浏览代码

采购合同修改

chris 2 年之前
父节点
当前提交
f67aaeb975

+ 203 - 0
src/views/modules/purchase/purchase-chose.vue

@@ -0,0 +1,203 @@
+<template>
+  <div>
+    <el-dialog
+      title="选择采购物品"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+      <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
+        <el-form-item label="物品名称">
+          <el-input v-model="dataForm.materialName" placeholder="物品名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="search()">查询</el-button>
+          <el-button type="primary" @click="addItems()">添加</el-button>
+  <!--          <el-button @click="visible = false" type="primary">返回</el-button>-->
+        </el-form-item>
+      </el-form>
+      <el-table
+        :data="dataList"
+        border
+        v-loading="dataListLoading"
+        @selection-change="selectionChangeHandle"
+        style="width: 100%;">
+        <el-table-column
+          type="selection">
+        </el-table-column>
+        <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>
+      <el-pagination
+        @size-change="sizeChangeHandle"
+        @current-change="currentChangeHandle"
+        :current-page="pageIndex"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="pageSize"
+        :total="totalPage"
+        layout="total, sizes, prev, pager, next, jumper">
+      </el-pagination>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'purchase-chose',
+    data () {
+      return {
+        visible: false,
+        dataForm: {},
+        dataList: [],
+        pageIndex: 1,
+        pageSize: 10,
+        totalPage: 0,
+        dataListLoading: false,
+        dataListSelections: []
+      }
+    },
+    methods: {
+      init () {
+        this.visible = true
+        this.getDataList()
+      },
+      search () {
+        this.pageIndex = 1
+        this.getDataList()
+      },
+      // 获取数据列表
+      getDataList () {
+        this.dataListLoading = true
+        this.$http({
+          url: this.$http.adornUrl('/biz-service/purchaseDetail/list'),
+          method: 'get',
+          params: this.$http.adornParams({
+            'current': this.pageIndex,
+            'size': this.pageSize,
+            'materialName': this.dataForm.materialName ? this.dataForm.name : null,
+            'purchaseState': 3
+          })
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataList = data.data.records
+            this.totalPage = Number(data.data.total)
+          } else {
+            this.dataList = []
+            this.totalPage = 0
+          }
+          this.dataListLoading = false
+        })
+      },
+      // 每页数
+      sizeChangeHandle (val) {
+        this.pageSize = val
+        this.pageIndex = 1
+        this.getDataList()
+      },
+      // 当前页
+      currentChangeHandle (val) {
+        this.pageIndex = val
+        this.getDataList()
+      },
+      // 多选
+      selectionChangeHandle (val) {
+        this.dataListSelections = val
+      },
+      // 添加
+      exportItem (item) {
+        this.$emit('addItem', item)
+      },
+      addItems () {
+        if (this.dataListSelections.length === 0) {
+          this.$message.warning('请选择物品')
+          return
+        }
+        this.visible = false
+        this.$emit('addItems', this.dataListSelections)
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

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

@@ -60,11 +60,116 @@
           <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">
+            <div class="title"><span style="color: red">*</span> 采购物品明细</div>
+            <el-table
+              :data="materialList"
+              border
+              style="width: 100%;">
+              <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-column
+                fixed="right"
+                header-align="center"
+                align="center"
+                width="100"
+                label="操作">
+                <template slot-scope="scope">
+                  <el-button type="text" size="small" @click="updateItemHandle(scope.row)">编辑</el-button>
+                  <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"/>
     </div>
 </template>
 
@@ -72,12 +177,14 @@
   import UploadComponent from '../common/upload-component'
   import { getContractDetail } from '@/api/sale'
   import SupplierComponent from '../common/supplier-component'
+  import AddPurchase from '../purchase/purchase-chose'
 
 export default {
     name: 'contract-add-or-update',
     components: {
       SupplierComponent,
-      UploadComponent
+      UploadComponent,
+      AddPurchase
     },
     computed: {
       orgId: {
@@ -87,7 +194,10 @@ export default {
     data () {
       return {
         id: 0,
+        addPurchaseVisible: false,
         dataForm: {},
+        materialList: [],
+        optionsPurchaseType: [],
         dataRule: {
           type: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
           contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
@@ -109,7 +219,8 @@ export default {
       onChose () {
         this.$emit('onChose')
       },
-      async init (id) {
+      async init (id, optionsType) {
+        this.optionsPurchaseType = optionsType
         this.fileList = []
         this.dataForm = {}
         this.id = id || 0
@@ -156,6 +267,16 @@ export default {
               return
             }
             // 产品明细
+            // 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
+                })
+              })
+            }
             this.$http({
               url: this.$http.adornUrl(`/biz-service/purPurchaseContract/${!this.id ? 'save' : 'update'}`),
               method: 'post',
@@ -177,6 +298,51 @@ export default {
             })
           }
         })
+      },
+      // 新增项目
+      addItemHandle () {
+        if (Number(this.dataForm.type) === 1) {
+          this.addPurchaseVisible = true
+          this.$nextTick(() => {
+            this.$refs.addPurchase.init()
+          })
+        }
+      },
+      // 编辑项目
+      updateItemHandle (row) {
+        if (Number(this.dataForm.type) === 1) {
+          this.productListVisible = true
+          this.$nextTick(() => {
+            this.$refs.addPurchase.init(row)
+          })
+        }
+      },
+      // 删除项目
+      deleteItemHandle (recordId) {
+        this.materialList.splice(this.materialList.findIndex((item) => item.recordId === recordId))
+      },
+      addItem (item) {
+        if (!item.recordId) {
+          item.recordId = Math.round(Math.random() * 1000000)
+        }
+        if (this.materialList.findIndex(item1 => item1.recordId === item.recordId) === -1) {
+          this.materialList.push({
+            ...item
+          })
+        }
+      },
+      // 转换属性“类别”
+      formatType (row) {
+        if (this.optionsPurchaseType && row.purchaseType) {
+          const item1 = this.optionsPurchaseType.find((item) => item.code === row.purchaseType.toString())
+          return item1 ? item1.value : ''
+        }
+      },
+      addMaterialItems (items) {
+        this.materialList = []
+        items.forEach((item) => {
+          this.addItem(item)
+        })
       }
     }
   }

+ 2 - 2
src/views/modules/sale/contract.vue

@@ -63,8 +63,8 @@
           prop="deliveryTime"
           header-align="center"
           align="center"
-          min-width="140"
-          :show-overflow-tooltip="true"
+          width="160"
+          :show-tooltip-when-overflow="true"
           label="合同交期">
         </el-table-column>
         <el-table-column

+ 4 - 4
src/views/modules/sale/purchase.vue

@@ -44,7 +44,7 @@
         </el-form-item>
         <el-form-item>
           <el-button @click="search()">查询</el-button>
-          <el-button v-if="isAuth('purchase:detail:save')" type="primary" @click="addOrUpdateHandle(0, false)">新建采购申请</el-button>
+          <el-button v-if="isAuth('purchase:detail:save')" type="primary" @click="addOrUpdateHandle(0)">新建采购申请</el-button>
           <el-button v-if="isAuth('purchase:detail:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">工作提示通知设置</el-button>
         </el-form-item>
       </el-form>
@@ -207,7 +207,7 @@
           label="操作">
           <template slot-scope="scope">
             <el-button v-if="isAuth('purchase:detail:info')" type="text" size="small" @click="detailHandle(scope.row.procurementId)">查看</el-button>
-            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 1)" type="text" size="small" @click="addOrUpdateHandle(scope.row.procurementId, false)">编辑</el-button>
+            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 1)" type="text" size="small" @click="addOrUpdateHandle(scope.row.procurementId)">编辑</el-button>
             <el-button v-if="isAuth('purchase:detail:updatePurchaseDetail') && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="operateHandle(scope.row)">采购</el-button>
             <el-button v-if="isAuth('purchase:detail:infoPutIn') && (Number(scope.row.approvalState) === 3  && Number(scope.row.purchaseState) > 1)" type="text" size="small" @click="inboundHandle(scope.row)">入库</el-button>
             <el-button v-if="isAuth('purchase:detail:infoPutInAgain') && (Number(scope.row.purchaseState) === 5)" type="text" size="small" @click="inboundHandle(scope.row.procurementId)">再次入库</el-button>
@@ -367,10 +367,10 @@
         this.dataListSelections = val
       },
       // 新增 / 修改
-      addOrUpdateHandle (id, disable) {
+      addOrUpdateHandle (id) {
         this.addOrUpdateVisible = true
         this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id, disable)
+          this.$refs.addOrUpdate.init(id, this.optionsType)
         })
       },
       // 转换属性“类别”