瀏覽代碼

【物料分类】 增加“物料分类”查询方式(优化查询、删除点击物料分类查询方式)

liangyan0105 3 年之前
父節點
當前提交
25294fa4a3

+ 0 - 2
src/app/routes/basedata/customer/edit/edit.component.ts

@@ -313,8 +313,6 @@ export class BasedataCustomerEditComponent implements OnInit {
 
       this.merchantsIndustryList = this.merchantsIndustryList.concat(res.result);
       console.log('>>>>', res.result);
-
-      // console.log('merchantsIndustryList--->', this.merchantsIndustryList);
     });
   }
 

+ 32 - 13
src/app/routes/basedata/material-file/material-file.component.html

@@ -49,12 +49,13 @@
       <div nz-row [nzGutter]="24">
         <div nz-col nzMd="24" nzLg="24">
           <nz-tree
+            *ngIf="materialNodes"
             [nzData]="materialNodes"
             [nzSearchValue]="searchValue"
             (nzClick)="treeClick($event)"
             (nzDblClick)="openFolder($event)"
           >
-            <!-- 右击 树节点  下拉菜单 4个按钮 -->
+            <!-- 下拉菜单 4个按钮 -->
             <ng-template #contextTemplate>
               <ul nz-menu nzInDropDown>
                 <li nz-menu-item (click)="addMaterial(1)">
@@ -87,26 +88,45 @@
     </nz-card>
   </div>
 
-  <!-- 右边 列表 -->
+  <!-- 右边 card -->
   <div nz-col nzMd="24" nzLg="18">
-    <nz-card>
+    <nz-card nz-col nzMd="24" nzLg="24">
       <form>
         <!--查询 条件-->
         <div nz-row nzGutter="24">
-          <div nz-col nzMd="24" nzLg="3">
-            <nz-form-label>产品编码</nz-form-label>
+          <!-- 物料分类名称 -->
+          <div nz-col nzMd="24" nzLg="2">
+            <nz-form-label nzNoColon="false"> {{ 'material.classification' | translate }} </nz-form-label>
+          </div>
+          <div nz-col nzMd="24" nzLg="4">
+            <nz-tree-select
+              nzAllowClear="false"
+              [nzNodes]="materialNodes"
+              nzShowSearch
+              nzPlaceHolder="{{ 'select.please.choose' | translate }}"
+              [(ngModel)]="baseMaterialFileProduct.baseMaterialFileClassificationId"
+              name="baseMaterialFileClassificationId"
+            >
+            </nz-tree-select>
+          </div>
+          <!-- 产品编码 -->
+          <div nz-col nzMd="24" nzLg="2">
+            <nz-form-label> {{ 'product' | translate }}{{ 'table.thead.code' | translate }} </nz-form-label>
           </div>
-          <div nz-col nzMd="24" nzLg="6">
+          <div nz-col nzMd="24" nzLg="4">
             <input nz-input [(ngModel)]="baseMaterialFileProduct.code" name="code" />
           </div>
-          <div nz-col nzMd="24" nzLg="3">
-            <nz-form-label>产品名称</nz-form-label>
+
+          <!-- 产品名称 -->
+          <div nz-col nzMd="24" nzLg="2">
+            <nz-form-label> {{ 'product' | translate }}{{ 'Name' | translate }} </nz-form-label>
           </div>
-          <div nz-col nzMd="24" nzLg="6">
+          <div nz-col nzMd="24" nzLg="4">
             <input nz-input [(ngModel)]="baseMaterialFileProduct.name" name="name" />
           </div>
+
           <!-- 列表查询重置 -->
-          <div nz-col nzMd="24" nzLg="6">
+          <div nz-col nzMd="24" nzLg="3">
             <button (click)="query()" nz-button nzType="primary">{{ 'button.query' | translate }}</button>
             <button (click)="rest()" nz-button nzType="primary">{{ 'button.reset' | translate }}</button>
           </div>
@@ -172,9 +192,8 @@
                   </ng-container>
                 </td>
 
-                <!-- 操作按钮 -->
-                <!-- 详情 -->
-                <td nzAlign="center" nzRight="0px" style="width: 20%;">
+                <!-- 操作按钮 详情 修改 删除-->
+                <td nzAlign="center" nzRight="0px" style="width: 30%;">
                   <a href="javascript:void(0);" (click)="detailProduct(data.id)">
                     {{ 'table.view' | translate }}
                   </a>

+ 16 - 15
src/app/routes/basedata/material-file/material-file.component.ts

@@ -157,7 +157,7 @@ export class BasedataMaterialFileComponent implements OnInit {
       string
     >({
       nzTitle: title,
-      nzWidth: 1200,
+      nzWidth: 800,
       nzContent: BasedataMaterialFileProductAddComponent,
       nzContentParams: {
         id: id, //页面点击的产品ID 传参给抽屉
@@ -179,9 +179,10 @@ export class BasedataMaterialFileComponent implements OnInit {
   }
   //树节点点击事件
   treeClick(data) {
-    console.log('点击节点id', data.node.key);
-    this.baseMaterialFileProduct.baseMaterialFileClassificationId = data.node.key;
-    this.getProductList(); // 查询对应产品数据
+    // 此方法查询产品后,需要点击重置才能刷新到所有产品列表
+    // console.log('点击节点id', data.node.key);
+    // this.baseMaterialFileProduct.baseMaterialFileClassificationId = data.node.key;
+    // this.getProductList(); // 查询对应产品数据
   }
 
   //按页码查询
@@ -231,17 +232,17 @@ export class BasedataMaterialFileComponent implements OnInit {
     });
   }
 
-    //产品详情
-    detailProduct(id) {
-      this.drawerService.create({
-        nzTitle: this.i18NService.fanyi('product.details'),
-        nzWidth: 800,
-        nzContent: BasedataMaterialFileDetailsComponent,
-        nzContentParams: {
-          id: id,
-        },
-      });
-    }
+  //产品详情
+  detailProduct(id) {
+    this.drawerService.create({
+      nzTitle: this.i18NService.fanyi('product.details'),
+      nzWidth: 800,
+      nzContent: BasedataMaterialFileDetailsComponent,
+      nzContentParams: {
+        id: id,
+      },
+    });
+  }
   //删除产品
   delPro(id) {
     this.baseMaterialFileProduct.pkOrg = sessionStorage.getItem('pkOrg'); //组织

+ 182 - 170
src/app/routes/basedata/material-file/product-add/product-add.component.html

@@ -1,182 +1,194 @@
 <nz-spin [nzSpinning]="isLoading">
-  <form nz-form [formGroup]="validateForm" (ngSubmit)="proSubForm()">
-    <!-- 产品编码 -->
-    <nz-form-item>
-      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
-        {{ 'product' | translate }}{{ 'table.thead.code' | translate }}
-      </nz-form-label>
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <input
-          [(ngModel)]="baseMaterialFileProduct.code"
-          formControlName="code"
-          nz-input
-          placeholder="{{ 'placeholder' | translate }}"
-          maxlength="10"
-        />
-        <nz-form-explain *ngIf="validateForm.get('code')?.dirty && validateForm.get('code')?.errors">
-          {{ 'placeholder' | translate }}{{ 'product' | translate }}{{ 'table.thead.code' | translate }}
-        </nz-form-explain>
-      </nz-form-control>
-      <!-- 名称 -->
-      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'Name' | translate }}</nz-form-label>
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <input
-          [(ngModel)]="baseMaterialFileProduct.name"
-          formControlName="name"
-          nz-input
-          placeholder="{{ 'placeholder' | translate }}"
-          maxlength="10"
-        />
-        <nz-form-explain *ngIf="validateForm.get('code')?.dirty && validateForm.get('code')?.errors">
-          {{ 'placeholder' | translate }}{{ 'Name' | translate }}
-        </nz-form-explain>
-      </nz-form-control>
-    </nz-form-item>
+  <div nz-row [nzGutter]="24">
+    <div nz-col nzMd="24" nzLg="24">
+      <form nz-form [formGroup]="validateForm" (ngSubmit)="proSubForm()">
+        <!-- 产品编码 -->
+        <nz-form-item>
+          <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
+            {{ 'product' | translate }}{{ 'table.thead.code' | translate }}
+          </nz-form-label>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <input
+              [(ngModel)]="baseMaterialFileProduct.code"
+              formControlName="code"
+              nz-input
+              placeholder="{{ 'placeholder' | translate }}"
+              maxlength="10"
+            />
+            <nz-form-explain *ngIf="validateForm.get('code')?.dirty && validateForm.get('code')?.errors">
+              {{ 'placeholder' | translate }}{{ 'product' | translate }}{{ 'table.thead.code' | translate }}
+            </nz-form-explain>
+          </nz-form-control>
+          <!-- 名称 -->
+          <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'Name' | translate }}</nz-form-label>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <input
+              [(ngModel)]="baseMaterialFileProduct.name"
+              formControlName="name"
+              nz-input
+              placeholder="{{ 'placeholder' | translate }}"
+              maxlength="10"
+            />
+            <nz-form-explain *ngIf="validateForm.get('code')?.dirty && validateForm.get('code')?.errors">
+              {{ 'placeholder' | translate }}{{ 'Name' | translate }}
+            </nz-form-explain>
+          </nz-form-control>
+        </nz-form-item>
 
-    <!-- 排序   -->
-    <nz-form-item>
-      <nz-form-label [nzSm]="3" [nzXs]="24" nzRequired>{{ 'depart.sort' | translate }}</nz-form-label>
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <input
-          [(ngModel)]="baseMaterialFileProduct.sort"
-          formControlName="sort"
-          nz-input
-          maxlength="100"
-          placeholder="{{ 'placeholder' | translate }}"
-        />
-        <nz-form-explain *ngIf="validateForm.get('sort')?.dirty && validateForm.get('sort')?.errors">
-          {{ 'placeholder' | translate }}{{ 'milestone.serial.number' | translate }}
-        </nz-form-explain>
-      </nz-form-control>
+        <!-- 排序   -->
+        <nz-form-item>
+          <nz-form-label [nzSm]="3" [nzXs]="24" nzRequired>{{ 'depart.sort' | translate }}</nz-form-label>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <input
+              [(ngModel)]="baseMaterialFileProduct.sort"
+              formControlName="sort"
+              nz-input
+              maxlength="100"
+              placeholder="{{ 'placeholder' | translate }}"
+            />
+            <nz-form-explain *ngIf="validateForm.get('sort')?.dirty && validateForm.get('sort')?.errors">
+              {{ 'placeholder' | translate }}{{ 'milestone.serial.number' | translate }}
+            </nz-form-explain>
+          </nz-form-control>
 
-      <!--  状态   0未启用    1启用  -->
-      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
-        {{ 'depart.Whether.to.enable' | translate }}
-      </nz-form-label>
+          <!--  状态   0未启用    1启用  -->
+          <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">
+            {{ 'depart.Whether.to.enable' | translate }}
+          </nz-form-label>
 
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <nz-switch
-          [(ngModel)]="status"
-          name="status"
-          [ngModelOptions]="{ standalone: true }"
-          nzCheckedChildren="{{ 'store.yes' | translate }}"
-          nzUnCheckedChildren="{{ 'store.no' | translate }}"
-        >
-        </nz-switch>
-      </nz-form-control>
-    </nz-form-item>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <nz-switch
+              [(ngModel)]="status"
+              name="status"
+              [ngModelOptions]="{ standalone: true }"
+              nzCheckedChildren="{{ 'store.yes' | translate }}"
+              nzUnCheckedChildren="{{ 'store.no' | translate }}"
+            >
+            </nz-switch>
+          </nz-form-control>
+        </nz-form-item>
 
-    <!-- 产品属性  -->
-    <nz-form-item>
-      <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'property' | translate }}</nz-form-label>
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <nz-select
-          nzShowSearch
-          nzPlaceHolder="{{ 'select.please.choose' | translate }}"
-          [nzDisabled]="false"
-          [(ngModel)]="baseMaterialFileProduct.attribute"
-          formControlName="attribute"
-        >
-          <!-- 1采购    2销售 --->
-          <nz-option nzLabel="{{ 'select.please.choose' | translate }}" nzValue="" selected="selected"></nz-option>
-          <nz-option nzLabel="{{ 'procurement' | translate }}" nzValue="1"></nz-option>
-          <nz-option nzLabel="{{ 'sales' | translate }}" nzValue="2"></nz-option>
-        </nz-select>
-        <nz-form-explain *ngIf="validateForm.get('attribute')?.dirty && validateForm.get('attribute')?.errors">
-          {{ 'select.please.choose' | translate }}{{ 'product' | translate }}{{ 'property' | translate }}
-        </nz-form-explain>
-      </nz-form-control>
-      <!-- 分类 -->
-      <nz-form-label [nzSm]="3" [nzXs]="24" nzNoColon="true" nzRequired>
-        {{ 'cost.item.category' | translate }}
-      </nz-form-label>
+        <!-- 产品属性  -->
+        <nz-form-item>
+          <nz-form-label nzRequired [nzSm]="3" [nzXs]="24">{{ 'property' | translate }}</nz-form-label>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <nz-select
+              nzShowSearch
+              nzPlaceHolder="{{ 'select.please.choose' | translate }}"
+              [nzDisabled]="false"
+              [(ngModel)]="baseMaterialFileProduct.attribute"
+              formControlName="attribute"
+            >
+              <!-- 1采购    2销售 --->
+              <nz-option nzLabel="{{ 'select.please.choose' | translate }}" nzValue="" selected="selected"></nz-option>
+              <nz-option nzLabel="{{ 'procurement' | translate }}" nzValue="1"></nz-option>
+              <nz-option nzLabel="{{ 'sales' | translate }}" nzValue="2"></nz-option>
+            </nz-select>
+            <nz-form-explain *ngIf="validateForm.get('attribute')?.dirty && validateForm.get('attribute')?.errors">
+              {{ 'select.please.choose' | translate }}{{ 'product' | translate }}{{ 'property' | translate }}
+            </nz-form-explain>
+          </nz-form-control>
+          <!-- 分类 -->
+          <nz-form-label [nzSm]="3" [nzXs]="24" nzNoColon="true" nzRequired>
+            {{ 'cost.item.category' | translate }}
+          </nz-form-label>
 
-      <nz-form-control [nzSm]="8" [nzXs]="12">
-        <nz-tree-select
-          nzAllowClear="false"
-          [nzNodes]="materialTree"
-          nzShowSearch
-          nzPlaceHolder="{{ 'select.please.choose' | translate }}"
-          [(ngModel)]="baseMaterialFileProduct.baseMaterialFileClassificationId"
-          formControlName="baseMaterialFileClassificationId"
-          (ngModelChange)="materialChange($event)"
-        >
-        </nz-tree-select>
-        <nz-form-explain
-          *ngIf="
-            validateForm.get('baseMaterialFileClassificationId')?.dirty &&
-            validateForm.get('baseMaterialFileClassificationId')?.errors
-          "
-        >
-          {{ 'select.please.choose' | translate }}{{ 'product' | translate }}{{ 'cost.item.category' | translate }}
-        </nz-form-explain>
-      </nz-form-control>
-    </nz-form-item>
-  </form>
-  <!-- 新增 模块 子表-->
-  <div>
-    <span id="modTitAdd" hidden="true"> {{ 'button.add' | translate }}{{ 'customer.contacts.name' | translate }} </span>
-    <span id="modTitUpdate" hidden="true">
-      {{ 'table.update' | translate }}{{ 'customer.contacts.name' | translate }}
-    </span>
+          <nz-form-control [nzSm]="8" [nzXs]="12">
+            <nz-tree-select
+              nzAllowClear="false"
+              [nzNodes]="materialTree"
+              nzShowSearch
+              nzPlaceHolder="{{ 'select.please.choose' | translate }}"
+              [(ngModel)]="baseMaterialFileProduct.baseMaterialFileClassificationId"
+              formControlName="baseMaterialFileClassificationId"
+              (ngModelChange)="materialChange($event)"
+            >
+            </nz-tree-select>
+            <nz-form-explain
+              *ngIf="
+                validateForm.get('baseMaterialFileClassificationId')?.dirty &&
+                validateForm.get('baseMaterialFileClassificationId')?.errors
+              "
+            >
+              {{ 'select.please.choose' | translate }}{{ 'product' | translate }}{{ 'cost.item.category' | translate }}
+            </nz-form-explain>
+          </nz-form-control>
+        </nz-form-item>
+      </form>
+      <!-- 新增 模块 子表-->
+      <div>
+        <span id="modTitAdd" hidden="true">
+          {{ 'button.add' | translate }}{{ 'customer.contacts.name' | translate }}
+        </span>
+        <span id="modTitUpdate" hidden="true">
+          {{ 'table.update' | translate }}{{ 'customer.contacts.name' | translate }}
+        </span>
 
-    <!-- 按钮 -->
-    <div nz-row nzGutter="24" style="margin-bottom:6px;">
-      <div nz-col nzMd="24" nzLg="24">
-        <button (click)="addRowMod()" style="margin-bottom:10px;" nz-button nzType="primary">
-          {{ 'button.add' | translate }}
-        </button>
-      </div>
-    </div>
+        <!-- 按钮 -->
+        <div nz-row nzGutter="24" style="margin-bottom:6px;">
+          <div nz-col nzMd="24" nzLg="24">
+            <button (click)="addRowMod()" style="margin-bottom:10px;" nz-button nzType="primary">
+              {{ 'button.add' | translate }}
+            </button>
+          </div>
+        </div>
 
-    <!-- 模块 表 -->
-    <div nz-row nzGutter="24">
-      <div nz-col nzMd="18" nzLg="24">
-        <nz-table nzSize="small" #basicTable [nzData]="modData" [nzFrontPagination]="false" [nzShowPagination]="false">
-          <thead>
-            <tr>
-              <th style="width:150px;">{{ 'module.code' | translate }}</th>
-              <th style="width:150px;">{{ 'module.name' | translate }}</th>
-              <th style="width:150px;">{{ 'standard.quotation' | translate }}</th>
-              <th style="width:150px;">{{ 'table.operation' | translate }}</th>
-            </tr>
-          </thead>
+        <!-- 模块 新增表 -->
+        <div nz-row nzGutter="24">
+          <div nz-col nzMd="18" nzLg="24">
+            <nz-table
+              nzSize="small"
+              #basicTable
+              [nzData]="modData"
+              [nzFrontPagination]="false"
+              [nzShowPagination]="false"
+            >
+              <thead>
+                <tr>
+                  <th style="width:150px;">{{ 'module.code' | translate }}</th>
+                  <th style="width:150px;">{{ 'module.name' | translate }}</th>
+                  <th style="width:150px;">{{ 'standard.quotation' | translate }}</th>
+                  <th style="width:150px;">{{ 'table.operation' | translate }}</th>
+                </tr>
+              </thead>
 
-          <tbody>
-            <tr *ngFor="let data of basicTable.data">
-              <!-- 模块编码 -->
-              <td>
-                <input type="text" [(ngModel)]="data.code" nz-input maxlength="20" />
-              </td>
-              <!-- 模块名称 -->
-              <td>
-                <input type="text" [(ngModel)]="data.name" nz-input maxlength="20" />
-              </td>
-              <!-- 标准报价 -->
-              <td>
-                <nz-input-number
-                  [(ngModel)]="data.standardQuotation"
-                  [nzMin]="0"
-                  [nzParser]="parserDollar"
-                  [nzFormatter]="formatterDollar"
-                  [nzMax]="100000000000000000"
-                  [nzStep]="10"
-                ></nz-input-number>
-              </td>
-              <td>
-                <a
-                  nz-popconfirm
-                  nzTitle="{{ 'confirm.to.delete' | translate }}?"
-                  nzOkText="{{ 'yes' | translate }}"
-                  nzCancelText="{{ 'no' | translate }}"
-                  (nzOnConfirm)="deleteMod(data)"
-                >
-                  {{ 'table.delete' | translate }}
-                </a>
-              </td>
-            </tr>
-          </tbody>
-        </nz-table>
+              <tbody>
+                <tr *ngFor="let data of basicTable.data">
+                  <!-- 模块编码 -->
+                  <td>
+                    <input type="text" [(ngModel)]="data.code" nz-input maxlength="20" />
+                  </td>
+                  <!-- 模块名称 -->
+                  <td>
+                    <input type="text" [(ngModel)]="data.name" nz-input maxlength="20" />
+                  </td>
+                  <!-- 标准报价 -->
+                  <td>
+                    <nz-input-number
+                      [(ngModel)]="data.standardQuotation"
+                      [nzMin]="0"
+                      [nzParser]="parserDollar"
+                      [nzFormatter]="formatterDollar"
+                      [nzMax]="100000000000000000"
+                      [nzStep]="10"
+                    ></nz-input-number>
+                  </td>
+                  <td>
+                    <a
+                      nz-popconfirm
+                      nzTitle="{{ 'confirm.to.delete' | translate }}?"
+                      nzOkText="{{ 'yes' | translate }}"
+                      nzCancelText="{{ 'no' | translate }}"
+                      (nzOnConfirm)="deleteMod(data)"
+                    >
+                      {{ 'table.delete' | translate }}
+                    </a>
+                  </td>
+                </tr>
+              </tbody>
+            </nz-table>
+          </div>
+        </div>
       </div>
     </div>
   </div>