Ver código fonte

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

yusheng 11 meses atrás
pai
commit
3e43f7fc7f

+ 76 - 25
src/views/salesServiceManagement/components/info.vue

@@ -36,6 +36,7 @@
             style="width: 100%"
             v-model="form.associationType"
             placeholder="请选择"
+            :disabled="type == 'view'"
             @change="selectType"
           >
             <el-option
@@ -95,7 +96,7 @@
           />
         </el-form-item>
       </el-col>
-      <el-col :span="6" v-show="form.associationType == '1'">
+      <el-col :span="6" v-if="form.associationType == '1'">
         <el-form-item
           label="发货单:"
           prop="orderCode"
@@ -108,12 +109,13 @@
           <el-input
             v-model="form.orderCode"
             readonly
+            :disabled="type == 'view'"
             @click.native="invoiceDialogOpen"
             placeholder="请选择"
           />
         </el-form-item>
       </el-col>
-      <el-col :span="6" v-show="form.associationType == '2'">
+      <el-col :span="6" v-if="form.associationType == '2'">
         <el-form-item
           label="销售订单:"
           prop="orderCode"
@@ -126,24 +128,48 @@
           <el-input
             v-model="form.orderCode"
             readonly
+            :disabled="type == 'view'"
             @click.native="saleorderDialogOpen"
             placeholder="请选择"
           />
         </el-form-item>
       </el-col>
+      <el-col :span="6" v-if="form.associationType == '3'">
+        <el-form-item label="产品:">
+          <el-input
+            v-model="form.orderCode"
+            readonly
+            :disabled="type == 'view'"
+            @click.native="customersDialogOpen"
+            placeholder="请选择"
+          />
+        </el-form-item>
+      </el-col>
       <el-col :span="6">
         <el-form-item label="客户编码:" prop="code">
-          <el-input v-model="form.contractInfo.code" readonly />
+          <el-input
+            v-model="form.contractInfo.code"
+            readonly
+            :disabled="type == 'view'"
+          />
         </el-form-item>
       </el-col>
       <el-col :span="6">
         <el-form-item label="客户代号:" prop="serialNo">
-          <el-input v-model="form.contractInfo.serialNo" readonly />
+          <el-input
+            v-model="form.contractInfo.serialNo"
+            readonly
+            :disabled="type == 'view'"
+          />
         </el-form-item>
       </el-col>
       <el-col :span="6">
         <el-form-item label="业务员:" prop="salesmanName">
-          <el-input v-model="form.contractInfo.salesmanName" readonly />
+          <el-input
+            v-model="form.contractInfo.salesmanName"
+            readonly
+            :disabled="type == 'view'"
+          />
         </el-form-item>
       </el-col>
       <el-col :span="6">
@@ -156,19 +182,15 @@
             trigger: 'change'
           }"
         >
-          <el-input v-model="form.contactAddress" :readonly="type == 'view'" />
+          <el-input
+            :disabled="type == 'view'"
+            v-model="form.contactAddress"
+            :readonly="type == 'view'"
+          />
         </el-form-item>
       </el-col>
       <el-col :span="6">
-        <el-form-item
-          label="故障等级:"
-          prop="faultLevel"
-          :rules="{
-            required: true,
-            message: '请选择故障等级',
-            trigger: 'change'
-          }"
-        >
+        <el-form-item label="故障等级:" prop="faultLevel">
           <DictSelection
             dictName="故障等级"
             :disabled="type == 'view'"
@@ -180,7 +202,7 @@
       <el-col :span="6">
         <el-form-item label="期望解决时间:" prop="expectedTime">
           <el-date-picker
-            :readonly="type == 'view'"
+            :disabled="type == 'view'"
             style="width: 100%"
             v-model="form.expectedTime"
             type="date"
@@ -692,6 +714,7 @@
       @changeParent="invoiceChange"
     ></invoiceDialog>
     <SaleorderDialog ref="saleorderDialogRef" @changeParent="saleorderChange" />
+    <ProductDialog ref="productDialogRef" @changeParent="productChange" />
   </el-form>
 </template>
 
@@ -704,6 +727,7 @@
   import parentList from '@/views/saleManage/contact/components/parentList.vue';
   import invoiceDialog from './invoiceDialog.vue';
   import SaleorderDialog from './saleorderDialog.vue';
+  import ProductDialog from './productDialog.vue';
   export default {
     mixins: [dictMixins],
     components: {
@@ -711,7 +735,8 @@
       invoiceDialog,
       PhotoList,
       SaleorderDialog,
-      fileMain
+      fileMain,
+      ProductDialog
     },
     computed: {
       ...mapGetters(['getDictValue']),
@@ -1097,6 +1122,10 @@
           {
             value: '2',
             label: '销售订单'
+          },
+          {
+            value: '3',
+            label: '客户'
           }
         ],
         isOrder: false // 是否为销售订单数据
@@ -1176,11 +1205,12 @@
               return item;
             })
           );
-
-          // 清空发货单的数据 *** 初次进来不清空
-          this.$set(this.form, 'orderCode', '');
-          this.$set(this.form, 'orderId', '');
-          this.$set(this.form, 'tableList', []);
+          if (this.form.associationType != '3') {
+            // 清空发货单的数据 *** 初次进来不清空
+            this.$set(this.form, 'orderCode', '');
+            this.$set(this.form, 'orderId', '');
+            this.$set(this.form, 'tableList', []);
+          }
         }
       },
       //发货单回调
@@ -1198,9 +1228,10 @@
       //发货单选择
       invoiceDialogOpen() {
         if (!this.form?.contractInfo?.id) {
-          this.$message.warning('请先选择客户!');
+          this.$message.warning('请先选择客户名称!');
           return;
         }
+        this.form.tableList = [];
         if (this.type != 'view') {
           let obj = {
             tableList: this.form.tableList || [],
@@ -1278,6 +1309,7 @@
           tableList: [],
           contractInfo: {},
           contactInfoVOS: [],
+          faultDetailList: [],
           orderCode: '',
           orderId: ''
         };
@@ -1287,12 +1319,14 @@
       // 销售订单选择
       saleorderDialogOpen() {
         if (!this.form?.contractInfo?.id) {
-          this.$message.warning('请先选择客户!');
+          this.$message.warning('请先选择客户名称!');
           return;
         }
+        this.form.tableList = [];
         if (this.type != 'view') {
           let obj = {
-            tableList: this.form.tableList || [],
+            // tableList: this.form.tableList || [],
+            tableList: [],
             orderCode: this.form.orderCode || '',
             orderId: this.form.orderId || ''
           };
@@ -1316,6 +1350,23 @@
           this.$set(this.form, 'faultDetailList', []);
         }
       },
+      // 产品选择
+      customersDialogOpen() {
+        this.$refs.productDialogRef.open();
+      },
+      // 产品选择回调
+      productChange(data) {
+        this.$set(this.form, 'faultDetailList', []);
+        this.$set(this.form, 'orderCode', data.orderCode);
+        this.$set(this.form, 'orderId', data.orderId);
+        let list = JSON.parse(JSON.stringify(data.tableList));
+        // 如果计量数量没有的话默认是 1
+        list.map(
+          (el) =>
+            (el.measureQuantity = el.measureQuantity ? el.measureQuantity : 1)
+        );
+        this.$set(this.form, 'tableList', list);
+      },
       // 新增故障 一级( 没有售后对象 )
       addFaults() {
         this.form.faultDetailList.push({

+ 93 - 17
src/views/salesServiceManagement/components/productDialog.vue

@@ -2,14 +2,14 @@
   <ele-modal
     :visible.sync="visible1"
     :close-on-click-modal="false"
-    width="1200px"
+    width="70%"
     append-to-body
     @close="close"
     :maxable="true"
   >
-    <el-form :model="searchForm" label-width="100px" @submit.native.prevent>
+    <el-form :model="searchForm" label-width="70px" @submit.native.prevent>
       <el-row :gutter="10">
-        <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
           <el-form-item label="编码">
             <el-input
               @keyup.enter.native="doSearch"
@@ -20,7 +20,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
           <el-form-item label="名称">
             <el-input
               @keyup.enter.native="doSearch"
@@ -31,8 +31,18 @@
             />
           </el-form-item>
         </el-col>
-
-        <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
+        <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+          <el-form-item label="型号">
+            <el-input
+              @keyup.enter.native="doSearch"
+              clearable
+              size="small"
+              v-model="searchForm.modelType"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
           <el-form-item>
             <el-button
               size="small"
@@ -68,33 +78,56 @@
         <ele-pro-table
           ref="table"
           :columns="columns"
-          :datasource="tableList"
+          :datasource="tableData"
           :selection.sync="selection"
           row-key="id"
           :needPage="false"
         >
-          <template v-slot:toolbar>
-            <el-button type="primary" size="small" @click="add">添加</el-button>
-            <el-button size="small" @click="del">移除</el-button>
-          </template>
         </ele-pro-table>
+        <div style="text-align: center; padding: 10px">
+          <el-pagination
+            background
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total"
+            :page-sizes="[10, 20, 30, 50, 100]"
+            :page-size.sync="searchForm.size"
+            :current-page.sync="searchForm.pageNum"
+            @current-change="handleCurrentChange"
+            @size-change="handleSizeChange"
+          ></el-pagination>
+        </div>
       </el-main>
     </el-container>
+    <div slot="footer">
+      <el-button type="primary" @click="confirm">确定</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
   </ele-modal>
 </template>
 
 <script>
   import AssetTree from './assetTree.vue';
   import { getProductList } from '@/api/saleManage/quotation';
+  import order from '@/store/modules/order';
+  import { mapGetters } from 'vuex';
   export default {
     components: { AssetTree },
+    computed: {
+      ...mapGetters(['getDictValue']),
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
     data() {
       return {
         visible1: false,
         searchForm: {
-          code: '',
-          name: '',
-          categoryLevelId: ''
+          // code: '',
+          // name: '',
+          categoryLevelId: '',
+          pageNum: 1,
+          size: 10
         },
         categoryLevelId: '',
         columns: [
@@ -150,10 +183,21 @@
           }
         ],
         tableData: [],
-        selection: []
+        selection: [],
+        total: 0
       };
     },
+
     methods: {
+      open() {
+        this.visible1 = true;
+        // this.warehouseData();
+        this.$nextTick(() => {
+          this.$refs.treeList.getTreeData().then((data) => {
+            this.handleNodeClick(data);
+          });
+        });
+      },
       close() {
         this.visible1 = false;
       },
@@ -162,15 +206,47 @@
         this.searchForm.categoryLevelId = data.id;
         this.doSearch();
       },
-      doSearch() {},
+      doSearch() {
+        this.searchForm.pageNum = 1;
+        this.warehouseData();
+      },
+      //
+      confirm() {
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择一条数据');
+          return;
+        }
+
+        if (this.selection.length > 1) {
+          this.$message.warning('只能选择一条数据');
+          return;
+        }
+        this.$emit('changeParent', {
+          // orderCode: this.rowClickData.orderNo,
+          // orderId: this.selection.id,
+          orderCode: this.selection[0].categoryCode,
+          orderId: this.selection[0].id,
+          tableList: this.selection
+        });
+        this.close();
+      },
+      handleSizeChange() {
+        this.searchForm.pageNum = 1;
+        this.warehouseData();
+      },
+      handleCurrentChange() {
+        this.warehouseData();
+      },
       async warehouseData() {
         const res = await getProductList(this.searchForm);
-        this.tableData = res.list.map((el) => {
+        let list = res.list.map((el) => {
           el.categoryModel = el.modelType;
           el.categoryName = el.name;
           el.categoryCode = el.code;
           return el;
         });
+        this.tableData = list;
+        this.total = res.count;
       },
       reset() {}
     }

+ 4 - 0
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -196,6 +196,10 @@
             delete pData.productDetail;
             pData.faultDetailList = data.faultDetailList;
           }
+          if (pData.associationType == '3' && pData.productDetail.length == 0) {
+            delete pData.productDetail;
+            pData.faultDetailList = data.faultDetailList;
+          }
           return pData;
         } catch (err) {}
       },