|
@@ -10,31 +10,66 @@
|
|
|
<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-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-autocomplete v-model.trim="deptName" clearable :fetch-suggestions="queryDeptSearchAsync" placeholder="请选择工段"
|
|
|
+ @select="handleDeptSelect" style="width: 140px;" @clear="handleClearDept">
|
|
|
+ <template #default="{ item }">
|
|
|
+ <div style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+ ">
|
|
|
+ <div class="name" style="font-size: 12px">
|
|
|
+ {{ item.deptName }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-autocomplete>
|
|
|
</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="processAlias" :options="processList" placeholder="请选择工序" style="width: 140px"
|
|
|
+ @change="handleProcessChange" /> -->
|
|
|
+ <el-autocomplete v-model.trim="processAlias" clearable :fetch-suggestions="queryProcessSearchAsync"
|
|
|
+ placeholder="请选择工序" @select="handleProcessSelect" style="width: 140px;" @clear="handleClearProcess">
|
|
|
+ <template #default="{ item }">
|
|
|
+ <div style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+ ">
|
|
|
+ <div class="name" style="font-size: 12px">
|
|
|
+ {{ item.label }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-autocomplete>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<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>
|
|
@@ -71,19 +106,11 @@
|
|
|
</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" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="单批单改" width="70" prop="isAmend" 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" />
|
|
@@ -100,18 +127,21 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup name="ProductionPlan">
|
|
|
+import { listDept } from '@/api/system/dept'
|
|
|
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";
|
|
|
import onceChange from "@/views/business/reviseBath/onceSingleChangeDialog.vue";
|
|
|
import InBatchesDialog from "@/views/business/lot/InBatchesDialog.vue";
|
|
|
+import { listProcess } from '@/api/business/process'
|
|
|
import { ref } from "vue";
|
|
|
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,8 +149,10 @@ 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 processAlias = ref('');
|
|
|
+const deptName = ref('')
|
|
|
const visible = ref(false);
|
|
|
const selections = ref([]);
|
|
|
const processList = ref([]);
|
|
@@ -131,8 +163,7 @@ const queryParams = ref({
|
|
|
pageSize: 10,
|
|
|
lotCode: "",
|
|
|
deptId: null,
|
|
|
- isFallback: "",
|
|
|
- isWasteRecycling: "",
|
|
|
+ flag: null,
|
|
|
productionPlanNo: "",
|
|
|
lineNumber: null,
|
|
|
});
|
|
@@ -144,6 +175,8 @@ const queryDeptParams = ref({
|
|
|
/*********************** 方法区 ****************************/
|
|
|
/** 打开抽屉 */
|
|
|
function getDept() {
|
|
|
+ getNowDate()
|
|
|
+ getPassDate()
|
|
|
//获取工段信息
|
|
|
queryParams.value.productionPlanNo = "";
|
|
|
queryParams.value.lineNumber = null;
|
|
@@ -152,17 +185,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(
|
|
@@ -207,42 +250,49 @@ function getLot() {
|
|
|
if (res.code == 200) {
|
|
|
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 handleProcessChange() {
|
|
|
- console.log(processList.value[processAlias.value].label);
|
|
|
-
|
|
|
- // 使用 some 方法检查是否存在于 processList 中
|
|
|
- lotList.value = lotInfo.value.filter((item) => {
|
|
|
- // 检查当前对象的 processAlias 是否等于目标值
|
|
|
- return item.processAlias == processList.value[processAlias.value].label;
|
|
|
- });
|
|
|
+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 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() {
|
|
@@ -282,7 +332,48 @@ const showInBatch = () => {
|
|
|
inBatchesDialogRef.value.open(selections.value[0]);
|
|
|
};
|
|
|
|
|
|
+/** 获取工序列表 */
|
|
|
+const queryProcessSearchAsync = (arg, cb) => {
|
|
|
+ const params = arg != null ? { processAlias: arg, ...queryParams.value } : { ...queryParams.value }
|
|
|
+ // listProcess(params).then(res => {
|
|
|
+ // const processes = res.rows
|
|
|
+ // cb(processes)
|
|
|
+ // })
|
|
|
+ getProcessList(params).then((response) => {
|
|
|
+ const processes = response.data;
|
|
|
+ cb(processes)
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const handleProcessSelect = (item) => {
|
|
|
+ console.log(item)
|
|
|
+ processAlias.value = item.label.trim()
|
|
|
+ queryParams.value.processId = item.value
|
|
|
+}
|
|
|
+
|
|
|
+const queryDeptSearchAsync = (arg, cb) => {
|
|
|
+ const params = arg != null ? { pageSize: 200, deptName: arg, isWorkSection: 1 } : { pageSize: 200 }
|
|
|
+ listDept(params).then(res => {
|
|
|
+ const depts = res.rows
|
|
|
+ cb(depts)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleDeptSelect = (item) => {
|
|
|
+ console.log(item)
|
|
|
+ deptName.value = item.deptName.trim()
|
|
|
+ queryParams.value.deptId = item.deptId
|
|
|
+}
|
|
|
+const handleClearProcess = () => {
|
|
|
+ processAlias.value = ''
|
|
|
+ queryParams.value.processId = null
|
|
|
+}
|
|
|
+const handleClearDept = () => {
|
|
|
+ deptName.value = ''
|
|
|
+ queryParams.value.deptId = null
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
getDept();
|
|
|
+
|
|
|
});
|
|
|
</script>
|