Просмотр исходного кода

采购需求汇总明细行编辑

黄梓星 2 лет назад
Родитель
Сommit
602ef2fd64

+ 8 - 0
src/api/purchase/DemandSummary.js

@@ -59,4 +59,12 @@ export function shutDownSummary(id) {
     url: `/pu/demand/item/summary/shutDown/${id}`,
     method: 'get',
   })
+}
+// 采购需求明细行编辑
+export function editSummaryMx(data) {
+  return request({
+    url: `/pu/demand/item/summary/detail/edit`,
+    method: 'post',
+    data: data
+  })
 }

+ 57 - 6
src/views/purchase/DemandSummary/add.vue

@@ -3,7 +3,8 @@
     <el-card>
       <span>采购需求汇总详情</span>
       <div class="btn_grooup">
-        <el-button type="primary" size="small">编辑</el-button>
+        <el-button type="primary" size="small" @click="editLine">编辑</el-button>
+        <el-button type="success" size="small" v-if="!lineDisable" @click="saveLine">保存</el-button>
         <el-button type="primary" size="small">确定</el-button>
         <el-button type="primary" size="small" @click="closeLine">行关闭</el-button>
         <el-button type="primary" size="small">重取批量</el-button>
@@ -36,8 +37,30 @@
         <el-table-column label="业务备注" align="center" prop="remark"/>
         <el-table-column label="有效期" align="center" prop="expiry"/>
         <el-table-column label="要求交货日期" align="center" prop="deliveryDate"/>
-        <el-table-column label="紧急标识" align="center" prop="isUrgency"/>
-        <el-table-column label="补单标识" align="center" prop="isReplenishment"/>
+        <el-table-column label="紧急标识" align="center" prop="isUrgency">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isUrgency"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column label="补单标识" align="center" prop="isReplenishment">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isReplenishment"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
         <el-table-column label="需求单单号" align="center" prop="code"/>
         <el-table-column label="供应仓库" align="center" prop="lastWarehouseName"/>
         <el-table-column label="供应货位" align="center" prop="lastAllocationName"/>
@@ -59,7 +82,18 @@
         <el-table-column label="最小批量" align="center" prop="minBatch"/>
         <el-table-column label="业务部门" align="center" prop="businessDeptName"/>
         <el-table-column label="需求部门" align="center" prop="demandDeptName"/>
-        <el-table-column label="批号锁定标识" align="center" prop="isBatchLock"/>
+        <el-table-column label="批号锁定标识" align="center" prop="isBatchLock">
+          <template slot-scope="scope">
+            <el-switch
+              v-model="scope.row.isBatchLock"
+              :disabled="lineDisable"
+              active-value="Y"
+              inactive-value="N"
+              active-color="#13ce66"
+              inactive-color="#a1a3a9">
+            </el-switch>
+          </template>
+        </el-table-column>
         <el-table-column label="采购需求单审批人" align="center" prop="approveName"/>
         <el-table-column label="需求单审批时间" align="center" prop="approverFinishTime"/>
         <el-table-column label="需求单提交时间" align="center" prop="createTime"/>
@@ -83,7 +117,7 @@
 </template>
 
 <script>
-import {getSummaryDetail, shutDownSummary } from '@/api/purchase/DemandSummary.js'
+import {getSummaryDetail, shutDownSummary, editSummaryMx } from '@/api/purchase/DemandSummary.js'
 export default {
   name: 'checkDemandSummary',
   props: ['pageStu','row', 'disable'],
@@ -93,8 +127,12 @@ export default {
   },
   data() {
     return{
+      // 不能直接改变props传来的值
+      sonPageStu: this.pageStu,
+      sonDisable: this.disable,
       tableList: [],
-      ids: []
+      ids: [],
+      lineDisable: true,
     }
   },
   created() {
@@ -127,6 +165,19 @@ export default {
         }
       })
     },
+    editLine() {
+      console.log('sonList`````', this.tableList)
+      this.lineDisable = false
+    },
+    saveLine() {
+      editSummaryMx(this.tableList).then(res => {
+        if (res.code === 200) {
+          this.$modal.msgSuccess("保存成功");
+          this.lineDisable = true
+          this.getDetails(this.row)
+        }
+      })
+    },
     // 行关闭
     closeLine() {
       if (this.ids.length == 0) {

+ 1 - 1
src/views/purchase/DemandSummary/index.vue

@@ -240,7 +240,7 @@
       <el-card>
         <div class="btn_grooup">
           <el-button type="primary" size="small" @click="editList">编辑</el-button>
-          <el-button type="primary" size="small" @click="saveList">保存</el-button>
+          <el-button type="success" size="small" v-if="!lineDisable" @click="saveList">保存</el-button>
           <el-button type="primary" size="small" @click="confirms">确认</el-button>
           <el-button type="primary" size="small" @click="cancels">取消</el-button>
           <el-button type="primary" size="small" @click="audits">审核</el-button>