Преглед на файлове

fix(督办):关联对象实现对项目、合同、金额的关联

likai преди 3 години
родител
ревизия
ad36c2fe4b
променени са 1 файла, в които са добавени 88 реда и са изтрити 2 реда
  1. 88 2
      src/views/plat/task/components/TaskAdd.vue

+ 88 - 2
src/views/plat/task/components/TaskAdd.vue

@@ -99,7 +99,12 @@
         </el-col>
         <el-col :span="12">
           <el-form-item label="关联对象" prop="targetId">
-            <el-select v-model="form.targetId" placeholder="请选择关联对象" style="width: 100%" @change="targetChange">
+            <el-select
+              v-model="form.targetId"
+              filterable
+              placeholder="请选择关联对象"
+              style="width: 100%"
+              @change="targetChange">
               <el-option v-for="item in targets" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
           </el-form-item>
@@ -130,6 +135,9 @@
   import SelectUser from '@/components/select/SelectUser.vue'
   import taskApi from '@/api/plat/task'
   import custApi from '@/api/customer/index'
+  import businessApi from '@/api/proj/business'
+  import contractApi from '@/api/contract'
+  import collectionApi from '@/api/contract/collection'
 
   export default {
     name: 'TaskAdd',
@@ -156,6 +164,12 @@
     },
     data() {
       return {
+        // 项目数据
+        projects: [],
+        // 合同
+        contracts: [],
+        // 回款
+        payments: [],
         selfVisible: false,
         // 团队成员
         teamIds: [],
@@ -218,6 +232,21 @@
             this.targets.push(cust)
           }
         }
+        if (this.form.targetType == '20') {
+          for (let cust of this.projects) {
+            this.targets.push(cust)
+          }
+        }
+        if (this.form.targetType == '30') {
+          for (let cust of this.contracts) {
+            this.targets.push(cust)
+          }
+        }
+        if (this.form.targetType == '40') {
+          for (let cust of this.payments) {
+            this.targets.push(cust)
+          }
+        }
       },
       // 关联对象变化
       targetChange() {
@@ -231,8 +260,11 @@
       // 获取基本数据
       getData() {
         this.customers = []
+        this.projects = []
+        this.contracts = []
+        this.payments = []
         custApi
-          .getList({ targetType: '10' })
+          .getList({ targetType: '10', pageSize: 9999 })
           .then((res) => {
             if (res.data.list) {
               for (let cust of res.data.list) {
@@ -247,6 +279,60 @@
           .catch((err) => {
             console.error(err)
           })
+        businessApi
+          .getList({ pageSize: 9999 })
+          .then((res) => {
+            if (res.data.list) {
+              for (let busi of res.data.list) {
+                let data = {
+                  value: busi.id,
+                  label: busi.nboName,
+                }
+                this.projects.push(data)
+              }
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+        contractApi
+          .getList({ pageSize: 9999 })
+          .then((res) => {
+            if (res.data.list) {
+              for (let con of res.data.list) {
+                let data = {
+                  value: con.id,
+                  label: con.contractName,
+                }
+                this.contracts.push(data)
+              }
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+        collectionApi
+          .getList({ pageSize: 9999 })
+          .then((res) => {
+            if (res.data.list) {
+              for (let pay of res.data.list) {
+                let data = {
+                  value: pay.id,
+                  label:
+                    '合同编号:' +
+                    pay.contractCode +
+                    ' 日期:' +
+                    (pay.collectionDatetime ? pay.collectionDatetime.split(' ')[0] : '') +
+                    ' 金额:' +
+                    pay.collectionAmount,
+                }
+                this.payments.push(data)
+              }
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
       },
       // 打开弹窗
       open() {