فهرست منبع

样品管理提交

yijing 1 سال پیش
والد
کامیت
b4d560e589
2فایلهای تغییر یافته به همراه114 افزوده شده و 63 حذف شده
  1. 11 2
      src/api/samplemanagement/index.js
  2. 103 61
      src/views/samplemanagement/components/edit.vue

+ 11 - 2
src/api/samplemanagement/index.js

@@ -12,7 +12,7 @@ export async function getList(data) {
 // 列表
 export async function getSampleQWorkOrderIdPage(data) {
   let par = new URLSearchParams(data);
-  const res = await request.get(`/qms/sample/getSampleQWorkOrderId?`+ par, {});
+  const res = await request.get(`/qms/sample/getSampleQWorkOrderId?` + par, {});
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -21,9 +21,18 @@ export async function getSampleQWorkOrderIdPage(data) {
 // 详情页面
 
 export async function getById(id) {
-  const res = await request.get(`/qms/sample/getById/`+id, {});
+  const res = await request.get(`/qms/sample/getById/` + id, {});
   if (res.data.code == 0) {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+export async function disposeSubmit(data) {
+  const res = await request.post(`/qms/sample/dispose`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 103 - 61
src/views/samplemanagement/components/edit.vue

@@ -4,39 +4,40 @@
     <el-card shadow="never">
       <header-title>
         <el-button @click="cancel">返回</el-button>
-        <el-button type="primary" @click="submit" :loading="loading" >提交</el-button>
+        <el-button type="primary" @click="submit" :loading="loading">提交</el-button>
       </header-title>
-    <base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType" ></base-info>
-    <ele-pro-table ref="table" :columns="tableColumns" :datasource="datasource" :pageSize="20"  :pageSizes="[20, 30, 40, 50, 100]">
-      <!-- 表头工具栏 -->
-      <template v-slot:toolbar>
-      </template>
-      <template v-slot:categoryCode="{ row }">
-        <el-link type="primary" :underline="false">
-          {{ row.categoryCode }}
-        </el-link>
-      </template>
-      <!-- 操作列 -->
-      <template v-slot:action="{ row }">
-        <el-link type="primary" :underline="false" @click="handleDispose(row, 'dispose')">
-          处置
-        </el-link>
-      </template>
-    </ele-pro-table>
+      <base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType"></base-info>
+      <ele-pro-table ref="table" :columns="tableColumns" :datasource="datasource" :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]">
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+        </template>
+        <template v-slot:categoryCode="{ row }">
+          <el-link type="primary" :underline="false">
+            {{ row.categoryCode }}
+          </el-link>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" @click="handleDispose(row, 'dispose')">
+            处置
+          </el-link>
+        </template>
+      </ele-pro-table>
 
-<!--    <template v-slot:footer>-->
-<!--      <el-button @click="handleClose">取消</el-button>-->
-<!--    </template>-->
-<!--  </ele-modal>-->
+      <!--    <template v-slot:footer>-->
+      <!--      <el-button @click="handleClose">取消</el-button>-->
+      <!--    </template>-->
+      <!--  </ele-modal>-->
     </el-card>
     <sampleDisposeDialog ref="disposeRef" @handleDisposeConfirm="handleDisposeConfirm"></sampleDisposeDialog>
   </div>
 </template>
 
 <script>
-import {getSampleQWorkOrderIdPage,getById} from "@/api/samplemanagement";
+import { getSampleQWorkOrderIdPage, getById, disposeSubmit } from "@/api/samplemanagement";
 import baseInfo from './baseInfo.vue';
-import {finishPageTab} from "@/utils/page-tab-util";
+import { finishPageTab } from "@/utils/page-tab-util";
 import sampleDisposeDialog from '@/views/inspectionWork/components/sampleDisposeDialog.vue';
 
 export default {
@@ -60,39 +61,46 @@ export default {
       qualityWorkOrderId: '',
       qualitySampleList: [],
       tableColumns: [
-        { label: '编码',prop: 'categoryCode', width: '150',align: 'center',showOverflowTooltip: true,slot: 'categoryCode'},
-        {label: '名称',prop: 'categoryName',width: '150',align: 'center',showOverflowTooltip: true},
-        { label: '批次号22222', prop: 'batchNo', align: 'center' ,showOverflowTooltip: true},
-        { label: '发货条码', prop: 'barcodes', align: 'center' ,showOverflowTooltip: true},
-        { label: '包装编码', prop: 'packageNo', align: 'center' ,showOverflowTooltip: true},
-        { label: '包装数量', prop: 'packingQuantity', align: 'center' ,showOverflowTooltip: true},
-        { label: '包装单位', prop: 'packingUnit', align: 'center' ,showOverflowTooltip: true},
-        { label: '计量数量', prop: 'measureQuantity', align: 'center' ,showOverflowTooltip: true},
-        { label: '计量单位', prop: 'measureUnit', align: 'center' ,showOverflowTooltip: true},
-        { label: '物料代号', prop: 'materielDesignation', align: 'center' ,showOverflowTooltip: true},
-        { label: '客户代号', prop: 'clientCode', align: 'center' ,showOverflowTooltip: true},
-        { label: '刻码', prop: 'engrave', align: 'center' ,showOverflowTooltip: true},
-        { label: '仓库', prop: 'warehouseName', align: 'center' ,showOverflowTooltip: true},
-        { label: '货区', prop: 'areaName', align: 'center' ,showOverflowTooltip: true},
-        { label: '货架', prop: 'goodsShelfName', align: 'center' ,showOverflowTooltip: true},
-        { label: '货位', prop: 'goodsAllocationName', align: 'center' ,showOverflowTooltip: true},
-        { label: '生产日期', prop: 'productionDate', align: 'center' ,showOverflowTooltip: true},
-        { label: '采购日期', prop: 'purchaseDate', align: 'center' ,showOverflowTooltip: true},
-        { label: '重量', prop: 'weight', align: 'center' ,showOverflowTooltip: true,fixed: 'right'},
-        { label: '重量单位', prop: 'weightUnit', align: 'center' ,showOverflowTooltip: true,fixed: 'right'},
-        { label: '处置状态', prop: 'disposalStatus', align: 'center' ,showOverflowTooltip: true,fixed: 'right',formatter: (row, column, cellValue) => {
-            return cellValue == 1 ? '返工' : cellValue == 2 ? '返修' : cellValue == 3? '报废' : cellValue == 4? '降级使用' :
-              cellValue == 5? '让步接收' : cellValue == 6? '留样' : cellValue == 7? '消耗' : cellValue == 8? '回用' : '';
-          }},
-        { label: '处置时间', prop: 'disposeTime', align: 'center' ,showOverflowTooltip: true,fixed: 'right'},
-        { label: '质检状态', prop: 'qualityStatus', align: 'center' ,showOverflowTooltip: true,fixed: 'right',formatter: (row, column, cellValue) => {
-            return cellValue == 0? '未检' : cellValue == 1? '已检' : cellValue == 2? '待检' : '';
-          }},
-        { label: '质检结果', prop: 'qualityResults', align: 'center' ,showOverflowTooltip: true,fixed: 'right',formatter: (row, column, cellValue) => {
+        { label: '编码', prop: 'categoryCode', width: '150', align: 'center', showOverflowTooltip: true, slot: 'categoryCode' },
+        { label: '名称', prop: 'categoryName', width: '150', align: 'center', showOverflowTooltip: true },
+        { label: '批次号22222', prop: 'batchNo', align: 'center', showOverflowTooltip: true },
+        { label: '发货条码', prop: 'barcodes', align: 'center', showOverflowTooltip: true },
+        { label: '包装编码', prop: 'packageNo', align: 'center', showOverflowTooltip: true },
+        { label: '包装数量', prop: 'packingQuantity', align: 'center', showOverflowTooltip: true },
+        { label: '包装单位', prop: 'packingUnit', align: 'center', showOverflowTooltip: true },
+        { label: '计量数量', prop: 'measureQuantity', align: 'center', showOverflowTooltip: true },
+        { label: '计量单位', prop: 'measureUnit', align: 'center', showOverflowTooltip: true },
+        { label: '物料代号', prop: 'materielDesignation', align: 'center', showOverflowTooltip: true },
+        { label: '客户代号', prop: 'clientCode', align: 'center', showOverflowTooltip: true },
+        { label: '刻码', prop: 'engrave', align: 'center', showOverflowTooltip: true },
+        { label: '仓库', prop: 'warehouseName', align: 'center', showOverflowTooltip: true },
+        { label: '货区', prop: 'areaName', align: 'center', showOverflowTooltip: true },
+        { label: '货架', prop: 'goodsShelfName', align: 'center', showOverflowTooltip: true },
+        { label: '货位', prop: 'goodsAllocationName', align: 'center', showOverflowTooltip: true },
+        { label: '生产日期', prop: 'productionDate', align: 'center', showOverflowTooltip: true },
+        { label: '采购日期', prop: 'purchaseDate', align: 'center', showOverflowTooltip: true },
+        { label: '重量', prop: 'weight', align: 'center', showOverflowTooltip: true, fixed: 'right' },
+        { label: '重量单位', prop: 'weightUnit', align: 'center', showOverflowTooltip: true, fixed: 'right' },
+        {
+          label: '处置状态', prop: 'disposalStatus', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
+            return cellValue == 1 ? '返工' : cellValue == 2 ? '返修' : cellValue == 3 ? '报废' : cellValue == 4 ? '降级使用' :
+              cellValue == 5 ? '让步接收' : cellValue == 6 ? '留样' : cellValue == 7 ? '消耗' : cellValue == 8 ? '回用' : '';
+          }
+        },
+        { label: '处置时间', prop: 'disposeTime', align: 'center', showOverflowTooltip: true, fixed: 'right' },
+        {
+          label: '质检状态', prop: 'qualityStatus', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
+            return cellValue == 0 ? '未检' : cellValue == 1 ? '已检' : cellValue == 2 ? '待检' : '';
+          }
+        },
+        {
+          label: '质检结果', prop: 'qualityResults', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
             return cellValue == 1 ? '合格' : cellValue == 2 ? '不合格' : '';
-          }},
-        {columnKey: 'action',label: '操作',align: 'center',width: 120,resizable: false,slot: 'action',fixed: 'right'}
+          }
+        },
+        { columnKey: 'action', label: '操作', align: 'center', width: 120, resizable: false, slot: 'action', fixed: 'right' }
       ],
+      tableData: []
     };
   },
   computed: {
@@ -106,13 +114,16 @@ export default {
     }
   },
   methods: {
-    datasource({page, where, limit}) {
+    async datasource({ page, where, limit }) {
       where.qualityWorkOrderId = this.$route.query.qualityWorkOrderId;
-     return getSampleQWorkOrderIdPage({
+      const arr = await getSampleQWorkOrderIdPage({
         ...where,
         pageNum: page,
         size: limit
       });
+      this.tableData = arr.list;
+      console.log(arr, 'arr')
+      return arr.list;
     },
     async getDetail() {
       this.visible = true;
@@ -125,7 +136,7 @@ export default {
     },
     async open(type, row) {
       this.btnType = type;
-      this.title =type == 'add'? '新增': type == 'edit'? '编辑': '详情';
+      this.title = type == 'add' ? '新增' : type == 'edit' ? '编辑' : '详情';
       if (this.btnType != 'add') {
         this.qualityWorkOrderId = row.qualityWorkOrderId;
         this.baseForm = JSON.parse(JSON.stringify(row));
@@ -144,10 +155,41 @@ export default {
       finishPageTab();
       this.$router.go(-1);
     },
-    submit() {
-      this.loading = false;
+    async submit() {
+      console.log(this.tableData, '表格');
+
+      for (let i = 0; i < this.tableData.length; i++) {
+        const disposalStatus = this.tableData[i].disposalStatus;
+        const disposeTime = this.tableData[i].disposeTime;
+        const qualityStatus = this.tableData[i].qualityStatus;
+        if (disposalStatus == null || disposeTime == null) {
+          this.$message.error('请完善处置状态和处置时间!')
+          this.loading = false;
+          return
+        }
+        if (qualityStatus == '2') {
+          this.$message.error('请完善质检状态!')
+          this.loading = false;
+          return
+        }
+      }
+      this.loading = true;
+      let pData = {
+        ...form,
+        qualitySampleUpdatePOList: this.tableData,
+      }
+      disposeSubmit(pData)
+        .then((msg) => {
+          this.loading = false;
+          this.$message.success(msg);
+          this.cancel();
+          this.$emit('done');
+        })
+        .catch((e) => {
+          this.loading = false;
+        });
     },
-    handleDispose( row, type) {
+    handleDispose(row, type) {
 
       row.sampleDate = this.getNowTimes();