|
@@ -68,6 +68,15 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="工序:">
|
|
|
+ <el-select-v2
|
|
|
+ v-model="processAlias"
|
|
|
+ :options="processList"
|
|
|
+ placeholder="请选择工序"
|
|
|
+ style="width: 140px"
|
|
|
+ @change="handleProcessChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="info" icon="Search" @click="handleQuerydaywork"
|
|
|
>搜索</el-button
|
|
@@ -81,11 +90,22 @@
|
|
|
: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" @click="handleQuerydaywork"
|
|
|
+ <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" @click="handleQuerydaywork"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="multi"
|
|
|
+ @click="handleMultiSingleChange"
|
|
|
>多批单改</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -94,97 +114,117 @@
|
|
|
<!-- 列表区 -->
|
|
|
<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-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="lotCode"
|
|
|
- width="130"
|
|
|
- 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"
|
|
|
+ <el-table
|
|
|
+ ref="dayworkTable"
|
|
|
+ v-loading="loading"
|
|
|
+ row-key="id"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ height="100%"
|
|
|
+ :data="lotList"
|
|
|
>
|
|
|
- <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="母批号" prop="fromCode" align="center" />
|
|
|
- </el-table>
|
|
|
+ <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="lotCode" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <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"
|
|
|
+ >
|
|
|
+ <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" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="单批单改"
|
|
|
+ width="70"
|
|
|
+ prop="isAmend"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="yes_no" :value="scope.row.isAmend" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="母批号" prop="fromCode" align="center" />
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 分页 -->
|
|
@@ -199,26 +239,35 @@
|
|
|
ref="wasteRecyclingDialogRef"
|
|
|
></waste-recycling-dialog>
|
|
|
<InBatchesDialog ref="inBatchesDialogRef"></InBatchesDialog>
|
|
|
+ <once-change ref="onceChangeRef" @handleSaveSuccess="getLot()" />
|
|
|
+ <multi-change ref="multiChangeRef" @handleSaveSuccess="getLot()" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup name="ProductionPlan">
|
|
|
import { getDeptList } from "@/api/system/dept.js";
|
|
|
import { getLotList } from "@/api/business/lot.js";
|
|
|
import wasteRecyclingDialog from "./DialogWasteRecycling.vue";
|
|
|
-import InBatchesDialog from '@/views/business/lot/InBatchesDialog.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 { ref } from "vue";
|
|
|
const route = useRoute();
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
/** 字典数组区 */
|
|
|
const { yes_no } = proxy.useDict("yes_no");
|
|
|
/** 表单抽屉 页变量 */
|
|
|
-const currentProductionPlan = ref({});
|
|
|
-const inBatchesDialogRef = ref(null)
|
|
|
+const inBatchesDialogRef = ref(null);
|
|
|
const loading = ref(false);
|
|
|
+const lotInfo = ref([]);
|
|
|
+const once = ref(true); //单批单改按钮是否可点击
|
|
|
+const multi = ref(true); //多批单改按钮是否可点击
|
|
|
const lotList = ref([]);
|
|
|
const total = ref(0);
|
|
|
+const processAlias = ref(null);
|
|
|
const visible = ref(false);
|
|
|
const selections = ref([]);
|
|
|
+const processList = ref([]);
|
|
|
const deptList = ref([]);
|
|
|
/** 查询对象 */
|
|
|
const queryParams = ref({
|
|
@@ -254,6 +303,47 @@ function getDept() {
|
|
|
getLot();
|
|
|
visible.value = true;
|
|
|
}
|
|
|
+
|
|
|
+/** 多批单改操作 */
|
|
|
+function handleMultiSingleChange() {
|
|
|
+ console.log("selections", selections.value);
|
|
|
+ //判断是否同一计划单且当前工序相同的数据
|
|
|
+ let isConsistent =
|
|
|
+ selections.value.every(
|
|
|
+ (item) => item.productionPlanNo === selections.value[0].productionPlanNo
|
|
|
+ ) &&
|
|
|
+ selections.value.every(
|
|
|
+ (item) => item.processAlias === selections.value[0].processAlias
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!isConsistent) {
|
|
|
+ proxy.$modal.msgError("请选择相同计划单且当前工序相同的数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断是否未修改过的批次
|
|
|
+ isConsistent =
|
|
|
+ selections.value.every((item) => item.isAmend == 0) &&
|
|
|
+ selections.value.every((item) => item.isWaste == 0) &&
|
|
|
+ selections.value.every((item) => item.isWasteRecycling == 0);
|
|
|
+
|
|
|
+ if (!isConsistent) {
|
|
|
+ proxy.$modal.msgError("多批单改只能修改未修改过的批次");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ proxy.$refs.multiChangeRef.open(selections);
|
|
|
+}
|
|
|
+
|
|
|
+/** 打开批次详情页 */
|
|
|
+function handleColumnClick(row) {
|
|
|
+ router.push({ path: "/reviseBath/lotFormParticulars/" + row.lotCode });
|
|
|
+}
|
|
|
+
|
|
|
+/** 单批单改按钮操作 */
|
|
|
+function handleOnceSingleChange() {
|
|
|
+ proxy.$refs.onceChangeRef.open(selections.value[0].lotCode);
|
|
|
+}
|
|
|
+
|
|
|
/**获取生产计划列表 */
|
|
|
function getLot() {
|
|
|
loading.value = true;
|
|
@@ -261,10 +351,39 @@ 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 handleQuerydaywork() {
|
|
|
getLot();
|
|
@@ -294,6 +413,8 @@ function reset() {
|
|
|
}
|
|
|
function handleSelectionChange(selection) {
|
|
|
selections.value = selection;
|
|
|
+ once.value = selections.value.length == 1 ? false : true;
|
|
|
+ multi.value = selections.value.length > 1 ? false : true;
|
|
|
}
|
|
|
|
|
|
/** 取消按钮 */
|
|
@@ -302,8 +423,8 @@ const handleCancel = () => {
|
|
|
};
|
|
|
|
|
|
const showInBatch = () => {
|
|
|
- inBatchesDialogRef.value.open(selections.value[0])
|
|
|
-}
|
|
|
+ inBatchesDialogRef.value.open(selections.value[0]);
|
|
|
+};
|
|
|
|
|
|
onMounted(() => {
|
|
|
getDept();
|