Commit 3a421ecf authored by renjintao's avatar renjintao

temp

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