feat:添加工艺路线复制功能

This commit is contained in:
shijing 2025-04-03 16:46:02 +08:00
parent e6c0069e74
commit ebf0a9a058
2 changed files with 107 additions and 11 deletions

View File

@ -440,8 +440,8 @@ export default {
},
copy:{
name: "复制",
req: async function (id,data) {
return await http.post(`${config.API_URL}/mtm/routepack/${id}/copy/`,data)
req: async function (data) {
return await http.post(`${config.API_URL}/mtm/routepack/copy/`,data)
}
},
togglestate:{

View File

@ -93,14 +93,14 @@
@click="table_show(scope.row, scope.$index)"
>查看
</el-button>
<!-- <el-button
<el-button
link
type="success"
size="small"
v-if="scope.row.state == 30"
@click="table_copy(scope.row)"
>复制
</el-button> -->
</el-button>
<el-button
link
type="success"
@ -127,6 +127,57 @@
</scTable>
</el-main>
</el-container>
<el-dialog title="复制工艺" v-model="dialogVisible">
<el-form ref="dialogForm" :model="form" :rules="rules" label-position="right" label-width="80px">
<el-row>
<el-col>
<el-form-item label="名称" prop="new_name">
<el-input
v-model="form.new_name"
type="text"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="原料" prop="material_in">
<el-select
v-model="form.material_in"
style="width: 100%"
filterable
>
<el-option
v-for="item in materialIn"
:key="item.id"
:label="item.full_name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="产品" prop="material_out">
<el-select
v-model="form.material_out"
style="width: 100%"
filterable
>
<el-option
v-for="item in materialOut"
:key="item.id"
:label="item.full_name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button type="primary" :loading="isSaveing" @click="form_save">保存</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</template>
</el-dialog>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@ -183,9 +234,22 @@ export default {
search: "",
keyword: null,
},
form:{
routepack:"",
new_name:"",
material_in:"",
material_out:""
},
rules: {
new_name:[{required: true,message: "请填写新工艺名称",trigger: "blur"}],
material_in:[{required: true,message: "请选择新工艺所用原料",trigger: "blur"}],
material_out:[{required: true,message: "请选择新工艺最终产品",trigger: "blur"}],
},
nodes:[],
edges:[],
timeRange: [],
materialIn: [],
materialOut: [],
filteType: "all",
stateOptions: [
{
@ -209,13 +273,28 @@ export default {
filterType: "all",
isSaveing:false,
limitedWatch:false,
dialogVisible:false,
};
},
mounted() {
let userInfo = this.$TOOL.data.get("USER_INFO");
this.userId = userInfo.id;
this.getMaterialIn();
this.getMaterialOut();
},
methods: {
getMaterialIn() {
let that = this;
that.$API.mtm.material.list.req({ page: 0, type__in: "20,30",is_hidden: false}).then((res) => {
that.materialIn = res;
});
},
getMaterialOut() {
let that = this;
that.$API.mtm.material.list.req({ page: 0, type__in: "10,20",is_hidden: false}).then((res) => {
that.materialOut = res;
});
},
getType(state) {
if (state == 10) {
return "warning";
@ -252,13 +331,30 @@ export default {
},
//
table_copy(row){
this.$API.mtm.routepack.copy.req(row.id).then((res) => {
this.$message.success("复制成功");
this.$refs.table.refresh();
return res;
}).catch((err) => {
return err;
});
let that = this;
that.form.routepack = row.id;
that.form.new_name = '';
that.form.material_in = '';
that.form.material_out ='';
that.dialogVisible = true;
},
form_save(){
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.$API.mtm.routepack.copy.req(that.form).then((res) => {
that.$message.success("复制成功");
that.$refs.table.refresh();
that.isSaveing = false;
that.dialogVisible = false;
return res;
}).catch((err) => {
that.isSaveing = false;
return err;
});
}
})
},
// handleWatch(row) {
// let that = this;