Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
caoqianming 2021-09-01 14:48:18 +08:00
commit 452d5d4cb8
8 changed files with 834 additions and 86 deletions

View File

@ -7,6 +7,12 @@ export function getpEquipmentList(query) {
params: query params: query
}) })
} }
export function getEquipmentAll() {
return request({
url: '/em/equipment/',
method: 'get'
})
}
export function createEquipment(data) { export function createEquipment(data) {
return request({ return request({
url: '/em/equipment/', url: '/em/equipment/',

View File

@ -14,6 +14,12 @@ export function createMaterial(data) {
data data
}) })
} }
export function getMaterial(id) {
return request({
url: `/mtm/material/${id}/`,
method: 'get'
})
}
export function updateMaterial(id, data) { export function updateMaterial(id, data) {
return request({ return request({
url: `/mtm/material/${id}/`, url: `/mtm/material/${id}/`,
@ -64,7 +70,12 @@ export function getStepList(id) {
method: 'get' method: 'get'
}) })
} }
export function getStep(id) {
return request({
url: `/mtm/step/${id}/`,
method: 'get'
})
}
export function createStep(data) { export function createStep(data) {
return request({ return request({
url: '/mtm/step/', url: '/mtm/step/',
@ -115,3 +126,87 @@ export function deleteProductprocess(id, data) {
data data
}) })
} }
//输入物料
export function getInputmaterialList(query) {
return request({
url: '/mtm/inputmaterial/',
method: 'get',
params: query
})
}
export function createInputmaterial(data) {
return request({
url: '/mtm/inputmaterial/',
method: 'post',
data
})
}
export function updateInputmaterial(id, data) {
return request({
url: `/mtm/inputmaterial/${id}/`,
method: 'put',
data
})
}
export function deleteInputmaterial(id, data) {
return request({
url: `/mtm/inputmaterial/${id}/`,
method: 'delete',
data
})
}
//输出物料
export function getOutputmaterialList(query) {
return request({
url: '/mtm/outputmaterial/',
method: 'get',
params: query
})
}
export function createOutputmaterial(data) {
return request({
url: '/mtm/outputmaterial/',
method: 'post',
data
})
}
export function updateOutputmaterial(id, data) {
return request({
url: `/mtm/outputmaterial/${id}/`,
method: 'put',
data
})
}
export function deleteOutputmaterial(id, data) {
return request({
url: `/mtm/outputmaterial/${id}/`,
method: 'delete',
data
})
}
//子工序
//输出物料
export function getUsedstepList(query) {
return request({
url: '/mtm/usedstep/',
method: 'get',
params: query
})
}
export function createUsedstep(data) {
return request({
url: '/mtm/usedstep/',
method: 'post',
data
})
}
export function deleteUsedstep(id, data) {
return request({
url: `/mtm/usedstep/${id}/`,
method: 'delete',
data
})
}

View File

@ -122,6 +122,14 @@ export const asyncRoutes = [
component: () => import('@/views/mtm/step.vue'), component: () => import('@/views/mtm/step.vue'),
meta: { title: '子工序', perms: ['vendor_manage'] }, meta: { title: '子工序', perms: ['vendor_manage'] },
hidden: true hidden: true
}
,
{
path: 'stepdo/:id',
name: 'StepDo',
component: () => import('@/views/mtm/stepdo.vue'),
meta: { title: '子工序查看', perms: ['vendor_manage'] },
hidden: true
}, },
{ {
path: '/mtm/productprocess/', path: '/mtm/productprocess/',

View File

@ -56,7 +56,9 @@
<el-table-column label="物料编号"> <el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计量单位">
<template slot-scope="scope">{{ scope.row.unit }}</template>
</el-table-column>
<el-table-column <el-table-column
@ -105,7 +107,16 @@
<el-form-item label="物料编号" prop="number"> <el-form-item label="物料编号" prop="number">
<el-input v-model="material.number" placeholder="物料编号" /> <el-input v-model="material.number" placeholder="物料编号" />
</el-form-item> </el-form-item>
<el-form-item label="计量单位" prop="unit">
<el-select style="width: 100%" v-model="material.unit" placeholder="请选择">
<el-option
v-for="item in unitoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料类别" prop="type"> <el-form-item label="物料类别" prop="type">
@ -118,6 +129,14 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="绑定工序" prop="processes">
<el-transfer
v-model="material.processes"
:data="processOptions"
:titles="['工序清单', '选择的工序清单']"
:props="{ key: 'id', label: 'name' }"
/>
</el-form-item>
<el-form-item label="排序" prop="sort_str"> <el-form-item label="排序" prop="sort_str">
<el-input v-model="material.sort_str" placeholder="排序" /> <el-input v-model="material.sort_str" placeholder="排序" />
</el-form-item> </el-form-item>
@ -131,7 +150,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getMaterialList, createMaterial,updateMaterial,deleteMaterial } from "@/api/mtm"; import { getMaterialList, createMaterial,updateMaterial,deleteMaterial,getProcessList } from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
@ -149,6 +168,7 @@ export default {
materialList: { materialList: {
count: 0, count: 0,
}, },
processOptions:[],
options_:{ options_:{
"1":'成品', "1":'成品',
@ -166,6 +186,15 @@ export default {
value: 3, value: 3,
label: '原料' label: '原料'
}], }],
unitoptions:[
{
value: '',
label: ''
}, {
value: '',
label: ''
},
],
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
@ -185,6 +214,7 @@ export default {
watch: {}, watch: {},
created() { created() {
this.getList(); this.getList();
this.getProcessList();
}, },
methods: { methods: {
@ -199,8 +229,12 @@ export default {
this.listLoading = false; this.listLoading = false;
}); });
}, },
//工序清单
getProcessList() {
getProcessList().then((res) => {
this.processOptions = res.data.results;
});
},
handleFilter() { handleFilter() {
this.listQuery.page = 1; this.listQuery.page = 1;

View File

@ -27,6 +27,9 @@
<el-table-column label="工序名称"> <el-table-column label="工序名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产车间" >
<template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template>
</el-table-column>
<el-table-column align="center" label="指导书"> <el-table-column align="center" label="指导书">
<template slot-scope="scope" v-if="scope.row.instruction_"> <template slot-scope="scope" v-if="scope.row.instruction_">
<el-link :href="scope.row.instruction_.path" >{{scope.row.instruction_.name}}</el-link> <el-link :href="scope.row.instruction_.path" >{{scope.row.instruction_.name}}</el-link>
@ -84,7 +87,9 @@
<el-form-item label="工序编号" prop="number"> <el-form-item label="工序编号" prop="number">
<el-input v-model="process.number" placeholder="工序编号" /> <el-input v-model="process.number" placeholder="工序编号" />
</el-form-item> </el-form-item>
<el-form-item label="生产车间" prop="workshop">
<treeselect v-model="process.workshop" :options="workoptions" placeholder="所属部门"/>
</el-form-item>
<el-form-item label="指导书内容" prop="instruction_content"> <el-form-item label="指导书内容" prop="instruction_content">
<el-input type="textarea" :rows="3" v-model="process.instruction_content" placeholder="指导书内容" /> <el-input type="textarea" :rows="3" v-model="process.instruction_content" placeholder="指导书内容" />
</el-form-item> </el-form-item>
@ -115,9 +120,11 @@
<script> <script>
import { getProcessList, createProcess,updateProcess,deleteProcess } from "@/api/mtm"; import { getProcessList, createProcess,updateProcess,deleteProcess } from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getOrgAll } from "@/api/org"
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultprocess = { const defaultprocess = {
@ -125,7 +132,7 @@ const defaultprocess = {
number: "", number: "",
}; };
export default { export default {
components: { Pagination }, components: { Pagination,Treeselect },
data() { data() {
return { return {
process: defaultprocess, process: defaultprocess,
@ -135,6 +142,7 @@ export default {
upHeaders: upHeaders(), upHeaders: upHeaders(),
upUrl: upUrl(), upUrl: upUrl(),
fileList:[], fileList:[],
workoptions:[],
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
@ -154,6 +162,7 @@ export default {
watch: {}, watch: {},
created() { created() {
this.getList(); this.getList();
this.getOrgAll();
}, },
methods: { methods: {
@ -168,7 +177,14 @@ export default {
this.listLoading = false; this.listLoading = false;
}); });
}, },
//生产车间
getOrgAll() {
this.treeLoding = true;
getOrgAll().then(response => {
this.workoptions = genTree(response.data);
this.treeLoding = false;
});
},
handlePreview(file) { handlePreview(file) {
if ("url" in file) { if ("url" in file) {
window.open(file.url); window.open(file.url);

View File

@ -23,104 +23,394 @@
</el-table> </el-table>
</el-card>
</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>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-mobile-phone"></i>
产品名称
</template>
{{products.name}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
产品编号
</template>
{{products.number}}
</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;">
<el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" @click.native=stepclick(item.id)>
</el-step>
</el-steps>
</el-card>
<el-tabs type="border-card">
<el-tab-pane label="输入物料">
<el-button type="primary" icon="el-icon-plus" @click="handleinputCreate"
>新增</el-button>
<el-table
:data="inputtableData.results"
border
fit
stripe
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料编号">
<template slot-scope="scope">{{scope.row.material_.number}}</template>
</el-table-column>
<el-table-column label="物料名称">
<template slot-scope="scope"> {{scope.row.material_.name}}</template>
</el-table-column>
<el-table-column label="计量单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="单位消耗量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleinputEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['material_delete'])"
type="danger"
@click="handleinputDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑输入物料' : '新增输入物料'"
> >
<el-form <el-form
ref="Form" ref="Form"
:model="productprocess" :model="inputmaterial"
label-width="80px" label-width="80px"
label-position="right" label-position="right"
:title="dialogType === 'edit' ? '编辑工序' : '新增工序'"
> >
<el-form-item label="消耗量" prop="count">
<el-form-item label="工序" prop="process"> <el-input v-model="inputmaterial.count" placeholder="输入整数或小数" />
</el-form-item>
<el-select style="width: 100%" v-model="productprocess.process" placeholder="请选择"> <el-form-item label="排序" prop="sort">
<el-input-number
v-model="inputmaterial.sort"
:min="-2147483648"
:max="2147483647"
></el-input-number>
</el-form-item>
<el-form-item label="输入物料" prop="unit">
<el-select style="width: 100%" v-model="inputmaterial.material" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in materialoptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number
v-model="productprocess.sort"
:min="-2147483648"
:max="2147483647"
></el-input-number>
</el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button> <el-button type="primary" @click="inputconfirm('Form')">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
</el-card> </el-tab-pane>
<el-tab-pane label="输出物料">
<el-button type="primary" icon="el-icon-plus" @click="handleoutputCreate"
>新增</el-button>
<el-table
</el-col> :data="outputtableData.results"
<el-col :span="18" > border
fit
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" stripe
>新增工序</el-button highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
> >
<el-card class="box-card"> <el-table-column type="index" width="50" />
<div slot="header" class="clearfix"> <el-table-column label="物料编号">
<span>产品信息</span> <template slot-scope="scope">{{scope.row.material_.number}}</template>
</el-table-column>
</div> <el-table-column label="物料名称">
<div class="text item"> <template slot-scope="scope"> {{scope.row.material_.name}}</template>
</el-table-column>
<el-table-column label="计量单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="单位消耗量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleoutputEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['material_delete'])"
type="danger"
@click="handleoutputDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisible1"
:title="dialogType1 === 'edit' ? '编辑输出物料' : '新增输出物料'"
>
<el-form
ref="Forms"
:model="outputmaterial"
label-width="80px"
label-position="right"
>
<el-form-item label="产出量" prop="count">
<el-input v-model="outputmaterial.count" placeholder="输入整数或小数" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number
v-model="outputmaterial.sort"
:min="-2147483648"
:max="2147483647"
></el-input-number>
</el-form-item>
<el-form-item label="输出物料" prop="unit">
<el-select style="width: 100%" v-model="outputmaterial.material" placeholder="请选择">
<el-option
v-for="item in materialoptions"
: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="dialogVisible1 = false">取消</el-button>
<el-button type="primary" @click="outputconfirm('Forms')">确认</el-button>
</div> </div>
</el-card> </el-dialog>
</el-tab-pane>
<el-tab-pane label="子工序列表">
<el-button type="primary" icon="el-icon-plus" @click="handleusedstepCreate"
>新增</el-button>
<el-table
:data="usedsteptableData.results"
border
fit
stripe
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="子工序名称">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
type="primary"
@click="handlesearch(scope)"
>查看</el-link
>
<el-link
v-if="checkPermission(['material_delete'])"
type="danger"
@click="handleusedstepDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisibleusedstep"
>
<el-form
ref="Formusedstep"
:model="usedstep"
label-width="80px"
label-position="right"
>
<el-form-item label="子工序" prop="unit">
<el-select style="width: 100%" v-model="usedstep.step" placeholder="请选择">
<el-option
v-for="item in stepoptions"
: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="dialogVisibleusedstep = false">取消</el-button>
<el-button type="primary" @click="usedstepconfirm('Formusedstep')">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="检验要求">
<el-button type="primary" icon="el-icon-plus"
>新增</el-button>
</el-tab-pane>
<el-tab-pane label="技术文件">
<el-button type="primary" icon="el-icon-plus"
>新增</el-button>
</el-tab-pane>
</el-tabs>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script>
import { getMaterialList } from "@/api/mtm"; import { getMaterialList,getMaterial,getInputmaterialList,createInputmaterial,updateInputmaterial
import { getProcessList } from "@/api/mtm"; ,deleteInputmaterial,getOutputmaterialList,createOutputmaterial,updateOutputmaterial,deleteOutputmaterial,
import { getProductprocessList, createProductprocess,updateProductprocess,deleteProductprocess } from "@/api/mtm"; getUsedstepList,createUsedstep,deleteUsedstep,getStepList } from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultprocess = { const defaultinputmaterial = {
}; };
const defaultoutputmaterial = {
};
const defaultusedstep = {
};
export default { export default {
components: { Pagination }, components: { Pagination },
data() { data() {
return { return {
productprocess: defaultprocess, materialoptions:[],
inputtableData:{count: 0},
inputmaterial: defaultinputmaterial,
outputtableData:{count: 0},
outputmaterial: defaultoutputmaterial,
usedsteptableData:{count: 0},
usedstep: defaultusedstep,
materialList: { materialList: {
count: 0, count: 0,
}, },
stepoptions:[],
processoptions:[],
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
productprocessList:[], listQueryinput: {
page: 1,
page_size: 20,
},
listQueryoutput: {
page: 1,
page_size: 20,
},
listQueryusedstep: {
page: 1,
page_size: 20,
},
values:1,
products:"",
dialogType: "new",
dialogVisible:false, dialogVisible:false,
dialogType1: "new",
dialogVisible1:false,
dialogTypeusedstep: "new",
dialogVisibleusedstep:false,
listLoading: true, listLoading: true,
options:[],
}; };
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.getList(); this.getList();
this.getpList();
}, },
methods: { methods: {
checkPermission, checkPermission,
//物料列表 //产品列表
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.listQuery.type=1; this.listQuery.type=1;
@ -131,63 +421,116 @@ export default {
this.listLoading = false; this.listLoading = false;
}); });
}, },
//物料
getpList() { getmaterialList() {
getProcessList({pageoff:true}).then((response) => { this.listLoading = true;
getMaterialList().then((response) => {
if (response.data) { if (response.data) {
this.materialoptions = genTree(response.data.results);
this.options = genTree(response.data.results);
} }
this.listLoading = false;
}); });
}, },
getppList() {
getProductprocessList({product:this.product}).then((response) => { //获取产品工艺
getMaterial(){
getMaterial(this.product).then((response) => {
if (response.data) { if (response.data) {
this.productprocessList = response.data; this.products = response.data;//产品信息
this.processoptions = response.data.processes_;//产品工艺
} }
}); })
}, },
//点击对应的产品弹出信息
handleCurrentChange(row){ handleCurrentChange(row){
this.product=row.id; this.product=row.id;
this.getppList(); this.getMaterial();
}, },
handleCreate() { //工艺点击信息
this.productprocess = Object.assign({}, defaultprocess);
stepclick(id)
{
this.process = id;
alert(this.process)
this.getInputmaterialLists();
this.getmaterialList();
this.getOutputmaterialLists();
this.getstepList();
this. getUsedstepLists();
},
//输入物料列表
getInputmaterialLists(){
this.listQueryinput.process=this.process;
this.listQueryinput.product=this.product
getInputmaterialList(this.listQueryinput).then((response) => {
if (response.data) {
this.inputtableData = response.data;//产品信息
}
})
},
//输入物料
handleinputCreate() {
this.inputmaterial = Object.assign({}, defaultinputmaterial);
this.dialogType = "new"; this.dialogType = "new";
this.dialogVisible = true; this.dialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs["Form"].clearValidate();
}); });
}, },
handleinputEdit(scope) {
handleEdit(scope) { this.inputmaterial = Object.assign({}, scope.row); // copy obj
this.process = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit"; this.dialogType = "edit";
this.dialogVisible = true; this.dialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs["Form"].clearValidate();
}); });
}, },
async confirm(form) { handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteInputmaterial(scope.row.id);
this.getInputmaterialLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async inputconfirm(form) {
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const isEdit = this.dialogType === "edit"; const isEdit = this.dialogType === "edit";
if (isEdit) { if (isEdit) {
updateProcess(this.process.id, this.process).then((res) => { this.inputmaterial.process=this.process;
this.inputmaterial.product=this.product;
updateInputmaterial(this.inputmaterial.id, this.inputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getInputmaterialLists()
this.dialogVisible = false; this.dialogVisible = false;
this.$message.success("成功"); this.$message.success("成功");
} }
}); });
} else { } else {
this.productprocess.product=this.product; this.inputmaterial.process=this.process;
createProductprocess(this.productprocess).then((res) => { this.inputmaterial.product=this.product;
createInputmaterial(this.inputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getInputmaterialLists()
this.dialogVisible = false; this.dialogVisible = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -199,6 +542,167 @@ export default {
}); });
}, },
//输出物料列表
getOutputmaterialLists(){
this.listQueryoutput.process=this.process;
this.listQueryoutput.product=this.product
getOutputmaterialList(this.listQueryoutput).then((response) => {
if (response.data) {
this.outputtableData = response.data;//产品信息
}
})
},
//输出物料
handleoutputCreate() {
this.outputmaterial = Object.assign({}, defaultoutputmaterial);
this.dialogType1 = "new";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handleoutputEdit(scope) {
this.outputmaterial = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handleoutputDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOutputmaterial(scope.row.id);
this.getOutputmaterialLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async outputconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType1 === "edit";
if (isEdit) {
this.outputmaterial.process=this.process;
this.outputmaterial.product=this.product;
updateOutputmaterial(this.outputmaterial.id, this.outputmaterial).then((res) => {
if (res.code >= 200) {
this.getOutputmaterialLists()
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
} else {
this.outputmaterial.process=this.process;
this.outputmaterial.product=this.product;
console.log(this.outputmaterial);
createOutputmaterial(this.outputmaterial).then((res) => {
if (res.code >= 200) {
this.getOutputmaterialLists()
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
//子工序列表
getUsedstepLists(){
this.listQueryusedstep.process=this.process;
this.listQueryusedstep.product=this.product
getUsedstepList(this.listQueryusedstep).then((response) => {
if (response.data) {
this.usedsteptableData = response.data;//产品信息
}
})
},
getstepList() {
getStepList(this.process).then((response) => {
if (response.data) {
this.stepoptions = genTree(response.data);
}
});
},
handlesearch(scope) {
this.$router.push({name: "StepDo", params: { id: scope.row.step_.id }, })
},
//子工序列表
handleusedstepCreate(){
this.usedstep = Object.assign({}, defaultusedstep);
this.dialogTypeusedstep = "new";
this.dialogVisibleusedstep = true;
this.$nextTick(() => {
this.$refs["Formusedstep"].clearValidate();
});
},
handleusedstepEdit(scope) {
this.outputmaterial = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handleusedstepDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteUsedstep(scope.row.id);
this.getUsedstepLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async usedstepconfirm(form) {
this.usedstep.process=this.process;
this.usedstep.product=this.product;
console.log(this.usedstep);
createUsedstep(this.usedstep).then((res) => {
if (res.code >= 200) {
this.getUsedstepLists()
this.dialogVisibleusedstep = false;
this.$message.success("成功");
}
});
},
}, },
}; };
</script> </script>
@ -219,4 +723,7 @@ export default {
border-radius: 4px; border-radius: 4px;
min-height: 36px; min-height: 36px;
} }
.box-card{
height:130px;
}
</style> </style>

View File

@ -36,8 +36,8 @@
<el-link <el-link
type="primary" type="primary"
@click="handleAdd(scope)" @click="handlesearch(scope)"
>操作</el-link >查看</el-link
> >
<el-link <el-link
v-if="checkPermission(['step_update'])" v-if="checkPermission(['step_update'])"
@ -72,7 +72,17 @@
<el-form-item label="步骤编号" prop="number"> <el-form-item label="步骤编号" prop="number">
<el-input v-model="step.number" placeholder="工序编号" /> <el-input v-model="step.number" placeholder="工序编号" />
</el-form-item> </el-form-item>
<el-form-item label="工序设备" prop="equipments">
<el-select style="width: 100%" multiple v-model="step.equipments" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="指导书内容" prop="instruction_content"> <el-form-item label="指导书内容" prop="instruction_content">
<el-input type="textarea" :rows="3" v-model="step.instruction_content" placeholder="指导书内容" /> <el-input type="textarea" :rows="3" v-model="step.instruction_content" placeholder="指导书内容" />
</el-form-item> </el-form-item>
@ -96,7 +106,7 @@
<script> <script>
import { getStepList, createStep,updateStep,deleteStep } from "@/api/mtm"; import { getStepList, createStep,updateStep,deleteStep } from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getEquipmentAll } from "@/api/equipment";
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
@ -117,6 +127,7 @@ export default {
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
options:[],
rule1: { rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }], name: [{ required: true, message: "请输入", trigger: "blur" }],
number: [{ required: true, message: "请输入", trigger: "blur" }], number: [{ required: true, message: "请输入", trigger: "blur" }],
@ -129,6 +140,7 @@ export default {
created() { created() {
this.step.process = this.$route.params.id; this.step.process = this.$route.params.id;
this.getList(); this.getList();
this.getequipments()
}, },
methods: { methods: {
@ -143,7 +155,14 @@ export default {
this.listLoading = false; this.listLoading = false;
}); });
}, },
//工序设备
getequipments() {
getEquipmentAll().then(response => {
this.options = genTree(response.data.results);
});
},
handlePreview(file) { handlePreview(file) {
if ("url" in file) { if ("url" in file) {
window.open(file.url); window.open(file.url);
@ -157,11 +176,7 @@ export default {
handleRemove(file, filelist){ handleRemove(file, filelist){
this.step.instruction = null; this.step.instruction = null;
}, },
//添加子工序
handleAdd(scope)
{
this.$router.push({name: "Step", params: { id: scope.row.id }, })
},
@ -184,6 +199,11 @@ export default {
this.$refs["Form"].clearValidate(); this.$refs["Form"].clearValidate();
}); });
}, },
handlesearch(scope) {
this.$router.push({name: "StepDo", params: { id: scope.row.id }, })
},
handleEdit(scope) { handleEdit(scope) {
this.step = Object.assign({}, scope.row); // copy obj this.step = Object.assign({}, scope.row); // copy obj

View File

@ -0,0 +1,62 @@
<template>
<div class="app-container">
<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" :contentStyle="{'text-align': 'left'}">
<el-tag v-for="item in step.equipments_"
:key="item.number"
:label="item.name"
:value="item.number">{{item.name}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="指导书内容" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">{{step.instruction_content}}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
</template>
<script>
import { getStep} from "@/api/mtm";
import checkPermission from "@/utils/permission";
export default {
components: { },
data() {
return {
step:"",
};
},
computed: {},
watch: {},
created() {
this.getStepD();
},
methods: {
checkPermission,
getStepD()
{
getStep(this.$route.params.id).then((response) => {
if (response.data) {
this.step = response.data;
}
});
}
},
};
</script>
<style>
.my-label {
background: #E1F3D8;
}
.my-content {
background: #FDE2E2;
}
</style>