guoyujia il y a 1 an
Parent
commit
9ef1aead33

+ 7 - 0
src/api/business/lot.js

@@ -34,6 +34,13 @@ export function getLot(id) {
     method: 'get'
   })
 }
+export function getProcessList(query) {
+  return request({
+    url: baseUrl + '/business/lot/getProcessList',
+    method: 'get',
+    params:query
+  })
+}
 
 // 查询批次查询详细
 export function getLotList(query) {

+ 258 - 72
src/views/business/lot/index.vue

@@ -1,89 +1,237 @@
 <template>
   <div class="page-container column-container">
     <!-- 搜索区 -->
-    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+    <el-form
+      class="list-search-container"
+      :model="queryParams"
+      ref="queryRef"
+      :inline="true"
+    >
       <el-form-item label="产品描述:">
-        <el-input placeholder="请输入产品描述" v-model.trim="queryParams.productDescription" style="width: 150px" clearable
-          @keyup.enter="handleQuerydaywork" @keydown.enter.prevent />
+        <el-input
+          placeholder="请输入产品描述"
+          v-model.trim="queryParams.productDescription"
+          style="width: 150px"
+          clearable
+          @keyup.enter="handleQuerydaywork"
+          @keydown.enter.prevent
+        />
       </el-form-item>
       <el-form-item label="生产计划单号:">
-        <el-input placeholder="请输入生产计划单号" v-model.trim="queryParams.productionPlanNo" style="width: 150px" clearable
-          @keyup.enter="handleQuerydaywork" @keydown.enter.prevent />
+        <el-input
+          placeholder="请输入生产计划单号"
+          v-model.trim="queryParams.productionPlanNo"
+          style="width: 150px"
+          clearable
+          @keyup.enter="handleQuerydaywork"
+          @keydown.enter.prevent
+        />
       </el-form-item>
-      <el-form-item label="序号:">
+      <!-- <el-form-item label="序号:">
         <el-input placeholder="请输入序号" v-model.trim="queryParams.lineNumber" style="width: 130px" clearable
           @keyup.enter="handleQuerydaywork" @keydown.enter.prevent />
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="批次号:">
-        <el-input placeholder="请输入批次号" v-model.trim="queryParams.lotCode" style="width: 130px" clearable
-          @keyup.enter="handleQuerydaywork" @keydown.enter.prevent />
+        <el-input
+          placeholder="请输入批次号"
+          v-model.trim="queryParams.lotCode"
+          style="width: 130px"
+          clearable
+          @keyup.enter="handleQuerydaywork"
+          @keydown.enter.prevent
+        />
       </el-form-item>
       <el-form-item label="工段:">
-        <el-select-v2 v-model="queryParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 140px" />
+        <el-select-v2
+          v-model="queryParams.deptId"
+          :options="deptList"
+          placeholder="请选择工段"
+          style="width: 140px"
+        />
       </el-form-item>
-      <el-form-item label="是否废品回用:">
-        <el-select style="width: 100px" v-model="queryParams.isWasteRecycling" placeholder="请选择">
-          <el-option v-for="item in yes_no" :key="item.value" :label="item.label" :value="item.value"></el-option>
+      <el-form-item label="标识:">
+        <el-select
+          style="width: 120px"
+          v-model="queryParams.flag"
+          clearable
+          placeholder="请选择标识"
+        >
+          <el-option
+            v-for="item in is_identification"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
         </el-select>
       </el-form-item>
+      <el-form-item label="时间:">
+        <el-date-picker
+          v-model="queryParams.startTime"
+          type="date"
+          value-format="YYYY-MM-DD"
+          :editable="false"
+          :clearable="false"
+          placeholder="请选择开始时间"
+          style="width: 150px"
+          @change="handleDateChange"
+        />
+        <span>To</span>
+        <el-date-picker
+          v-model="queryParams.endTime"
+          type="date"
+          value-format="YYYY-MM-DD"
+          :editable="false"
+          :clearable="false"
+          placeholder="请选择结束时间"
+          style="width: 150px"
+          @change="handleDateChange"
+        />
+      </el-form-item>
       <el-form-item label="工序:">
-        <el-select-v2 v-model="processAlias" :options="processList" placeholder="请选择工序" style="width: 140px"
-          @change="handleProcessChange" />
+        <el-select-v2
+          v-model="queryParams.processId"
+          :options="processList"
+          clearable
+          placeholder="请选择工序"
+          style="width: 140px"
+        />
       </el-form-item>
       <el-form-item>
-        <el-button type="info" icon="Search" @click="handleQuerydaywork">搜索</el-button>
+        <el-button type="info" icon="Search" @click="handleQuerydaywork"
+          >搜索</el-button
+        >
       </el-form-item>
       <div style="margin-top: 20px">
         <el-button type="primary" @click="handleFallback">回退</el-button>
-        <el-button type="primary" @click="handleWasteRecycling"
-          :disabled="selections.length == 0 || selections.length > 1">添加废品回用</el-button>
-        <el-button :disabled="selections.length !== 1" type="primary" @click="showInBatch">分批</el-button>
-        <el-button type="primary" :disabled="once" @click="handleOnceSingleChange">单批单改</el-button>
-        <el-button type="primary" :disabled="multi" @click="handleMultiSingleChange">多批单改</el-button>
+        <el-button
+          type="primary"
+          @click="handleWasteRecycling"
+          :disabled="selections.length == 0 || selections.length > 1"
+          >添加废品回用</el-button
+        >
+        <el-button
+          :disabled="selections.length !== 1"
+          type="primary"
+          @click="showInBatch"
+          >分批</el-button
+        >
+        <el-button
+          type="primary"
+          :disabled="once"
+          @click="handleOnceSingleChange"
+          >单批单改</el-button
+        >
+        <el-button
+          type="primary"
+          :disabled="multi"
+          @click="handleMultiSingleChange"
+          >多批单改</el-button
+        >
       </div>
     </el-form>
 
     <!-- 列表区 -->
     <div class="el-table-container">
       <div class="el-table-inner-container">
-        <el-table ref="dayworkTable" v-loading="loading" row-key="id" @selection-change="handleSelectionChange"
-          height="100%" :data="lotList">
+        <el-table
+          ref="dayworkTable"
+          v-loading="loading"
+          row-key="id"
+          @selection-change="handleSelectionChange"
+          height="100%"
+          :data="lotList"
+        >
           <el-table-column type="selection" width="40" align="center" />
-          <el-table-column label="客户简称" prop="companyAlias" width="120" align="center" />
-          <el-table-column label="生产计划单号" width="100" prop="productionPlanNo" align="center" />
-          <el-table-column label="序号" width="60" prop="lineNumber" align="center" />
+          <el-table-column
+            label="客户简称"
+            prop="companyAlias"
+            width="120"
+            align="center"
+          />
+          <el-table-column
+            label="生产计划单号"
+            width="100"
+            prop="productionPlanNo"
+            align="center"
+          />
+          <el-table-column
+            label="序号"
+            width="60"
+            prop="lineNumber"
+            align="center"
+          />
 
           <el-table-column label="批次号" prop="lotCode" align="center">
             <template #default="scope">
-              <el-button link type="primary" @click="handleColumnClick(scope.row)"><span>{{ scope.row.lotCode
-                  }}</span></el-button>
+              <el-button
+                link
+                type="primary"
+                @click="handleColumnClick(scope.row)"
+                ><span>{{ scope.row.lotCode }}</span></el-button
+              >
             </template>
           </el-table-column>
-          <el-table-column label="产品描述" prop="productDescription" align="center" />
-          <el-table-column label="图纸版本" width="80" prop="technologyVersion" align="center" />
-          <el-table-column label="投产量" width="100" prop="productionQuantity" align="center" />
-          <el-table-column label="下达日期" prop="createTime" width="100" align="center">
+          <el-table-column
+            label="产品描述"
+            prop="productDescription"
+            align="center"
+          />
+          <el-table-column
+            label="图纸版本"
+            width="80"
+            prop="technologyVersion"
+            align="center"
+          />
+          <el-table-column
+            label="投产量"
+            width="100"
+            prop="productionQuantity"
+            align="center"
+          />
+          <el-table-column
+            label="下达日期"
+            prop="createTime"
+            width="100"
+            align="center"
+          >
             <template #default="scope">
               <span>{{
-      proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
-    }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="当前工段" width="100" prop="deptName" align="center" />
-          <el-table-column label="当前工序" width="120" prop="processAlias" align="center" />
-          <el-table-column label="废品回用" width="70" prop="isWasteRecycling" align="center">
-            <template #default="scope">
-              <dict-tag :options="yes_no" :value="scope.row.isWasteRecycling" />
-            </template>
-          </el-table-column>
-          <el-table-column label="批废" width="70" prop="isWaste" align="center">
-            <template #default="scope">
-              <dict-tag :options="yes_no" :value="scope.row.isWaste" />
+                proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+              }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="单批单改" width="70" prop="isAmend" align="center">
+          <el-table-column
+            label="当前工段"
+            width="100"
+            prop="deptName"
+            align="center"
+          />
+          <el-table-column
+            label="当前工序"
+            width="120"
+            prop="processAlias"
+            align="center"
+          />
+          <el-table-column label="标识" width="300" align="center">
             <template #default="scope">
-              <dict-tag :options="yes_no" :value="scope.row.isAmend" />
+              <el-tag
+                v-if="scope.row.isWaste == 1"
+                class="spacing"
+                type="danger"
+                >{{ "批废" }}</el-tag
+              >
+              <el-tag
+                v-if="scope.row.isAmend == 1"
+                class="spacing"
+                type="danger"
+                >{{ "工艺修改" }}</el-tag
+              >
+              <el-tag
+                v-if="scope.row.isWasteRecycling == 1"
+                class="spacing"
+                type="primary"
+                >{{ "废品回用" }}</el-tag
+              >
             </template>
           </el-table-column>
           <el-table-column label="母批号" prop="fromCode" align="center" />
@@ -91,9 +239,16 @@
       </div>
     </div>
     <!-- 分页 -->
-    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
-      v-model:limit="queryParams.pageSize" @pagination="getLot" />
-    <waste-recycling-dialog ref="wasteRecyclingDialogRef"></waste-recycling-dialog>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getLot"
+    />
+    <waste-recycling-dialog
+      ref="wasteRecyclingDialogRef"
+    ></waste-recycling-dialog>
     <InBatchesDialog ref="inBatchesDialogRef" :getList="handleQuerydaywork" />
     <once-change ref="onceChangeRef" @handleSaveSuccess="getLot()" />
     <multi-change ref="multiChangeRef" @handleSaveSuccess="getLot()" />
@@ -101,7 +256,7 @@
 </template>
 <script setup name="ProductionPlan">
 import { getDeptList } from "@/api/system/dept.js";
-import { getLotList } from "@/api/business/lot.js";
+import { getLotList,getProcessList } from "@/api/business/lot.js";
 import wasteRecyclingDialog from "./DialogWasteRecycling.vue";
 import router from "@/router";
 import multiChange from "@/views/business/reviseBath/multiSingleChangeDialog.vue";
@@ -112,6 +267,7 @@ const route = useRoute();
 const { proxy } = getCurrentInstance();
 /** 字典数组区 */
 const { yes_no } = proxy.useDict("yes_no");
+const { is_identification } = proxy.useDict("is_identification");
 /** 表单抽屉 页变量 */
 const inBatchesDialogRef = ref(null);
 const loading = ref(false);
@@ -119,6 +275,7 @@ const lotInfo = ref([]);
 const once = ref(true); //单批单改按钮是否可点击
 const multi = ref(true); //多批单改按钮是否可点击
 const lotList = ref([]);
+const value1 = ref(null);
 const total = ref(0);
 const processAlias = ref(null);
 const visible = ref(false);
@@ -131,8 +288,7 @@ const queryParams = ref({
   pageSize: 10,
   lotCode: "",
   deptId: null,
-  isFallback: "",
-  isWasteRecycling: "",
+  flag:null,
   productionPlanNo: "",
   lineNumber: null,
 });
@@ -144,6 +300,8 @@ const queryDeptParams = ref({
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 function getDept() {
+  getNowDate()
+  getPassDate()
   //获取工段信息
   queryParams.value.productionPlanNo = "";
   queryParams.value.lineNumber = null;
@@ -152,17 +310,27 @@ function getDept() {
       deptList.value = res.data;
     }
   });
+  getProcess()
   if (route.params.productionPlanNo != ":productionPlanNo") {
     queryParams.value.productionPlanNo = route.params.productionPlanNo;
     queryParams.value.lineNumber = route.params.lineNumber;
   }
+
   getLot();
   visible.value = true;
 }
+function handleDateChange() {
+  console.log(queryParams.value.startTime);
+  console.log(queryParams.value.endTime);
+}
+function getProcess() {
+  getProcessList(queryParams.value).then((response) => {
+    processList.value = response.data;
+  });
+}
 
 /** 多批单改操作 */
 function handleMultiSingleChange() {
-  console.log("selections", selections.value);
   //判断是否同一计划单且当前工序相同的数据
   let isConsistent =
     selections.value.every(
@@ -208,27 +376,38 @@ function getLot() {
       lotList.value = res.rows;
       total.value = res.total;
       lotInfo.value = res.rows;
-      res.rows.forEach((item) => {
-        // 如果 processList 中不存在当前 processAlias,则添加到 processList 中
-        if (
-          !processList.value.find(
-            (process) => process.label === item.processAlias
-          )
-        ) {
-          // 计算当前 processAlias 的唯一递增值
-          const count = processList.value.length;
-          processList.value.push({
-            label: item.processAlias,
-            value: count,
-          });
-        }
-      });
-      console.log(processList.value);
       loading.value = false;
     }
   });
 }
 
+function getNowDate() {
+  var nowDate = new Date();
+    var date = {
+      year: nowDate.getFullYear(),
+      month: nowDate.getMonth() + 1,
+      day: nowDate.getDate()
+    };
+    const dayDate =date.year + "-" + (date.month >= 10 ? date.month : "0" + date.month) + "-" + (date.day >= 10 ? date.day : "0" + date.day);
+    console.log(dayDate)
+  queryParams.value.endTime = dayDate ;
+}
+function getPassDate() {
+  var myDate = new Date();
+    myDate.setDate(myDate.getDate() - 29);
+    var dateTemp;
+    var day;
+    for (var i = 0; i < 30; i++) {
+        if (myDate.getDate() < 10) {
+            day = '0' + myDate.getDate().toString()
+        } else {
+            day = myDate.getDate().toString()
+        }
+      }
+        var month = myDate.getMonth() + 1;
+        dateTemp = myDate.getFullYear() + "-" + (month < 10 ? '0' + month : '' + month) + "-" + day;
+    queryParams.value.startTime = dateTemp
+}
 /**工序切换 */
 function handleProcessChange() {
   console.log(processList.value[processAlias.value].label);
@@ -242,7 +421,13 @@ function handleProcessChange() {
 
 /**搜索 */
 function handleQuerydaywork() {
-  getLot();
+  queryParams.value.lineNumber = null
+  if(queryParams.value.endTime<queryParams.value.startTime && queryParams.value.endTime!=''&& queryParams.value.startTime!='') {
+    proxy.$modal.msgError('结束时间不能小于开始时间');
+  }else {
+    getLot();
+  }
+  
 }
 /**打开废品回用弹窗 */
 function handleWasteRecycling() {
@@ -284,5 +469,6 @@ const showInBatch = () => {
 
 onMounted(() => {
   getDept();
+
 });
 </script>

+ 7 - 0
src/views/business/reviseBath/index.vue

@@ -17,6 +17,11 @@
           style="width: 160px"
         />
       </el-form-item>
+      <el-form-item label="批号状态:" label-width="100px">
+        <el-select v-model="queryParams.lotCodeStatusCode" clearable placeholder="请选择批号状态" style="width: 150px">
+						<el-option v-for="dict in lot_code_status_code" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
+					</el-select>
+        </el-form-item>
       <el-form-item>
         <el-button type="info" icon="Search" @click="handleQuery"
           >搜索</el-button
@@ -210,6 +215,8 @@ const queryParams = ref({
   pullP2PlanDetails: false,
   pageNum: 1,
   pageSize: 10,
+  startTime: "",
+    endTime: "",
 });
 
 onMounted(() => {