Commit f54bf6d8 authored by renjintao's avatar renjintao

修改外协工时

parent 237513ab
......@@ -16,20 +16,33 @@
></DataGrid>
</Col>
</Row>
<Modal
v-model="setTimeModal"
title="修改外协时间"
width="680"
footer-hide
@on-cancel="cancel"
>
<EditDuration :rowData="row" ref="editDurationRef" @on-close="cancel" @on-ok="editInfo"></EditDuration>
</Modal>
</div>
</template>
<script>
import Api from "./api";
import EditDuration from "./editDuration";
export default {
components: {
EditDuration
},
data() {
return {
add: null,
editDuration: null,
tempModal: false,
columnsDuration: [
{
key: "projectNo",
title: this.l("projectNo"),
align: "left",
align: "left"
},
{
key: "batchNum",
......@@ -81,13 +94,14 @@ export default {
title: "修改外协工期",
oprate: "edit"
},
on: { click: () => this.edit(params.row.id) }
on: { click: () => this.edit(params.row) }
})
]);
}
}
],
data: []
data: [],
row: {}
};
},
created() {},
......@@ -96,37 +110,36 @@ export default {
},
methods: {
loadDuration() {
Api.getoutsidetimelist().then(r => {
this.data = [];
Api.getoutsidetimelist()
.then(r => {
if (r.success) {
this.data = r.result;
} else {
this.$Message.error("加载数据失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
}
});
},
handleClose() {
this.$emit("on-close");
},
cancel() {
this.add = null;
this.tempModal = false;
},
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");
this.row = {};
this.setTimeModal = false;
},
edit(rowData) {
this.row = rowData;
this.setTimeModal = true;
},
editInfo(entity) {
let tempData = this.data;
this.data = [];
tempData.forEach(data => {
if (data.taskSeq == entity.taskSeq) {
data.outSideTime = entity.outSideTime;
}
this.data.push(data);
});
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
......
<template>
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col span="12">
<FormItem :label="l('projectNo')">
<Input v-model="entity.projectNo" disabled></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('productName')">
<Input v-model="entity.productName" disabled></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('outSideTime')" prop="outSideTime">
<InputNumber v-model="entity.outSideTime" style="width:150px;" :min="0"></InputNumber>
</FormItem>
</Col>
</Row>
</Form>
<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>
import Api from "./api";
export default {
data() {
return {
entity: {
},
rules: {
outSideTime: [
{ required: true, message: "必填", type: "number", trigger: "change" }
]
}
};
},
props: {
rowData: {
type: Object,
default: () => {
return null;
}
}
},
created() {},
mounted() {},
methods: {
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
let params = {
items: [
{
partTaskPk: this.entity.partTaskPk,
opTaskPk: this.entity.opTaskPk,
outSideTime: this.entity.outSideTime
}
]
};
Api.saveoutsidetime(params)
.then(res => {
if (res.success && res.result) {
this.$Message.success("修改外协时间成功");
this.$emit("on-ok", this.entity);
} else {
this.$Message.error("修改外协时间失败");
}
this.$emit("on-close");
})
.catch(e => {
this.$Message.error("数据异常!");
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
},
computed: {},
watch: {
rowData(v) {
if (v != {}) {
this.entity = this.$u.clone(v);
}
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -60,7 +60,7 @@
<Modal v-model="addModalTemp" title="自定义排序模板" footer-hide width="1000" class="tempModal">
<Temp :data="listTemp" ref="tempRef"></Temp>
</Modal>
<Modal v-model="modalDuration" title="外协任务" footer-hide width="1000" class="tempModal">
<Modal v-model="modalDuration" title="外协任务" footer-hide width="1000" >
<Duration ref="durationRef"></Duration>
</Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
......
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