Ver Fonte

采购合同修改

liqianyi há 2 anos atrás
pai
commit
8045eec974

+ 2 - 3
src/views/modules/check/ibc-add-or-update.vue

@@ -268,15 +268,14 @@
         })
       },
       deleteItemHandle (id) {
-        this.checkItems.splice(this.checkItems.findIndex((item) => item.id === id))
-        console.log('items = ' + JSON.stringify(this.checkItems))
+        this.checkItems.splice(this.checkItems.findIndex((item) => item.id === id), 1)
       },
       addItem (item) {
         if (!item) return
         this.addItemVisible = false
         let i = this.checkItems.findIndex((item1) => item1.id === item.id)
         if (i > -1) {
-          this.checkItems.splice(i)
+          this.checkItems.splice(i, 1)
         }
         this.checkItems.push(item)
       }

+ 70 - 0
src/views/modules/common/attach-detail-dialog.vue

@@ -0,0 +1,70 @@
+<template>
+  <div>
+    <el-dialog
+      title="附件列表"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+        <div v-if="attachList">
+          <e-desc column="3" style="margin-bottom: 20px">
+            <e-desc-item span="2" label="文件">
+              <div v-for="(item, index) in attachList" style="display: inline">
+                <span v-if="index > 0">, </span>
+                <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+              </div>
+            </e-desc-item>
+          </e-desc>
+        </div>
+        <span slot="footer">
+          <el-button @click="onChose">返回</el-button>
+        </span>
+      <!-- 文件预览 -->
+      <preview-component v-if="previewVisible" ref="preview"/>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import EDesc from '../common/e-desc'
+  import EDescItem from '../common/e-desc-item'
+  import { downloadUrl } from '@/api/file'
+  import UploadComponent from '../common/upload-component'
+  import PreviewComponent from '../common/preview-component'
+  export default {
+    name: 'attach-detail-dialog',
+    components: {
+      PreviewComponent,
+      UploadComponent,
+      EDesc,
+      EDescItem
+    },
+    data () {
+      return {
+        visible: false,
+        previewVisible: false,
+        attachList: [],
+        downloadUrl: downloadUrl
+      }
+    },
+    methods: {
+      onChose () {
+        this.visible = false
+      },
+      async init (attachList) {
+        this.visible = true
+        this.attachList = attachList
+      },
+      // 预览
+      previewFile (fileName, url) {
+        this.previewVisible = true
+        this.$nextTick(() => {
+          this.$refs.preview.init(fileName, url)
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/modules/cus/communicate-add-or-update.vue

@@ -326,7 +326,7 @@
       },
       // 删除产品项
       deleteProductHandle (recordId) {
-        this.cusRCommProductVOS.splice(this.cusRCommProductVOS.findIndex((item) => item.recordId === recordId))
+        this.cusRCommProductVOS.splice(this.cusRCommProductVOS.findIndex((item) => item.recordId === recordId), 1)
       }
     }
   }

+ 1 - 1
src/views/modules/cus/contract-record-add-or-update.vue

@@ -294,7 +294,7 @@ export default {
       },
       // 删除产品项
       deleteProductHandle (recordId) {
-        this.productList.splice(this.productList.findIndex((item) => item.recordId === recordId))
+        this.productList.splice(this.productList.findIndex((item) => item.recordId === recordId), 1)
       },
       // 编辑产品
       updateProductHandle (row) {

+ 1 - 1
src/views/modules/order/order-add-or-update.vue

@@ -361,7 +361,7 @@
       },
       // 删除产品项
       deleteProductHandle (recordId) {
-        this.productDetails.splice(this.productDetails.findIndex((item) => item.recordId === recordId))
+        this.productDetails.splice(this.productDetails.findIndex((item) => item.recordId === recordId), 1)
       }
     }
   }

+ 1 - 2
src/views/modules/order/order.vue

@@ -169,11 +169,10 @@
 <script>
   import AddOrUpdate from './order-add-or-update'
   import Detail from './order-detail'
-  import { getOrderList, deliverOrder } from '@/api/sale'
+  import { getOrderList, deliverOrder, revokeOrder } from '@/api/sale'
   import CusComponent from '../common/cus-component'
   import DispatchArrived from './dispatch-arrived'
   import NoticeChangeSetting from './order-notice-change-setting'
-  import {revokeOrder} from '@/api/sale'
   export default {
     name: 'order',
     components: {

+ 2 - 2
src/views/modules/production/scheduling-outsource.vue

@@ -349,7 +349,7 @@ export default {
       },
       deleteProductHandle (detailId) {
         if (!detailId) return
-        this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId))
+        this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId), 1)
         this.calTotal()
       },
       addProductCallback (data) {
@@ -357,7 +357,7 @@ export default {
         this.addProductVisible = false
         let i = this.productDetails.findIndex((item) => item.detailId === data.detailId)
         if (i > -1) {
-          this.productDetails.splice(i)
+          this.productDetails.splice(i, 1)
         }
         this.productDetails.push(data)
         this.calTotal()

+ 1 - 2
src/views/modules/purchase/outsource-chose.vue

@@ -147,8 +147,7 @@
           params: this.$http.adornParams({
             'current': this.pageIndex,
             'size': this.pageSize,
-            'productName': this.dataForm.productName ? this.dataForm.productName : null,
-            'purchaseState': 3
+            'productName': this.dataForm.productName ? this.dataForm.productName : null
           })
         }).then(({data}) => {
           if (data && data.code === '200') {

+ 216 - 28
src/views/modules/sale/contract-add-or-update.vue

@@ -61,12 +61,12 @@
           <el-row class="my-row">
             <upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
           </el-row>
-          <el-row style="margin-top: 10px" class="my-row">
+          <el-row v-if="Number(contactType) === 1" style="margin-top: 10px" class="my-row">
             <div class="title"><span style="color: red">*</span> 采购物品明细</div>
             <el-table
               :data="materialList"
               border
-              style="width: 100%;">
+              style="width: 100%;margin-top: 10px">
               <el-table-column
                 label="序号"
                 type="index"
@@ -164,13 +164,164 @@
               <el-button type="primary" icon="el-icon-plus" @click="addItemHandle"></el-button>
             </el-row>
           </el-row>
+          <el-row v-if="Number(contactType) === 2" style="margin-top: 10px" class="my-row">
+            <div class="title"><span style="color: red">*</span> 委外物品明细</div>
+            <el-table
+              :data="outsourceList"
+              border
+              style="width: 100%;margin-top: 10px">
+              <el-table-column
+                label="序号"
+                type="index"
+                width="50"
+                align="center">
+              </el-table-column>
+              <el-table-column
+                prop="purchaseCode"
+                header-align="center"
+                align="center"
+                min-width="120"
+                :show-tooltip-when-overflow="true"
+                label="采购编码">
+              </el-table-column>
+              <el-table-column
+                prop="productName"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="产品名称">
+              </el-table-column>
+              <el-table-column
+                prop="prodCode"
+                header-align="center"
+                align="center"
+                min-width="120"
+                :show-tooltip-when-overflow="true"
+                label="产品编号">
+              </el-table-column>
+              <el-table-column
+                prop="commissionTypeName"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-overflow-tooltip="true"
+                :formatter="formatType"
+                label="委外类别">
+              </el-table-column>
+              <el-table-column
+                prop="specificationExplian"
+                header-align="center"
+                align="center"
+                min-width="100"
+                :show-tooltip-when-overflow="true"
+                label="型号及规格">
+              </el-table-column>
+              <el-table-column
+                prop="cnt"
+                header-align="center"
+                align="center"
+                label="数量">
+              </el-table-column>
+              <el-table-column
+                prop="qualifiedCnt"
+                header-align="center"
+                align="center"
+                label="合格数量">
+              </el-table-column>
+              <el-table-column
+                prop="unitName"
+                header-align="center"
+                align="center"
+                min-width="100"
+                :show-tooltip-when-overflow="true"
+                label="单位">
+              </el-table-column>
+              <el-table-column
+                prop="deadline"
+                header-align="center"
+                align="center"
+                min-width="160"
+                :show-tooltip-when-overflow="true"
+                label="采购期限">
+              </el-table-column>
+              <el-table-column
+                prop="arrivedTime"
+                header-align="center"
+                align="center"
+                min-width="160"
+                :show-tooltip-when-overflow="true"
+                label="到料时间">
+              </el-table-column>
+              <el-table-column
+                prop="batchNumber"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="批次号/用途">
+              </el-table-column>
+              <el-table-column
+                prop="supplierName"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="供应商">
+              </el-table-column><el-table-column
+              prop="applyTime"
+              header-align="center"
+              align="center"
+              min-width="160"
+              :show-tooltip-when-overflow="true"
+              label="申请时间">
+            </el-table-column>
+              <el-table-column
+                prop="applier"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="申请人">
+              </el-table-column>
+              <el-table-column
+                prop="orgName"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="申请部门">
+              </el-table-column>
+              <el-table-column
+                prop="notes"
+                header-align="center"
+                align="center"
+                min-width="180"
+                :show-overflow-tooltip="true"
+                label="备注">
+              </el-table-column>
+              <el-table-column
+                fixed="right"
+                header-align="center"
+                align="center"
+                width="100"
+                label="操作">
+                <template slot-scope="scope">
+                  <el-button style="color: red" type="text" size="small" @click="deleteItemHandle(scope.row.recordId)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-row style="text-align: center; margin-top: 10px;">
+              <el-button type="primary" icon="el-icon-plus" @click="addItemHandle"></el-button>
+            </el-row>
+          </el-row>
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button @click="onChose">取消</el-button>
           <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
         </span>
       <add-purchase v-if="addPurchaseVisible" ref="addPurchase" @addItems="addMaterialItems"/>
-      <add-outsource v-if="addOutsourceVisible" ref="addOutsource" @addItems="addMaterialItems"/>
+      <add-outsource v-if="addOutsourceVisible" ref="addOutsource" @addItems="addOutsourceItems"/>
     </div>
 </template>
 
@@ -200,7 +351,12 @@ export default {
         addPurchaseVisible: false,
         addOutsourceVisible: false,
         dataForm: {},
+        // 合同类型: 1 采购合同;2 委外合同
+        contactType: 1,
+        // 采购物品明细
         materialList: [],
+        // 委外物品明细
+        outsourceList: [],
         optionsPurchaseType: [],
         dataRule: {
           type: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
@@ -233,6 +389,7 @@ export default {
         await getContractDetail(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
+            this.contactType = data.data.type
             // 附件
             if (data.data.attachList) {
               data.data.attachList.forEach((item) => {
@@ -243,14 +400,20 @@ export default {
                 })
               })
             }
-            // 采购物品明细
-            if (data.data.purchaseDetailList) {
+            if (Number(this.dataForm.type) === 1 && data.data.purchaseDetailList) {
+              // 采购物品明细
               data.data.purchaseDetailList.forEach((item) => {
-                if (!item.recordId) {
-                  item.recordId = Math.round(Math.random() * 1000000)
-                }
                 this.materialList.push({
-                  ...item
+                  ...item,
+                  recordId: item.recordId || Math.round(Math.random() * 1000000)
+                })
+              })
+            } else {
+              // 委外物品明细
+              data.data.purCommissionDetailList.forEach((item) => {
+                this.outsourceList.push({
+                  ...item,
+                  recordId: item.recordId || Math.round(Math.random() * 1000000)
                 })
               })
             }
@@ -284,13 +447,25 @@ export default {
             // 产品明细
             // console.log(JSON.stringify(this.materialList))
             this.dataForm.purPurchaseContractDetailsList = []
-            if (this.materialList) {
-              this.materialList.forEach((item) => {
-                this.dataForm.purPurchaseContractDetailsList.push({
-                  contractId: this.id || 0,
-                  dataId: item.purchaseDetailId
+            if (Number(this.contactType) === 1) {
+              if (this.materialList) {
+                this.materialList.forEach((item) => {
+                  this.dataForm.purPurchaseContractDetailsList.push({
+                    contractId: this.id || 0,
+                    dataId: item.purchaseDetailId
+                  })
                 })
-              })
+              }
+            }
+            if (Number(this.contactType) === 2) {
+              if (this.outsourceList) {
+                this.outsourceList.forEach((item) => {
+                  this.dataForm.purPurchaseContractDetailsList.push({
+                    contractId: this.id || 0,
+                    dataId: item.purComDetailId
+                  })
+                })
+              }
             }
             this.$http({
               url: this.$http.adornUrl(`/biz-service/purPurchaseContract/${!this.id ? 'save' : 'update'}`),
@@ -321,17 +496,18 @@ export default {
           this.$nextTick(() => {
             this.$refs.addPurchase.init()
           })
-        } else if (Number(this.dataForm.type) === 2) {}
-        this.addOutsourceVisible = true
-        this.$nextTick(() => {
-          this.$refs.addOutsource.init()
-        })
+        } else if (Number(this.dataForm.type) === 2) {
+          this.addOutsourceVisible = true
+          this.$nextTick(() => {
+            this.$refs.addOutsource.init()
+          })
+        }
       },
       // 删除项目
       deleteItemHandle (recordId) {
-        this.materialList.splice(this.materialList.findIndex((item) => item.recordId === recordId))
+        this.materialList.splice(this.materialList.findIndex((item) => item.recordId === recordId), 1)
       },
-      addItem (item) {
+      addPurchaseItem (item) {
         if (!item.recordId) {
           item.recordId = Math.round(Math.random() * 1000000)
         }
@@ -341,6 +517,16 @@ export default {
           })
         }
       },
+      addOutsourceItem (item) {
+        if (!item.recordId) {
+          item.recordId = Math.round(Math.random() * 1000000)
+        }
+        if (this.outsourceList.findIndex(item1 => item1.recordId === item.recordId) === -1) {
+          this.outsourceList.push({
+            ...item
+          })
+        }
+      },
       // 转换属性“类别”
       formatType (row) {
         if (this.optionsPurchaseType && row.purchaseType) {
@@ -351,15 +537,17 @@ export default {
       addMaterialItems (items) {
         this.materialList = []
         items.forEach((item) => {
-          if (Number(this.dataForm.type) === 1) {
-            this.addItem(item)
-          } else if (Number(this.dataForm.type) === 2) {
-            this.addItem(item)
-          }
+          this.addPurchaseItem(item)
+        })
+      },
+      addOutsourceItems (items) {
+        this.outsourceList = []
+        items.forEach((item) => {
+          this.addOutsourceItem(item)
         })
       },
       typeChanged (type) {
-        this.materialList = []
+        this.contactType = type
       }
     }
   }

+ 215 - 0
src/views/modules/sale/contract-detail.vue

@@ -30,6 +30,221 @@
           </div>
         </e-desc-item>
       </e-desc>
+      <e-desc v-if="Number(dataForm.type) === 1" title="采购物品明细">
+        <el-table
+          border
+          :data="dataForm.purchaseDetailList">
+          <el-table-column
+            label="序号"
+            type="index"
+            width="50"
+            align="center">
+          </el-table-column>
+          <el-table-column
+            prop="procurementCode"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-tooltip-when-overflow="true"
+            label="采购编码">
+          </el-table-column>
+          <el-table-column
+            prop="materialName"
+            header-align="center"
+            align="center"
+            width="160"
+            :show-tooltip-when-overflow="true"
+            label="物品名称">
+          </el-table-column>
+          <el-table-column
+            prop="specification"
+            header-align="center"
+            align="center"
+            width="120"
+            :show-tooltip-when-overflow="true"
+            label="型号及规格">
+          </el-table-column>
+          <el-table-column
+            prop="cnt"
+            header-align="center"
+            align="center"
+            label="数量">
+          </el-table-column>
+          <el-table-column
+            prop="qualifiedCnt"
+            header-align="center"
+            align="center"
+            label="合格数量">
+          </el-table-column>
+          <el-table-column
+            prop="unitName"
+            header-align="center"
+            align="center"
+            min-width="100"
+            :show-tooltip-when-overflow="true"
+            label="单位">
+          </el-table-column>
+          <el-table-column
+            prop="deadline"
+            header-align="center"
+            align="center"
+            min-width="160"
+            :show-tooltip-when-overflow="true"
+            label="采购期限">
+          </el-table-column>
+          <el-table-column
+            prop="arrivedTime"
+            header-align="center"
+            align="center"
+            min-width="160"
+            :show-tooltip-when-overflow="true"
+            label="到料时间">
+          </el-table-column>
+          <el-table-column
+            prop="batchNumber"
+            header-align="center"
+            align="center"
+            min-width="160"
+            :show-tooltip-when-overflow="true"
+            label="批次号/用途">
+          </el-table-column>
+          <el-table-column
+            prop="notes"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-overflow-tooltip="true"
+            label="备注">
+          </el-table-column>
+        </el-table>
+      </e-desc>
+      <e-desc v-if="Number(dataForm.type) === 2" title="委外物品明细">
+        <el-table
+          border
+          :data="dataForm.purCommissionDetailList">
+          <el-table-column
+            label="序号"
+            type="index"
+            width="50"
+            align="center">
+          </el-table-column>
+          <el-table-column
+            prop="purchaseCode"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="采购编码">
+          </el-table-column>
+          <el-table-column
+            prop="productName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="产品名称">
+          </el-table-column>
+          <el-table-column
+            prop="prodCode"
+            header-align="center"
+            align="center"
+            min-width="120"
+            :show-tooltip-when-overflow="true"
+            label="产品编号">
+          </el-table-column>
+          <el-table-column
+            prop="specificationExplian"
+            header-align="center"
+            align="center"
+            min-width="100"
+            :show-tooltip-when-overflow="true"
+            label="型号及规格">
+          </el-table-column>
+          <el-table-column
+            prop="cnt"
+            header-align="center"
+            align="center"
+            label="数量">
+          </el-table-column>
+          <el-table-column
+            prop="qualifiedCnt"
+            header-align="center"
+            align="center"
+            label="合格数量">
+          </el-table-column>
+          <el-table-column
+            prop="unitName"
+            header-align="center"
+            align="center"
+            min-width="100"
+            :show-tooltip-when-overflow="true"
+            label="单位">
+          </el-table-column>
+          <el-table-column
+            prop="deadline"
+            header-align="center"
+            align="center"
+            min-width="160"
+            :show-tooltip-when-overflow="true"
+            label="采购期限">
+          </el-table-column>
+          <el-table-column
+            prop="arrivedTime"
+            header-align="center"
+            align="center"
+            min-width="160"
+            :show-tooltip-when-overflow="true"
+            label="到料时间">
+          </el-table-column>
+          <el-table-column
+            prop="batchNumber"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="批次号/用途">
+          </el-table-column>
+          <el-table-column
+            prop="supplierName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="供应商">
+          </el-table-column><el-table-column
+          prop="applyTime"
+          header-align="center"
+          align="center"
+          min-width="160"
+          :show-tooltip-when-overflow="true"
+          label="申请时间">
+        </el-table-column>
+          <el-table-column
+            prop="applier"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="申请人">
+          </el-table-column>
+          <el-table-column
+            prop="orgName"
+            header-align="center"
+            align="center"
+            min-width="140"
+            :show-tooltip-when-overflow="true"
+            label="申请部门">
+          </el-table-column>
+          <el-table-column
+            prop="notes"
+            header-align="center"
+            align="center"
+            min-width="180"
+            :show-overflow-tooltip="true"
+            label="备注">
+          </el-table-column>
+        </el-table>
+      </e-desc>
     </div>
     <span slot="footer" class="dialog-footer">
       <el-button @click="onChose">返回</el-button>

+ 2 - 2
src/views/modules/sale/outsource-add-or-update.vue

@@ -345,7 +345,7 @@ export default {
       },
       deleteProductHandle (detailId) {
         if (!detailId) return
-        this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId))
+        this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId), 1)
         this.calTotal()
       },
       addProductCallback (data) {
@@ -353,7 +353,7 @@ export default {
         this.addProductVisible = false
         let i = this.productDetails.findIndex((item) => item.detailId === data.detailId)
         if (i > -1) {
-          this.productDetails.splice(i)
+          this.productDetails.splice(i, 1)
         }
         this.productDetails.push(data)
         this.calTotal()

+ 4 - 1
src/views/modules/sale/outsource-detail.vue

@@ -59,6 +59,7 @@
             header-align="center"
             align="center"
             min-width="120"
+            :show-tooltip-when-overflow="true"
             label="产品名称">
           </el-table-column>
           <el-table-column
@@ -66,6 +67,7 @@
             header-align="center"
             align="center"
             min-width="120"
+            :show-tooltip-when-overflow="true"
             label="产品编号">
           </el-table-column>
           <el-table-column
@@ -73,6 +75,7 @@
             header-align="center"
             align="center"
             min-width="120"
+            :show-tooltip-when-overflow="true"
             label="型号及规格">
           </el-table-column>
           <el-table-column
@@ -202,7 +205,7 @@
   import { dealStepData, dealStepLogs } from '@/api/util'
   import { getOutsourceDetailByProId } from '@/api/sale'
   import ApproveComponent from '../common/approve-component'
-  import AttachDetail from '../common/attach-detail'
+  import AttachDetail from '../common/attach-detail-dialog'
   export default {
     name: 'outsource-detail',
     components: {

+ 2 - 2
src/views/modules/sale/purchase-add-or-update.vue

@@ -260,7 +260,7 @@
         })
       },
       deleteMaterialHandle (detailId) {
-        this.materialDetails.splice(this.materialDetails.findIndex((item) => item.detailId === detailId))
+        this.materialDetails.splice(this.materialDetails.findIndex((item) => item.detailId === detailId), 1)
         // this.calTotal()
       },
       addMaterialCallback (data) {
@@ -268,7 +268,7 @@
         this.addMaterialVisible = false
         let i = this.materialDetails.findIndex((item) => item.detailId === data.detailId)
         if (i > -1) {
-          this.materialDetails.splice(i)
+          this.materialDetails.splice(i, 1)
         }
         this.materialDetails.push(data)
         // this.calTotal()