695593266@qq.com 11 miesięcy temu
rodzic
commit
6f47e20080

+ 34 - 3
src/api/samplemanagement/index.js

@@ -9,6 +9,16 @@ export async function getList(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//保存
+export async function saveData(data) {
+  const res = await request.post(`/qms/sample/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 列表
 export async function getSampleQWorkOrderIdPage(data) {
   let par = new URLSearchParams(data);
@@ -28,7 +38,6 @@ export async function getById(id) {
   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) {
@@ -37,11 +46,13 @@ export async function disposeSubmit(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 列表
 export async function getSampleSmallWhole(data) {
   let par = new URLSearchParams(data);
-  const res = await request.get(`/qms/qualitysample/getSampleSmallWhole?` + par, {});
+  const res = await request.get(
+    `/qms/qualitysample/getSampleSmallWhole?` + par,
+    {}
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -56,3 +67,23 @@ export async function getQualitySampleList(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//删除
+export async function removeItem(data) {
+  const res = await request.delete('/qms/sample/delete', {
+    data
+  });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//修改
+export async function updateData(data) {
+  const res = await request.put('/qms/sample/update', data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 88 - 83
src/utils/request.js

@@ -1,86 +1,91 @@
 /**
  * axios 实例
  */
- import axios from 'axios';
- import router from '@/router';
- import store from '@/store';
- import { MessageBox, Message } from 'element-ui';
- import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
- import { getToken, setToken } from './token-util';
- import { logout } from './page-tab-util';
- import JSONBIG from 'json-bigint';
- const service = axios.create({
-   baseURL: API_BASE_URL,
-   transformResponse: [
-     function (data) {
-       if (data instanceof Blob) {
-         return data;
-       }
-       const json = JSONBIG({
-         storeAsString: true
-       });
-       const res = json.parse(data);
-       return res;
-     }
-   ]
- });
- /**
-  * 添加请求拦截器
-  */
- service.interceptors.request.use(
-   (config) => {
-     // 添加 token 到 header
-     const token = getToken();
-     if (token && config.headers) {
-       config.headers.common[TOKEN_HEADER_NAME] = token;
-     }
- 
-     return config;
-   },
-   (error) => {
-     return Promise.reject(error);
-   }
- );
- 
- /**
-  * 添加响应拦截器
-  */
- service.interceptors.response.use(
-   (res) => {
-     // token 自动续期
-     if (res.data.code == '-1' && res.config?.showErrorToast !== false&&res.data.message) {
-       Message.error(res.data.message);
-     }
-     const token = res.headers[TOKEN_HEADER_NAME.toLowerCase()];
-     if (token) {
-       setToken(token);
-     }
-     return res;
-   },
-   (error) => {
-     // 登录过期处理
-     if (error?.response?.status === 401) {
-       const currentPath = router.currentRoute.path;
-       if (currentPath === LAYOUT_PATH) {
-         logout(true);
-       } else {
-         MessageBox.alert('登录状态已过期, 请退出重新登录!', '系统提示', {
-           confirmButtonText: '重新登录',
-           callback: (action) => {
-             if (action === 'confirm') {
-               logout(false, currentPath);
-             }
-           },
-           beforeClose: () => {
-             MessageBox.close();
-           }
-         });
-       }
-       return Promise.reject(new Error(error.response.data?.message));
-     }
-     return Promise.reject(error);
-   }
- );
- 
- export default service;
- 
+import axios from 'axios';
+import router from '@/router';
+import store from '@/store';
+import { MessageBox, Message } from 'element-ui';
+import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
+import { getToken, setToken } from './token-util';
+import { logout } from './page-tab-util';
+import JSONBIG from 'json-bigint';
+const service = axios.create({
+  baseURL: API_BASE_URL,
+  transformResponse: [
+    function (data) {
+      if (data instanceof Blob) {
+        return data;
+      }
+      const json = JSONBIG({
+        storeAsString: true
+      });
+      const res = json.parse(data);
+      return res;
+    }
+  ]
+});
+/**
+ * 添加请求拦截器
+ */
+service.interceptors.request.use(
+  (config) => {
+    // 添加 token 到 header
+    const token = getToken();
+    if (token && config.headers) {
+      config.headers.common[TOKEN_HEADER_NAME] = token;
+    }
+
+    return config;
+  },
+  (error) => {
+    return Promise.reject(error);
+  }
+);
+
+/**
+ * 添加响应拦截器
+ */
+service.interceptors.response.use(
+  (res) => {
+    // token 自动续期
+    if (
+      res.data.code == '-1' &&
+      res.config?.showErrorToast !== false &&
+      res.data.message
+    ) {
+      Message.error(res.data.message);
+    }
+    const token = res.headers[TOKEN_HEADER_NAME.toLowerCase()];
+    if (token) {
+      setToken(token);
+    }
+    return res;
+  },
+  (error) => {
+    // 登录过期处理
+    if (error?.response?.status === 401) {
+      const currentPath = router.currentRoute.path;
+      if (currentPath === LAYOUT_PATH) {
+        logout(true);
+      } else {
+        MessageBox.alert('登录状态已过期, 请退出重新登录!', '系统提示', {
+          confirmButtonText: '重新登录',
+          callback: (action) => {
+            if (action === 'confirm') {
+              logout(false, currentPath);
+            }
+          },
+          beforeClose: () => {
+            MessageBox.close();
+          }
+        });
+      }
+      return Promise.reject(new Error(error.response.data?.message));
+    } else if (!error?.response?.status) {
+      Message.error('服务器调用失败,请联系管理人员!');
+    }
+    return Promise.reject(error);
+  }
+);
+
+export default service;

+ 1 - 1
src/views/inspectionPlan/components/new-edit.vue

@@ -2112,7 +2112,7 @@
           const sampleListData =
             this.btnType == 'add'
               ? this.sampleList
-              : this.btnType == 'issued' && this.isSampleList
+              : this.btnType == 'edit' && this.isSampleList
               ? this.newSampleList
               : this.sampleList;
 

+ 11 - 3
src/views/inspectionWork/components/QualityContentTabs.vue

@@ -426,7 +426,10 @@
       loading: Boolean,
       form: Object,
       ids: String,
-      activeName: String
+      activeName: {
+        type: String,
+        default: '1'
+      }
     },
     data() {
       return {
@@ -678,8 +681,13 @@
     },
     methods: {
       async datasource({ page, limit, where }) {
-        const res = await queryQualityInventory({ ...where, page, limit });
-        return res;
+        console.log(11111111);
+        // const res = await queryQualityInventory({
+        //   ...where,
+        //   pageNum: page,
+        //   size: limit
+        // });
+        // return res;
       },
 
       reload(where) {

+ 34 - 34
src/views/inspectionWork/components/baseInfo.vue

@@ -393,41 +393,41 @@
       }
     },
     watch: {
-      'form.qualityMode': {
-        handler(newVal) {
-          if (newVal) {
-            this.$emit('changeModel', newVal);
-          } else {
-            console.log('清空样品清单');
-            // this.$emit('table2');
-          }
-        },
-        immediate: false
-      },
-      'form.inspectionStandards': {
-        handler(newVal) {
-          if (newVal && this.qualityType1 == 2) {
-            this.$emit('changeInspectionStandardsModel', newVal);
-          } else {
-            console.log('清空样品清单');
-            // this.$emit('table2');
-          }
-        },
-        immediate: false
-      },
+      // 'form.qualityMode': {
+      //   handler(newVal) {
+      //     if (newVal) {
+      //       this.$emit('changeModel', newVal);
+      //     } else {
+      //       console.log('清空样品清单');
+      //       // this.$emit('table2');
+      //     }
+      //   },
+      //   immediate: false
+      // },
+      // 'form.inspectionStandards': {
+      //   handler(newVal) {
+      //     if (newVal && this.qualityType1 == 2) {
+      //       this.$emit('changeInspectionStandardsModel', newVal);
+      //     } else {
+      //       console.log('清空样品清单');
+      //       // this.$emit('table2');
+      //     }
+      //   },
+      //   immediate: false
+      // },
       // 新增 *** 监听合格率更改 质检结果
-      'form.qualificationRate': {
-        handler(newVal) {
-          // if (newVal == '100.00%' || newVal == '100%' || newVal == '100.0%') {
-          //   this.$set(this.form, 'qualityResults', 1);
-          // } else {
-          //   this.$set(this.form, 'qualityResults', 2);
-          //   // this.$emit('table2');
-          // }
-        },
-        immediate: false,
-        deep: true
-      }
+      // 'form.qualificationRate': {
+      //   handler(newVal) {
+      // if (newVal == '100.00%' || newVal == '100%' || newVal == '100.0%') {
+      //   this.$set(this.form, 'qualityResults', 1);
+      // } else {
+      //   this.$set(this.form, 'qualityResults', 2);
+      //   // this.$emit('table2');
+      // }
+      //   },
+      //   immediate: false,
+      //   deep: true
+      // }
     },
     data() {
       return {

+ 5 - 1
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -673,7 +673,11 @@
     },
     methods: {
       async datasource({ page, limit, where }) {
-        const res = await queryQualityInventory({ ...where, page, limit });
+        const res = await queryQualityInventory({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
         return res;
       },
 

+ 6 - 1
src/views/inspectionWork/edit.vue

@@ -151,7 +151,7 @@
         sampleList: [],
         schemeList: [],
         inventoryList: [],
-        activeName: null,
+        activeName: '1',
 
         isValid: true,
         isStatus: true,
@@ -596,6 +596,7 @@
           } else if (this.isWeightStandardFullSample()) {
             //抽检取计重取整样
             if (!this.validateSampleCount(sampleCount)) return;
+
             await this.handleWeightFullSample(sampleCount);
           }
           this.activeName = '2';
@@ -1149,6 +1150,10 @@
           }
         }
         this.sampleList = result;
+        if (this.sampleList.length > sampleCount) {
+          this.sampleList = this.sampleList.splice(0, sampleCount);
+        }
+
         this.form.sampleNumber = this.sampleList.length;
       },
       validateWeight(measureQ, sampleCount) {

+ 62 - 2
src/views/sample/samplemanagement/components/addOrEditSample.vue

@@ -87,6 +87,7 @@
   import dictMixins from '@/mixins/dictMixins';
   import sampleTable from './sampleTable.vue';
   import { getCode } from '@/api/login';
+  import { saveData, updateData } from '@/api/samplemanagement';
   export default {
     components: {
       sampleTable
@@ -121,7 +122,8 @@
             { required: true, message: '请选择商品分类', trigger: 'change' }
           ]
         },
-        dataList: []
+        dataList: [],
+        sampleType: ''
       };
     },
 
@@ -134,6 +136,11 @@
           type === 'add' ? '新增' : type === 'view' ? '详情' : '修改';
         this.type = type;
         this.visible = true;
+        this.sampleType = type;
+
+        console.log(row, 'row');
+
+        this.dataList = [...row];
         // if (type == 'add') {
         //   this.isUpdate = false;
         // } else {
@@ -148,7 +155,34 @@
         this.$refs[formName].validate((valid) => {
           if (valid) {
             if (this.dataList.length > 0) {
-              
+              let params = {
+                ...this.form,
+                sampleVOList: this.dataList
+              };
+
+              if (this.sampleType == 'add') {
+                saveData(params)
+                  .then((msg) => {
+                    this.loading = false;
+                    this.$message.success(msg);
+                    this.handleClose();
+                    this.$emit('done');
+                  })
+                  .catch((e) => {
+                    this.loading = false;
+                  });
+              } else {
+                updateData(params)
+                  .then((msg) => {
+                    this.loading = false;
+                    this.$message.success(msg);
+                    this.handleClose();
+                    this.$emit('done');
+                  })
+                  .catch((e) => {
+                    this.loading = false;
+                  });
+              }
             }
           } else {
             console.log('error submit!!');
@@ -160,6 +194,7 @@
         // console.log(data.code);
 
         const newData = {};
+        this.dataList = [];
         data.sampleCode = await this.getSampleCode();
 
         console.log(data.sampleCode);
@@ -172,6 +207,8 @@
         newData.measureUnit = data.measuringUnit;
         newData.weightUnit = data.weightUnit;
         newData.weight = data.netWeight;
+        newData.specification = data.specification;
+        newData.modelType = data.modelType;
 
         this.dataList.push(newData);
 
@@ -191,6 +228,29 @@
       },
       async getSampleCode() {
         return await getCode('sample_code');
+      },
+
+      handleClose() {
+        this.$nextTick(() => {
+          this.resetForm();
+          this.resetTable();
+        });
+      },
+
+      resetTable() {
+        this.dataList = [];
+      },
+      resetForm() {
+        // this.form= {
+        //   pricingWay: [],
+        //   conditionType: '',
+        //   categoryCode: ''
+        // },
+        this.form = {
+          pricingWay: [],
+          conditionType: '',
+          categoryCode: ''
+        };
       }
     }
   };

+ 58 - 16
src/views/sample/samplemanagement/components/sampleTable.vue

@@ -79,25 +79,67 @@
             width: '150',
             align: 'center'
           },
-          { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
-          { label: '发货条码', prop: 'barcodes', align: 'center' },
-          { label: '包装编码', prop: 'packageNo', align: 'center' },
-          { label: '计量数量', prop: 'measureQuantity', align: 'center' },
-          { label: '计量单位', prop: 'measureUnit', align: 'center' },
-          { label: '物料代号', prop: 'materielDesignation', align: 'center' },
-          { label: '客户代号', prop: 'clientCode', align: 'center' },
-          { label: '刻码', prop: 'engrave', align: 'center' },
+          {
+            label: '规格',
+            prop: 'specification',
+            width: '150',
+            align: 'center'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum',
+            width: '150',
+            align: 'center'
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'disposeTime',
+            label: '处置时间',
+            align: 'center',
+            width: '180'
+          }
+          // { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
+          // { label: '发货条码', prop: 'barcodes', align: 'center' },
+          // { label: '包装编码', prop: 'packageNo', align: 'center' },
+          // { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+          // { label: '计量单位', prop: 'measureUnit', align: 'center' },
+          // { label: '物料代号', prop: 'materielDesignation', align: 'center' },
+          // { label: '客户代号', prop: 'clientCode', align: 'center' },
+          // { label: '刻码', prop: 'engrave', align: 'center' },
           // { prop: 'specification', label: '规格', align: 'center', width: 100, showOverflowTooltip: true },
           // { prop: 'brandNum', label: '牌号', align: 'center', width: 100, showOverflowTooltip: true },
           // { prop: 'modelType', label: '型号', align: 'center', width: 100, showOverflowTooltip: true },
-          { label: '重量', prop: 'weight', align: 'center' },
-          { label: '重量单位', prop: 'weightUnit', align: 'center' },
-          { label: '仓库', prop: 'warehouseName', align: 'center' },
-          { label: '货区', prop: 'areaName', align: 'center' },
-          { label: '货架', prop: 'goodsShelfName', align: 'center' },
-          { label: '货位', prop: 'goodsAllocationName', align: 'center' },
-          { label: '生产日期', prop: 'productionDate', align: 'center' },
-          { label: '采购日期', prop: 'purchaseDate', align: 'center' }
+          // { label: '重量', prop: 'weight', align: 'center' },
+          // { label: '重量单位', prop: 'weightUnit', align: 'center' },
+          // { label: '仓库', prop: 'warehouseName', align: 'center' },
+          // { label: '货区', prop: 'areaName', align: 'center' },
+          // { label: '货架', prop: 'goodsShelfName', align: 'center' },
+          // { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+          // { label: '生产日期', prop: 'productionDate', align: 'center' },
+          // { label: '采购日期', prop: 'purchaseDate', align: 'center' }
         ];
       }
     },

+ 78 - 15
src/views/sample/samplemanagement/index.vue

@@ -43,17 +43,62 @@
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="openEdit('edit', row)"
+          >
+            修改
+          </el-link>
           <el-link
             type="primary"
             :underline="false"
             @click="processingMethod('process', row)"
           >
-            处理
+            处
           </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
         </template>
       </ele-pro-table>
       <!-- <processingInfo ref="processingRefs"></processing> -->
     </el-card>
+
+    <el-dialog :visible.sync="dialogVisible" width="10%" @close="close">
+      <!-- <DictSelection
+        dictName="样品处理类型"
+        :filterArr="all ? ['返工返修'] : []"
+        v-model="sampleType"
+      /> -->
+
+      <el-select
+        v-model="sampleType"
+        :key="sampleType"
+        placeholder="请选择"
+        style="width: 100%"
+      >
+        <el-option
+          v-for="item in sampleTypeList"
+          :key="item.value"
+          :label="item.label"
+          :value="item.value"
+        >
+        </el-option>
+      </el-select>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消 </el-button>
+        <el-button type="primary" @click="dispose()">确 定</el-button>
+      </span>
+    </el-dialog>
     <!--      <edit ref="edit" ></edit>-->
 
     <sample ref="sampleRef" @done="reload"></sample>
@@ -64,7 +109,7 @@
   import edit from './components/edit.vue';
   import sample from './components/addOrEditSample.vue';
 
-  import { getList } from '@/api/samplemanagement';
+  import { getList, removeItem } from '@/api/samplemanagement';
 
   import dictMixins from '@/mixins/dictMixins';
 
@@ -96,14 +141,14 @@
           },
           {
             prop: 'categoryCode',
-            label: '品编码',
+            label: '品编码',
             align: 'center',
             width: 160,
             showOverflowTooltip: true
           },
           {
             prop: 'categoryName',
-            label: '物品名称',
+            label: '名称',
             align: 'center',
             width: 160,
             showOverflowTooltip: true
@@ -184,7 +229,15 @@
             fixed: 'right'
           }
         ],
-        activeName: '1'
+        activeName: '1',
+        sampleTypeList: [
+          { value: 1, label: '留样' },
+          { value: 2, label: '归批/回用' },
+          { value: 3, label: '报废' },
+          { value: 4, label: '退货' }
+        ],
+        sampleType: '',
+        dialogVisible: false
       };
     },
     created() {
@@ -243,16 +296,17 @@
         // this.$refs.table.reload({ page: 1, where });
       },
       processingMethod(type, row) {
-        this.$router.push({
-          path: '/sample/samplemanagement/components/edit',
-          query: {
-            type: type,
-            qualityWorkOrderId: row.qualityWorkOrderId || '',
-            id: row.id || '',
-            qualityType: row.qualityType || '',
-            sampleCode: row.sampleCode || ''
-          }
-        });
+        // this.$router.push({
+        //   path: '/sample/samplemanagement/components/edit',
+        //   query: {
+        //     type: type,
+        //     qualityWorkOrderId: row.qualityWorkOrderId || '',
+        //     id: row.id || '',
+        //     qualityType: row.qualityType || '',
+        //     sampleCode: row.sampleCode || ''
+        //   }
+        // });
+        this.dialogVisible = true;
         // this.$refs.edit.open(type, row)
       },
       handleClick(tab) {
@@ -261,6 +315,15 @@
       },
       openEdit(type, row) {
         this.$refs.sampleRef.open(type, row);
+      },
+
+      remove(item) {
+        removeItem([item.id])
+          .then((message) => {
+            this.$message.success(message);
+            this.reload();
+          })
+          .catch((e) => {});
       }
     }
   };

+ 13 - 9
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -66,8 +66,8 @@
       @close="close"
       title="处置"
     >
-      <el-form ref="form1" :model="formData" label-width="80px">
-        <el-row :gutter="24">
+      <!-- <el-form ref="form1" :model="formData" label-width="80px"> -->
+      <!-- <el-row :gutter="24">
           <el-col :span="12">
             <el-form-item label="产品编码">
               <el-input v-model="formData.categoryCode" disabled></el-input>
@@ -78,8 +78,8 @@
               <el-input v-model="formData.categoryName" disabled></el-input>
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row :gutter="24">
+        </el-row> -->
+      <!-- <el-row :gutter="24">
           <el-col :span="12">
             <el-form-item label="批次号">
               <el-input v-model="formData.batchNo" disabled></el-input>
@@ -127,12 +127,16 @@
                     </el-option>
                   </el-select>
                 </template>
-              </template>
-              <!-- <DictSelection dictName="不良品处理类型" :filterArr="all ? ['返工返修'] : []" v-model="current.disposalStatus" /> -->
-            </el-form-item>
+              </template> -->
+      <DictSelection
+        dictName="不良品处理类型"
+        :filterArr="all ? ['返工返修'] : []"
+        v-model="current.disposalStatus"
+      />
+      <!-- </el-form-item>
           </el-col>
-        </el-row>
-      </el-form>
+        </el-row> -->
+      <!-- </el-form> -->
 
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消 </el-button>

+ 2 - 2
vue.config.js

@@ -33,10 +33,10 @@ module.exports = {
       '/api': {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.107:18086',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.30:18086',
-        // target: 'http://192.168.1.251:18186',
+        target: 'http://192.168.1.251:18186',
         // target: 'http://124.71.68.31:50001',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {