Pārlūkot izejas kodu

产品交接表更改

qinhb 5 mēneši atpakaļ
vecāks
revīzija
5c50f5e43b

+ 12 - 4
src/api/process/index.ts

@@ -1,6 +1,5 @@
 import request from "@/utils/request";
 import { AxiosPromise } from "axios";
-import {OrderInfoQuery} from "@/api/order/types";
 
 export function queryOutSourceDetails(id: object): AxiosPromise<any> {
   return request({
@@ -48,10 +47,11 @@ export function addProRecord(params: object): AxiosPromise<any> {
   });
 }
 
-export function queryProductHandover(id: number): AxiosPromise<any> {
+export function queryProductHandover(params: object): AxiosPromise<any> {
   return request({
-    url: "/api/v1/proRecord/get/" + id,
-    method: "get",
+    url: "/api/v1/proRecord/queryByType",
+    method: "post",
+    data: params
   });
 }
 export function updateHandoverList(params: object): AxiosPromise<any> {
@@ -70,6 +70,14 @@ export function exportOperationRecord(queryParams: object) {
     responseType: "arraybuffer",
   });
 }
+export function exportOperationRecord1(queryParams: object) {
+  return request({
+    url: "/api/v1/proRecord/export1",
+    method: "post",
+    data: queryParams,
+    responseType: "arraybuffer",
+  });
+}
 
 export function queryHInfo(id: number) {
   return request({

+ 1 - 0
src/common/configs/dictDataUtil.ts

@@ -68,6 +68,7 @@ const DictDataUtil = {
     //报故追踪状态状态
     produce_type: "produce_type",
     op_group: "op_group",
+    process_type: "process_type",
     filter_order: "filter_order",
     quality_grade: "quality_grade",
   },

+ 81 - 40
src/views/quality/handover/index.vue

@@ -17,28 +17,20 @@
         @current-change="dataList"
         @selection-change="selectionChange"
     >
-      <template #menu-right="{}">
-        <el-button
-            class="ml-3"
-            @click="handleExport"
-        >
-          <template #icon> <i-ep-download /> </template>导出
-        </el-button>
-      </template>
       <template #menu="{ size, row, index }">
-        <el-button
+<!--        <el-button
             icon="el-icon-edit"
             text
             @click="openDialog(1, row.id)"
             type="primary"
             :size="size"
         >编辑</el-button
-        >
+        >-->
 
         <el-button
-            icon="el-icon-edit"
+            icon="el-icon-view"
             text
-            @click="openDialog(0, row.id)"
+            @click="openDialog(0, row)"
             type="primary"
             :size="size"
         >详情</el-button
@@ -48,9 +40,17 @@
     <el-dialog
         v-model="dialog.visible"
         :title="dialog.title"
-        width="1500px"
+        width="1650px"
         @close="dialog.visible = false"
     >
+
+<!--      <el-button
+          class="ml-3"
+          style="margin-bottom: 5px;"
+          @click="handleExport"
+      >
+        <template #icon> <i-ep-download /> </template>导出
+      </el-button>-->
       <el-table :data="itemList" border style="width: 100%" span-method="objectSpanMethod">
         <el-table-column show-overflow-tooltip  prop="operationName" label="工序" width="100"/>
         <el-table-column show-overflow-tooltip  prop="materialModel" label="物料型号" width="100"/>
@@ -124,10 +124,11 @@
 
       <div
           class="dialog-footer"
+          style="margin-top: 10px;"
           align="center"
       >
         <el-button @click="dialog.visible = false">取 消</el-button>
-        <el-button type="primary" @click="saveItemList"  v-if="dialog.type === 1" >保 存</el-button>
+        <el-button type="primary" @click="handleExport" v-if="itemList.value !== 0">导 出</el-button>
       </div>
     </el-dialog>
   </div>
@@ -137,6 +138,7 @@ import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
 import { exportOperationRecord ,addProRecord,queryProductHandover,updateHandoverList} from "@/api/process";
 import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const test = () => {
   isShowTable.value = true;
@@ -146,21 +148,41 @@ const radio = ref(0);
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
     useCrud({
-      src: "/api/v1/proRecord",
+      dataListUrl: "/api/v1/proRecord/queryCompleteOpList",
     });
 const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
     Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 const loading = ref(false);
+const times = ref(null)
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 const dialog = reactive({
   title: "产品交接",
   visible: false,
   type: 0,
 });
+const dialog0 = reactive({
+  title: "完工工序",
+  visible: false,
+});
 const createRowSave = (row,done,loading) =>{
-  form.value.type = "0"
+  if(!row.startDate || !row.endDate){
+    ElMessage.error("请选择日期");
+    loading()
+  }else{
+    done();
+    times.value = row;
+    dialog0.visible = true
+  }
+
+
+
+
+
+
+
+  /*form.value.type = "0"
   addProRecord(form.value).then((data) =>{
     ElMessage.success(data.msg);
     form.value.startDate = "";
@@ -172,11 +194,13 @@ const createRowSave = (row,done,loading) =>{
     dataList()
   }).catch(() => {
     loading()
-  });
+  });*/
 }
+const clickOperationType = ref(null)
 const itemList = ref([])
-const openDialog = (type, id) => {
-  queryProductHandover(id).then((data) => {
+const openDialog = (type, row) => {
+  clickOperationType.value = row.operationType
+  queryProductHandover(row).then((data) => {
     itemList.value = data.data;
     dialog.visible = true;
     dialog.type = type;
@@ -197,8 +221,10 @@ const saveItemList = () => {
 option.value = Object.assign(option.value, {
   searchEnter: true,
   editBtn: false,
+  delBtn: false,
   viewBtn: false,
-  selection: true,
+  addBtn: false,
+  selection: false,
   column: [
     {
       label: "开始日期",
@@ -219,40 +245,46 @@ option.value = Object.assign(option.value, {
       overHidden: true,
     },
     {
-      label: "操作人",
+      label: "工序类型",
       overHidden: true,
-      prop: "creator",
+      prop: "operationType",
       search: true,
+      type: 'select',
+      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.process_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
       addDisplay: false,
       editDisplay: false,
     },
     {
-      label: "操作时间",
+      label: "完工数量",
       overHidden: true,
-      prop: "created",
+      prop: "completeNum",
       addDisplay: false,
       editDisplay: false,
     },
   ],
 });
 const handleExport = () => {
-  if(toDeleteIds.value.length == 0){
-    ElMessage.error("请选择数据导出");
-    return;
-  }
-  exportOperationRecord({ids: toDeleteIds.value,type: 0}).then((response) => {
-    try {
-      const decoder = new TextDecoder("utf-8");
-      const jsonString = decoder.decode(response.data);
-      const jsonObject = JSON.parse(jsonString);
-      const { code, msg } = jsonObject;
-      if (code != "200") {
-        ElMessage.error(msg);
+  if(data.value.length !== 0){
+    exportOperationRecord({...search.value,operationType: clickOperationType.value,type: 0}).then((response) => {
+      try {
+        const decoder = new TextDecoder("utf-8");
+        const jsonString = decoder.decode(response.data);
+        const jsonObject = JSON.parse(jsonString);
+        const { code, msg } = jsonObject;
+        if (code != "200") {
+          ElMessage.error(msg);
+        }
+      } catch (e) {
+        downFile(response);
       }
-    } catch (e) {
-      downFile(response);
-    }
-  });
+    })
+  }else{
+    ElMessage.error("请先搜索数据");
+  }
 };
 const downFile = (response) => {
   const fileData = response.data;
@@ -274,6 +306,15 @@ const downFile = (response) => {
 onMounted(() => {
   form.value.type = "0"
   search.value.type = "0"
+
+  const now = new Date();
+  const year = now.getFullYear();
+  let month = now.getMonth() + 1; // 从0开始的月份
+  // 当月结束日期
+  const daysInMonth = new Date(year, now.getMonth() + 1, 0).getDate();
+  month = month.toLocaleString().length === 1 ? "0" + month : month;
+  search.value.startDate = year + "-" + month + "-" + "01"
+  search.value.endDate = year + "-" + month + "-" + daysInMonth
   dataList();
 });
 </script>

+ 68 - 36
src/views/quality/opRecord/index.vue

@@ -17,28 +17,28 @@
         @current-change="dataList"
         @selection-change="selectionChange"
     >
-      <template #menu-right="{}">
+<!--      <template #menu-right="{}">
         <el-button
             class="ml-3"
             @click="handleExport"
         >
           <template #icon> <i-ep-download /> </template>导出
         </el-button>
-      </template>
+      </template>-->
       <template #menu="{ size, row, index }">
-        <el-button
+<!--        <el-button
             icon="el-icon-edit"
             text
             @click="openDialog(1, row.id)"
             type="primary"
             :size="size"
         >编辑</el-button
-        >
+        >-->
 
         <el-button
-            icon="el-icon-edit"
+            icon="el-icon-view"
             text
-            @click="openDialog(0, row.id)"
+            @click="openDialog(0, row)"
             type="primary"
             :size="size"
         >详情</el-button
@@ -48,7 +48,7 @@
     <el-dialog
         v-model="dialog.visible"
         :title="dialog.title"
-        width="1500px"
+        width="1600px"
         @close="dialog.visible = false"
     >
       <el-table :data="itemList" border style="width: 100%">
@@ -90,7 +90,7 @@
             <el-input v-model="scope.row.useDevice"></el-input>
           </template>
         </el-table-column>
-        <el-table-column prop="craftCondition" label="工艺条件)" width="140">
+        <el-table-column prop="craftCondition" label="工艺条件" width="140">
           <template v-if="dialog.type === 1"  #default="scope">
             <el-input v-model="scope.row.craftCondition"></el-input>
           </template>
@@ -123,9 +123,10 @@
       <div
           class="dialog-footer"
           align="center"
+          style="margin-top: 10px;"
       >
         <el-button @click="dialog.visible = false">取 消</el-button>
-        <el-button type="primary" @click="saveItemList"  v-if="dialog.type === 1" >保 存</el-button>
+        <el-button type="primary" @click="handleExport" v-if="itemList.value !== 0">导 出</el-button>
       </div>
     </el-dialog>
 
@@ -308,9 +309,10 @@
       <div
           class="dialog-footer"
           align="center"
+          style="margin-top: 10px"
       >
         <el-button @click="dialog1.visible = false">取 消</el-button>
-        <el-button type="primary" @click="saveDetails"  v-if="dialog.type === 1" >保 存</el-button>
+        <el-button type="primary" @click="handleExport1">导 出</el-button>
       </div>
     </el-dialog>
   </div>
@@ -318,8 +320,9 @@
 <script setup>
 import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
-import { exportOperationRecord ,addProRecord,queryProductHandover,updateHandoverList,queryHInfo,saveOpDetails} from "@/api/process";
+import { exportOperationRecord,exportOperationRecord1 ,addProRecord,queryProductHandover,updateHandoverList,queryHInfo,saveOpDetails} from "@/api/process";
 import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const test = () => {
   isShowTable.value = true;
@@ -329,7 +332,7 @@ const radio = ref(0);
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
     useCrud({
-      src: "/api/v1/proRecord",
+      dataListUrl: "/api/v1/proRecord/queryCompleteOpList",
     });
 const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
     Methords; //增删改查
@@ -368,27 +371,29 @@ const hInfo = ref({
   operator: '',
   materialModel: ''
 })
-const openDialog = (type, id) => {
-  queryProductHandover(id).then((data) => {
+const clickOperationType = ref(null)
+const openDialog = (type, row) => {
+  clickOperationType.value = row.operationType
+  row.type = 1
+  queryProductHandover(row).then((data) => {
     itemList.value = data.data;
     dialog.visible = true;
     dialog.type = type;
   });
 };
 const clickH = (row) =>{
-  queryHInfo(row.id).then((data)=>{
-    if(data.data !== null){
+  if(null === row.detailId){
+    hInfo.value = JSON.parse(JSON.stringify(row))
+    hInfo.value.operator = row.reReceiveUser
+    hInfo.value.operatorTime = row.reDate
+    hInfo.value.handoverId = row.id
+    hInfo.value.num = row.reNum
+  }else{
+    queryHInfo(row.detailId).then((data)=>{
       hInfo.value = data.data
-    }else{
-      hInfo.value = JSON.parse(JSON.stringify(row))
-      hInfo.value.operator = row.reReceiveUser
-      hInfo.value.operatorTime = row.reDate
-      hInfo.value.handoverId = row.id
-      hInfo.value.num = row.reNum
-    }
-    dialog1.visible = true
-  });
-
+    });
+  }
+  dialog1.visible = true
 }
 
 const saveDetails = ()=>{
@@ -415,7 +420,9 @@ option.value = Object.assign(option.value, {
   searchEnter: true,
   editBtn: false,
   viewBtn: false,
-  selection: true,
+  delBtn: false,
+  addBtn: false,
+  selection: false,
   column: [
     {
       label: "开始日期",
@@ -436,28 +443,45 @@ option.value = Object.assign(option.value, {
       overHidden: true,
     },
     {
-      label: "操作人",
+      label: "工序类型",
       overHidden: true,
-      prop: "creator",
+      prop: "operationType",
       search: true,
+      type: 'select',
+      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.process_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
       addDisplay: false,
       editDisplay: false,
     },
     {
-      label: "操作时间",
+      label: "完工数量",
       overHidden: true,
-      prop: "created",
+      prop: "completeNum",
       addDisplay: false,
       editDisplay: false,
     },
   ],
 });
 const handleExport = () => {
-  if(toDeleteIds.value.length == 0){
-    ElMessage.error("请选择数据导出");
-    return;
-  }
-  exportOperationRecord({ids: toDeleteIds.value,type: 1}).then((response) => {
+  exportOperationRecord({...search.value,operationType: clickOperationType.value,type: 1}).then((response) => {
+    try {
+      const decoder = new TextDecoder("utf-8");
+      const jsonString = decoder.decode(response.data);
+      const jsonObject = JSON.parse(jsonString);
+      const { code, msg } = jsonObject;
+      if (code != "200") {
+        ElMessage.error(msg);
+      }
+    } catch (e) {
+      downFile(response);
+    }
+  });
+};
+const handleExport1 = () => {
+  exportOperationRecord1(hInfo.value).then((response) => {
     try {
       const decoder = new TextDecoder("utf-8");
       const jsonString = decoder.decode(response.data);
@@ -491,6 +515,14 @@ const downFile = (response) => {
 onMounted(() => {
   form.value.type = "1"
   search.value.type = "1"
+  const now = new Date();
+  const year = now.getFullYear();
+  let month = now.getMonth() + 1; // 从0开始的月份
+  // 当月结束日期
+  const daysInMonth = new Date(year, now.getMonth() + 1, 0).getDate();
+  month = month.toLocaleString().length === 1 ? "0" + month : month;
+  search.value.startDate = year + "-" + month + "-" + "01"
+  search.value.endDate = year + "-" + month + "-" + daysInMonth
   dataList();
 });
 </script>