Browse Source

fix(客户管理/供应商管理): 修复初始化缓存问题

liujt 5 months ago
parent
commit
c0f8ee41f3

+ 12 - 7
src/views/financialManage/collectionPlan/index.vue

@@ -44,7 +44,7 @@
                   type="primary"
                   icon="el-icon-plus"
                   class="ele-btn-icon"
-                  @click="openEdit('add', {})"
+                  @click="openEdit({}, 'add')"
                 >
                   合并开票
                 </el-button>
@@ -80,7 +80,7 @@
                       [0, 3].includes(row.orderStatus)) ||
                     !isNeed_process_is_close
                   "
-                  @click="openEdit('edit', row)"
+                  @click="openEdit(row, 'edit')"
                 >
                   修改
                 </el-link>
@@ -167,6 +167,8 @@
     <!-- 开票 -->
     <addOrEditDialogNew
       ref="addOrEditDialogNewRef"
+      :add-or-edit-dialog-flag.sync="addOrEditDialogNewFlag"
+      v-if="addOrEditDialogNewFlag"
       @success="reload"
     />
   </div>
@@ -227,7 +229,7 @@ export default {
       loading: false, // 加载状态
       processSubmitDialogFlag: false,
       addOrEditDialogFlag: false,
-      addOrEditDialogFlag1: false,
+      addOrEditDialogNewFlag: false,
       params: {},
 
       groupName: '',
@@ -595,15 +597,18 @@ export default {
     },
 
     //新增编辑
-    openEdit(type, row) {
+    openEdit(row, type) {
       let partaIds = this.selection.map((item) => item.partaId);
       if(this.selection.length == 0 || new Set(partaIds).size != 1) {
         this.$message.warning('请选择相同客户的计划!');
         return
       }
-      this.$refs.addOrEditDialogNewRef.init(type, row, row.id);
-      this.$refs.addOrEditDialogNewRef.$refs.form &&
-        this.$refs.addOrEditDialogNewRef.$refs.form.clearValidate();
+      this.addOrEditDialogNewFlag = true;
+      this.$nextTick(() => {
+        this.$refs.addOrEditDialogNewRef.createInvoice1(row, 1, 1);
+      });
+      // this.$refs.addOrEditDialogNewRef.$refs.form &&
+      //   this.$refs.addOrEditDialogNewRef.$refs.form.clearValidate();
     },
     uploadFile() {
       this.$refs.importDialogRef.open();

+ 90 - 143
src/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue

@@ -278,25 +278,25 @@
           class="time-form"
         >
           <template v-slot:toolbar>
-            <span>已开票金额:{{ invoiceAmount }}</span>
+            <!-- <span>已开票金额:{{ totalInvoiceAmount }}</span> -->
           </template>
           
-          <template v-slot:totalCount="scope">
+          <template v-slot:invoiceAmount="scope">
             <el-form-item
               style="width: 100%;"
-              :prop="'detailList.' + scope.$index + '.totalCount'"
+              :prop="'detailList.' + scope.$index + '.invoiceAmount'"
               :rules="[
                 {
                   required: true,
-                  message: '请输入数量',
+                  message: '请输入开票金额',
                   trigger: 'blur'
                 },
                 {
                   validator: (rule, value, callback) => {
                     if (value === undefined || value === null || value === '') {
-                      callback('请输入数量');
+                      callback('请输入开票金额');
                     } else if (parseFloat(value) <= 0) {
-                      callback('数量必须大于0');
+                      callback('开票金额必须大于0');  
                     } else {
                       callback();
                     }
@@ -305,36 +305,8 @@
                 }
               ]"
             > 
-              <span v-if="dialogType === 'view'">{{ scope.row.totalCount }}</span>
-              <el-input v-else v-model="scope.row.totalCount" type="number" @input="updateTotalPrice(scope.row)"></el-input>
-            </el-form-item>
-          </template>
-          <template v-slot:productBrand="scope">
-            <el-form-item
-              style="width: 100%;"
-              :prop="'detailList.' + scope.$index + '.totalCount'"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入',
-                  trigger: 'blur'
-                },
-                {
-                  validator: (rule, value, callback) => {
-                    if (value === undefined || value === null || value === '') {
-                      callback('请输入');
-                    } else if (parseFloat(value) <= 0) {
-                      callback('必须大于0');
-                    } else {
-                      callback();
-                    }
-                  },
-                  trigger: 'blur'
-                }
-              ]"
-            > 
-              <span v-if="dialogType === 'view'">{{ scope.row.totalCount }}</span>
-              <el-input v-else v-model="scope.row.totalCount" type="number" @input="updateTotalPrice(scope.row)"></el-input>
+              <span v-if="dialogType === 'view'">{{ scope.row.invoiceAmount }}</span>
+              <el-input v-else v-model="scope.row.invoiceAmount" type="number" @input="updateInvoiceAmount(scope.row)"></el-input>
             </el-form-item>
           </template>
         </ele-pro-table>
@@ -342,7 +314,7 @@
     </div>
     <div style="margin-top: 20px;">
       <headerTitle title="关联物品清单信息"></headerTitle>
-      <table-info
+      <table-info-new
         :isOtherSourceFlag="isOtherSourceFlag"
         :dialogType="dialogType"
         :form="form"
@@ -350,7 +322,7 @@
         ref="table"
         @setPrice="setPrice"
         :invoiceAmount="form.invoiceAmount"
-      ></table-info>
+      ></table-info-new>
     </div>
     <div slot="footer">
       <el-button type="primary" @click="handleSave(0)">保存</el-button>
@@ -417,7 +389,7 @@
   import { listOrganizations } from '@/api/system/organization';
   import { mapGetters } from 'vuex';
   import fileUpload from '@/components/upload/fileUpload.vue';
-  import tableInfo from './tableInfo.vue';
+  import tableInfoNew from './tableInfoNew.vue';
   import { getTreeByPid } from '@/api/classifyManage';
   import {
     invoiceApplyInfoAPI,
@@ -480,7 +452,7 @@
       processSubmitDialog,
       fileUpload,
       personSelect,
-      tableInfo,
+      tableInfoNew,
       accountStatementDialog,
       contractListDialog,
       purchasinOrderListDialog,
@@ -547,41 +519,41 @@
           {
             width: 120,
             prop: 'type',
-            label: '订单名称',
+            label: '订单类型',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'type',
-            label: '发票号',
+            prop: 'contractCode',
+            label: '合同编码',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'type',
-            label: '关联应收编码',
+            prop: 'contractNumber',
+            label: '合同编号',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'contractName',
+            label: '合同名称',
             align: 'center'
           },
           {
             prop: 'period',
             label: '期数',
-            slot: 'period',
-            headerSlot: 'headerPeriod',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'type',
+            prop: 'moneyType',
             label: '款项类型',
-            slot: 'type',
-            headerSlot: 'headerMoneyName',
             align: 'center'
           },
           {
             prop: 'moneyName',
             label: '款项名称',
-            slot: 'moneyName',
-            headerSlot: 'headerMoneyName',
             align: 'center',
             width: 170
           },
@@ -589,100 +561,73 @@
             width: 150,
             prop: 'ratio',
             label: '比例',
-            slot: 'ratio',
-            headerSlot: 'headerRatio',
             align: 'center'
           },
           {
             width: 170,
             prop: 'price',
             label: '计划收款金额',
-            slot: 'price',
             align: 'center',
-            headerSlot: 'headerPrice',
-          },
-
-          {
-            width: 160,
-            prop: 'deadLine',
-            label: '计划收款日期',
-            slot: 'deadLine',
-            headerSlot: 'headerDeadLine',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '是否已开票',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '已开票金额',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '开票日期',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '是否生成应收款项',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '应收金额',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '已收款金额',
-            align: 'center'
           },
           {
             width: 120,
-            prop: 'type',
-            label: '实际收款日期',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '发货状态',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '对账状态',
-            align: 'center'
-          },
-          {
-            width: 220,
-            prop: 'remark',
-            label: '收款状态',
-            slot: 'remark',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'type',
-            label: '逾期状态',
-            align: 'center'
+            prop: 'invoiceAmount',
+            label: '开票金额',
+            align: 'center',
+            slot: 'invoiceAmount'
           }
         ];
       },
     },
     data() {
       return {
-        tableData: [],
+        tableData: [
+          {
+            id: 1,
+            type: 'SKJH202401001', // 收款计划编码
+            orderCode: 'DD202401001', // 订单编号
+            orderType: '销售订单', // 订单类型
+            contractCode: 'HT202401001', // 合同编码
+            contractNumber: 'HTBH202401001', // 合同编号
+            contractName: '年度采购合同', // 合同名称
+            period: 1, // 期数
+            moneyType: '预付款', // 款项类型
+            moneyName: '首期预付款', // 款项名称
+            ratio: '30.00', // 比例
+            price: 30000.00, // 计划收款金额
+            invoiceAmount: 15000.00 // 开票金额(测试用)
+          },
+          {
+            id: 2,
+            type: 'SKJH202401002',
+            orderCode: 'DD202401001',
+            orderType: '销售订单',
+            contractCode: 'HT202401001',
+            contractNumber: 'HTBH202401001',
+            contractName: '年度采购合同',
+            period: 2,
+            moneyType: '进度款',
+            moneyName: '中期进度款',
+            ratio: '40.00',
+            price: 40000.00,
+            invoiceAmount: 20000.00
+          },
+          {
+            id: 3,
+            type: 'SKJH202401003',
+            orderCode: 'DD202401001',
+            orderType: '销售订单',
+            contractCode: 'HT202401001',
+            contractNumber: 'HTBH202401001',
+            contractName: '年度采购合同',
+            period: 3,
+            moneyType: '尾款',
+            moneyName: '最终尾款',
+            ratio: '30.00',
+            price: 30000.00,
+            invoiceAmount: 0
+          }
+        ],
         fullscreen: false,
         receivableDialogFlag: false,
         dialogType: '',
@@ -692,7 +637,7 @@
         accountStatementDialogFlag: false,
         paymentListDialogFlag: false,
         enterprisePage: [],
-
+        totalInvoiceAmount: 0,
         form: {
           applyDeptId: '',
           applyDeptName: '',
@@ -729,7 +674,7 @@
     },
     methods: {
       //从发票管理新增发票初始化
-      async init(type, row = {}) {
+      async init(row = {}, type) {
         this.title = type == 'add' ? '新增' : '修改';
         this.dialogType = type;
         if (type == 'add') {
@@ -749,10 +694,12 @@
           await this.getInfo(row.id);
         }
         this.$nextTick(async () => {
-          await this.getUserList(this.form.applyDeptId);
+          // await this.getUser List(this.form.applyDeptId);
         });
       },
-
+      updateInvoiceAmount(row) {
+        // row.invoiceAmount = Number(row.invoiceAmount).toFixed(2);
+      },
       //来源类型
       async handleSelectAccount(val) {
         if (val == 1) {
@@ -923,15 +870,15 @@
 
         await this.init({}, 'add');
 
-        if (sourceType == 2) {
-          this.changeContract(data);
-        }
-        if (sourceType == 3) {
-          this.changeOrder(data);
-        }
-        if (sourceType == 4 || sourceType == 5) {
-          this.payableManage(data);
-        }
+        // if (sourceType == 2) {
+        //   this.changeContract(data);
+        // }
+        // if (sourceType == 3) {
+        //   this.changeOrder(data);
+        // }
+        // if (sourceType == 4 || sourceType == 5) {
+        //   this.payableManage(data);
+        // }
       },
 
       //对账单列表

+ 382 - 0
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -0,0 +1,382 @@
+<template>
+  <div>
+    <el-tabs type="border-card">
+      <el-tab-pane label="用户管理">
+        <el-form ref="form" :model="tableForm">
+          <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :datasource="tableForm.detailList"
+            row-key="id"
+            class="time-form"
+          >
+            <template v-slot:toolbar>
+              <span>本次开票合计:{{ invoiceAmount }}</span>
+            </template>
+            
+            <template v-slot:totalCount="scope">
+            <el-form-item
+              style="width: 100%;"
+              :prop="'detailList.' + scope.$index + '.totalCount'"
+              :rules="[
+                {
+                  required: true,
+                  message: '请输入数量',
+                  trigger: 'blur'
+                },
+                {
+                  validator: (rule, value, callback) => {
+                    if (value === undefined || value === null || value === '') {
+                      callback('请输入数量');
+                    } else if (parseFloat(value) <= 0) {
+                      callback('数量必须大于0');
+                    } else {
+                      callback();
+                    }
+                  },
+                  trigger: 'blur'
+                }
+              ]"
+            > 
+              <span v-if="dialogType === 'view'">{{ scope.row.totalCount }}</span>
+              <el-input v-else v-model="scope.row.totalCount" type="number" @input="updateTotalPrice(scope.row)"></el-input>
+            </el-form-item>
+          </template>
+
+          </ele-pro-table>
+        </el-form>
+      </el-tab-pane>
+    </el-tabs>
+    
+  </div>
+</template>
+<script>
+  export default {
+    name: 'tableInfo',
+    components: {},
+    props: {
+      form: {
+        type: Object,
+        default: () => {
+          return {
+            detailList: []
+          };
+        }
+      },
+      dialogType: {
+        type: String,
+        default: ''
+      },
+      isOtherSourceFlag: {
+        type: Boolean,
+        default: false
+      },
+      contactData: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      },
+      invoiceAmount: {
+        type: Number,
+        default: 0
+      }
+    },
+    data() {
+      return {
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            width: 100,
+            prop: 'typeName',
+            label: '类型',
+            slot: 'typeName',
+            align: 'center'
+          },
+          // {
+          //   minWidth: 100,
+          //   prop: 'sourceCode',
+          //   label: '类型编码',
+          //   slot: 'sourceCode',
+          //   align: 'center'
+          // },
+          // {
+          //   width: 100,
+          //   prop: 'productCategoryName',
+          //   label: '分类',
+          //   slot: 'productCategoryName',
+          //   align: "center"
+          // },
+          // {
+          //   width: 100,
+          //   prop: 'productCode',
+          //   label: '编码',
+          //   slot: 'productCode',
+          //   align: "center"
+          // },
+          {
+            minWidth: 100,
+            prop: 'productName',
+            label: '产品名称',
+            slot: 'productName',
+            align: 'center'
+          },
+          {
+            minWidth: 100,
+            prop: 'modelType',
+            label: '型号',
+            slot: 'modelType',
+            align: 'center'
+          },
+
+          {
+            minWidth: 100,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'productBrand',
+            label: '未开票金额',
+            slot: 'productBrand',
+            align: "center"
+          },
+          
+          // {
+          //   width: 80,
+          //   prop: 'singleWeight',
+          //   label: '单量',
+          //   align: 'center'
+          // },
+
+          {
+            minWidth: 80,
+            prop: 'totalPrice',
+            label: '开票金额',
+            slot: 'totalPrice',
+            align: 'center'
+          },
+          {
+            minWidth: 80,
+            prop: 'taxRate',
+            label: '税率',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              return _row.taxRate
+                ? _row.taxRate+'%'
+                : '';
+            },
+          },
+          {
+            minWidth: 80,
+            prop: 'discountSinglePrice',
+            label: '不含税单价',
+            slot: 'discountSinglePrice',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'totalCount',
+            label: '订单数量',
+            // slot: 'totalCount',
+            align: 'center',
+          },
+          {
+            width: 150,
+            prop: 'pricingWay',
+            label: '报价方式',
+            formatter: (row, column) => {
+              return row.pricingWay == 1
+                ? '按数量计价'
+                : row.pricingWay == 2
+                ? '按重量计价'
+                : '';
+            },
+            align: 'center'
+
+          },
+          {
+            minWidth: 80,
+            prop: 'singlePrice',
+            label: '单价',
+            slot: 'singlePrice',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'totalPrice',
+            label: '合计',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'discountRate',
+            label: '折让比例',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            align: 'center'
+          },
+          // {
+          //   width: 100,
+          //   prop: 'sourceType',
+          //   label: '来源类型',
+          //   slot: 'sourceType',
+          //   align: "center",
+          //   formatter: (row, column) => {
+          //     return row.sourceType == 2 ? '对账销售订单' : '对账采购订单';
+          //   }
+          // },
+        ],
+        tableForm: {
+          detailList: [],
+          link: []
+        },
+        typeList: [
+          {
+            label: '销售发货',
+            value: '10'
+          },
+          {
+            label: '销售退货',
+            value: '11'
+          },
+          {
+            label: '采购收货',
+            value: '20'
+          },
+          {
+            label: '采购退货',
+            value: '21'
+          }
+        ],
+      };
+    },
+    mounted() {
+      this.tableForm = this.form;
+    },
+    watch: {
+      form(val) {
+        this.tableForm = this.form;
+      }
+    },
+    methods: {
+      //获取选择的对账单数据
+      async getAccountData(params) {
+        if (params.children.orderType == 6) {
+          this.tableForm.detailList = params.children.detailList;
+          this.tableForm.detailList.forEach((item, index) => {
+            item.sourceCode = params.children.orderNo;
+            item.sourceId = params.children.id;
+            item.sourceType = params.type == 1 ? 2 : 3;
+            item.type = 12;
+            item.singlePrice = item.discountSinglePrice;
+            item.totalPrice = item.discountTotalPrice;
+            item.typeName = '销售赔付';
+          });
+        } else {
+          this.tableForm.detailList = [];
+          params.children.subList.forEach((item, index) => {
+            item.detailList.forEach((i, n) => {
+              i.sourceCode = item.statementSubOrderCode;
+              i.sourceId = params.children.id;
+              i.sourceType = params.type == 1 ? 2 : 3;
+              i.type = item.subType;
+              console.log(item.subType);
+              i.typeName = this.typeList.find(
+                (i) => i.value == item.subType
+              ).label;
+              // i.singlePrice = item.discountSinglePrice
+              i.totalPrice = i.discountTotalPrice;
+            });
+            this.tableForm.detailList.push(...item.detailList);
+          });
+          this.$refs.table.reload();
+        }
+        this.$emit(
+          'setPrice',
+          params.children.amountTotalPrice - this.invoiceAmount
+        );
+        let row = {
+          id: params.id,
+          name: params.statementNo,
+          code: params.statementNo,
+          linkType: params.type == 1 ? 190 : 290,
+          linkTypeName: params.type == 1 ? '销售对账单' : '采购对账单'
+        };
+        this.setSelectData(row);
+      },
+      setValue(data) {
+        this.tableForm.detailList = data;
+      },
+      clearTable() {
+        this.tableForm = {
+          detailList: [],
+          link: []
+        };
+      },
+      // 当数量变化时更新金额
+      updateTotalPrice(row) {
+        if (row.totalCount && row.singlePrice) {
+          row.totalPrice = (parseFloat(row.totalCount) * parseFloat(row.singlePrice)).toFixed(2);
+        }
+      },
+      getTableValidate() {
+        return new Promise((resolve, reject) => {
+          if (
+            this.tableForm.detailList.length == 0 &&
+            ![4, 5].includes(this.form.sourceType)
+          )
+            return this.$message.warning('请选择关联信息');
+          resolve(this.tableForm);
+        });
+      },
+      validateForm(callback) {
+        //开始表单校验
+        this.$refs.form.validate((valid, obj) => {
+          if (obj) {
+            let messages = Object.keys(obj).map((key) => obj[key][0]);
+            if (messages.length > 0) {
+              this.$message.warning(messages[0].message);
+            }
+          }
+          callback(valid);
+        });
+      },
+      setSelectData(val) {
+        this.tableForm.link = [{}];
+        this.$set(this.tableForm.link[0], 'linkId', val.id);
+        this.$set(this.tableForm.link[0], 'linkName', val.name);
+        this.$set(this.tableForm.link[0], 'linkCode', val.code);
+        this.$set(this.tableForm.link[0], 'linkType', val.linkType);
+        this.$set(this.tableForm.link[0], 'linkTypeName', val.linkTypeName);
+      },
+      getTableData() {}
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+.time-form .el-form-item {
+  margin-bottom: 0 !important;
+}
+</style>

+ 5 - 3
src/views/purchasingManage/supplierManage/index.vue

@@ -393,9 +393,11 @@
       openEdit(type, row) {
         this.current = row;
         this.showEdit = true;
-        this.$refs.addContactDialogRef.open(type, row, this.curNodeData.id, 2);
-        this.$refs.addContactDialogRef.$refs.form &&
-          this.$refs.addContactDialogRef.$refs.form.clearValidate();
+        this.$nextTick(() => {
+          this.$refs.addContactDialogRef.open(type, row, this.curNodeData.id, 2);
+          this.$refs.addContactDialogRef.$refs.form &&
+            this.$refs.addContactDialogRef.$refs.form.clearValidate();
+        })
       },
       //批量删除
       allDelBtn() {

+ 37 - 26
src/views/saleManage/contact/components/addContactDialog.vue

@@ -13,7 +13,7 @@
     @close="cancel"
   >
     <el-tabs v-model="activeName" type="card" @tab-click="handleActive">
-      <el-tab-pane label="基本信息" :name="1">
+      <el-tab-pane label="基本信息" name="1">
         <headerTitle title="基本信息" style="margin-top: 30px"></headerTitle>
         <el-form
           label-width="120px"
@@ -351,7 +351,7 @@
           </el-row>
         </el-form>
       </el-tab-pane>
-      <el-tab-pane label="银行信息" :name="2">
+      <el-tab-pane label="银行信息" name="2">
         <headerTitle title="银行信息" style="margin-top: 30px"></headerTitle>
         <ele-pro-table
           ref="table"
@@ -410,7 +410,7 @@
           </template>
         </ele-pro-table>
       </el-tab-pane>
-      <el-tab-pane label="联系人信息" :name="3">
+      <el-tab-pane label="联系人信息" name="3">
         <headerTitle title="联系人信息" style="margin-top: 30px"></headerTitle>
         <ele-pro-table
           ref="linkTable"
@@ -613,7 +613,7 @@
         </el-form>
       </el-tab-pane> -->
 
-      <el-tab-pane label="证书资质" :name="4">
+      <el-tab-pane label="证书资质" name="4">
         <headerTitle title="证书资质" style="margin-top: 30px"></headerTitle>
         <certificateManagement
           ref="certificateManagementRef"
@@ -695,7 +695,7 @@
           </template>
         </ele-pro-table> -->
       </el-tab-pane>
-      <el-tab-pane :label="getLabel" :name="5">
+      <el-tab-pane :label="getLabel" name="5">
         <headerTitle :title="getLabel" style="margin-top: 30px"></headerTitle>
         <ele-pro-table
           ref="supplyRef"
@@ -760,23 +760,23 @@
       <el-button
         type="primary"
         @click="pageChange('up')"
-        :disabled="activeName == 1"
+        :disabled="activeName == '1'"
         >上一步</el-button
       >
       <el-button
         type="primary"
         @click="pageChange('next')"
-        :disabled="activeName == 5"
+        :disabled="activeName == '5'"
         >下一步</el-button
       >
-      <el-button type="primary" v-if="form?.id||activeName == 5" @click="save" v-click-once
+      <el-button type="primary" v-if="form?.id||activeName == '5'" @click="save" v-click-once
         >保存</el-button
       >
       <el-button
         type="primary"
         v-if="
           form.type == 1 &&
-          activeName == 5 &&
+          activeName == '5' &&
           form.qualificationCensorship == '1'
         "
         @click="save('sub')"
@@ -926,7 +926,7 @@
         processSubmitDialogFlag: false,
         title: '',
         row: {},
-        activeName: 1,
+        activeName: '1',
         formDef,
         supplyList: [],
         otherFormDef,
@@ -1364,6 +1364,7 @@
 
     methods: {
       async open(type, row, contactCategoryId, pageType) {
+        this.resetForm()
         // return
         this.form.type = pageType || 1;
         this.title = type;
@@ -1538,7 +1539,7 @@
         return new Promise((resolve, reject) => {
           this.$refs.form.validate((valid) => {
             if (!valid) {
-              this.activeName = 1;
+              this.activeName = '1';
               reject(false);
             } else {
               resolve(true);
@@ -1551,7 +1552,7 @@
           this.$refs.otherForm.validate((valid) => {
             console.log(valid, 'valid');
             if (!valid) {
-              this.activeName = 1;
+              this.activeName = '1';
               reject(false);
             } else {
               resolve(true);
@@ -1562,7 +1563,7 @@
       tableLinkDataValid() {
         return new Promise((resolve, reject) => {
           if (this.tableLinkData.length == 0) {
-            this.activeName = 3;
+            this.activeName = '3';
             this.$message.error('联系人信息至少有1条');
             reject(false);
           } else {
@@ -1580,20 +1581,20 @@
 
       async pageChange(type) {
         if (type == 'up') {
-          this.activeName -= 1;
+          this.activeName = (parseInt(this.activeName) - 1).toString();
         }
         if (type == 'next') {
-          if (this.activeName == 1 && !(await this.formValid())) {
+          if (this.activeName == '1' && !(await this.formValid())) {
             return;
           }
-          if (this.activeName == 3 && !(await this.tableLinkDataValid())) {
+          if (this.activeName == '3' && !(await this.tableLinkDataValid())) {
             this.$message.error('联系人信息至少有1条');
             return;
           }
           // if (this.activeName == 4 && !(await this.otherFormValid())) {
           //   return;
           // }
-          this.activeName += 1;
+          this.activeName = (parseInt(this.activeName) + 1).toString();
         }
       },
       async save(type = '') {
@@ -1726,19 +1727,29 @@
       },
       cancel() {
         this.$nextTick(() => {
-          this.activeName = 1;
+          this.activeName = '1';
           // 关闭后,销毁所有的表单数据
-          this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
-          this.$refs['formRef'] && this.$refs['formRef'].resetFields();
-          this.tableCertificateDataList = [];
-          this.form = copyObj(this.formDef);
-          this.otherForm = copyObj(this.otherFormDef);
-          this.tableBankData = [];
-          this.tableLinkData = [];
-          this.categoryIdList = [];
+          this.resetForm()
+    
           this.visible = false;
         });
       },
+      resetForm() {
+        this.$set(this, 'form', copyObj(this.formDef));
+          this.$set(this, 'otherForm', copyObj(this.otherFormDef));
+          this.$set(this, 'tableBankData', []);
+          this.$set(this, 'tableLinkData', []);
+          this.$set(this, 'categoryIdList', []);
+          this.$set(this, 'tableCertificateDataList', []);
+          // this.form = copyObj(this.formDef);
+          // this.otherForm = copyObj(this.otherFormDef);
+          // this.tableBankData = [];
+          // this.tableLinkData = [];
+          // this.categoryIdList = [];
+          // this.tableCertificateDataList = [];
+          this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
+          this.$refs['form'] && this.$refs['form'].resetFields();
+      },
       async _getById(id) {
         const data = await contactDetail(id);
         this.form = data.base;

+ 6 - 3
src/views/saleManage/contact/contactList.vue

@@ -483,9 +483,12 @@
       openEdit(row, type) {
         this.current = row;
         this.showEdit = true;
-        this.$refs.addContactDialogRef.open(row, type, this.curNodeData.id);
-        this.$refs.addContactDialogRef.$refs.form &&
-          this.$refs.addContactDialogRef.$refs.form.clearValidate();
+        this.$nextTick(() => {
+          this.$refs.addContactDialogRef.open(row, type, this.curNodeData.id);
+          this.$refs.addContactDialogRef.$refs.form &&
+            this.$refs.addContactDialogRef.$refs.form.clearValidate();
+        });
+        
       },
       //批量删除
       allDelBtn() {