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

View File

@ -1,360 +1,171 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
</div>
<!-- <div class="right-panel">
<el-date-picker
v-model="query.date"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
>查询</el-button>
</div> -->
</el-header>
<el-main style="background:#ffffff;padding:20px">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<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-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<el-container>
<el-header>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" type="card">
<el-tab-pane v-for="item in tabOptions" v-bind:key="item.name" :label="item.label" :name="item.name">
</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>
</el-tabs>
<el-checkbox v-model="showHidden" label="显示隐式物料" @change="hiddenChange" />
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe>
<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>
</el-main>
</el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./materials_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
import saveDialog from "./materials_form.vue";
export default {
name: "rparty",
components: {
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 {
dialog: {
save: false,
},
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:'办公用品',
},
};
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
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_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
//
table_edit(row) {
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",
}).then(() => {
this.$API.pm.mtask.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 = {};
},
}).then(() => {
this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
};
</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-header>
<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-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</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-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="工段名称" 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">
<span>{{ cates_[scope.row.cate] }}</span>
<span>{{ scope.row.process_cate }} - {{ scope.row.process_name }}</span>
</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="sort" min-width="80"></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">
<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-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
@ -34,93 +36,84 @@
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./mgroup_form.vue";
export default {
name: 'dept',
components: {
saveDialog
},
data() {
return {
apiObj: this.$API.mtm.mgroup.list,
query: {},
dialog: {
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;
});
import saveDialog from "./mgroup_form.vue";
export default {
name: 'mgroup',
components: {
saveDialog
},
data() {
return {
apiObj: this.$API.mtm.mgroup.list,
params: { 'cate': 'photon' },
query: {},
dialog: {
save: false,
permission: false,
},
//
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();
tableData: [],
selection: [],
cates_: {
'section': '工序',
'other': '其他',
},
}
},
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>
<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>

View File

@ -1,173 +1,137 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@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-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @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-input v-model="form.name" clearable></el-input>
</el-form-item>
<el-form-item label="工序" prop="process">
<el-select
v-model="form.process"
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 v-model="form.process" 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-form-item>
<el-form-item label="所属部门">
<el-select
v-model="form.belong_dept"
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 v-model="form.belong_dept" 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-form-item>
<el-form-item label="排序">
<el-input-number v-model="form.sort" :min="1" />
</el-form-item>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
name: "",
process:'',
cate:'photon',
belong_dept:'',
need_enm:false,
};
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: '新增测点集',
edit: '编辑测点集',
show: '查看测点集'
},
//
form: {
},
//
rules: {
name: [{required: true, message: "请输入名称", trigger: "blur"}],
process: [{required: true, message: "请选择工序", trigger: "blur"}],
belong_dept: [{required: true, message: "请选择所属部门", trigger: "blur"}]
},
visible: false,
isSaveing: false,
options:[],
group: [],
materials:[],
setFiltersVisible: false,
};
<script>
const defaultForm = {
name: "",
process: '',
cate: 'photon',
belong_dept: '',
need_enm: false,
};
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: '新增',
edit: '编辑',
show: '查看'
},
//
form: {
},
//
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
// process: [{ required: true, message: "", trigger: "blur" }],
belong_dept: [{ required: true, message: "请选择所属部门", trigger: "blur" }]
},
visible: false,
isSaveing: false,
options: [],
group: [],
materials: [],
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();//
this.getProcess();//
//
getProcess() {
var res = this.$API.mtm.process.list.req({ page: 0 }).then(res => {
this.options = res;
});
},
methods: {
//
getGroup() {
this.$API.system.dept.list.req({page:0,type:'dept'}).then(res=>{
let data = [];
res.forEach(item => {
if(item.parent=='3423856735881117696'){
data.push(item)
}
});
this.group = data;
});
},
//
getProcess(){
var res = this.$API.mtm.process.list.req({page:0}).then(res=>{
this.options = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
Object.assign(this.form,data);
},
getReceptionist(data) {
this.form.leader=data.id;
this.form.leader_name=data.name
},
//
submit() {
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("操作成功");
})
}
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
Object.assign(this.form, data);
},
getReceptionist(data) {
this.form.leader = data.id;
this.form.leader_name = data.name
},
//
submit() {
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>
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
</style>
<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>
<el-container style="flex-direction: column">
<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;">
<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-search" @click="handleQuery" >导出</el-button>
<el-container style="flex-direction: column">
<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;z-index: 100">
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
<el-button type="primary" icon="el-icon-plus" @click="mtaskAssgin">任务下达</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>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="粗加工6车间" name="first">
<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="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>
<!-- <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>
<el-dialog title="排产">
</el-dialog>
</template>
<script>
import gantt from 'dhtmlx-gantt';
@ -115,61 +103,72 @@ import saveDialog from "./mtask_form.vue";
export default {
name: "rparty",
components: {
saveDialog
saveDialog
},
data() {
return {
mtaskStateOptions: {
10: '创建中',
20: '已下达',
40: '已完成'
},
ganttHeight: '500px',
ganttLoading: false,
projectId: '',
orderitems: [],
tasks: {
data: []
},
gantttt:{
data:[],
links:[
{ id:1, source:1, target:3, type:"0"},
{ id:2, source:12323545, target:12345453, type:"1"},
{ 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' },
gantttt: {
data: [],
links: [
{ id: 1, source: 1, target: 3, type: "0" },
{ id: 2, source: 12323545, target: 12345453, type: "1" },
{ 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' },
],
},
dialog: {
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: {
page:1,
page_size:20,
date:''
page: 1,
page_size: 20,
date: ''
},
activeName:'first',
activeNameSub:'order',
activeName: 'first',
activeNameSub: 'order',
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
},
created() {
//gantt
gantt.clearAll();
},
mounted(){
mounted() {
var $this = this;
//
gantt.i18n.setLocale('cn');
@ -181,25 +180,26 @@ export default {
gantt.config.show_grid = true;
//便使
gantt.config.columns = [
{
name: 'text',label: '分项工程',
tree: true,width: '*',align: 'left',template: function (obj) { return `<span class="gantt-name-box" title="${obj.text}">${obj.text}</span>` }
{
name: 'text', label: '分项工程',
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: '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}`;}
}
];
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 },
{ "id": "1635835705701744642", "text": "111", "start_date": "2023-03-14", "beginTime": "2023-03-14", "endTime": "2023-03-17", "limitTime": 3, "duration": 3, "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": "1635835705701744644", "text": "分项工程1", "start_date": "2023-03-30", "beginTime": "2023-03-30", "endTime": "2023-04-20", "limitTime": 21, "duration": 21, "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": "1635835705701744646", "text": "分项工程3", "start_date": "2023-03-23", "beginTime": "2023-03-23", "endTime": "2023-03-31", "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": "1635835705701744648", "text": "1", "start_date": "2023-03-16", "beginTime": "2023-03-16", "endTime": "2023-03-17", "limitTime": 1, "duration": 1, "progress": 1 },
];
{ 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: '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 },
{ "id": "1635835705701744642", "text": "111", "start_date": "2023-03-14", "beginTime": "2023-03-14", "endTime": "2023-03-17", "limitTime": 3, "duration": 3, "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": "1635835705701744644", "text": "分项工程1", "start_date": "2023-03-30", "beginTime": "2023-03-30", "endTime": "2023-04-20", "limitTime": 21, "duration": 21, "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": "1635835705701744646", "text": "分项工程3", "start_date": "2023-03-23", "beginTime": "2023-03-23", "endTime": "2023-03-31", "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": "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.row_height = 44;
@ -216,7 +216,7 @@ export default {
return date.getFullYear();
};
var monthScaleTemplate = function (date) {
var month = date.getMonth()+1;
var month = date.getMonth() + 1;
return month;
};
var dayScaleTemplate = function (date) {
@ -250,7 +250,7 @@ export default {
//
gantt.config.details_on_dblclick = false;
//gantt
//gantt
gantt.config.show_errors = false;
//
gantt.attachEvent('onBeforeTaskDrag', function (id, mode, e) {
@ -282,9 +282,23 @@ export default {
gantt.init(this.$refs.gantt);
},
methods: {
//
getProjectTaskData() {
this.ganttLoading= true;
mtaskAssgin() {
let rows = this.$refs.table1.getSelectionRows()
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.$http({
url: this.$http.adornUrl('url'),
@ -299,7 +313,7 @@ export default {
gantt.parse(this.tasks);
//
gantt.refreshData();
this.ganttLoading= false;
this.ganttLoading = false;
} else {
this.$message.error(data.msg);
}
@ -341,15 +355,15 @@ export default {
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
type: "warning",
}).then(() => {
this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {
return err;
});
}).catch(() => {});
this.$API.pm.mtask.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
//
@ -370,12 +384,14 @@ export default {
};
</script>
<style scoped>
.el-main.nopadding{
padding:0 20px 20px 20px
}
.gantt-container {
.el-main.nopadding {
padding: 0 20px 20px 20px
}
.gantt-container {
height: 30%;
}
.ganntClass {
background-color: #fff;
padding: 10px;

View File

@ -1,153 +1,126 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-input
v-model="query.search"
placeholder="名称"
clearable
style="margin-right: 5px;"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'contract.create'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
>
<el-table-column type="index" width="50"/>
<el-table-column label="合同名称" prop="name">
</el-table-column>
<el-table-column label="合同编号" prop="number">
</el-table-column>
<el-table-column label="合同金额" prop="amount">
</el-table-column>
<el-table-column label="签订日期" prop="sign_date">
</el-table-column>
<el-table-column label="关联客户" prop="customer">
</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="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'contract.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-auth="'contract.delete'"
>
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<script>
import saveDialog from "./contract_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
<el-container>
<el-header>
<div class="left-panel">
<el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'contract.create'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
<el-table-column type="index" width="50" />
<el-table-column label="合同名称" prop="name">
</el-table-column>
<el-table-column label="合同编号" prop="number">
</el-table-column>
<el-table-column label="合同金额" prop="amount">
</el-table-column>
<el-table-column label="签订日期" prop="sign_date">
</el-table-column>
<el-table-column label="关联客户" prop="customer_name">
</el-table-column>
<el-table-column label="创建人" prop="create_by_name">
</el-table-column>
<el-table-column label="描述">
<template #default="scope">{{ scope.row.description }}</template>
</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="'contract.update'">
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'contract.delete'">
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./contract_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.sam.contract.list,
query: {
page: 1,
page_size: 20,
type: 10
},
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.sam.contract.list,
query: {
page:1,
page_size:20,
type:10
},
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
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_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.pum.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 = {};
},
}).then(() => {
this.$API.pum.order.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
};
</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>
<el-container>
<el-header>
<div class="left-panel">
<el-input
v-model="query.search"
placeholder="名称"
clearable
style="margin-right: 5px;"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'order.delete'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<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="state">
<template #default="scope">
<span><el-tag :type="stateOption[scope.row.state].color">{{stateOption[scope.row.state]}}</el-tag></span>
</template>
</el-table-column>
<el-table-column label="客户" prop="customer" show-overflow-tooltip>
</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-container>
<el-header>
<div class="left-panel">
<el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'order.delete'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<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="state">
<template #default="scope">
{{ stateOption[scope.row.state] }}
</template>
</el-table-column>
<el-table-column label="客户" prop="customer_name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="所属合同" prop="contract_number" 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_name">
</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-divider direction="vertical"></el-divider>
<el-link
type="primary"
@click="table_submit(scope.row)"
v-auth="'order.update'"
:disabled="scope.row.state!==10"
>
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="primary" @click="table_submit(scope.row)" v-auth="'order.update'"
:disabled="scope.row.state !== 10">
提交
</el-link>
<el-divider direction="vertical"></el-divider>
<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"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<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");
});
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="primary" @click="table_edit(scope.row)" v-auth="'order.update'"
:disabled="scope.row.state !== 10">
编辑
</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" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./order_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
apiObj: this.$API.sam.order.list,
query: {
page: 1,
page_size: 20
},
table_submit(row){
this.$API.sam.order.submit.req(row.id).then((res) => {
this.$message.success("提交成功");
selection: [],
stateOption: {
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;
}).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;
}).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 = {};
},
}).catch(() => { });
},
};
</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>
<el-container>
<el-header>
<div class="left-panel">
<el-input
v-model="query.search"
placeholder="名称"
clearable
style="margin-right: 5px;"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
</div>
</el-header>
<el-card>
<el-form label-width="120px">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="订单编号:">{{ orderObj.number }}</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="客户:">{{ orderObj.customer }}</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="订单状态:">{{ orderObj.state }}</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="计划开工日期:">{{ orderObj.customer }}</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="计划完工日期:">{{ orderObj.customer }}</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
>
<el-table-column type="index" width="50"/>
<el-table-column label="所需产品" prop="material" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.material_"> {{ scope.row.material_.name }}</span>
</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>
<div style="padding: 8px">
<div>
<el-card style="width: 100%" header="基本信息" shadow="hover">
<el-descriptions>
<el-descriptions-item label="订单编号">{{ orderObj.number }}</el-descriptions-item>
<el-descriptions-item label="客户">{{ orderObj.customer_name }}</el-descriptions-item>
<el-descriptions-item label="订单状态">{{ orderObj.state }}</el-descriptions-item>
<el-descriptions-item label="截止交货">{{ orderObj.delivery_date }}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
<div style="height:8px"></div>
<div>
<el-card style="width: 100%" header="订单明细" shadow="hover">
<div>
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'order.update'"></el-button>
</div>
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query" hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="所需产品" prop="material" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.material_"> {{ scope.row.material_.name }}</span>
</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-card>
</div>
</div>
<save-dialog v-if="dialog.save" ref="saveDialog" :orderId="orderId" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./orderitem_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
saveDialog,
},
data() {
return {
@ -108,32 +66,32 @@ export default {
},
apiObj: this.$API.sam.orderitem.list,
query: {
page:1,
page_size:20
page: 1,
page_size: 20
},
orderId:'',
orderObj:{},
orderId: '',
orderObj: {},
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
},
mounted(){
mounted() {
this.orderId = this.$route.query.order;
this.getOrder();
},
methods: {
getOrder(){
getOrder() {
this.$API.sam.order.item.req(this.orderId).then((res) => {
this.orderObj = res;
})
},
//
add() {
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
@ -164,7 +122,7 @@ export default {
}).catch((err) => {
return err;
});
}).catch(() => {});
}).catch(() => { });
},
//
handleSaveSuccess(data, mode) {
@ -175,8 +133,8 @@ export default {
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},

View File

@ -1,40 +1,20 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @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-width="110px"
>
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="所需产品" prop="material">
<el-select
v-model="form.material"
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 v-model="form.material" 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-form-item>
</el-col>
<el-col :md="12" :sm="24">
<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-col>
</el-row>
@ -50,7 +30,7 @@
<script>
export default {
emits: ["success", "closed"],
props:{
props: {
orderId: { type: String, default: '' },
},
data() {
@ -64,7 +44,7 @@ export default {
},
form: {},
rules: {
material: [{required: true, message: "请选择所需产品", trigger: "blur"}],
material: [{ required: true, message: "请选择所需产品", trigger: "blur" }],
},
visible: false,
isSaveing: false,
@ -82,8 +62,8 @@ export default {
this.visible = true;
return this;
},
getList(){
this.$API.mtm.material.list.req({page:0}).then(res=>{
getList() {
this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => {
this.options = res;
})
},
@ -92,13 +72,13 @@ export default {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
this.form.order = this.orderId;
this.form.order = this.orderId;
try {
var res;
if (this.mode == "add") {
res = await this.$API.sam.orderitem.create.req(this.form);
} 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.$emit("success", this.form, this.mode);
@ -124,5 +104,4 @@ export default {
},
};
</script>
<style>
</style>
<style></style>