wentixiugai

This commit is contained in:
shilixia 2021-09-06 13:36:25 +08:00
parent b580f858eb
commit 7f4658cef2
6 changed files with 540 additions and 55 deletions

View File

@ -24,7 +24,7 @@ export default {
},
data() {
return {
title: 'Django Vue Admin',
title: '航玻生产管理系统',
logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
}
}

View File

@ -26,7 +26,7 @@
</div>
<div style="margin-top: 10px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增设备</el-button
>新增仓库</el-button
>
</div>
</el-card>

View File

@ -2,7 +2,12 @@
<div class="app-container">
<el-row :gutter="24">
<el-col :span="6" >
<el-card style="margin-top: 10px">
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
font-weight: 700;
">产品列表</span>
</div>
<el-table
v-loading="listLoading"
:data="materialList.results"
@ -29,8 +34,7 @@
</el-col>
<el-col :span="18" >
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-descriptions class="margin-top" title="产品信息" :column="3" border>
@ -50,11 +54,15 @@
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card class="box-card">
<el-steps :active="values" spac="400px" align-center="" style="padding-top: 40px;">
<div slot="header" class="clearfix">
<span style="font-size: 16px;
font-weight: 700;
">工艺流程</span>
</div>
<el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;">
<el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" @click.native=stepclick(item.id)>
</el-step>
@ -268,8 +276,9 @@
<el-table-column label="子工序名称">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
</el-table-column >
<el-table-column
align="center"
label="操作"
@ -452,7 +461,7 @@ export default {
stepclick(id)
{
this.process = id;
alert(this.process)
// alert(this.process)
this.getInputmaterialLists();
this.getmaterialList();
@ -651,7 +660,7 @@ export default {
handlesearch(scope) {
this.$router.push({name: "StepDo", params: { id: scope.row.step_.id }, })
this.$router.push({name: "Step", params: { id: scope.row.step_.id }, })
},

View File

@ -2,13 +2,16 @@
<div class="app-container">
<el-card>
<div style="margin-top: 10px">
<div slot="header" class="clearfix">
<span style="font-size: 16px;
font-weight: 700;
">子工序列表</span>
</div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增工序</el-button
>新增工序</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="stepList"
@ -17,6 +20,7 @@
stripe
highlight-current-row
max-height="600"
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<el-table-column label="工序步骤名称">
@ -34,11 +38,6 @@
<template slot-scope="scope">
<el-link
type="primary"
@click="handlesearch(scope)"
>查看</el-link
>
<el-link
v-if="checkPermission(['step_update'])"
@click="handleEdit(scope)"
@ -54,10 +53,10 @@
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑工序' : '新增工序'"
:visible.sync="dialogVisibles"
:title="dialogTypes === 'edit' ? '编辑工序' : '新增工序'"
>
<el-form
ref="Form"
@ -97,26 +96,254 @@
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="danger" @click="dialogVisibles = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-card>
<el-card>
<el-row :gutter="24">
<el-col :span="6" >
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
font-weight: 700;
">过程记录表</span>
</div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增</el-button>
<el-table
:data="recordformList.results"
border
fit
stripe
highlight-current-row
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
@current-change="handleCurrentChange"
>
<el-table-column type="index" width="50" />
<el-table-column label="表名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['material_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
>
<el-form
ref="Forms"
:model="recordform"
label-width="80px"
label-position="right"
>
<el-form-item label="表格名称" prop="name">
<el-input v-model="recordform.name" placeholder="表格名称" />
</el-form-item>
<el-form-item label="表格类型" prop="type">
<el-select style="width: 100%" v-model="recordform.type" placeholder="请选择">
<el-option
v-for="item in typeoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="recordformconfirm('Forms')">确认</el-button>
</div>
</el-dialog>
</el-card>
</el-col>
<el-col :span="18" >
<el-card >
<div slot="header" class="clearfix">
<span style="font-size: 16px;
font-weight: 700;
">记录字段</span>
</div>
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
>新增</el-button>
<el-table
:data="fieldList.results"
border
fit
stripe
highlight-current-row
height="100"
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="字段类型">
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
</el-table-column>
<el-table-column label="字段名称">
<template slot-scope="scope">{{ scope.row.field_name }}</template>
</el-table-column>
<el-table-column label="字段标识">
<template slot-scope="scope">{{ scope.row.field_key }}</template>
</el-table-column>
<el-table-column label="布尔类型显示名">
<template slot-scope="scope">{{ scope.row.boolean_field_display }}</template>
</el-table-column>
<el-table-column label="选项显示名">
<template slot-scope="scope">{{ scope.row.field_choice }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handlefieldEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['material_delete'])"
type="danger"
@click="handlefieldDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisible1"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
>
<el-form
ref="Form"
:model="field"
label-width="80px"
label-position="right"
>
<el-form-item label="字段类型" prop="field_type">
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
<el-option
v-for="item in fieldtypeoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="字段标识" prop="field_key">
<el-input v-model="field.field_key" placeholder="字段标识" />
</el-form-item>
<el-form-item label="字段名称" prop="field_name">
<el-input v-model="field.field_name" placeholder="字段名称" />
</el-form-item>
<el-form-item label="布尔类型显示名" prop="boolean_field_display">
<vue-json-editor
v-model="field.boolean_field_display"
:showBtns="false"
:mode="'code'"
lang="zh"
/>
</el-form-item>
<el-form-item label="选项" prop="field_choice">
<vue-json-editor
v-model="field.field_choice"
:showBtns="false"
:mode="'code'"
lang="zh"
/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="field.sort" placeholder="排序" />
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible1 = false">取消</el-button>
<el-button type="primary" @click="fieldconfirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-card>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import { getStepList, createStep,updateStep,deleteStep } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { getEquipmentAll } from "@/api/equipment";
import { upUrl, upHeaders } from "@/api/file";
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
deleterffield} from "@/api/mtm";
import vueJsonEditor from 'vue-json-editor'
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultstep = {
name: "",
number: "",
};
const defaultrecordform = {
};
const defaultfield = {
};
export default {
components: { Pagination },
components: { Pagination,vueJsonEditor },
data() {
return {
step: defaultstep,
@ -125,14 +352,97 @@ export default {
upUrl: upUrl(),
fileList:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
dialogVisibles: false,
dialogTypes: "new",
options:[],
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
number: [{ required: true, message: "请输入", trigger: "blur" }],
},
recordform: defaultrecordform,
field: defaultfield,
dialogType: "new",
dialogVisible:false,
dialogType1: "new",
dialogVisible1:false,
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
fieldList: {
count: 0,
},
listQueryfield: {
page: 1,
page_size: 20,
},
options_: {
'string':'字符串',
'int':'整型',
'float': '浮点',
'boolean':'布尔',
'date': '日期',
'datetime': '日期时间',
'radio': '单选',
'checkbox': '多选',
'select': '单选下拉',
'selects': '多选下拉',
'textarea': '文本域'
},
fieldtypeoptions: [{
value: 'string',
label: '字符串'
},
{
value: 'int',
label: '整型'
},
{
value: 'float',
label: '浮点'
},
{
value: 'boolean',
label: '布尔'
},
{
value: 'date',
label: '日期'
},
{
value: 'datetime',
label: '日期时间'
},
{
value: 'radio',
label: '单选'
},
{
value: 'checkbox',
label: '多选'
},
{
value: 'select',
label: '单选下拉'
},
{
value: 'selects',
label: '多选下拉'
},
{
value: 'textarea',
label: '文本域'
}],
typeoptions: [{
value: 1,
label: '生产记录'
}],
};
},
computed: {},
@ -193,22 +503,22 @@ export default {
},
handleCreate() {
this.step = Object.assign({}, defaultstep);
this.dialogType = "new";
this.dialogVisible = true;
this.dialogTypes = "new";
this.dialogVisibles = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handlesearch(scope) {
this.$router.push({name: "StepDo", params: { id: scope.row.id }, })
rowClick(row) {
this.stepid= row.id ;
this.recordformLists();
},
handleEdit(scope) {
this.step = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.dialogTypes = "edit";
this.dialogVisibles = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
@ -233,13 +543,13 @@ export default {
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
const isEdit = this.dialogTypes === "edit";
if (isEdit) {
updateStep(this.step.id, this.step).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.dialogVisibles = false;
this.$message.success("成功");
}
});
@ -248,6 +558,126 @@ export default {
createStep(this.step).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisibles = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
handleCurrentChange(row){
this.formID=row.id;
this.fieldLists();
},
recordformLists()
{
this.listQueryrecordform.step=this.stepid;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
fieldLists()
{
this.listQueryfield.form=this.formID
getrffieldList(this.listQueryfield).then((response) => {
if (response.data) {
this.fieldList = response.data;
}
});
},
handleCreate() {
this.recordform = Object.assign({}, defaultrecordform);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldCreate() {
this.field = Object.assign({}, defaultfield);
this.dialogType1 = "new";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.recordform = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldEdit(scope) {
this.field = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleterecordform(scope.row.id);
this.recordformLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
handlefieldDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleterffield(scope.row.id);
this.fieldLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async recordformconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.recordform.step=this.stepid
updaterecordform(this.recordform.id, this.recordform).then((res) => {
if (res.code >= 200) {
this.recordformLists()
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.recordform.step=this.stepid
createrecordform(this.recordform).then((res) => {
if (res.code >= 200) {
this.recordformLists()
this.dialogVisible = false;
this.$message.success("成功");
}
@ -258,6 +688,45 @@ export default {
}
});
},
async fieldconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType1 === "edit";
if (isEdit) {
this.field.form=this.formID
updaterffield(this.field.id, this.field).then((res) => {
if (res.code >= 200) {
this.fieldLists()
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
} else {
this.field.form=this.formID
createrffield(this.field).then((res) => {
if (res.code >= 200) {
this.fieldLists()
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>
<style>
.my-label {
background: #E1F3D8;
}
.my-content {
background: #FDE2E2;
}
</style>

View File

@ -3,10 +3,10 @@
<el-card>
<el-descriptions title="子工序详情" :column="2" border>
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{step.name}}</el-descriptions-item>
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{step.number}}</el-descriptions-item>
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{stepDO.name}}</el-descriptions-item>
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{stepDO.number}}</el-descriptions-item>
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
<el-tag v-for="item in step.equipments_"
<el-tag v-for="item in stepDO.equipments_"
:key="item.number"
:label="item.name"
:value="item.number">{{item.name}}</el-tag>
@ -37,7 +37,7 @@
>
<el-table-column type="index" width="50" />
<el-table-column label="产品信息">
<el-table-column label="表名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
@ -158,11 +158,7 @@
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-dialog
<el-dialog
:visible.sync="dialogVisible1"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
>
@ -220,6 +216,11 @@
<el-button type="primary" @click="fieldconfirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-card>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
@ -241,9 +242,12 @@ const defaultfield = {
};
export default {
components: { vueJsonEditor },
name: "stepdo",
props: ["stepid"],
data() {
return {
step:"",
stepDO:"",
recordform: defaultrecordform,
field: defaultfield,
dialogType: "new",
@ -328,7 +332,9 @@ export default {
};
},
computed: {},
watch: {},
watch: {
},
created() {
this.getStepD();
@ -339,9 +345,10 @@ export default {
checkPermission,
getStepD()
{
getStep(this.$route.params.id).then((response) => {
getStep(this.stepid).then((response) => {
if (response.data) {
this.step = response.data;
this.stepDO = response.data;
}
});
@ -354,7 +361,7 @@ export default {
},
recordformLists()
{
this.listQueryrecordform.step=this.$route.params.id;
this.listQueryrecordform.step=this.stepid;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
@ -439,7 +446,7 @@ export default {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.recordform.step=this.$route.params.id
this.recordform.step=this.stepid
updaterecordform(this.recordform.id, this.recordform).then((res) => {
if (res.code >= 200) {
@ -449,7 +456,7 @@ export default {
}
});
} else {
this.recordform.step=this.$route.params.id
this.recordform.step=this.stepid
createrecordform(this.recordform).then((res) => {
if (res.code >= 200) {

View File

@ -95,7 +95,7 @@
<el-form
ref="Form"
:model="vendor"
label-width="80px"
label-width="120px"
label-position="right"
:rules="rule1"
>