Explorar el Código

Merge branch 'dev' of git.echepei.com:caojunjie/Smart_platform_ui into dev

caojunjie hace 3 años
padre
commit
de7efa9767

+ 2 - 4
src/views/dealer/purchase/config/customerContact.json

@@ -13,8 +13,7 @@
   "showSummary": true,
   "summaryText": "合计",
   "indexSlot": true,
-  "sumColumnList": [
-    {
+  "sumColumnList": [{
       "name": "orderQuantity",
       "type": "sum",
       "decimals": 0
@@ -28,8 +27,7 @@
       "type": "sum"
     }
   ],
-  "column": [
-    {
+  "column": [{
       "label": "产品编码",
       "prop": "code",
       "index": 1,

+ 234 - 156
src/views/workManagement/handoverSheet/detail.vue

@@ -8,7 +8,8 @@
           icon="el-icon-arrow-left"
           @click="backToList"
           :loading="btnLoading"
-        >返回列表</el-button>
+          >返回列表</el-button
+        >
       </div>
       <div class="add-customer-btn">
         <el-button
@@ -17,30 +18,38 @@
           class="el-button--small-yh"
           @click.stop="openEdit"
           v-if="disabled"
-        >编 辑</el-button>
+          >编 辑</el-button
+        >
         <el-button
-          v-if="form.id && loginUser === form.handingUser && form.confirmStatus !== 1"
+          v-if="
+            form.id &&
+              loginUser === form.handingUser &&
+              form.confirmStatus !== 1
+          "
           type="primary"
           size="small"
           class="el-button--small-yh"
           :loading="btnLoading"
           @click="submitConfirm"
           :disabled="!form.id || disabled"
-        >提交确认</el-button>
+          >提交确认</el-button
+        >
         <el-button
           v-if="checker && form.status != 3"
           type="primary"
           size="small"
           class="el-button--small-yh"
-          @click.stop="openCheckDialog">
+          @click.stop="openCheckDialog"
+        >
           审批
         </el-button>
         <el-button
           v-if="form.status > 0"
-          @click.native="checkScheduleDialog = true,checkId=form.id"
+          @click.native="(checkScheduleDialog = true), (checkId = form.id)"
           type="primary"
           size="small"
-        >审核进度</el-button>
+          >审核进度</el-button
+        >
         <el-button
           type="primary"
           v-if="!checkDisabled"
@@ -48,7 +57,8 @@
           size="small"
           @click="pleaseCheck"
           :loading="btnLoading"
-        >请核</el-button>
+          >请核</el-button
+        >
         <el-button
           type="success"
           :disabled="!form.id"
@@ -56,17 +66,19 @@
           @click="copyDoc"
           :loading="btnLoading"
           v-if="false"
-        >复制单据</el-button>
+          >复制单据</el-button
+        >
         <el-button
           type="primary"
           @click="editCustomer"
           size="small"
           :loading="btnLoading"
-        >保存数据</el-button>
+          >保存数据</el-button
+        >
       </div>
     </div>
     <div class="customer-main">
-      <containerTitle title="基础信息"/>
+      <containerTitle title="基础信息" />
       <basic-container :showBtn="true">
         <avue-form
           ref="form"
@@ -100,11 +112,16 @@
               clearable
               size="small"
               placeholder="请选择"
-              :disabled="disabled || checkDisabled || form.chargeStatus == 0 || confirmDisabled"
+              :disabled="
+                disabled ||
+                  checkDisabled ||
+                  form.chargeStatus == 0 ||
+                  confirmDisabled
+              "
               @change="handingUserChange"
             >
               <el-option
-                v-for="(item,index) in userList"
+                v-for="(item, index) in userList"
                 :key="index"
                 :label="item.realName"
                 :value="item.id"
@@ -120,10 +137,15 @@
               default-first-option
               size="small"
               placeholder="请选择"
-              :disabled="disabled || checkDisabled || form.chargeStatus == 0 || confirmDisabled"
+              :disabled="
+                disabled ||
+                  checkDisabled ||
+                  form.chargeStatus == 0 ||
+                  confirmDisabled
+              "
             >
               <el-option
-                v-for="(item,index) in userList"
+                v-for="(item, index) in userList"
                 :key="index"
                 :label="item.realName"
                 :value="item.realName"
@@ -138,11 +160,12 @@
               :active-value="1"
               :inactive-value="0"
               :disabled="disabled || checkDisabled || confirmDisabled"
+              @change="externalChange"
             ></el-switch>
           </template>
         </avue-form>
       </basic-container>
-      <containerTitle title="详情内容"/>
+      <containerTitle title="详情内容" />
       <basic-container>
         <avue-crud
           ref="crud"
@@ -159,13 +182,15 @@
               size="small"
               @click.stop="newDetails"
               :disabled="disabled || checkDisabled || confirmDisabled"
-            >录入明细</el-button>
+              >录入明细</el-button
+            >
             <el-button
               type="info"
               icon="el-icon-printer"
               size="small"
               @click="openReport"
-            >报表打印</el-button>
+              >报表打印</el-button
+            >
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button
@@ -174,21 +199,24 @@
               type="text"
               @click="rowCell(row, index)"
               :disabled="disabled || checkDisabled || confirmDisabled"
-            >{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
+              >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
+            >
             <el-button
               size="small"
               icon="el-icon-upload"
               type="text"
               :disabled="disabled || checkDisabled || confirmDisabled"
               @click="annexOpen(row, index)"
-            >附件</el-button>
+              >附件</el-button
+            >
             <el-button
               size="small"
               icon="el-icon-delete"
               type="text"
               @click="rowDel(row, index)"
               :disabled="disabled || checkDisabled || confirmDisabled"
-            >删除</el-button>
+              >删除</el-button
+            >
           </template>
           <template slot="quantity" slot-scope="{ row, index }">
             <el-input-number
@@ -233,7 +261,7 @@
           </template>
         </avue-crud>
       </basic-container>
-      <containerTitle title="客户未收款"/>
+      <containerTitle title="客户未收款" />
       <basic-container>
         <avue-form
           ref="detailForm"
@@ -290,7 +318,8 @@
       title="附件"
       :visible.sync="dialogVisible"
       append-to-body
-      width="70%">
+      width="70%"
+    >
       <c-upload
         typeUpload="PC"
         :basic="true"
@@ -300,9 +329,15 @@
         :enumerationValue="124"
       ></c-upload>
       <span slot="footer" class="dialog-footer">
-          <el-button @click="dialogVisible = false" size="small">取 消</el-button>
-          <el-button type="primary" @click="saveAnnex" size="small" :disabled="upLoadForm.status >= 2">保 存</el-button>
-        </span>
+        <el-button @click="dialogVisible = false" size="small">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="saveAnnex"
+          size="small"
+          :disabled="upLoadForm.status >= 2"
+          >保 存</el-button
+        >
+      </span>
     </el-dialog>
   </div>
 </template>
@@ -316,8 +351,8 @@ import {
   IntegerFormat
 } from "@/util/validate";
 import { gainUser } from "@/api/basicData/customerInquiry";
-import {getUserInfo} from "@/api/system/user";
-import {getDeptTree} from "@/api/system/dept";
+import { getUserInfo } from "@/api/system/user";
+import { getDeptTree } from "@/api/system/dept";
 import { getCurrentDate } from "@/util/date";
 import { contrastObj, contrastList } from "@/util/contrastData";
 import check from "@/components/check/check";
@@ -329,7 +364,8 @@ import {
   pleaseCheck,
   saveAttached,
   getAttachment,
-  submitConfirm} from "@/api/standAlone/handoverSheet";
+  submitConfirm
+} from "@/api/standAlone/handoverSheet";
 import reportDialog from "@/components/report-dialog/main";
 
 export default {
@@ -347,11 +383,11 @@ export default {
   data() {
     const validateHandingUser = (rule, value, callback) => {
       if (this.form.chargeStatus == 1 && !this.form.handingUser) {
-        callback(new Error('接收人不能为空'))
+        callback(new Error("接收人不能为空"));
       } else {
-        callback()
+        callback();
       }
-    }
+    };
     return {
       disabled: false,
       pageLoading: false,
@@ -372,7 +408,7 @@ export default {
               }
             ],
             span: 8,
-            slot: true,
+            slot: true
           },
           {
             label: "交接日期",
@@ -392,45 +428,49 @@ export default {
           {
             label: "NO.",
             prop: "serialNo",
-            disabled:true,
-            span: 8,
+            disabled: true,
+            span: 8
           },
           {
             label: "交接人",
             prop: "handoverUserName",
-            span: 8,
+            span: 8
           },
           {
             label: "联系电话",
             prop: "contacts",
-            span: 8,
+            span: 8
           },
           {
             label: "是否收费",
             prop: "chargeStatus",
-            span: 8,
+            span: 8
           },
           {
             label: "接收人",
             prop: "handingUser",
             span: 8,
-            rules: [
-              {validator: validateHandingUser, trigger: 'change'}
-            ]
+            rules: [{ validator: validateHandingUser, trigger: "change" }]
           },
           {
             label: "是否外部交接单",
             prop: "external",
+            span: 8
+          },
+          {
+            label: "接收客户名称",
+            prop: "handingCorpName",
             span: 8,
+            display: false
           },
           {
             label: "交接备注",
             prop: "remarks",
             type: "textarea",
             minRows: 2,
-            span: 24,
-          },
-        ],
+            span: 24
+          }
+        ]
       },
       detailForm: {},
       detailOption: {
@@ -440,16 +480,16 @@ export default {
           {
             label: "客户名称",
             prop: "corpName",
-            disabled:true,
-            span: 8,
+            disabled: true,
+            span: 8
           },
           {
             label: "未收金额",
             prop: "uncollectedAmount",
             disabled: true,
-            span: 8,
+            span: 8
           }
-        ],
+        ]
       },
       dataList: [],
       tableOption: {},
@@ -463,25 +503,25 @@ export default {
       switchDialog: false, // 报表弹窗控制
       userList: [],
       dic: [],
-      loginUser: '', // 登录人
+      loginUser: "", // 登录人
       oldForm: {},
       oldDataList: [],
       checkDisabled: false, // 审核状态
       confirmDisabled: false, // 提交状态
       checker: false,
-      checkId: '',
-      batchNo:'',
+      checkId: "",
+      batchNo: "",
       checkDialog: false,
       checkScheduleDialog: false,
       checkData: {},
       dialogVisible: false,
       orderList: [],
       upLoadForm: {},
-      rowIndex: null, //暂存明细下标
-    }
+      rowIndex: null //暂存明细下标
+    };
   },
   async created() {
-    this.$set(this.form, 'handoverDate', getCurrentDate()); // 默认当前日期
+    this.$set(this.form, "handoverDate", getCurrentDate()); // 默认当前日期
     this.tableOption = await this.getColumnData(
       this.getColumnName(104),
       tableOption
@@ -491,22 +531,22 @@ export default {
     });
     getUserInfo().then(res => {
       this.loginUser = res.data.data.id;
-    })
+    });
     getDeptTree().then(res => {
-      this.dic = res.data.data
-    })
-    this.getWorkDicts('unit').then(res => {
+      this.dic = res.data.data;
+    });
+    this.getWorkDicts("unit").then(res => {
       this.unitOption = res.data.data;
-    })
+    });
     if (this.detailData.query) {
       this.disabled = true;
       this.option.column.map(e => {
-        this.$set(e, 'disabled', true)
-      })
+        this.$set(e, "disabled", true);
+      });
       this.queryData(this.detailData.id);
     } else if (this.detailData.auditId) {
       this.checker = true;
-      this.batchNo = this.detailData.check.batchNo
+      this.batchNo = this.detailData.check.batchNo;
       this.queryData(this.detailData.id);
     }
   },
@@ -522,22 +562,24 @@ export default {
     // 查询
     queryData(id) {
       this.pageLoading = true;
-      dataDetail({id: id}).then(res => {
-        this.form = res.data.data;
-        this.dataList = this.form.itemList? this.form.itemList: [];
-        delete this.form.itemList;
-        this.oldForm = {...this.form};
-        this.oldDataList = [...this.dataList];
-        this.checkDisabled = this.form.status > 0? true: false;
-        this.confirmDisabled = this.form.confirmStatus === 1? true: false;
-        if (this.form.status > 0 || this.form.confirmStatus === 1) {
-          this.option.column.map(e => {
-            this.$set(e, 'disabled', true)
-          })
-        }
-      }).finally(() => {
-        this.pageLoading = false;
-      })
+      dataDetail({ id: id })
+        .then(res => {
+          this.form = res.data.data;
+          this.dataList = this.form.itemList ? this.form.itemList : [];
+          delete this.form.itemList;
+          this.oldForm = { ...this.form };
+          this.oldDataList = [...this.dataList];
+          this.checkDisabled = this.form.status > 0 ? true : false;
+          this.confirmDisabled = this.form.confirmStatus === 1 ? true : false;
+          if (this.form.status > 0 || this.form.confirmStatus === 1) {
+            this.option.column.map(e => {
+              this.$set(e, "disabled", true);
+            });
+          }
+        })
+        .finally(() => {
+          this.pageLoading = false;
+        });
     },
     //返回列表
     backToList() {
@@ -548,13 +590,13 @@ export default {
       this.disabled = false;
       this.option.column.map(e => {
         if (this.checkDisabled || this.confirmDisabled) {
-          this.$set(e, 'disabled', true)
+          this.$set(e, "disabled", true);
         } else {
-          if (e.prop != 'serialNo') {
-            this.$set(e, 'disabled', false)
+          if (e.prop != "serialNo") {
+            this.$set(e, "disabled", false);
           }
         }
-      })
+      });
     },
     // 复制
     copyDoc() {
@@ -565,21 +607,26 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          this.$set(this.form, 'itemList', this.dataList)
+          this.$set(this.form, "itemList", this.dataList);
           this.form.itemList.forEach(item => {
-            item.fileList = item.fileList? item.fileList: [];
-          })
+            item.fileList = item.fileList ? item.fileList : [];
+          });
           this.btnLoading = true;
-          typeSave(this.form).then(res => {
-            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-            this.queryData(res.data.data);
-          }).finally(() => {
-            this.btnLoading = false;
-          })
+          typeSave(this.form)
+            .then(res => {
+              this.$message({
+                type: "success",
+                message: this.form.id ? "修改成功!" : "新增成功!"
+              });
+              this.queryData(res.data.data);
+            })
+            .finally(() => {
+              this.btnLoading = false;
+            });
         } else {
-          return false
+          return false;
         }
-      })
+      });
     },
     cellStyle() {
       return "padding:0;height:40px;";
@@ -594,8 +641,8 @@ export default {
         //关闭窗口
         this.$refs.crud.$refs.dialogColumn.columnBox = false;
         this.$nextTick(() => {
-          this.$refs.crud.doLayout()
-        })
+          this.$refs.crud.doLayout();
+        });
       }
     },
     async resetColumn() {
@@ -606,8 +653,8 @@ export default {
       );
       if (inSave) {
         this.$nextTick(() => {
-          this.$refs.crud.doLayout()
-        })
+          this.$refs.crud.doLayout();
+        });
         this.$message.success("重置成功");
         //关闭窗口
         setTimeout(() => {
@@ -618,13 +665,13 @@ export default {
     //录入明细
     newDetails() {
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
           this.dataList.push({
-            $cellEdit: true,
-          })
+            $cellEdit: true
+          });
         }
-      })
+      });
     },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
@@ -642,11 +689,11 @@ export default {
         if (row.id) {
           removeGoods(row.id).then(res => {
             this.$message({
-              type: 'success',
-              message: '删除成功!'
-            })
+              type: "success",
+              message: "删除成功!"
+            });
             this.dataList.splice(row.$index, 1);
-          })
+          });
         } else {
           this.$message({
             type: "success",
@@ -657,63 +704,70 @@ export default {
       });
     },
     getKHData(row) {
-      this.$set(this.form, 'corpName', row.cname)
+      this.$set(this.form, "corpName", row.cname);
     },
     // 验证新旧值对比
     verification() {
-      if (contrastObj(this.form, this.oldForm) ||
-        contrastList(this.dataList, this.oldDataList)) {
+      if (
+        contrastObj(this.form, this.oldForm) ||
+        contrastList(this.dataList, this.oldDataList)
+      ) {
         this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
-        }).then(() => {
-          this.editCustomer();
-        }).catch(() => {
-          return false;   //取消改动数据
         })
+          .then(() => {
+            this.editCustomer();
+          })
+          .catch(() => {
+            return false; //取消改动数据
+          });
       } else {
         return true;
       }
     },
     //打开审核
-    openCheckDialog(){
-      this.checkData  = this.detailData.check
+    openCheckDialog() {
+      this.checkData = this.detailData.check;
       this.checkDialog = true;
     },
     //关闭审核
-    choceCheckFun(){
+    choceCheckFun() {
       this.checkDialog = false;
     },
-    choceScheduleFun(){
-      this.checkScheduleDialog = false
+    choceScheduleFun() {
+      this.checkScheduleDialog = false;
     },
     // 请核
     pleaseCheck() {
       if (this.verification()) {
         const data = {
-          id : this.form.id,
+          id: this.form.id,
           serialNo: this.form.serialNo,
-          checkType: 'jjd',
-          url: '/workManagement/handoverSheet/index',
-          pageStatus:"this.$store.getters.handOverStatus",
-          pageLabel:"交接单",
-          checkFlag: 1,
-        }
+          checkType: "jjd",
+          url: "/workManagement/handoverSheet/index",
+          pageStatus: "this.$store.getters.handOverStatus",
+          pageLabel: "交接单",
+          checkFlag: 1
+        };
         this.btnLoading = true;
-        pleaseCheck(data).then(res => {
-          this.$message.success('请核成功')
-          this.queryData(this.form.id)
-        }).catch(() => {
-          this.$message.error('请核失败')
-        }).finally(() => {
-          this.btnLoading = false;
-        })
+        pleaseCheck(data)
+          .then(res => {
+            this.$message.success("请核成功");
+            this.queryData(this.form.id);
+          })
+          .catch(() => {
+            this.$message.error("请核失败");
+          })
+          .finally(() => {
+            this.btnLoading = false;
+          });
       }
     },
     // 报表
     openReport() {
-      this.switchDialog =! this.switchDialog;
+      this.switchDialog = !this.switchDialog;
     },
     // 报表关闭
     onClose(val) {
@@ -721,14 +775,14 @@ export default {
     },
     //打开附件
     annexOpen(row, index) {
-      this.dialogVisible = true
-      this.upLoadForm = row
+      this.dialogVisible = true;
+      this.upLoadForm = row;
       if (row.id) {
-        getAttachment({id: row.id}).then(res => {
-          this.orderList = res.data.data? res.data.data: [];
-        })
+        getAttachment({ id: row.id }).then(res => {
+          this.orderList = res.data.data ? res.data.data : [];
+        });
       } else {
-        this.$set(row, 'fileList', row.fileList? row.fileList: []); // 新数据默认插入空
+        this.$set(row, "fileList", row.fileList ? row.fileList : []); // 新数据默认插入空
         this.orderList = [...row.fileList];
         this.rowIndex = index;
       }
@@ -736,21 +790,23 @@ export default {
     //保存
     saveAnnex() {
       if (this.upLoadForm.id) {
-        this.orderList.forEach(item => this.$set(item, 'pid', this.upLoadForm.id))
+        this.orderList.forEach(item =>
+          this.$set(item, "pid", this.upLoadForm.id)
+        );
         saveAttached(this.orderList).then(res => {
           this.$nextTick(() => {
             this.dialogVisible = false;
             this.rowIndex = null;
             this.orderList = [];
-          })
-        })
+          });
+        });
       } else {
         this.dataList[this.rowIndex].fileList = [...this.orderList];
         this.$nextTick(() => {
           this.dialogVisible = false;
           this.rowIndex = null;
           this.orderList = [];
-        })
+        });
       }
     },
     // 是否收费选择触发
@@ -759,7 +815,13 @@ export default {
     },
     // 接收人选择触发
     handingUserChange(data) {
-      this.$set(this.form, 'handingUserName', this.userList.find(item => data == item.id)? this.userList.find(item => data == item.id).realName: null);
+      this.$set(
+        this.form,
+        "handingUserName",
+        this.userList.find(item => data == item.id)
+          ? this.userList.find(item => data == item.id).realName
+          : null
+      );
     },
     // 提交确认
     submitConfirm() {
@@ -768,19 +830,35 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        this.btnLoading = true
-        submitConfirm({id: this.form.id}).then(res => {
-          this.$message.success('提交成功');
-          this.queryData(this.form.id);
-        }).finally(() => {
-          this.btnLoading = false;
-        })
-      })
+        this.btnLoading = true;
+        submitConfirm({ id: this.form.id })
+          .then(res => {
+            this.$message.success("提交成功");
+            this.queryData(this.form.id);
+          })
+          .finally(() => {
+            this.btnLoading = false;
+          });
+      });
     },
+    externalChange(row) {
+      // if (row == 1) {
+      //   this.findObject(this.option.column, "handingCorpName").display = true;
+      // } else {
+      //   this.findObject(this.option.column, "handingCorpName").display = false;
+      // }
+    }
   },
-}
+  watch: {
+    "form.external": function(obj) {
+      if (obj == 1) {
+        this.findObject(this.option.column, "handingCorpName").display = true;
+      } else {
+        this.findObject(this.option.column, "handingCorpName").display = false;
+      }
+    }
+  }
+};
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>