Commit dbda6e15 authored by renjintao's avatar renjintao

temp模板修改

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