Commit dbda6e15 authored by renjintao's avatar renjintao

temp模板修改

parent 8bc7e4b3
<template> <template>
<div class="parameter"> <div class="parameter">
<div v-if="load" style="width:100px;margin:0 auto;padding-top:60px;"> <div v-if="load" style="width:100px;margin:0 auto;padding-top:260px;">
<Spin size="large"></Spin> <Spin size="large"></Spin>
</div> </div>
<div v-show="!load"> <div v-show="!load">
...@@ -73,7 +73,9 @@ export default { ...@@ -73,7 +73,9 @@ export default {
load: true load: true
}; };
}, },
props: {}, props: {
rowId: { type: Number, default: 0 }
},
created() {}, created() {},
mounted() { mounted() {
this.$dragging.$on("dragged", ({ value }) => { this.$dragging.$on("dragged", ({ value }) => {
...@@ -110,17 +112,33 @@ export default { ...@@ -110,17 +112,33 @@ export default {
//加载模板描述信息 //加载模板描述信息
loadInfo() { loadInfo() {
let tempList = []; let tempList = [];
Api.addsorttemplateplus().then(r => { if (this.rowId == 0) {
if (r.success) { //新增模板时新增接口方法
tempList = r.result.templateList; Api.addsorttemplateplus().then(r => {
this.tempDataList = tempList; if (r.success) {
this.entity.id = r.result.id; tempList = r.result.templateList;
this.entity.tempName = ""; this.tempDataList = tempList;
//this.entity.tempName = r.result.templateName; this.entity.id = r.result.id;
this.outInfo(tempList); this.entity.tempName = "";
this.$emit("changeStatu", r.result.id); //this.entity.tempName = r.result.templateName;
} this.outInfo(tempList);
}); }
});
} else {
//修改模板接口方法
let parms = {
id: this.rowId
};
Api.getsorttemplate(parms).then(r => {
if (r.success) {
tempList = r.result.templateList;
this.tempDataList = tempList;
this.entity.id = this.rowId;
this.entity.tempName = r.result.templateName;
this.outInfo(tempList);
}
});
}
}, },
//返回模板描述信息 //返回模板描述信息
outInfo(list) { outInfo(list) {
...@@ -158,15 +176,18 @@ export default { ...@@ -158,15 +176,18 @@ export default {
Api.savesorttemplate(params) Api.savesorttemplate(params)
.then(res => { .then(res => {
if (res.success && res.result) { if (res.success && res.result) {
this.$Message.success("新增成功"); if (this.rowId == 0) {
this.$Message.success("新增成功");
} else {
this.$Message.success("编辑成功");
}
let paramsData = { let paramsData = {
id: this.entity.id, id: this.entity.id,
name: this.entity.tempName, name: this.entity.tempName,
info: this.entity.tempInfo desc: this.entity.tempInfo
}; };
this.$emit("on-ok", paramsData); this.$emit("on-ok", paramsData);
this.$emit("on-close"); this.$emit("on-close");
this.$emit("changeStatu", 0);
} else { } else {
this.$Message.error("新增失败"); this.$Message.error("新增失败");
this.$emit("on-close"); this.$emit("on-close");
...@@ -179,15 +200,17 @@ export default { ...@@ -179,15 +200,17 @@ export default {
}); });
}, },
handleClose() { handleClose() {
let params = { if (this.rowId == 0) {
id: this.entity.id let params = {
}; id: this.entity.id
Api.removesorttemplate(params).then(r => { };
if (r.success) { Api.removesorttemplate(params).then(r => {
} else { if (r.success) {
this.$Message.error("删除失败"); } else {
} this.$Message.error("删除失败");
}); }
});
}
this.$emit("on-close"); this.$emit("on-close");
}, },
l(key) { l(key) {
...@@ -196,7 +219,13 @@ export default { ...@@ -196,7 +219,13 @@ export default {
} }
}, },
computed: {}, computed: {},
watch: {} watch: {
rowId(v) {
if (v != 0) {
this.entity.id = v;
}
}
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -104,6 +104,10 @@ export default { ...@@ -104,6 +104,10 @@ export default {
//删除排产模板 //删除排产模板
removesorttemplate(params){ removesorttemplate(params){
return Api.post(`${apsUrl}/apspoolappservices/removesorttemplate `, params); return Api.post(`${apsUrl}/apspoolappservices/removesorttemplate `, params);
} },
//获取单个模板信息
getsorttemplate(params) {
return Api.get(`${apsUrl}/apspoolappservices/getsorttemplate`,params);
},
//排序模板相关end----- //排序模板相关end-----
} }
...@@ -60,9 +60,8 @@ ...@@ -60,9 +60,8 @@
footer-hide footer-hide
width="1000" width="1000"
class="tempModal" class="tempModal"
@on-cancel="tempCancel"
> >
<Temp :data="listTemp" @changeStatu="changeStatu" ref="tempRef"></Temp> <Temp :data="listTemp" ref="tempRef"></Temp>
</Modal> </Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000"> <Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
<Add <Add
...@@ -589,23 +588,6 @@ export default { ...@@ -589,23 +588,6 @@ export default {
openaddModalTemp() { openaddModalTemp() {
this.addModalTemp = true; this.addModalTemp = true;
}, },
tempCancel() {
if (this.tempStatu != 0) {
let params = {
id: this.tempStatu
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
this.$refs.tempRef.cancel()
} else {
this.$Message.error("删除失败");
}
});
}
},
changeStatu(val) {
this.tempStatu = val;
},
//选择排序模板 //选择排序模板
tempValueChange(val) { tempValueChange(val) {
let params = { let params = {
......
<template> <template>
<div> <div>
<Row> <Row>
<Col span="6" class="pt15"> <Col span="24">
<DataGrid <DataGrid
:columns="columnsTemp" :columns="columnsTemp"
ref="gridTemp" ref="gridTemp"
...@@ -11,20 +11,32 @@ ...@@ -11,20 +11,32 @@
:batch="false" :batch="false"
:easy="false" :easy="false"
:set="false" :set="false"
:height="575" :height="400"
:tool="false" >
></DataGrid> <template slot="buttons">
</Col> <Button type="primary" @click="addTempModal">新增模板</Button>
<Col span="18"> </template>
<Component :is="add" @on-close="cancel" @on-ok="addData" @changeStatu="changeStatu"></Component> </DataGrid>
</Col> </Col>
</Row> </Row>
<Row>
<Col span="6" class="h50 tr"> <Modal
<Button type="primary" @click="addTempModal">新增模板</Button> v-model="tempModal"
</Col> :title="tempTitle"
<Col span="18"></Col> width="680"
</Row> footer-hide
class="tempModal"
@on-cancel="cancelModal"
>
<Component
:is="add"
:rowId="id"
ref="tempRef"
@on-close="cancel"
@on-ok="addData"
style="height:600px"
></Component>
</Modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -44,10 +56,8 @@ export default { ...@@ -44,10 +56,8 @@ export default {
"Tooltip", "Tooltip",
{ {
props: { props: {
content: content: params.row.name,
params.row.name + placement: "top",
":"+params.row.desc,
placement: "left-start",
transfer: true, transfer: true,
maxWidth: "800" maxWidth: "800"
} }
...@@ -56,13 +66,28 @@ export default { ...@@ -56,13 +66,28 @@ export default {
); );
} }
}, },
{
key: "desc",
title: "模板描述",
align: "left",
width: 650
},
{ {
title: " ", title: " ",
key: "action", key: "action",
width: 60, width: 100,
align: "center", align: "center",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", { class: "action" }, [
h("op", {
props: {
icon: "md-create",
type: "icon",
title: "修改模板",
oprate: "edit"
},
on: { click: () => this.edit(params.row.id) }
}),
h("op", { h("op", {
props: { props: {
icon: "ios-trash", icon: "ios-trash",
...@@ -76,7 +101,9 @@ export default { ...@@ -76,7 +101,9 @@ export default {
]); ]);
} }
} }
] ],
tempTitle: "新建模板",
id: 0
}; };
}, },
props: { props: {
...@@ -92,6 +119,8 @@ export default { ...@@ -92,6 +119,8 @@ export default {
methods: { methods: {
addTempModal() { addTempModal() {
if (this.add == null) { if (this.add == null) {
this.tempTitle = "新建模板";
this.tempModal = true;
this.add = () => import("./addTemp"); this.add = () => import("./addTemp");
} }
}, },
...@@ -120,13 +149,36 @@ export default { ...@@ -120,13 +149,36 @@ export default {
}, },
addData(obj) { addData(obj) {
//this.data.splice(0, 0,obj); //this.data.splice(0, 0,obj);
this.data.push(obj); if (this.id == 0) {
this.data.push(obj);
} else {
let dataTemp = this.data;
this.data = [];
dataTemp.forEach(rowData => {
if (rowData.id ==this.id) {
rowData.name = obj.name;
rowData.desc = obj.desc;
}
this.data.push(rowData);
});
}
}, },
cancel() { cancel() {
this.add = null; this.add = null;
this.tempModal = false;
}, },
changeStatu(val) { cancelModal() {
this.$emit("changeStatu", val); this.$refs.tempRef.handleClose();
this.tempModal = false;
this.add = null;
},
edit(id) {
if (this.add == null) {
this.id = id;
this.tempTitle = "编辑模板";
this.tempModal = true;
this.add = () => import("./addTemp");
}
}, },
l(key) { l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key; let vkey = "mes_op_task_plan_simulate" + "." + key;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment