Commit 3a421ecf authored by renjintao's avatar renjintao

temp

parent cd795b18
...@@ -7,44 +7,45 @@ ...@@ -7,44 +7,45 @@
<Input v-model="entity.tempName"></Input> <Input v-model="entity.tempName"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col span="24" style="height:90px;"> <Col span="24" style="height:60px;">
<FormItem label="模板描述">{{entity.tempInfo}}</FormItem> <FormItem label="模板描述">{{entity.tempInfo}}</FormItem>
</Col> </Col>
<Col span="24"> <Col span="24">
<FormItem label="排序规则"></FormItem> <FormItem label="排序规则"></FormItem>
</Col> </Col>
</Row> </Row>
<!--
<FormItem class="click-btn">
<Button type="primary" @click="handleSubmit">确定</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>-->
</Form> </Form>
<div> <div>
<div <div
class="listFather" class="listFather"
v-for="(item,index) in tempDataList" v-for="(item,index) in tempDataList"
v-dragging="{ item: item, list: tempDataList, group: 'item'}" v-dragging="{ item: item, list: tempDataList, group: 'item'}"
:key="item.text" :key="item.name"
title="拖动上下移动" title="拖动上下移动"
> >
<div> <div>
<Icon type="md-move" /> <Icon type="md-move" />
{{item.text}} {{index+1}}.{{item.name}}
</div> </div>
<div <div
class="listChildren" class="listChildren"
v-for="(item1,index1) in item.children" v-for="(item1,index1) in item.sons"
v-dragging="{ item: item1, list: item.children, group: 'item1' }" v-dragging="{ item: item1, list: item.sons, group: 'item1' }"
:key="index1" :key="index1"
> >
<div> <div>
<Icon type="md-move" /> <Icon type="md-move" />
{{item1.text}} {{index1+1}}.{{item1.name}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<Row>
<Col span="24" style="text-align:right;height:60px;line-height:60px">
<Button type="primary" @click="handleSubmit">确定</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</Col>
</Row>
</div> </div>
</template> </template>
<script> <script>
...@@ -57,50 +58,7 @@ export default { ...@@ -57,50 +58,7 @@ export default {
tempName: "", tempName: "",
tempInfo: "" tempInfo: ""
}, },
tempDataList: [ tempDataList: [],
{
id: 1,
text: "时间节点要素"
},
{
id: 2,
text: "批量工时要素"
},
{
id: 3,
text: "工序数量要素"
},
{
id: 4,
text: "生产关重要素"
},
{
id: 5,
text: "紧急程度要素"
},
{
id: 6,
text: "生产类型要素",
children: [
{
id: 7,
text: "批产"
},
{
id: 8,
text: "研制"
},
{
id: 9,
text: "工装"
},
{
id: 10,
text: "协外"
}
]
}
],
tempInfo: "", tempInfo: "",
listTemp: [], listTemp: [],
listTempShort: [], listTempShort: [],
...@@ -109,46 +67,26 @@ export default { ...@@ -109,46 +67,26 @@ export default {
} }
}; };
}, },
props: { props: {},
partTaskPk: {
//生产计划ID
type: Number,
default: 0
},
taskSeq: {
//工序编号
type: String,
default: ""
},
row: {
type: Object,
default: () => {
return null;
}
}
},
created() {}, created() {},
mounted() { mounted() {
this.$dragging.$on("dragged", ({ value }) => { this.$dragging.$on("dragged", ({ value }) => {
// console.log("aaa__" + JSON.stringify(value.item));
// console.log("bbb__" + JSON.stringify(value.list));
if (this.listTemp.length < 1 && value.list.length < 5) { if (this.listTemp.length < 1 && value.list.length < 5) {
this.listTemp = this.tempDataList; this.listTemp = this.tempDataList;
this.listTempShort = value.list; this.listTempShort = value.list;
this.listTemp.forEach(dataAdd1 => { this.listTemp.forEach(dataAdd1 => {
if (dataAdd1.children && dataAdd1.children.length > 0) { if (dataAdd1.sons && dataAdd1.sons.length > 0) {
dataAdd1.children = []; dataAdd1.sons = [];
dataAdd1.children = this.listTempShort; dataAdd1.sons = this.listTempShort;
} }
}); });
} else if (this.listTemp.length > 1 && value.list.length < 5) { } else if (this.listTemp.length > 1 && value.list.length < 5) {
this.listTempShort = value.list; this.listTempShort = value.list;
this.listTemp.forEach(dataAdd => { this.listTemp.forEach(dataAdd => {
if (dataAdd.children && dataAdd.children.length > 0) { if (dataAdd.sons && dataAdd.sons.length > 0) {
dataAdd.children = []; dataAdd.sons = [];
dataAdd.children = this.listTempShort; dataAdd.sons = this.listTempShort;
} }
}); });
} else { } else {
...@@ -158,31 +96,43 @@ export default { ...@@ -158,31 +96,43 @@ export default {
this.outInfo(this.listTemp); this.outInfo(this.listTemp);
}); });
this.$dragging.$on("dragend", () => {}); this.$dragging.$on("dragend", () => {});
this.loadInfo(); setTimeout(() => {
this.loadInfo();
}, 600);
}, },
methods: { methods: {
//加载模板描述信息 //加载模板描述信息
loadInfo() { loadInfo() {
let tempList = this.tempDataList; let tempList = [];
this.outInfo(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);
}
});
}, },
//返回模板描述信息 //返回模板描述信息
outInfo(list) { outInfo(list) {
this.tempInfo = ""; this.tempInfo = "";
list.forEach(data => { list.forEach(data => {
if (data.children && data.children.length > 0) { if (data.sons && data.sons.length > 0) {
let dataInfo = ""; let dataInfo = "";
data.children.forEach(dataChild => { data.sons.forEach(dataChild => {
dataInfo += dataChild.text + "-->"; dataInfo += dataChild.name + "-->";
}); });
dataInfo = dataInfo.substring(0, dataInfo.length - 3); dataInfo = dataInfo.substring(0, dataInfo.length - 3);
this.tempInfo += this.tempInfo +=
data.text.substr(0, data.text.length - 2) + data.name.substr(0, data.name.length - 2) +
"【" + "【" +
dataInfo + dataInfo +
"】-->"; "】-->";
} else { } else {
this.tempInfo += data.text.substr(0, data.text.length - 2) + "-->"; this.tempInfo += data.name.substr(0, data.name.length - 2) + "-->";
} }
}); });
this.tempInfo = this.tempInfo.substring(0, this.tempInfo.length - 3); this.tempInfo = this.tempInfo.substring(0, this.tempInfo.length - 3);
...@@ -191,22 +141,46 @@ export default { ...@@ -191,22 +141,46 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
// Api.apsschedulupdateparameter(this.entity) let params = {
// .then(res => { id: this.entity.id,
// if (res.result.state) { templateName: this.entity.tempName,
// this.$Message.success(res.result.msg); templateDesc: this.entity.tempInfo,
// this.$emit("on-parameter-ok"); templateList:
// } else { this.listTemp.length < 1 ? this.tempDataList : this.listTemp
// this.$Message.error(res.result.msg); };
// } Api.savesorttemplate(params)
// }) .then(res => {
// .catch(e => { if (res.success && res.result) {
// this.$Message.error("数据异常!"); this.$Message.success("新增成功");
// }); let paramsData = {
id: this.entity.id,
name: this.entity.tempName,
info: this.entity.tempInfo
};
this.$emit("on-ok",paramsData);
this.$emit("on-close");
this.$emit("changeStatu",0);
} else {
this.$Message.error("新增失败");
this.$emit("on-close");
}
})
.catch(e => {
this.$Message.error("数据异常!");
});
} }
}); });
}, },
handleClose() { handleClose() {
let params = {
id: this.entity.id
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
} else {
this.$Message.error("删除失败");
}
});
this.$emit("on-close"); this.$emit("on-close");
}, },
l(key) { l(key) {
...@@ -233,19 +207,19 @@ export default { ...@@ -233,19 +207,19 @@ export default {
padding: 5px 5px 0px 5px; padding: 5px 5px 0px 5px;
border-bottom: #ccc solid 1px; border-bottom: #ccc solid 1px;
line-height: 30px; line-height: 30px;
cursor: pointer; cursor: move;
} }
.listFather:hover { .listFather:hover {
background: #E9F2FD; background: #e9f2fd;
} }
.listChildren { .listChildren {
padding: 5px 5px 5px 20px; padding: 5px 5px 5px 20px;
border-bottom: #ccc dotted 1px; border-bottom: #ccc dotted 1px;
line-height: 25px; line-height: 25px;
cursor: pointer; cursor: move;
} }
.listChildren:hover{ .listChildren:hover {
background: #D3E6FB; background: #d3e6fb;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -89,5 +89,21 @@ export default { ...@@ -89,5 +89,21 @@ export default {
getdropsortlist() { getdropsortlist() {
return Api.get(`${apsUrl}/apspoolappservices/getdropsortlist`); return Api.get(`${apsUrl}/apspoolappservices/getdropsortlist`);
}, },
//点击新增初始化数据
addsorttemplateplus(){
return Api.post(`${apsUrl}/apspoolappservices/addsorttemplateplus`);
},
//保存模板
savesorttemplate(params) {
return Api.post(`${apsUrl}/apspoolappservices/savesorttemplate`, params);
},
//使用排产规则
usesorttemplate (params) {
return Api.post(`${apsUrl}/apspoolappservices/usesorttemplate `, params);
},
//删除排产模板
removesorttemplate(params){
return Api.post(`${apsUrl}/apspoolappservices/removesorttemplate `, params);
}
//排序模板相关end----- //排序模板相关end-----
} }
...@@ -15,8 +15,14 @@ ...@@ -15,8 +15,14 @@
> >
<template slot="easySearch"></template> <template slot="easySearch"></template>
<template slot="searchBack"> <template slot="searchBack">
<Select placeholder="选择排序优先级" v-model="tempValue" style="width: 150px;"> <Select
placeholder="选择排序优先级"
v-model="tempValue"
style="width: 150px;"
@on-change="tempValueChange"
clearable
>
<Option v-for="(item,index) in listTemp" :key="index" :value="item.id" :label="item.name"></Option>
</Select> </Select>
<a style="font-weight: bold;" @click="openaddModalTemp"> <a style="font-weight: bold;" @click="openaddModalTemp">
<Icon type="md-color-palette" size="14" />&nbsp;自定义排序模板 <Icon type="md-color-palette" size="14" />&nbsp;自定义排序模板
...@@ -48,8 +54,15 @@ ...@@ -48,8 +54,15 @@
<Button type="primary" class="mr10 ml10" @click="removeOk">移出排产</Button> <Button type="primary" class="mr10 ml10" @click="removeOk">移出排产</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="addModalTemp" title="自定义排序模板" footer-hide width="1000" class="tempModal"> <Modal
<Temp></Temp> v-model="addModalTemp"
title="自定义排序模板"
footer-hide
width="1000"
class="tempModal"
@on-cancel="testCancel"
>
<Temp :data="listTemp"></Temp>
</Modal> </Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000"> <Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
<Add <Add
...@@ -82,7 +95,6 @@ import Api from "./api"; ...@@ -82,7 +95,6 @@ import Api from "./api";
import Add from "./add"; import Add from "./add";
import Temp from "./temp"; import Temp from "./temp";
import Expand from "./components/excute"; import Expand from "./components/excute";
import API from '../../../iview-pro/examples/iview/types/iview.components';
export default { export default {
name: "list", name: "list",
components: { components: {
...@@ -324,13 +336,14 @@ export default { ...@@ -324,13 +336,14 @@ export default {
}, },
//设置参数结束 //设置参数结束
circleModal: false, //进度条 circleModal: false, //进度条
listTemp:[],//自定义模板排序下拉框列表 listTemp: [], //自定义模板排序下拉框列表
tempValue:null, tempValue: null,
tempStatu: 0 //新建模型时传过来的id值
}; };
}, },
mounted() { mounted() {
this.loadList(); this.loadList();
this.loadTemp();
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
...@@ -343,12 +356,27 @@ export default { ...@@ -343,12 +356,27 @@ export default {
this.list = res.result; this.list = res.result;
} }
}); });
// Api.getdropsortlist().then(resDrop=>{ },
// if(resDrop.success) loadTemp() {
// { Api.getdropsortlist().then(resDrop => {
// this.listTemp=resDrop.result //加载排序模板列表
// } if (resDrop.success) {
// }) this.listTemp = resDrop.result;
}
});
},
//选择排序模板
tempValueChange(val) {
let params = {
id: val
};
Api.usesorttemplate(params).then(r => {
if (r.success) {
this.$Message.success("设置成功");
this.list = [];
this.loadList();
}
});
}, },
addOk() { addOk() {
this.list = []; this.list = [];
...@@ -571,6 +599,24 @@ export default { ...@@ -571,6 +599,24 @@ export default {
//打开自定义排序模板窗口 //打开自定义排序模板窗口
openaddModalTemp() { openaddModalTemp() {
this.addModalTemp = true; this.addModalTemp = true;
},
testCancel() {
alert(this.tempStatu);
if (this.tempStatu != 0) {
let params = {
id: this.tempStatu
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
} else {
this.$Message.error("删除失败");
}
});
}
},
changeStatu(val) {
this.tempStatu = val;
} }
} }
}; };
......
<template> <template>
<div> <div>
<DataGrid <Row>
:columns="columnsTemp" <Col span="6">
ref="gridTemp" <DataGrid
:data="listTemp" :columns="columnsTemp"
:high="false" ref="gridTemp"
:page="false" :data="data"
:batch="false" :high="false"
:easy="false" :page="false"
:set="false" :batch="false"
:height="300" :easy="false"
> :set="false"
<template slot="buttons"> :height="590"
:tool="false"
></DataGrid>
</Col>
<Col span="18">
<Component :is="add" @on-close="cancel" @on-ok="addData" @changeStatu="changeStatu"></Component>
</Col>
</Row>
<Row>
<Col span="6" style="text-align:right;height:50px;">
<Button type="primary" @click="addTempModal">新增模板</Button> <Button type="primary" @click="addTempModal">新增模板</Button>
</template> </Col>
</DataGrid> <Col span="18"></Col>
<Modal v-model="tempModal" title="新增模板" class="tempModal"> </Row>
<AddTemp></AddTemp>
</Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import AddTemp from "./addTemp"; // import AddTemp from "./addTemp";
export default { export default {
components: {
AddTemp
},
data() { data() {
return { return {
add: null,
tempModal: false, tempModal: false,
columnsTemp: [ columnsTemp: [
{ {
key: "id", key: "name",
title: "id",
hide: true,
width: 50
},
{
key: "tempName",
title: "模板名称", title: "模板名称",
align: "left", align: "left",
width: 200 render: (h, params) => {
}, return h(
{ 'Tooltip',
key: "tempInfo", {
title: "模板描述", props: {
align: "left" content: params.row.name+":时间节点-->批量工时-->工序数量-->生产关重-->紧急程度-->生产类型【批产-->研制-->工装-->协外】",
placement: 'left-start',
transfer:'true',
maxWidth:'800'
},
},
params.row.name
)
}
}, },
{ {
title: "操作", title: " ",
key: "action", key: "action",
width: 100, width: 60,
align: "center", align: "center",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", { class: "action" }, [
// h("op", {
// attrs: {
// icon: "md-create",
// type: "icon",
// title: "編輯模板",
// oprate: "edit"
// },
// on: { click: () => this.edit(params.row) }
// }),
h("op", { h("op", {
attrs: { attrs: {
icon: "ios-trash", icon: "ios-trash",
...@@ -72,70 +70,27 @@ export default { ...@@ -72,70 +70,27 @@ export default {
oprate: "delete", oprate: "delete",
msg: "确定删除模板?" msg: "确定删除模板?"
}, },
on: { click: () => this.remove(params.row.part_task_pk) } on: { click: () => this.remove(params.row) }
}) })
]); ]);
} }
} }
],
listTemp: [
{
id: 1,
tempName: "模型名称1",
tempInfo:
"时间节点-->批量工时-->工序数量-->生产关重-->紧急程度-->生产类型【批产-->研制-->工装-->协外】"
},
{
id: 2,
tempName: "模型名称2",
tempInfo:
"工序数量-->生产关重-->时间节点-->生产类型【批产-->工装-->协外-->研制】-->批量工时-->紧急程度"
},
{
id: 3,
tempName: "模型名称3",
tempInfo:
"批量工时-->紧急程度-->生产类型【研制-->工装-->批产-->协外】-->工序数量-->生产关重-->时间节点"
},
{
id: 4,
tempName: "模型名称4",
tempInfo:
"生产关重-->生产类型【批产-->协外-->研制-->工装】-->紧急程度-->时间节点-->批量工时-->工序数量"
},
{
id: 5,
tempName: "模型名称5",
tempInfo:
"生产关重-->生产类型【批产-->协外-->研制-->工装】-->紧急程度-->工序数量-->时间节点-->批量工时"
}
] ]
}; };
}, },
props: { props: {
taskSeq: { data: {
//工序编号 type: Array,
type: String,
default: ""
},
count: {
//生产计划数量
type: Number,
default: 0
},
row: {
type: Object,
default: () => { default: () => {
return null; return [];
} }
} }
}, },
created() { created() {},
},
mounted() {}, mounted() {},
methods: { methods: {
addTempModal() { addTempModal() {
this.tempModal = true; this.add = () => import("./addTemp");
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
...@@ -143,9 +98,33 @@ export default { ...@@ -143,9 +98,33 @@ export default {
} }
}); });
}, },
//删除模板
remove(row) {
let params = {
id: row.id
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
this.data.splice(row._index, 1);
} else {
this.$Message.success("删除失败");
}
});
},
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
addData(obj) {
this.data.splice(0, 0,obj);
},
cancel() {
this.add = null;
},
changeStatu(val)
{
this.$emit("changeStatu",val)
},
l(key) { l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key; let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
...@@ -156,5 +135,4 @@ export default { ...@@ -156,5 +135,4 @@ export default {
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
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