Commit ffbdc0fe authored by tanjunxin's avatar tanjunxin

fix: 生产组合单追加生产单增加查询及表格优化

parent ffcce544
<template>
<div class="app-container">
<div class="app-container" style="padding: 0">
<el-form
:model="queryParams"
@submit.native.prevent
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="工单编码" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
placeholder="请输入工单编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
......@@ -11,12 +40,10 @@
:disabled="multiple"
@click="handleCombination"
v-hasPermi="['pro:combination:add']"
>追加到组合单
>追加到组合单
</el-button>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="workorderList"
......@@ -25,15 +52,15 @@
@selection-change="handleSelectionChange"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="工单编码" width="180" prop="workorderCode"/>
<el-table-column
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工单编码" width="180" prop="workorderCode" />
<!-- <el-table-column
label="组合单号"
width="180"
align="center"
prop="combinationCode"
:show-overflow-tooltip="true"
/>
/> -->
<el-table-column
label="工单名称"
width="200"
......@@ -41,7 +68,7 @@
prop="workorderName"
:show-overflow-tooltip="true"
/>
<el-table-column label="工单来源" align="center" prop="orderSource">
<!-- <el-table-column label="工单来源" align="center" prop="orderSource">
<template slot-scope="scope">
<dict-tag
:options="dict.type.mes_workorder_sourcetype"
......@@ -61,7 +88,7 @@
width="140"
align="center"
prop="sourceCode"
/>
/> -->
<el-table-column
label="产品编号"
width="120"
......@@ -75,7 +102,7 @@
prop="productName"
:show-overflow-tooltip="true"
/>
<el-table-column
<!-- <el-table-column
label="规格型号"
align="center"
prop="productSpc"
......@@ -108,7 +135,7 @@
align="center"
prop="clientName"
:show-overflow-tooltip="true"
/>
/> -->
<el-table-column
label="需求日期"
align="center"
......@@ -119,14 +146,14 @@
<span>{{ parseTime(scope.row.requestDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="单据状态" align="center" prop="status">
<!-- <el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag
:options="dict.type.mes_workorder_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
</el-table-column> -->
</el-table>
<pagination
v-show="total > 0"
......@@ -146,16 +173,16 @@ import {
addWorkorder,
updateWorkorder,
dofinish,
doCheckToolNum
doCheckToolNum,
} from "@/api/mes/pro/workorder";
import {addProtaskList} from "@/api/mes/pro/protask";
import { addProtaskList } from "@/api/mes/pro/protask";
import ItemSelect from "@/components/itemSelect/single.vue";
import ClientSelect from "@/components/clientSelect/single.vue";
import VendorSelect from "@/components/vendorSelect/single.vue";
import {genCode} from "@/api/system/autocode/rule";
import { genCode } from "@/api/system/autocode/rule";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getToken} from "@/utils/auth";
import {batchAddCombination} from "@/api/mes/pro/combination";
import { getToken } from "@/utils/auth";
import { batchAddCombination } from "@/api/mes/pro/combination";
export default {
name: "chooseWorkorderForComb",
......@@ -167,8 +194,8 @@ export default {
props: {
combinationCode: {
type: String,
default: null
}
default: null,
},
},
components: {
ItemSelect,
......@@ -209,7 +236,7 @@ export default {
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: {Authorization: "Bearer " + getToken()},
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/mes/pro/workorder/importData",
},
......@@ -244,31 +271,31 @@ export default {
// 表单校验
rules: {
workorderCode: [
{required: true, message: "工单编码不能为空", trigger: "blur"},
{ required: true, message: "工单编码不能为空", trigger: "blur" },
],
workorderName: [
{required: true, message: "工单名称不能为空", trigger: "blur"},
{ required: true, message: "工单名称不能为空", trigger: "blur" },
],
workorderType: [
{required: true, message: "请选择生产工单类型", trigger: "blur"},
{ required: true, message: "请选择生产工单类型", trigger: "blur" },
],
orderSource: [
{required: true, message: "来源类型不能为空", trigger: "blur"},
{ required: true, message: "来源类型不能为空", trigger: "blur" },
],
productId: [
{required: true, message: "产品不能为空", trigger: "blur"},
{ required: true, message: "产品不能为空", trigger: "blur" },
],
productCode: [
{required: true, message: "产品编号不能为空", trigger: "blur"},
{ required: true, message: "产品编号不能为空", trigger: "blur" },
],
productName: [
{required: true, message: "产品名称不能为空", trigger: "blur"},
{ required: true, message: "产品名称不能为空", trigger: "blur" },
],
quantity: [
{required: true, message: "生产数量不能为空", trigger: "blur"},
{ required: true, message: "生产数量不能为空", trigger: "blur" },
],
requestDate: [
{required: true, message: "需求日期不能为空", trigger: "blur"},
{ required: true, message: "需求日期不能为空", trigger: "blur" },
],
},
};
......@@ -280,25 +307,27 @@ export default {
async handleCombination() {
let params = {
combinationCode: this.combinationCode,
workorderList: []
}
workorderList: [],
};
let shouldExit = false;
this.selectedRows.forEach((item, index) => {
console.log(item);
if (item.combinationCode != '' && item.combinationCode != null) {
this.$modal.msgWarning(`${item.workorderCode}生产单已绑定组合单,不能再绑定!`);
shouldExit = true
if (item.combinationCode != "" && item.combinationCode != null) {
this.$modal.msgWarning(
`${item.workorderCode}生产单已绑定组合单,不能再绑定!`
);
shouldExit = true;
}
params["workorderList"].push({
workorderId: item.workorderId,
workorderCode: item.workorderCode
})
workorderCode: item.workorderCode,
});
});
if (!shouldExit) {
batchAddCombination(params).then(response => {
if(response.length == 0){
batchAddCombination(params).then((response) => {
if (response.length == 0) {
this.$modal.msgWarning("不允许组合");
}else {
} else {
this.$modal.msgSuccess("追加组合单成功");
}
this.getList();
......@@ -340,10 +369,10 @@ export default {
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
response.msg +
"</div>",
"导入结果",
{dangerouslyUseHTMLString: true}
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
......@@ -472,7 +501,7 @@ export default {
},
// 查询明细按钮操作
handleView(row) {
handleView
handleView;
this.reset();
this.getTreeselect();
const workorderId = row.workorderId || this.ids;
......@@ -491,9 +520,9 @@ export default {
handleSelectionChange(selection) {
// this.selectedRows = val;
this.selectedRows = selection;
this.ids = selection.map(item => item.toolId)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map((item) => item.toolId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
// // 多选框选中数据
// handleSelectionChange(selection) {
......@@ -555,8 +584,7 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {
});
.catch(() => {});
},
/** 生产任务单操作 */
handleDofinish() {
......@@ -572,8 +600,7 @@ export default {
this.getList();
this.$modal.msgSuccess("生成成功");
})
.catch(() => {
});
.catch(() => {});
},
handleToolNumCheck() {
this.$modal
......@@ -586,8 +613,7 @@ export default {
this.getList();
this.$modal.msgSuccess("已齐套");
})
.catch(() => {
});
.catch(() => {});
},
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true;
......@@ -625,8 +651,7 @@ export default {
this.getList();
this.$modal.msgSuccess("更改成功");
})
.catch(() => {
});
.catch(() => {});
},
// //物料选择弹出框
// onItemSelected(obj){
......@@ -672,8 +697,7 @@ export default {
this.getList();
this.$modal.msgSuccess("已确认成功");
})
.catch(() => {
});
.catch(() => {});
},
//自动生成编码
handleAutoGenChange(autoGenFlag) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment