Răsfoiți Sursa

feature(*): 1、首页当年回款金额与报表不一致问题处理,统一为报表处的统计逻辑
2、合同审批通过生成工单时,合同签约单位带到工单中
3、交付工单中销售可以创建安装任务流程调整

likai 2 ani în urmă
părinte
comite
0aa80dab41

+ 46 - 1
src/views/work/deliver/components/completeProgress.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px">
+  <el-dialog :title="title" :visible.sync="dialogFormVisible" width="750px">
     <el-form ref="form" label-position="top" :model="form" :rules="rules">
       <el-row :gutter="20">
         <el-col :span="24">
@@ -29,6 +29,16 @@
               value-format="yyyy-MM-dd HH:mm:ss" />
           </el-form-item>
         </el-col>
+        <el-col v-if="progress.progressType == '30'" :span="24">
+          <el-form-item label="产品">
+            <el-table ref="productTable" :data="products" style="width: 100%">
+              <el-table-column type="selection" width="55" />
+              <el-table-column label="产品名称" prop="productName" />
+              <el-table-column label="产品编号" prop="productCode" />
+              <el-table-column label="数量" prop="productNum" />
+            </el-table>
+          </el-form-item>
+        </el-col>
         <el-col :span="24">
           <el-form-item label="备注" prop="remark">
             <el-input v-model="form.remark" placeholder="请输入备注" :rows="5" show-word-limit type="textarea" />
@@ -45,6 +55,7 @@
 
 <script>
   import deliverWorkApi from '@/api/work/deliverWork'
+  import orderWorkApi from '@/api/work/deliver'
   import to from 'await-to-js'
   import axios from 'axios'
   import asyncUploadFile from '@/utils/uploadajax'
@@ -60,6 +71,7 @@
     },
     data() {
       return {
+        products: [],
         form: {
           date: '',
           fileUrl: '',
@@ -102,8 +114,23 @@
         if (this.$refs.uploadRef) {
           this.$refs.uploadRef.clearFiles() //去掉文件列表
         }
+        this.getProgressProducts()
         this.dialogFormVisible = true
       },
+      // 获取产品
+      async getProgressProducts() {
+        let temp = []
+        const [err, res] = await to(orderWorkApi.getDeliverOrder({ id: this.progress.deliverOrderId }))
+        if (err) return
+        if (res.code == 200 && res.data && res.data.progressProducts) {
+          for (let item of res.data.progressProducts) {
+            if (item.installProgressId == this.progress.id) {
+              temp.push(item)
+            }
+          }
+        }
+        this.products = temp
+      },
       // 上传附件
       beforeAvatarUpload(file) {
         let flag1 = file.size < this.fileSettings.fileSize
@@ -187,6 +214,22 @@
                 this.$emit('fetch-data')
               }
             } else if (this.progress.progressType == '30') {
+              if (!this.$refs.productTable.selection || this.$refs.productTable.selection == 0) {
+                this.$baseMessage('未选中任何产品', 'error', 'vab-hey-message-error')
+                return
+              }
+              let idMap = {}
+              let idArr = []
+              let unIdArr = []
+              for (let item of this.$refs.productTable.selection) {
+                idMap[item.id] = item.id
+                idArr.push(item.id)
+              }
+              for (let item of this.products) {
+                if (!idMap[item.id]) {
+                  unIdArr.push(item.id)
+                }
+              }
               const [err, res] = await to(
                 deliverWorkApi.completeInstall({
                   id: this.progress.id,
@@ -194,6 +237,8 @@
                   installCheckFileUrl: this.form.fileUrl,
                   fileName: this.form.fileName,
                   remark: this.form.remark,
+                  installProductIdArr: idArr,
+                  uninstallProductIdArr: unIdArr,
                 })
               )
               if (err) return

+ 24 - 3
src/views/work/deliver/components/editWork.vue

@@ -272,13 +272,13 @@
                 const { msg } = await deliverWorkApi.startDeliverGoodsProgress(data)
                 this.$baseMessage(msg, 'success', 'vab-hey-message-success')
               } else if (params.progressType == '30') {
-                if (!this.$refs.productTable.selection || this.$refs.productTable.selection == 0) {
-                  this.$baseMessage('未选中任何产品', 'error', 'vab-hey-message-error')
+                if (this.products.length == 0) {
+                  this.$baseMessage('无可操作产品,操作失败', 'error', 'vab-hey-message-error')
                   return
                 }
                 let data = {
                   progress: params,
-                  products: this.$refs.productTable.selection,
+                  products: this.products,
                 }
                 const { msg } = await deliverWorkApi.startInstallProgress(data)
                 this.$baseMessage(msg, 'success', 'vab-hey-message-success')
@@ -367,6 +367,25 @@
             this.form.progressTitle =
               '[' + res.data.contractCode + '][' + res.data.projectName + ']发货任务单-' + res.data.number
           }
+        } else if (this.form.progressType == '30' && this.workId == 0) {
+          // 1052, "于洋"
+          this.form.principalPersonId = 1052
+          this.form.principalPerson = '于洋'
+          orderWorkApi
+            .getHardwareUserInfo({ name: '于洋' })
+            .then((res) => {
+              if (res.data) {
+                this.form.principalPersonId = res.data.id
+                this.form.principalPerson = res.data.nickName
+              }
+            })
+            .catch((err) => {
+              console.error(err)
+            })
+          if (!this.form.progressTitle) {
+            this.form.progressTitle =
+              '[' + res.data.contractCode + '][' + res.data.projectName + ']安装任务单-' + res.data.number2
+          }
         }
         for (let p of this.allProducts) {
           p.max = p.productNum - p.completeNum
@@ -398,6 +417,8 @@
           if (this.form.progressType == '10') {
             this.productEditable = true
             this.products = this.deliverProducts
+          } else if (this.form.progressType == '30') {
+            this.products = this.selfProducts
           }
         }
       },

+ 5 - 0
src/views/work/deliver/index.vue

@@ -174,6 +174,11 @@
             width: '280px',
             prop: 'contractCode',
           },
+          {
+            label: '合同签订单位',
+            width: '280px',
+            prop: 'signatoryUnit',
+          },
           {
             label: '交付状态',
             width: '100px',

+ 30 - 4
src/views/work/deliver/plan.vue

@@ -100,14 +100,19 @@
               @click="openAddWork('10')">
               生成发货任务单
             </el-button>
-            <!-- <el-button
-              v-show="workOrderStatus == 15 && curPlanStatus != 30 && orderType == '20'"
-              v-permissions="['order:delivery:work:addinstall']"
+            <el-button
+              v-show="
+                workOrderStatus == 15 &&
+                curPlanStatus != 30 &&
+                orderType == '20' &&
+                userId == saleId &&
+                canInstallProgress
+              "
               icon="el-icon-plus"
               type="primary"
               @click="openAddWork('30')">
               生成部署安装单
-            </el-button> -->
+            </el-button>
           </vab-query-form-left-panel>
           <vab-query-form-right-panel>
             <table-tool :columns="columns" :show-columns.sync="showColumns" table-type="deliveryPlanTable" />
@@ -358,6 +363,7 @@
     },
     data() {
       return {
+        canInstallProgress: false,
         orderType: '',
         saleId: '',
         planList: [], //左侧工单列表
@@ -488,8 +494,27 @@
       this.id = parseInt(this.$route.query.id)
       await this.getOrderDetails()
       this.fetchPlanList()
+      this.getInstallProgress()
     },
     methods: {
+      // 获取安装单的数量
+      async getInstallProgress() {
+        this.canInstallProgress = false
+        const [err, res] = await to(
+          deliverWorkApi.list({ progressType: '30', pageNum: 1, pageSize: 9999, deliverOrderId: this.id })
+        )
+        if (err) return
+        if (res.code == 200 && res.data) {
+          if (res.data.total != 0) {
+            this.canInstallProgress = true
+            for (let item of res.data.list) {
+              if (item.progressStatus == '10' || item.progressStatus == '15' || item.progressStatus == '20') {
+                this.canInstallProgress = false
+              }
+            }
+          }
+        }
+      },
       // 返回
       back() {
         this.$router.push({
@@ -703,6 +728,7 @@
           this.tabaleList = res.data.list
           this.total = res.data.total
         }
+        this.getInstallProgress()
       },
     },
   }