feat: 物料/工段/工艺路线页面及排产部分逻辑

This commit is contained in:
caoqianming 2023-10-18 16:31:52 +08:00
parent ae47399224
commit 848182e6a4
10 changed files with 1154 additions and 1255 deletions

View File

@ -692,16 +692,6 @@ const routes = [
}, },
"component": "mtm/materials" "component": "mtm/materials"
}, },
{
"name": "products",
"path": "/mtm/products",
"meta": {
"title": "产品管理",
"icon": "el-icon-cellphone",
"perms": ["mtm"]
},
"component": "mtm/products"
},
{ {
"name": "mgruops", "name": "mgruops",
"path": "/mtm/mgruops", "path": "/mtm/mgruops",
@ -712,6 +702,16 @@ const routes = [
}, },
"component": "mtm/mgroup" "component": "mtm/mgroup"
}, },
{
"name": "route",
"path": "/mtm/route",
"meta": {
"title": "加工路线",
"icon": "el-icon-share",
"perms": ["mtm"]
},
"component": "mtm/route"
},
// { // {
// "name": "process", // "name": "process",
// "path": "/mtm/process", // "path": "/mtm/process",
@ -930,16 +930,6 @@ const routes = [
"perms": ["sam"] "perms": ["sam"]
}, },
"children": [ "children": [
{
"name": "contract",
"path": "/sam/contract",
"meta": {
"title": "合同信息",
"icon": "el-icon-cellphone",
"perms": ["sam"]
},
"component": "sam/contract"
},
{ {
"name": "customer", "name": "customer",
"path": "/sam/customer", "path": "/sam/customer",
@ -950,6 +940,16 @@ const routes = [
}, },
"component": "sam/customer" "component": "sam/customer"
}, },
{
"name": "contract",
"path": "/sam/contract",
"meta": {
"title": "合同信息",
"icon": "el-icon-cellphone",
"perms": ["sam"]
},
"component": "sam/contract"
},
{ {
"name": "samOrder", "name": "samOrder",
"path": "/sam/samOrder", "path": "/sam/samOrder",

View File

@ -1,360 +1,171 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button> <el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
</div> </div>
<!-- <div class="right-panel"> </el-header>
<el-date-picker <el-main class="nopadding">
v-model="query.date" <el-container>
type="daterange" <el-header>
range-separator="至" <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" type="card">
start-placeholder="开始时间" <el-tab-pane v-for="item in tabOptions" v-bind:key="item.name" :label="item.label" :name="item.name">
end-placeholder="结束时间" </el-tab-pane>
/> </el-tabs>
<el-button <el-checkbox v-model="showHidden" label="显示隐式物料" @change="hiddenChange" />
type="primary" </el-header>
icon="el-icon-search" <el-main class="nopadding">
@click="handleQuery" <scTable ref="table" :apiObj="apiObj" row-key="id" stripe>
>查询</el-button> <el-table-column type="index" width="50" />
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{ typeOptions[scope.row.type] }}</el-tag>
<el-tag type="warning" v-if="scope.row.is_assemb"></el-tag>
<el-tag type="warning" v-if="scope.row.process_name">{{ scope.row.process_name }}</el-tag>
<el-tag type="warning" v-if="scope.row.is_hidden"></el-tag></span>
</template>
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100">
<template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)" v-auth="'material.update'">
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'material.delete'">
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</div> --> </el-main>
</el-header> </el-container>
<el-main style="background:#ffffff;padding:20px"> <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> @closed="dialog.save = false"></save-dialog>
<el-tab-pane label="主要原料" name="主要原料">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query3"
>
<el-table-column type="index" width="50"/>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{typeOptions[scope.row.type]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="辅助材料" name="辅助材料">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query4"
>
<el-table-column type="index" width="50"/>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{typeOptions[scope.row.type]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="加工工具" name="加工工具">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query5"
>
<el-table-column type="index" width="50"/>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{typeOptions[scope.row.type]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="辅助工装" name="辅助工装">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query6"
>
<el-table-column type="index" width="50"/>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{typeOptions[scope.row.type]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="办公工具" name="办公用品">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query7"
>
<el-table-column type="index" width="50"/>
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料类别" prop="type">
<template #default="scope">
<span><el-tag type="primary">{{typeOptions[scope.row.type]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格型号" prop="specification">
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template> </template>
<script> <script>
import saveDialog from "./materials_form.vue"; import saveDialog from "./materials_form.vue";
export default { export default {
name: "rparty", name: "rparty",
components: { components: {
saveDialog, saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: null,
query: { type: 10, is_hidden: false },
activeName: '主要原料',
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
tabOptions: [
{ label: "成品", name: 10 },
{ label: "半成品", name: 20 },
{ label: "主要原料", name: 30 },
{ label: "辅助材料", name: 40 },
{ label: "加工工具", name: 50 },
{ label: "辅助工装", name: 60 },
{ label: "办公用品", name: 70 },
{ label: "电/水/气", name: 0 },
],
typeOptions: {
0: '电/水/气',
10: '成品',
20: '半成品',
30: '主要原料',
40: '辅助材料',
50: '加工工具',
60: '辅助工装',
70: '办公用品',
},
showHidden: false,
};
},
mounted() {
this.apiObj = this.$API.mtm.material.list
this.$refs.table.queryData(this.query)
},
methods: {
handleClick(pane, ev) {
this.query.type = pane.props.name
this.query.page = 1
this.$refs.table.queryData(this.query)
}, },
data() { //
return { add() {
dialog: { this.dialog.save = true;
save: false, this.$nextTick(() => {
}, this.$refs.saveDialog.open("add");
apiObj: this.$API.mtm.material.list, });
query3: {
page:1,
page_size:20,
type:30
},
query4: {
page:1,
page_size:20,
type:40
},
query5: {
page:1,
page_size:20,
type:50
},
query6: {
page:1,
page_size:20,
type:60
},
query7: {
page:1,
page_size:20,
type:70
},
activeName:'主要原料',
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
typeOptions:{
0:'电/水/气',
10:'成品',
20:'半成品',
30:'主要原料',
40:'辅助材料',
50:'加工工具',
60:'辅助工装',
70:'办公用品',
},
};
}, },
methods: { //
// table_edit(row) {
add() { this.dialog.save = true;
this.dialog.save = true; this.$nextTick(() => {
this.$nextTick(() => { this.$refs.saveDialog.open("edit").setData(row);
this.$refs.saveDialog.open("add"); });
}); },
}, //
// table_show(row) {
table_edit(row) { this.dialog.save = true;
this.dialog.save = true; this.$nextTick(() => {
this.$nextTick(() => { this.$refs.saveDialog.open("show").setData(row);
this.$refs.saveDialog.open("edit").setData(row); });
}); },
}, //
// async table_del(row) {
table_show(row) { this.$confirm(`确定删除吗?`, "提示", {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.$API.pm.mtask.delete.req(row.id).then((res) => { this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$message.success("删除成功"); this.$message.success("删除成功");
return res; return res;
}).catch((err) => { }).catch((err) => {
return err; return err;
}); });
}).catch(() => {}); }).catch(() => { });
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
}, },
};
</script> //
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
hiddenChange(val) {
if (val) {
this.query.is_hidden = ''
}
else {
this.query.is_hidden = false
}
this.$refs.table.queryData(this.query)
}
},
};
</script>

View File

@ -2,27 +2,29 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'mgroup.create'"></el-button>
</div>
<div class="right-panel">
<el-input style="margin-right: 5px;" v-model="query.search" placeholder="名称" clearable></el-input> <el-input style="margin-right: 5px;" v-model="query.search" placeholder="名称" clearable></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'mgroup.create'"></el-button>
</div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<scTable ref="table" :data="tableData" row-key="id" hidePagination> <scTable ref="table" :apiObj="apiObj" row-key="id" hidePagination :params="params">
<el-table-column label="#" type="index" width="50"></el-table-column> <el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="工段名称" prop="name" min-width="100"></el-table-column> <el-table-column label="工段名称" prop="name" min-width="100"></el-table-column>
<!-- <el-table-column label="工序" prop="cate" min-width="100"> <el-table-column label="所在工序" prop="cate" min-width="100">
<template #default="scope"> <template #default="scope">
<span>{{ cates_[scope.row.cate] }}</span> <span>{{ scope.row.process_cate }} - {{ scope.row.process_name }}</span>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="所属部门" prop="belong_dept_name" min-width="150"></el-table-column> <el-table-column label="所属部门" prop="belong_dept_name" min-width="150"></el-table-column>
<el-table-column label="排序" prop="sort" min-width="80"></el-table-column>
<el-table-column label="创建时间" prop="create_time" min-width="150"></el-table-column> <el-table-column label="创建时间" prop="create_time" min-width="150"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140"> <el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope"> <template #default="scope">
<el-button link size="small" @click="table_edit(scope.row)" v-auth="'mgroup.update'" type="primary">编辑</el-button> <el-button link size="small" @click="table_edit(scope.row)" v-auth="'mgroup.update'"
type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)"> <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference> <template #reference>
@ -34,93 +36,84 @@
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
<save-dialog <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
v-if="dialog.save" @closed="dialog.save = false"></save-dialog>
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template> </template>
<script> <script>
import saveDialog from "./mgroup_form.vue"; import saveDialog from "./mgroup_form.vue";
export default { export default {
name: 'dept', name: 'mgroup',
components: { components: {
saveDialog saveDialog
}, },
data() { data() {
return { return {
apiObj: this.$API.mtm.mgroup.list, apiObj: this.$API.mtm.mgroup.list,
query: {}, params: { 'cate': 'photon' },
dialog: { query: {},
save: false, dialog: {
permission: false, save: false,
}, permission: false,
tableData:[],
selection:[],
cates_:{
'section':'工序',
'other':'其他',
},
}
},
mounted(){
this.getTableData();
},
methods: {
getTableData(){
this.$API.mtm.mgroup.list.req({page:0}).then(res=>{
let data = [];
res.forEach(item => {
if(!item.need_enm){
data.push(item)
}
});
this.tableData = data;
});
}, },
// tableData: [],
table_add() { selection: [],
this.dialog.save = true; cates_: {
this.$nextTick(() => { 'section': '工序',
this.$refs.saveDialog.open("add"); 'other': '其他',
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
async table_del(row){
var id = row.id;
var res = await this.$API.mtm.mgroup.delete.req(id);
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//
selectionChange(selection){
this.selection = selection;
},
//
handleQuery(){
this.$refs.table.queryData(this.query)
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
}, },
} }
},
mounted() {
},
methods: {
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
async table_del(row) {
var id = row.id;
var res = await this.$API.mtm.mgroup.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg)
} else {
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query)
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
} }
}
</script> </script>
<style scoped> <style scoped>
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;} .treeMain {
width: 100%;
height: 280px;
overflow: auto;
border: 1px solid #dcdfe6;
margin-bottom: 10px;
}
</style> </style>

View File

@ -1,173 +1,137 @@
<template> <template>
<el-dialog <el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
:title="titleMap[mode]" <el-container v-loading="loading">
v-model="visible" <el-main style="padding: 0 20px 20px 20px">
:size="1000" <el-form ref="dialogForm" :model="form" :rules="rules" label-position="right" label-width="80px"
destroy-on-close style="padding: 0 10px;">
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px;"
>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="form.name" clearable></el-input> <el-input v-model="form.name" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="工序" prop="process"> <el-form-item label="工序" prop="process">
<el-select <el-select v-model="form.process" placeholder="工序" clearable style="width: 100%;">
v-model="form.process" <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
placeholder="工序"
clearable
style="width: 100%;"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属部门"> <el-form-item label="所属部门">
<el-select <el-select v-model="form.belong_dept" placeholder="所属部门" clearable style="width: 100%;">
v-model="form.belong_dept" <el-option v-for="item in group" :key="item.id" :label="item.name" :value="item.id"></el-option>
placeholder="所属部门"
clearable
style="width: 100%;"
>
<el-option
v-for="item in group"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" :min="1" />
</el-form-item>
</el-form> </el-form>
</el-main> </el-main>
<el-footer> <el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button> <el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
</el-footer> </el-footer>
</el-container> </el-container>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
const defaultForm = { const defaultForm = {
name: "", name: "",
process:'', process: '',
cate:'photon', cate: 'photon',
belong_dept:'', belong_dept: '',
need_enm:false, need_enm: false,
}; };
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
return { return {
loading: false, loading: false,
mode: "add", mode: "add",
titleMap: { titleMap: {
add: '新增测点集', add: '新增',
edit: '编辑测点集', edit: '编辑',
show: '查看测点集' show: '查看'
}, },
// //
form: { form: {
}, },
// //
rules: { rules: {
name: [{required: true, message: "请输入名称", trigger: "blur"}], name: [{ required: true, message: "请输入名称", trigger: "blur" }],
process: [{required: true, message: "请选择工序", trigger: "blur"}], // process: [{ required: true, message: "", trigger: "blur" }],
belong_dept: [{required: true, message: "请选择所属部门", trigger: "blur"}] belong_dept: [{ required: true, message: "请选择所属部门", trigger: "blur" }]
}, },
visible: false, visible: false,
isSaveing: false, isSaveing: false,
options:[], options: [],
group: [], group: [],
materials:[], materials: [],
setFiltersVisible: false, setFiltersVisible: false,
}; };
},
mounted() {
this.getGroup();//
this.getProcess();//
},
methods: {
//
getGroup() {
this.$API.system.dept.list.req({ page: 0, type: 'dept' }).then(res => {
this.group = res;
});
}, },
mounted() { //
this.getGroup();// getProcess() {
this.getProcess();// var res = this.$API.mtm.process.list.req({ page: 0 }).then(res => {
this.options = res;
});
}, },
methods: { //
// open(mode = "add") {
getGroup() { this.mode = mode;
this.$API.system.dept.list.req({page:0,type:'dept'}).then(res=>{ this.visible = true;
let data = []; return this;
res.forEach(item => { },
if(item.parent=='3423856735881117696'){ //
data.push(item) setData(data) {
} Object.assign(this.form, data);
}); },
this.group = data; getReceptionist(data) {
}); this.form.leader = data.id;
}, this.form.leader_name = data.name
// },
getProcess(){ //
var res = this.$API.mtm.process.list.req({page:0}).then(res=>{ submit() {
this.options = res; let that = this;
}); that.$refs.dialogForm.validate(async (valid) => {
}, if (valid) {
// that.form.cate = 'photon';
open(mode = "add") { that.form.need_enm = false;
this.mode = mode; that.isSaveing = true;
this.visible = true; if (that.mode === 'add') {
return this; that.$API.mtm.mgroup.create.req(that.form).then(res => {
}, that.isSaveing = false;
// that.$emit("success", that.form, that.mode);
setData(data) { that.visible = false;
Object.assign(this.form,data); that.$message.success("操作成功");
}, })
getReceptionist(data) { } else {
this.form.leader=data.id; that.$API.mtm.mgroup.update.req(that.form.id, that.form).then(res => {
this.form.leader_name=data.name that.isSaveing = false;
}, that.$emit("success", that.form, that.mode);
// that.visible = false;
submit() { that.$message.success("操作成功");
let that = this; })
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.form.cate = 'photon';
that.form.need_enm = false;
that.isSaveing = true;
if(that.mode==='add'){
that.$API.mtm.mgroup.create.req(that.form).then(res=>{
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
})
}else{
that.$API.mtm.mgroup.update.req(that.form.id,that.form).then(res=>{
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
})
}
} }
}); }
}, });
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
}, },
};
</script>
<style> //
</style> setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

237
src/views/mtm/route.vue Normal file
View File

@ -0,0 +1,237 @@
<template>
<el-container>
<el-aside width="300px">
<el-container>
<el-main class="nopadding">
<div style="font-size: 20px; padding: 8px;">产品</div>
<el-tree node-key="id" :data="productOptions" @node-click="productClick"></el-tree>
</el-main>
</el-container>
</el-aside>
<el-main class="nopadding">
<el-container>
<el-aside width="200px">
<el-container>
<el-header>
<div style="font-size: 20px; padding: 8px;" v-if="selectedProduct">{{ selectedProduct.name }}
</div>
</el-header>
<el-main class="nopadding">
<div style="height: 90%; padding: 8px">
<el-steps direction="vertical" active="20">
<el-step v-for="item in currentRoute" v-bind:key="item.id" :title="item.process_name" />
</el-steps>
</div>
</el-main>
</el-container>
</el-aside>
<el-main class="nopadding">
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="table_add"
v-auth="'route.create'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :data="currentRoute" row-key="id" hidePagination>
<el-table-column label="排序" prop="sort" min-width="80"></el-table-column>
<el-table-column label="工序" min-width="120">
<template #default="scope">
<span>{{ scope.row.process_cate }} - {{ scope.row.process_name }}</span>
</template>
</el-table-column>
<el-table-column label="自动排产" prop="is_autotask" min-width="80">
<template #default="scope">
<el-icon v-if="scope.row.is_autotask" color="green">
<CircleCheckFilled />
</el-icon>
</template>
</el-table-column>
<el-table-column label="输入/输出" min-width="120">
<template #default="scope">
<span>{{ scope.row.material_in_name }} / {{ scope.row.material_out_name }}</span>
</template>
</el-table-column>
<el-table-column label="出材率" prop="out_rate" min-width="80"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope">
<el-button link size="small" @click="table_edit(scope.row)" v-auth="'mgroup.update'"
type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'mgroup.delete'"
type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-main>
</el-container>
</el-main>
</el-container>
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="30%">
<el-form ref="dialogForm" :model="form" :rules="rules" label-position="right" label-width="80px">
<el-form-item label="排序" prop="sort">
<el-input-number v-model="form.sort" :min="1" />
</el-form-item>
<el-form-item label="工序" prop="process">
<el-select v-model="form.process" placeholder="工序" clearable style="width: 100%;" :disabled="updateDisable">
<el-option v-for="item in processOptions" :key="item.id" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="出材率" prop="out_rate">
<el-input-number v-model="form.out_rate" :max="100" :precision="1" :step="0.1" />
</el-form-item>
<el-form-item label="自动排产" prop="is_autotask">
<el-switch v-model="form.is_autotask" />
</el-form-item>
<el-form-item label="主要输入" prop="material_in">
<el-select v-model="form.material_in" placeholder="物料" clearable style="width: 100%;">
<el-option v-for="item in materialOptions" :key="item.id" :label="item.name" :value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="
float: right;
color: '#E6A23C';
font-size: 13px;
" v-if="item.is_hidden">{{ item.process_name }}-</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="主要输出" prop="material_out">
<el-select v-model="form.material_out" placeholder="物料" clearable style="width: 100%;">
<el-option v-for="item in materialOptions" :key="item.id" :label="item.name" :value="item.id"><span
style="float: left">{{ item.name }}</span>
<span style="
float: right;
color: '#E6A23C';
font-size: 13px;
" v-if="item.is_hidden">{{ item.process_name }}-</span></el-option>
</el-select>
</el-form-item>
</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>
</template>
<script>
const defaultForm = {
process: null,
sort: 1,
out_rate: 100,
is_autotask: true,
};
export default {
name: "route",
components: {},
data() {
return {
apiObj: null,
query: {},
productOptions: [],
dialogVisible: false,
form: {},
rules: {
process: [{ required: true, trigger: "blur" }],
sort: [{ required: true, trigger: "blur" }],
out_rate: [{ required: true, trigger: "blur" }]
},
processOptions: [],
materialOptions: [],
selectedProduct: { id: 0 },
dialogTitle: '新增',
updateDisable: false,
currentRoute: [],
}
},
mounted() {
this.getProducts()
this.getProcess()
this.getMaterial()
},
methods: {
getRoute() {
this.$API.mtm.route.list({ material: this.selectedProduct.id, page: 0 }).then(res => {
this.currentRoute = res
})
},
//
getProcess() {
var res = this.$API.mtm.process.list.req({ page: 0 }).then(res => {
this.processOptions = res;
});
},
getMaterial() {
this.$API.mtm.material.list.req({ page: 0, type__in: "10,20" }).then(res => {
this.materialOptions = res
})
},
getProducts() {
this.$API.mtm.material.list.req({ page: 0, type: 10, is_assemb: false }).then(res => {
res.forEach(m => {
m.label = m.name
})
this.productOptions = res
})
},
table_add() {
if (this.selectedProduct.id === 0) {
this.$message.error('请先选择左侧产品');
return
}
this.dialogTitle = '新增'
this.updateDisable = false;
this.form = Object.assign({}, defaultForm);
this.form.material = this.selectedProduct.id
this.dialogVisible = true;
},
table_edit(row) {
this.dialogTitle = '编辑'
this.updateDisable = true;
this.form = Object.assign({}, row);
this.dialogVisible = true;
},
table_del(row) {
this.$API.mtm.route.delete.req(row.id).then(res => {
this.productClick()
})
},
form_save() {
if (this.dialogTitle == '新增') {
this.$API.mtm.route.create.req(this.form).then(res => {
this.productClick()
this.dialogVisible = false
this.getMaterial()
})
} else if (this.dialogTitle == '编辑') {
this.$API.mtm.route.update.req(this.form.id, this.form).then(res => {
this.productClick()
this.dialogVisible = false
})
}
},
productClick(data) {
let materialId = this.selectedProduct.id
if (data) {
this.selectedProduct = data
materialId = data.id
}
this.$API.mtm.route.list.req({ page: 0, material: materialId }).then(res => {
this.currentRoute = res
})
}
}
}
</script>

View File

@ -1,112 +1,100 @@
<template> <template>
<el-container style="flex-direction: column"> <el-container style="flex-direction: column">
<el-main class="nopadding" style="position: relative;height: 50%;margin-bottom: 20px;"> <el-main class="nopadding" style="position: relative;height: 50%;margin-bottom: 20px;">
<div class="right-panel" style=" display: inline-block;position: absolute;right: 20px;margin-top: 4px;"> <div class="right-panel" style=" display: inline-block;position: absolute;right: 20px;margin-top: 4px;z-index: 100">
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button> <el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
<el-button type="primary" icon="el-icon-plus" @click="add">任务下达</el-button> <el-button type="primary" icon="el-icon-plus" @click="mtaskAssgin">任务下达</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" >导出</el-button> </div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="粗加工6车间" name="first">
<scTable ref="table1" :apiObj="apiMtask" row-key="id" stripe :params="paramsMtask" hidePagination>
<el-table-column type="selection" width="55" />
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number">
</el-table-column>
<el-table-column label="任务状态" prop="state">
<template #default="scope"><span>{{ mtaskStateOptions[scope.row.state] }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="产品名称" prop="material" show-overflow-tooltip>
</el-table-column>
<el-table-column label="型号" prop="number">
</el-table-column> -->
<el-table-column label="工段" prop="mgroup_name">
</el-table-column>
<el-table-column label="任务量" prop="count">
</el-table-column>
<el-table-column label="实际生产数" prop="count_real">
</el-table-column>
<el-table-column label="开工时间" prop="start_date">
</el-table-column>
<el-table-column label="完工时间" prop="end_date">
</el-table-column>
<!-- <el-table-column label="完成量" prop="count">
</el-table-column> -->
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)" v-auth="'equipment.update'">
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'equipment.delete'">
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
</el-tabs>
</el-main>
<el-main class="nopadding" style="position: relative;height: 50%;">
<div class="right-panel" v-if="activeNameSub == 'order'"
style="display: inline-block;position: absolute;right: 20px;margin-top: 4px;">
<el-button type="primary" icon="el-icon-plus" @click="startPlan">排产</el-button>
<el-button type="primary" icon="el-icon-plus">合并任务</el-button>
</div>
<el-tabs v-model="activeNameSub" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="订单排产" name="order">
<scTable ref="table2" :apiObj="apiOrderItem" row-key="id" stripe :params="paramsOrderItem" hidePagination>
<el-table-column type="selection" width="55" />
<el-table-column label="订单编号" prop="number">
<template #default="scope">
<span v-if="scope.row.order">{{ scope.row.order_.number }}</span>
</template>
</el-table-column>
<el-table-column label="产品名称" prop="number">
<template #default="scope">
<span v-if="scope.row.material">{{ scope.row.material_.name }}</span>
</template>
</el-table-column>
<el-table-column label="型号/规格" prop="count">
<template #default="scope">
<span v-if="scope.row.material">{{ scope.row.material_.specification }}</span>
</template>
</el-table-column>
<el-table-column label="需求量" prop="count">
</el-table-column>
<el-table-column label="交货时间" prop="delivery_date">
<template #default="scope">
<span v-if="scope.row.order">{{ scope.row.order_.delivery_date }}</span>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="生产进度" name="rate">
<div class="ganntClass" :style="{ height: ganttHeight }" v-loading="ganttLoading">
<div ref="gantt" class="gantt-container"></div>
</div> </div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <!-- <vue-gantt :tasks="tasks" :timerange="timeRange"></vue-gantt> -->
<el-tab-pane label="粗加工6车间" name="first"> </el-tab-pane>
<scTable </el-tabs>
ref="table" </el-main>
:apiObj="apiObj" </el-container>
row-key="id" <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
stripe @closed="dialog.save = false"></save-dialog>
:params="query" <el-dialog title="排产">
>
<el-table-column type="index" width="50"/> </el-dialog>
<el-table-column label="任务编号" prop="number">
</el-table-column>
<el-table-column label="产品名称" prop="material" show-overflow-tooltip>
</el-table-column>
<el-table-column label="型号" prop="number">
</el-table-column>
<el-table-column label="任务量" prop="number">
</el-table-column>
<el-table-column label="计划量" prop="count">
</el-table-column>
<!-- <el-table-column label="状态" prop="count">
</el-table-column> -->
<el-table-column label="日均产量" prop="count">
</el-table-column>
<el-table-column label="计划开工时间" prop="start_date">
</el-table-column>
<el-table-column label="计划完工时间" prop="end_date">
</el-table-column>
<el-table-column label="完成量" prop="count">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'equipment.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'equipment.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-tab-pane>
</el-tabs>
</el-main>
<el-main class="nopadding" style="position: relative;height: 50%;">
<div class="right-panel" v-if="activeNameSub=='order'" style="display: inline-block;position: absolute;right: 20px;margin-top: 4px;">
<el-button type="primary" icon="el-icon-plus">排产</el-button>
<el-button type="primary" icon="el-icon-plus">合并任务</el-button>
</div>
<el-tabs v-model="activeNameSub" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="订单排产" name="order">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
>
<el-table-column type="index" width="50"/>
<el-table-column label="订单编号" prop="number">
</el-table-column>
<el-table-column label="合同编号" prop="material" show-overflow-tooltip>
</el-table-column>
<el-table-column label="合同名称" prop="number">
</el-table-column>
<el-table-column label="产品名称" prop="number">
</el-table-column>
<el-table-column label="型号" prop="count">
</el-table-column>
<el-table-column label="规格" prop="count">
</el-table-column>
<el-table-column label="计划量" prop="count">
</el-table-column>
<el-table-column label="交货时间" prop="end_date">
</el-table-column>
</scTable>
</el-tab-pane>
<el-tab-pane label="生产进度" name="rate">
<div class="ganntClass" :style="{ height: ganttHeight }" v-loading="ganttLoading">
<div ref="gantt" class="gantt-container"></div>
</div>
<!-- <vue-gantt :tasks="tasks" :timerange="timeRange"></vue-gantt> -->
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template> </template>
<script> <script>
import gantt from 'dhtmlx-gantt'; import gantt from 'dhtmlx-gantt';
@ -115,61 +103,72 @@ import saveDialog from "./mtask_form.vue";
export default { export default {
name: "rparty", name: "rparty",
components: { components: {
saveDialog saveDialog
}, },
data() { data() {
return { return {
mtaskStateOptions: {
10: '创建中',
20: '已下达',
40: '已完成'
},
ganttHeight: '500px', ganttHeight: '500px',
ganttLoading: false, ganttLoading: false,
projectId: '', projectId: '',
orderitems: [],
tasks: { tasks: {
data: [] data: []
}, },
gantttt:{ gantttt: {
data:[], data: [],
links:[ links: [
{ id:1, source:1, target:3, type:"0"}, { id: 1, source: 1, target: 3, type: "0" },
{ id:2, source:12323545, target:12345453, type:"1"}, { id: 2, source: 12323545, target: 12345453, type: "1" },
{ id:3, source:12345453, target:12345437, type:"0"} { id: 3, source: 12345453, target: 12345437, type: "0" }
],
columns:[
{ align: 'right', name: 'color', label: '', width: '15',
template:function(task){
if(task.color){
return "<div class='tttttt' style='background:"+ task.color+ "'>"+"</div>"}
}
},
{ align: 'left', name: 'text', label: '', tree: true, width:"*",min_width:120},
{ align: 'center', name: 'person', label: '负责人', width: '100' },
{ align: 'right', name: 'time', label: '时间节点', width: '80' },
], ],
}, columns: [
{
align: 'right', name: 'color', label: '', width: '15',
template: function (task) {
if (task.color) {
return "<div class='tttttt' style='background:" + task.color + "'>" + "</div>"
}
}
},
{ align: 'left', name: 'text', label: '', tree: true, width: "*", min_width: 120 },
{ align: 'center', name: 'person', label: '负责人', width: '100' },
{ align: 'right', name: 'time', label: '时间节点', width: '80' },
],
},
dialog: { dialog: {
save: false, save: false,
}, },
apiObj: this.$API.pm.mtask.list, apiMtask: this.$API.pm.mtask.list,
apiOrderItem: this.$API.sam.orderitem.list,
paramsOrderItem: { mtask__isnull: true },
paramsMtask: { parent__isnull: true, mgroup__belong_dept__name: '6车间' },
query: { query: {
page:1, page: 1,
page_size:20, page_size: 20,
date:'' date: ''
}, },
activeName:'first', activeName: 'first',
activeNameSub:'order', activeNameSub: 'order',
selection: [], selection: [],
state_: { state_: {
10: '完好', 10: '完好',
20: '限用', 20: '限用',
30: '在修', 30: '在修',
40: '禁用', 40: '禁用',
}, },
}; };
}, },
created() { created() {
//gantt //gantt
gantt.clearAll(); gantt.clearAll();
}, },
mounted(){ mounted() {
var $this = this; var $this = this;
// //
gantt.i18n.setLocale('cn'); gantt.i18n.setLocale('cn');
@ -181,25 +180,26 @@ export default {
gantt.config.show_grid = true; gantt.config.show_grid = true;
//便使 //便使
gantt.config.columns = [ gantt.config.columns = [
{ {
name: 'text',label: '分项工程', name: 'text', label: '分项工程',
tree: true,width: '*',align: 'left',template: function (obj) { return `<span class="gantt-name-box" title="${obj.text}">${obj.text}</span>` } tree: true, width: '*', align: 'left', template: function (obj) { return `<span class="gantt-name-box" title="${obj.text}">${obj.text}</span>` }
}, },
{name: 'beginTime',label: '开始日期', width: '100',align: 'center', template: function (obj) {return obj.beginTime;}}, { name: 'beginTime', label: '开始日期', width: '100', align: 'center', template: function (obj) { return obj.beginTime; } },
{name: 'endTime',label: '结束日期',width: '100',align: 'center',template: function (obj) {return obj.endTime;}}, { name: 'endTime', label: '结束日期', width: '100', align: 'center', template: function (obj) { return obj.endTime; } },
{name: 'limitTime',label: '工期',width: '100', align: 'center',template: function (obj) {return `${obj.limitTime}`;} {
} name: 'limitTime', label: '工期', width: '100', align: 'center', template: function (obj) { return `${obj.limitTime}`; }
]; }
gantt.config.data=[ ];
{ "id": "1635835705701744641", "text": "345分项工程分项工程分项工程", "start_date": "2022-12-01", "beginTime": "2022-12-01", "endTime": "2023-03-14", "limitTime": 103, "duration": 103, "progress": 1 }, gantt.config.data = [
{ "id": "1635835705701744642", "text": "111", "start_date": "2023-03-14", "beginTime": "2023-03-14", "endTime": "2023-03-17", "limitTime": 3, "duration": 3, "progress": 1 }, { "id": "1635835705701744641", "text": "345分项工程分项工程分项工程", "start_date": "2022-12-01", "beginTime": "2022-12-01", "endTime": "2023-03-14", "limitTime": 103, "duration": 103, "progress": 1 },
{ "id": "1635835705701744643", "text": "分项工程", "start_date": "2023-03-13", "beginTime": "2023-03-13", "endTime": "2023-03-23", "limitTime": 10, "duration": 10, "progress": 1 }, { "id": "1635835705701744642", "text": "111", "start_date": "2023-03-14", "beginTime": "2023-03-14", "endTime": "2023-03-17", "limitTime": 3, "duration": 3, "progress": 1 },
{ "id": "1635835705701744644", "text": "分项工程1", "start_date": "2023-03-30", "beginTime": "2023-03-30", "endTime": "2023-04-20", "limitTime": 21, "duration": 21, "progress": 1 }, { "id": "1635835705701744643", "text": "分项工程", "start_date": "2023-03-13", "beginTime": "2023-03-13", "endTime": "2023-03-23", "limitTime": 10, "duration": 10, "progress": 1 },
{ "id": "1635835705701744645", "text": "分项工程2", "start_date": "2023-03-21", "beginTime": "2023-03-21", "endTime": "2023-03-29", "limitTime": 8, "duration": 8, "progress": 1 }, { "id": "1635835705701744644", "text": "分项工程1", "start_date": "2023-03-30", "beginTime": "2023-03-30", "endTime": "2023-04-20", "limitTime": 21, "duration": 21, "progress": 1 },
{ "id": "1635835705701744646", "text": "分项工程3", "start_date": "2023-03-23", "beginTime": "2023-03-23", "endTime": "2023-03-31", "limitTime": 8, "duration": 8, "progress": 1 }, { "id": "1635835705701744645", "text": "分项工程2", "start_date": "2023-03-21", "beginTime": "2023-03-21", "endTime": "2023-03-29", "limitTime": 8, "duration": 8, "progress": 1 },
{ "id": "1635835705701744647", "text": "6", "start_date": "2023-03-29", "beginTime": "2023-03-29", "endTime": "2023-03-30", "limitTime": 1, "duration": 1, "progress": 1 }, { "id": "1635835705701744646", "text": "分项工程3", "start_date": "2023-03-23", "beginTime": "2023-03-23", "endTime": "2023-03-31", "limitTime": 8, "duration": 8, "progress": 1 },
{ "id": "1635835705701744648", "text": "1", "start_date": "2023-03-16", "beginTime": "2023-03-16", "endTime": "2023-03-17", "limitTime": 1, "duration": 1, "progress": 1 }, { "id": "1635835705701744647", "text": "6", "start_date": "2023-03-29", "beginTime": "2023-03-29", "endTime": "2023-03-30", "limitTime": 1, "duration": 1, "progress": 1 },
]; { "id": "1635835705701744648", "text": "1", "start_date": "2023-03-16", "beginTime": "2023-03-16", "endTime": "2023-03-17", "limitTime": 1, "duration": 1, "progress": 1 },
];
// //
//gantt.config.fit_tasks = true; //gantt.config.fit_tasks = true;
gantt.config.row_height = 44; gantt.config.row_height = 44;
@ -216,7 +216,7 @@ export default {
return date.getFullYear(); return date.getFullYear();
}; };
var monthScaleTemplate = function (date) { var monthScaleTemplate = function (date) {
var month = date.getMonth()+1; var month = date.getMonth() + 1;
return month; return month;
}; };
var dayScaleTemplate = function (date) { var dayScaleTemplate = function (date) {
@ -250,7 +250,7 @@ export default {
// //
gantt.config.details_on_dblclick = false; gantt.config.details_on_dblclick = false;
//gantt //gantt
gantt.config.show_errors = false; gantt.config.show_errors = false;
// //
gantt.attachEvent('onBeforeTaskDrag', function (id, mode, e) { gantt.attachEvent('onBeforeTaskDrag', function (id, mode, e) {
@ -282,9 +282,23 @@ export default {
gantt.init(this.$refs.gantt); gantt.init(this.$refs.gantt);
}, },
methods: { methods: {
// mtaskAssgin() {
getProjectTaskData() { let rows = this.$refs.table1.getSelectionRows()
this.ganttLoading= true; if (rows.length == 0) {
this.$message.error('未选择任何任务')
return
}
},
startPlan() {
let rows = this.$refs.table2.getSelectionRows()
if (rows.length == 0) {
this.$message.error('未选择任何订单明细项目')
return
}
},
//
getProjectTaskData() {
this.ganttLoading = true;
this.tasks.data = []; this.tasks.data = [];
this.$http({ this.$http({
url: this.$http.adornUrl('url'), url: this.$http.adornUrl('url'),
@ -299,7 +313,7 @@ export default {
gantt.parse(this.tasks); gantt.parse(this.tasks);
// //
gantt.refreshData(); gantt.refreshData();
this.ganttLoading= false; this.ganttLoading = false;
} else { } else {
this.$message.error(data.msg); this.$message.error(data.msg);
} }
@ -341,15 +355,15 @@ export default {
// //
async table_del(row) { async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", { this.$confirm(`确定删除吗?`, "提示", {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.$API.pm.mtask.delete.req(row.id).then((res) => { this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$message.success("删除成功"); this.$message.success("删除成功");
return res; return res;
}).catch((err) => { }).catch((err) => {
return err; return err;
}); });
}).catch(() => {}); }).catch(() => { });
}, },
// //
@ -370,12 +384,14 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped>
.el-main.nopadding{ .el-main.nopadding {
padding:0 20px 20px 20px padding: 0 20px 20px 20px
} }
.gantt-container {
.gantt-container {
height: 30%; height: 30%;
} }
.ganntClass { .ganntClass {
background-color: #fff; background-color: #fff;
padding: 10px; padding: 10px;

View File

@ -1,153 +1,126 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-input <el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input>
v-model="query.search" <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
placeholder="名称" </div>
clearable <div class="right-panel">
style="margin-right: 5px;" <el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'contract.create'"></el-button>
></el-input> </div>
<el-button </el-header>
type="primary" <el-main class="nopadding">
icon="el-icon-search" <scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
@click="handleQuery" <el-table-column type="index" width="50" />
></el-button> <el-table-column label="合同名称" prop="name">
</div> </el-table-column>
<div class="right-panel"> <el-table-column label="合同编号" prop="number">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'contract.create'"></el-button> </el-table-column>
</div> <el-table-column label="合同金额" prop="amount">
</el-header> </el-table-column>
<el-main class="nopadding"> <el-table-column label="签订日期" prop="sign_date">
<scTable </el-table-column>
ref="table" <el-table-column label="关联客户" prop="customer_name">
:apiObj="apiObj" </el-table-column>
row-key="id" <el-table-column label="创建人" prop="create_by_name">
stripe </el-table-column>
:params="query" <el-table-column label="描述">
> <template #default="scope">{{ scope.row.description }}</template>
<el-table-column type="index" width="50"/> </el-table-column>
<el-table-column label="合同名称" prop="name"> <el-table-column label="操作" fixed="right" align="left" width="120">
</el-table-column> <template #default="scope">
<el-table-column label="合同编号" prop="number"> <el-link type="primary" @click="table_edit(scope.row)" v-auth="'contract.update'">
</el-table-column> 编辑
<el-table-column label="合同金额" prop="amount"> </el-link>
</el-table-column> <el-divider direction="vertical"></el-divider>
<el-table-column label="签订日期" prop="sign_date"> <el-link type="danger" @click="table_del(scope.row)" v-auth="'contract.delete'">
</el-table-column> 删除
<el-table-column label="关联客户" prop="customer"> </el-link>
</el-table-column> </template>
<el-table-column label="创建人" prop="create_by"> </el-table-column>
</el-table-column> </scTable>
<el-table-column label="描述"> </el-main>
<template #default="scope">{{ scope.row.description }}</template> </el-container>
</el-table-column> <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
<el-table-column label="操作" fixed="right" align="left" width="120"> @closed="dialog.save = false"></save-dialog>
<template #default="scope"> </template>
<el-link <script>
type="primary" import saveDialog from "./contract_form.vue";
@click="table_edit(scope.row)" export default {
v-auth="'contract.update'" name: "rparty",
> components: {
编辑 saveDialog,
</el-link> },
<el-divider direction="vertical"></el-divider> data() {
<el-link return {
type="danger" dialog: {
@click="table_del(scope.row)" save: false,
v-auth="'contract.delete'" },
> apiObj: this.$API.sam.contract.list,
删除 query: {
</el-link> page: 1,
</template> page_size: 20,
</el-table-column> type: 10
</scTable> },
</el-main> selection: [],
</el-container> state_: {
<save-dialog 10: '完好',
v-if="dialog.save" 20: '限用',
ref="saveDialog" 30: '在修',
@success="handleSaveSuccess" 40: '禁用',
@closed="dialog.save = false" },
></save-dialog> };
</template> },
<script> methods: {
import saveDialog from "./contract_form.vue"; //
export default { add() {
name: "rparty", this.dialog.save = true;
components: { this.$nextTick(() => {
saveDialog, this.$refs.saveDialog.open("add");
});
}, },
data() { //
return { table_edit(row) {
dialog: { this.dialog.save = true;
save: false, this.$nextTick(() => {
}, this.$refs.saveDialog.open("edit").setData(row);
apiObj: this.$API.sam.contract.list, });
query: {
page:1,
page_size:20,
type:10
},
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
}, },
methods: { //
// table_show(row) {
add() { this.dialog.save = true;
this.dialog.save = true; this.$nextTick(() => {
this.$nextTick(() => { this.$refs.saveDialog.open("show").setData(row);
this.$refs.saveDialog.open("add"); });
}); },
}, //
// async table_del(row) {
table_edit(row) { this.$confirm(`确定删除吗?`, "提示", {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
this.$API.pum.order.delete.req(row.id).then((res) => { this.$API.pum.order.delete.req(row.id).then((res) => {
this.$message.success("删除成功"); this.$message.success("删除成功");
return res; return res;
}).catch((err) => { }).catch((err) => {
return err; return err;
}); });
}).catch(() => {}); }).catch(() => { });
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
}, },
};
</script> //
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
},
};
</script>

View File

@ -1,183 +1,151 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-input <el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input>
v-model="query.search" <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
placeholder="名称" </div>
clearable <div class="right-panel">
style="margin-right: 5px;" <el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'order.delete'"></el-button>
></el-input> </div>
<el-button </el-header>
type="primary" <el-main class="nopadding">
icon="el-icon-search" <scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
@click="handleQuery" <el-table-column type="index" width="50" />
></el-button> <el-table-column label="订单编号" prop="number">
</div> </el-table-column>
<div class="right-panel"> <el-table-column label="状态" prop="state">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'order.delete'"></el-button> <template #default="scope">
</div> {{ stateOption[scope.row.state] }}
</el-header> </template>
<el-main class="nopadding"> </el-table-column>
<scTable <el-table-column label="客户" prop="customer_name" show-overflow-tooltip>
ref="table" </el-table-column>
:apiObj="apiObj" <el-table-column label="所属合同" prop="contract_number" show-overflow-tooltip>
row-key="id" </el-table-column>
stripe <el-table-column label="截止到货日期" prop="delivery_date">
:params="query" </el-table-column>
> <el-table-column label="提交时间" prop="submit_time">
<el-table-column type="index" width="50"/> </el-table-column>
<el-table-column label="订单编号" prop="number"> <el-table-column label="创建人" prop="create_by_name">
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="state"> <el-table-column label="备注">
<template #default="scope"> <template #default="scope">{{ scope.row.description }}</template>
<span><el-tag :type="stateOption[scope.row.state].color">{{stateOption[scope.row.state]}}</el-tag></span> </el-table-column>
</template> <el-table-column label="操作" fixed="right" align="center" width="200">
</el-table-column> <template #default="scope">
<el-table-column label="客户" prop="customer" show-overflow-tooltip> <el-link type="primary" @click="table_detail(scope.row)" v-auth="'order.update'">
</el-table-column>
<el-table-column label="所属合同" prop="contract" show-overflow-tooltip>
</el-table-column>
<el-table-column label="截止到货日期" prop="delivery_date">
</el-table-column>
<el-table-column label="提交时间" prop="submit_time">
</el-table-column>
<el-table-column label="创建人" prop="create_by">
</el-table-column>
<el-table-column label="备注">
<template #default="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template #default="scope">
<el-link
type="primary"
@click="table_detail(scope.row)"
v-auth="'order.update'"
>
详情 详情
</el-link> </el-link>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-link <el-link type="primary" @click="table_submit(scope.row)" v-auth="'order.update'"
type="primary" :disabled="scope.row.state !== 10">
@click="table_submit(scope.row)"
v-auth="'order.update'"
:disabled="scope.row.state!==10"
>
提交 提交
</el-link> </el-link>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-link <el-link type="primary" @click="table_edit(scope.row)" v-auth="'order.update'"
type="primary" :disabled="scope.row.state !== 10">
@click="table_edit(scope.row)" 编辑
v-auth="'order.update'" </el-link>
> <el-divider direction="vertical"></el-divider>
编辑 <el-link type="danger" @click="table_del(scope.row)" v-auth="'order.delete'">
</el-link> 删除
<el-divider direction="vertical"></el-divider> </el-link>
<el-link </template>
type="danger" </el-table-column>
@click="table_del(scope.row)" </scTable>
v-auth="'order.delete'" </el-main>
> </el-container>
删除 <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
</el-link> @closed="dialog.save = false"></save-dialog>
</template> </template>
</el-table-column> <script>
</scTable> import saveDialog from "./order_form.vue";
</el-main> export default {
</el-container> name: "rparty",
<save-dialog components: {
v-if="dialog.save" saveDialog,
ref="saveDialog" },
@success="handleSaveSuccess" data() {
@closed="dialog.save = false" return {
></save-dialog> dialog: {
</template> save: false,
<script>
import saveDialog from "./order_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.sam.order.list,
query: {
page:1,
page_size:20
},
selection: [],
stateOption: {
10: '创建中',
20: '已提交',
30: '已排产',
50: '已交付',
},
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
}, },
// apiObj: this.$API.sam.order.list,
table_edit(row) { query: {
this.dialog.save = true; page: 1,
this.$nextTick(() => { page_size: 20
this.$refs.saveDialog.open("edit").setData(row);
});
}, },
table_submit(row){ selection: [],
this.$API.sam.order.submit.req(row.id).then((res) => { stateOption: {
this.$message.success("提交成功"); 10: '创建中',
20: '已提交',
30: '已排产',
40: '排产完成',
50: '已交付',
},
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
table_submit(row) {
this.$API.sam.order.submit.req(row.id).then((res) => {
this.$message.success("提交成功");
this.handleQuery();
return res;
}).catch((err) => {
return err;
});
},
//
table_detail(row) {
this.$router.push({
name: "samOrderitem",
query: { order: row.id }
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.sam.order.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res; return res;
}).catch((err) => { }).catch((err) => {
return err; return err;
}); });
}, }).catch(() => { });
//
table_detail(row) {
this.$router.push({
name: "samOrderitem",
query:{order:row.id}
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.sam.order.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {
return err;
});
}).catch(() => {});
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
}, },
};
</script> //
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
},
};
</script>

View File

@ -1,105 +1,63 @@
<template> <template>
<el-container> <div style="padding: 8px">
<el-header> <div>
<div class="left-panel"> <el-card style="width: 100%" header="基本信息" shadow="hover">
<el-input <el-descriptions>
v-model="query.search" <el-descriptions-item label="订单编号">{{ orderObj.number }}</el-descriptions-item>
placeholder="名称" <el-descriptions-item label="客户">{{ orderObj.customer_name }}</el-descriptions-item>
clearable <el-descriptions-item label="订单状态">{{ orderObj.state }}</el-descriptions-item>
style="margin-right: 5px;" <el-descriptions-item label="截止交货">{{ orderObj.delivery_date }}</el-descriptions-item>
></el-input> </el-descriptions>
<el-button </el-card>
type="primary" </div>
icon="el-icon-search" <div style="height:8px"></div>
@click="handleQuery" <div>
></el-button> <el-card style="width: 100%" header="订单明细" shadow="hover">
</div> <div>
<div class="right-panel"> <el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'order.update'"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button> </div>
</div> <scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query" hidePagination>
</el-header> <el-table-column type="index" width="50" />
<el-card> <el-table-column label="所需产品" prop="material" show-overflow-tooltip>
<el-form label-width="120px"> <template #default="scope">
<el-row> <span v-if="scope.row.material_"> {{ scope.row.material_.name }}</span>
<el-col :md="12" :sm="24"> </template>
<el-form-item label="订单编号:">{{ orderObj.number }}</el-form-item> </el-table-column>
</el-col> <!-- <el-table-column label="关联订单" prop="order" show-overflow-tooltip>
<el-col :md="12" :sm="24"> <template #default="scope">
<el-form-item label="客户:">{{ orderObj.customer }}</el-form-item> <span v-if="scope.row.order_"> {{ scope.row.order_.name }}</span>
</el-col> </template>
<el-col :md="12" :sm="24"> </el-table-column> -->
<el-form-item label="订单状态:">{{ orderObj.state }}</el-form-item> <el-table-column label="所需数量" prop="count">
</el-col> </el-table-column>
<el-col :md="12" :sm="24"> <el-table-column label="已交货数量" prop="delivered_count">
<el-form-item label="计划开工日期:">{{ orderObj.customer }}</el-form-item> </el-table-column>
</el-col> <el-table-column label="创建时间" prop="create_time" show-overflow-tooltip>
<el-col :md="12" :sm="24"> </el-table-column>
<el-form-item label="计划完工日期:">{{ orderObj.customer }}</el-form-item> <el-table-column label="操作" fixed="right" align="center" width="100px">
</el-col> <template #default="scope">
</el-row> <el-link type="primary" @click="table_edit(scope.row)" v-auth="'order.update'">
</el-form> 编辑
</el-card> </el-link>
<el-main class="nopadding"> <el-divider direction="vertical"></el-divider>
<scTable <el-link type="danger" @click="table_del(scope.row)" v-auth="'order.delete'">
ref="table" 删除
:apiObj="apiObj" </el-link>
row-key="id" </template>
stripe </el-table-column>
:params="query" </scTable>
> </el-card>
<el-table-column type="index" width="50"/> </div>
<el-table-column label="所需产品" prop="material" show-overflow-tooltip> </div>
<template #default="scope"> <save-dialog v-if="dialog.save" ref="saveDialog" :orderId="orderId" @success="handleSaveSuccess"
<span v-if="scope.row.material_"> {{ scope.row.material_.name }}</span> @closed="dialog.save = false"></save-dialog>
</template>
</el-table-column>
<el-table-column label="关联订单" prop="order" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.order_"> {{ scope.row.order_.name }}</span>
</template>
</el-table-column>
<el-table-column label="所需数量" prop="count">
</el-table-column>
<el-table-column label="已到货数量" prop="delivered_count">
</el-table-column>
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100px">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'order.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'order.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:orderId="orderId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template> </template>
<script> <script>
import saveDialog from "./orderitem_form.vue"; import saveDialog from "./orderitem_form.vue";
export default { export default {
name: "rparty", name: "rparty",
components: { components: {
saveDialog, saveDialog,
}, },
data() { data() {
return { return {
@ -108,32 +66,32 @@ export default {
}, },
apiObj: this.$API.sam.orderitem.list, apiObj: this.$API.sam.orderitem.list,
query: { query: {
page:1, page: 1,
page_size:20 page_size: 20
}, },
orderId:'', orderId: '',
orderObj:{}, orderObj: {},
selection: [], selection: [],
state_: { state_: {
10: '完好', 10: '完好',
20: '限用', 20: '限用',
30: '在修', 30: '在修',
40: '禁用', 40: '禁用',
}, },
}; };
}, },
mounted(){ mounted() {
this.orderId = this.$route.query.order; this.orderId = this.$route.query.order;
this.getOrder(); this.getOrder();
}, },
methods: { methods: {
getOrder(){ getOrder() {
this.$API.sam.order.item.req(this.orderId).then((res) => { this.$API.sam.order.item.req(this.orderId).then((res) => {
this.orderObj = res; this.orderObj = res;
}) })
}, },
// //
add() { table_add() {
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("add"); this.$refs.saveDialog.open("add");
@ -164,7 +122,7 @@ export default {
}).catch((err) => { }).catch((err) => {
return err; return err;
}); });
}).catch(() => {}); }).catch(() => { });
}, },
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
@ -175,8 +133,8 @@ export default {
} }
}, },
handleQuery() { handleQuery() {
this.$refs.table.queryData(this.query) this.$refs.table.queryData(this.query)
}, },
resetQuery() { resetQuery() {
this.query = {}; this.query = {};
}, },

View File

@ -1,40 +1,20 @@
<template> <template>
<el-dialog <el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading"> <el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px"> <el-main style="padding: 0 20px 20px 20px">
<el-form <el-form ref="dialogForm" :model="form" :rules="rules" label-width="110px">
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="所需产品" prop="material"> <el-form-item label="所需产品" prop="material">
<el-select <el-select v-model="form.material" placeholder="所需产品" clearable style="width:100%">
v-model="form.material" <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
placeholder="所需产品"
clearable
style="width:100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="所需数量"> <el-form-item label="所需数量">
<el-input-number v-model="form.count" :precision="0" :min="1" controls-position="right" placeholder="所需数量" style="width:100%"/> <el-input-number v-model="form.count" :precision="0" :min="1" controls-position="right" placeholder="所需数量"
style="width:100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -50,7 +30,7 @@
<script> <script>
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
props:{ props: {
orderId: { type: String, default: '' }, orderId: { type: String, default: '' },
}, },
data() { data() {
@ -64,7 +44,7 @@ export default {
}, },
form: {}, form: {},
rules: { rules: {
material: [{required: true, message: "请选择所需产品", trigger: "blur"}], material: [{ required: true, message: "请选择所需产品", trigger: "blur" }],
}, },
visible: false, visible: false,
isSaveing: false, isSaveing: false,
@ -82,8 +62,8 @@ export default {
this.visible = true; this.visible = true;
return this; return this;
}, },
getList(){ getList() {
this.$API.mtm.material.list.req({page:0}).then(res=>{ this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => {
this.options = res; this.options = res;
}) })
}, },
@ -92,13 +72,13 @@ export default {
this.$refs.dialogForm.validate(async (valid) => { this.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
this.isSaveing = true; this.isSaveing = true;
this.form.order = this.orderId; this.form.order = this.orderId;
try { try {
var res; var res;
if (this.mode == "add") { if (this.mode == "add") {
res = await this.$API.sam.orderitem.create.req(this.form); res = await this.$API.sam.orderitem.create.req(this.form);
} else if (this.mode == "edit") { } else if (this.mode == "edit") {
res = await this.$API.sam.orderitem.update.req(this.form.id,this.form); res = await this.$API.sam.orderitem.update.req(this.form.id, this.form);
} }
this.isSaveing = false; this.isSaveing = false;
this.$emit("success", this.form, this.mode); this.$emit("success", this.form, this.mode);
@ -124,5 +104,4 @@ export default {
}, },
}; };
</script> </script>
<style> <style></style>
</style>