Commit 25cb7877 authored by 康振飞's avatar 康振飞

拆分

parent e9f50b41
<style lang="less" scoped> <style lang="less" scoped>
@import './dispatch.less'; @import "./dispatch.less";
</style> </style>
<template> <template>
<div class="dispatch myBug"> <div class="dispatch myBug">
...@@ -27,17 +27,21 @@ ...@@ -27,17 +27,21 @@
</p> </p>
<div class="dispatch_part_body" v-if="listShow == '订单'" :style="{height:byheight}"> <div class="dispatch_part_body" v-if="listShow == '订单'" :style="{height:byheight}">
<!-- {{ids}} --> <!-- {{ids}} -->
<Collapse simple> <!-- <Collapse simple> -->
<Panel v-for="(item,index) in listOrder" :key="index" :name="item.mesCode"> <div v-for="(item,index) in listOrder" :key="index" :name="item.mesCode">
<b>订单号:{{item[0].mesCode}} <Tag>{{item.length}}</Tag></b> <h3>
订单号:{{item[0].mesCode}}
<Tag class="ml20">{{item.length}}</Tag>
</h3>
<!-- 订单号:{{item[0].mesCode}} {{item.length}} --> <!-- 订单号:{{item[0].mesCode}} {{item.length}} -->
<p slot="content"> <p slot="content">
<Row :gutter="15" class="card_body01"> <Row :gutter="15" class="card_body01">
<Col span="8" class="dispatch_card" v-for="(li,index) in item" :key="li.id"> <Col span="8" class="dispatch_card" v-for="(li,index) in item" :key="li.id">
<Card> <Card>
<p slot="title" class="card_top"> <p slot="title" class="card_top">
<Checkbox v-model="li.checked" :disabled="li.status!=-1" > <Checkbox v-model="li.checked" :disabled="li.status!=-1">
<Icon type="ios-pricetags" />工序{{li.process_seq}}{{li.process_name}} <Icon type="ios-pricetags" />
工序{{li.process_seq}}{{li.process_name}}
</Checkbox> </Checkbox>
</p> </p>
<div class="h60"> <div class="h60">
...@@ -67,8 +71,8 @@ ...@@ -67,8 +71,8 @@
</Col> </Col>
</Row> </Row>
</p> </p>
</Panel> </div>
</Collapse> <!--</Collapse> -->
</div> </div>
<div class="dispatch_part_body" v-else-if="listShow == '工单'" :style="{height:byheight}"> <div class="dispatch_part_body" v-else-if="listShow == '工单'" :style="{height:byheight}">
<Row :gutter="15" class="card_body01"> <Row :gutter="15" class="card_body01">
...@@ -138,7 +142,8 @@ ...@@ -138,7 +142,8 @@
span="12" span="12"
class="dispatch_card" class="dispatch_card"
v-for="(item,index) in listSheBei" v-for="(item,index) in listSheBei"
:key="index"> :key="index"
>
<Card class="card"> <Card class="card">
<p slot="title" class="card_top"> <p slot="title" class="card_top">
<label @click="setShebeiId(item.id)" class="label"> <label @click="setShebeiId(item.id)" class="label">
...@@ -171,9 +176,9 @@ ...@@ -171,9 +176,9 @@
<Row :gutter="15"> <Row :gutter="15">
<Col span="8" class="dispatch_card02" v-for="(item,index) in listMan" :key="index"> <Col span="8" class="dispatch_card02" v-for="(item,index) in listMan" :key="index">
<CheckboxGroup class="man_body"> <CheckboxGroup class="man_body">
<Checkbox v-model="item.checked" border class='checkUser'> <Checkbox v-model="item.checked" border class="checkUser">
<!-- <Tooltip :content="item.userName" placement="top-start"> --> <!-- <Tooltip :content="item.userName" placement="top-start"> -->
<span class="svg_name" :title='item.userName'>{{item.userName}}</span> <span class="svg_name" :title="item.userName">{{item.userName}}</span>
<!-- <span class="svg">{{item.id}}</span> --> <!-- <span class="svg">{{item.id}}</span> -->
<!-- </Tooltip> --> <!-- </Tooltip> -->
</Checkbox> </Checkbox>
...@@ -186,8 +191,14 @@ ...@@ -186,8 +191,14 @@
</Col> </Col>
</Row> </Row>
<!-- 拆分 fenModel --> <!-- 拆分 fenModel -->
<Modal v-model="chaiModal" title="拆分工序" :width="400" <Modal
:mask-closable="false" ok-text="拆分" @on-ok="okChai()" > v-model="chaiModal"
title="拆分工序"
:width="400"
:mask-closable="false"
ok-text="拆分"
@on-ok="okChai()"
>
拆分数量: 拆分数量:
<Tag>{{chaiNum}}</Tag> <Tag>{{chaiNum}}</Tag>
<Slider v-model="chaiNum" :max="maxnum" show-stops :min="1"></Slider> <Slider v-model="chaiNum" :max="maxnum" show-stops :min="1"></Slider>
...@@ -291,27 +302,28 @@ ...@@ -291,27 +302,28 @@
</div> </div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
components: { }, components: {},
data() { data() {
return { return {
action: Api.index, action: Api.index,
toheight: '500px', toheight: "500px",
byheight: '450px', byheight: "450px",
button1: '全部', button1: "全部",
button2: '设备', button2: "设备",
listShow: '订单', listShow: "订单",
shebei: '', shebei: "",
curTask:null,
dateRange: { dateRange: {
//禁选工时时间区间 //禁选工时时间区间
disabledDate(date) { disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000 return date && date.valueOf() < Date.now() - 86400000;
} }
}, },
shebeiId: -1, shebeiId: -1,
footerToolbar: false, footerToolbar: false,
status: '1', //排产状态 status: "1", //排产状态
footerMore: true, //CheckItem!=null&&CheckItem!='' footerMore: true, //CheckItem!=null&&CheckItem!=''
footerModel: false, //底部按钮 footerModel: false, //底部按钮
facilityModal: false, //设备抽屉 facilityModal: false, //设备抽屉
...@@ -319,358 +331,373 @@ export default { ...@@ -319,358 +331,373 @@ export default {
listSheBei: [], //设备列表 listSheBei: [], //设备列表
listMan: [], //人员列表 listMan: [], //人员列表
listTask: [], //工单列表数据 listTask: [], //工单列表数据
listTitle: [],//订单号列表 listTitle: [], //订单号列表
newList: [], //选中数据 newList: [], //选中数据
chaiModal: false, //拆分弹框 chaiModal: false, //拆分弹框
chaiNum: 1, //拆分数量 chaiNum: 1, //拆分数量
maxnum: 1, maxnum: 1,
rowIndex: 0, //多选项的index rowIndex: 0, //多选项的index
chaiId:0, chaiId: 0,
entity: { entity: {
taskTime: '', //工时 taskTime: "", //工时
userIds: null, //选中人员 userIds: null, //选中人员
remark: '' //备注 remark: "" //备注
}, },
ruleValidate: { ruleValidate: {
taskTime: [{ taskTime: [
{
required: true, required: true,
type: 'array', type: "array",
message: "请选择工时时间段", message: "请选择工时时间段",
trigger: 'blur', trigger: "blur",
fields: { fields: {
0: {type: "date", required: true, message: "请选择工时时间段"}, 0: { type: "date", required: true, message: "请选择工时时间段" },
1: {type: "date", required: true, message: "请选择工时时间段"} 1: { type: "date", required: true, message: "请选择工时时间段" }
} }
}], }
],
userIds: [ userIds: [
{ {
required: true, required: true,
message: '请选择人员!', message: "请选择人员!",
trigger: 'blur', trigger: "blur",
type: 'array' type: "array"
} }
] ]
}, },
pentity: { pentity: {
taskTime: '', //工时 taskTime: "", //工时
remark: '' //备注 remark: "" //备注
}, },
rulepepole:{ rulepepole: {
taskTime: [{ taskTime: [
{
required: true, required: true,
type: 'array', type: "array",
message: "请选择工时时间段", message: "请选择工时时间段",
trigger: 'blur', trigger: "blur",
fields: { fields: {
0: {type: "date", required: true, message: "请选择工时时间段"}, 0: { type: "date", required: true, message: "请选择工时时间段" },
1: {type: "date", required: true, message: "请选择工时时间段"} 1: { type: "date", required: true, message: "请选择工时时间段" }
} }
}]
},
} }
]
}
};
}, },
created() { created() {
this.getUserInfoFn() this.getUserInfoFn();
this.byheight = window.innerHeight - 208 + 'px' this.byheight = window.innerHeight - 208 + "px";
}, },
mounted() { mounted() {
this.byheight = window.innerHeight - 208 + 'px' this.byheight = window.innerHeight - 208 + "px";
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
getUserInfoFn() { getUserInfoFn() {
let userId = this.$store.state.userInfo.userId let userId = this.$store.state.userInfo.userId;
let infoid, departId let infoid, departId;
Api.getUserDepartment({ userId: userId }).then((res) => { Api.getUserDepartment({ userId: userId }).then(res => {
if (res.success) { if (res.success) {
infoid = res.result.id infoid = res.result.id;
} else { } else {
infoid = [] infoid = [];
this.$Message.error('查询失败!') this.$Message.error("查询失败!");
} }
}) });
Api.getUserInfo({ id: userId }).then((res) => { Api.getUserInfo({ id: userId }).then(res => {
if (res.success) { if (res.success) {
departId = res.result.departmentId departId = res.result.departmentId;
this.getEntryList(departId) this.getEntryList(departId);
this.getselectuser(departId) this.getselectuser(departId);
this.getlistall(departId) this.getlistall(departId);
} else { } else {
departId = '' departId = "";
this.$Message.error('查询失败!') this.$Message.error("查询失败!");
} }
}) });
}, },
setShebeiId(id) { setShebeiId(id) {
this.shebeiId = id this.shebeiId = id;
this.footerToolbar = true this.footerToolbar = true;
}, },
// 获取查询人员 // 获取查询人员
getselectuser(id) { getselectuser(id) {
let parme = { departmentId: id, type: '2' } let parme = { departmentId: id, type: "2" };
Api.getUser(parme).then((res) => { Api.getUser(parme).then(res => {
res.result.map((u) => { res.result.map(u => {
u.checked = false u.checked = false;
}) });
this.listMan = res.result this.listMan = res.result;
}) });
}, },
// 获取查询设备 // 获取查询设备
getlistall(id) { getlistall(id) {
let parme = { shopid: id } let parme = { shopid: id };
Api.getlistall(parme).then((res) => { Api.getlistall(parme).then(res => {
res.result.map((u) => { res.result.map(u => {
u.checked = false u.checked = false;
}) });
this.listSheBei = res.result this.listSheBei = res.result;
}) });
}, },
// 获取用户工单 JSON.stringify(parme) // 获取用户工单 JSON.stringify(parme)
getEntryList(id) { getEntryList(id) {
let parme = { departmentId: id, DispatchStatus: this.status } let parme = { departmentId: id, DispatchStatus: this.status };
Api.getEntryList(parme).then((res) => { Api.getEntryList(parme).then(res => {
var savedUl = [] var savedUl = [];
var pid var pid;
res.result.map((u) => { res.result.map(u => {
if(u.pid){ if (u.pid) {
pid = u.pid pid = u.pid;
}else{ } else {
pid = 0 pid = 0;
} }
let detailnew = { let detailnew = {
beginTime: u.beginTime,//开始时间 beginTime: u.beginTime, //开始时间
dispatchStatus: u.dispatchStatus,// dispatchStatus: u.dispatchStatus, //
endTime: u.endTime,// endTime: u.endTime, //
equipCode: u.equipCode,// equipCode: u.equipCode, //
equipId: u.equipId,// equipId: u.equipId, //
executeId: u.executeId,// executeId: u.executeId, //
id: u.id,// id: u.id, //
mesCode: u.mesCode,// mesCode: u.mesCode, //
order_id: u.order_id,// order_id: u.order_id, //
process_content: u.process_content,// process_content: u.process_content, //
process_name: u.process_name,// process_name: u.process_name, //
process_seq: u.process_seq,// process_seq: u.process_seq, //
productName: u.productName,// productName: u.productName, //
quantity: u.quantity,// quantity: u.quantity, //
routingDetailId: u.routingDetailId,// routingDetailId: u.routingDetailId, //
routingHeaderId: u.routingHeaderId,// routingHeaderId: u.routingHeaderId, //
status: u.status,// status: u.status, //
userIds: u.userIds,// userIds: u.userIds, //
userNames: u.userNames, userNames: u.userNames,
pid: pid, //拆分项id pid: pid //拆分项id
} };
savedUl.push(detailnew) savedUl.push(detailnew);
}) });
this.listTask = savedUl this.listTask = savedUl;
}) });
}, },
// 数组去重 // 数组去重
getArray(a) { getArray(a) {
const hash = {} const hash = {};
const len = a.length const len = a.length;
const result = [] const result = [];
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (!hash[a[i]]) { if (!hash[a[i]]) {
hash[a[i]] = true hash[a[i]] = true;
result.push(a[i]) result.push(a[i]);
} }
} }
return result return result;
}, },
// 时间改变方法 // 时间改变方法
handleChange(daterange) { handleChange(daterange) {
this.newList.map((u) => { this.newList.map(u => {
u.beginTime = daterange[0] u.beginTime = daterange[0];
u.endTime = daterange[1] u.endTime = daterange[1];
}) });
}, },
handleChangeTime(time) { handleChangeTime(time) {
this.newList.map((u) => { this.newList.map(u => {
u.beginTime = time[0] u.beginTime = time[0];
u.endTime = time[1] u.endTime = time[1];
}) });
}, },
// 过滤条件 // 过滤条件
changeStatus(a) { changeStatus(a) {
// console.log(a) // console.log(a)
this.getUserInfoFn() this.getUserInfoFn();
}, },
// 打开抽屉 // 打开抽屉
openDrawer() { openDrawer() {
let chekids = this.ids let chekids = this.ids;
let formData = this.listTask let formData = this.listTask;
let timebegin = formData[0].beginTime let timebegin = formData[0].beginTime;
let timend = formData[0].endTime let timend = formData[0].endTime;
this.newList = [] this.newList = [];
chekids.forEach((v) => { chekids.forEach(v => {
var item = formData.filter((u) => { var item = formData.filter(u => {
return u.id == v return u.id == v;
}) });
if (item && item[0]) { if (item && item[0]) {
this.newList.push(item[0]) this.newList.push(item[0]);
} }
}) });
if (this.button2 == '设备') { if (this.button2 == "设备") {
this.entity.taskTime = [timebegin,timend] this.entity.taskTime = [timebegin, timend];
this.facilityModal = true this.facilityModal = true;
} else { } else {
this.pentity.taskTime = [timebegin,timend] this.pentity.taskTime = [timebegin, timend];
if(formData.map(t=>{ if (
this.newList.filter(m=>{ formData.map(t => {
if(m.id = t.id){ this.newList.filter(m => {
console.log(m.checked) if ((m.id = t.id)) {
console.log(m.checked);
} }
});
}) })
})){ ) {
} }
this.manModal = true this.manModal = true;
} }
console.log('选中的数据', this.newList) console.log("选中的数据", this.newList);
}, },
// 设备派工 // 设备派工
sendSheBei() { sendSheBei() {
let item = this.newList let item = this.newList;
item.map((u) => { item.map(u => {
u.userIds = this.entity.userIds u.userIds = this.entity.userIds;
u.remark = this.entity.remark u.remark = this.entity.remark;
u.equipId = this.shebeiId u.equipId = this.shebeiId;
}) });
this.$refs['formValidate'].validate((valid) => { this.$refs["formValidate"].validate(valid => {
if(valid){ if (valid) {
Api.saveTeamentry(item).then((res) => { Api.saveTeamentry(item).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('设备派工成功。') this.$Message.success("设备派工成功。");
this.getUserInfoFn() this.getUserInfoFn();
this.facilityModal = false this.facilityModal = false;
} else { } else {
this.$Message.error('设备派工失败...') this.$Message.error("设备派工失败...");
} }
}) });
}else{ } else {
this.$Message.error('校验不通过...') this.$Message.error("校验不通过...");
} }
}) });
}, },
// 人员派工 // 人员派工
sendUser() { sendUser() {
let item = this.newList let item = this.newList;
item.map((u) => { item.map(u => {
u.userIds = this.peploeId u.userIds = this.peploeId;
u.remark = this.pentity.remark u.remark = this.pentity.remark;
}) });
this.$refs['formpepole'].validate((valid) => { this.$refs["formpepole"].validate(valid => {
if(valid){ if (valid) {
let params = { let params = {
isDispatch: 1,//派工是1,保存是0 isDispatch: 1, //派工是1,保存是0
entryList: item entryList: item
} };
Api.saveTeamentry(params).then((res) => { Api.saveTeamentry(params).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('人员派工成功。') this.$Message.success("人员派工成功。");
this.getUserInfoFn() this.getUserInfoFn();
this.manModal = false this.manModal = false;
} else { } else {
this.$Message.error('人员派工失败...') this.$Message.error("人员派工失败...");
} }
}) });
}else{ } else {
this.$Message.error('校验不通过...') this.$Message.error("校验不通过...");
} }
}) });
},
setChaiding(li, index){
console.log(li, index)
this.chaiModal = true;
this.chaiNum = 1;
this.maxnum = li.quantity - 1;
this.rowIndex = index;
}, },
// 拆分方法 // 拆分方法
setChai(item, index) { setChai(item, index) {
this.chaiModal = true console.log(item, index)
this.chaiNum = 1 this.curTask=item;
this.maxnum = item.quantity - 1 this.chaiModal = true;
this.rowIndex = index this.chaiNum = 1;
}, this.maxnum = item.quantity - 1;
okChai() { this.rowIndex = index;
var detail = this.$u.clone(this.listTask[this.rowIndex])
this.listTask[this.rowIndex].quantity -= this.chaiNum
detail.pid = detail.id
detail.id = 0
detail.quantity = this.chaiNum
this.listTask.splice(this.rowIndex + 1, 0, detail)
console.log("拆分后数据",this.listTask)
this.saveFameData()
this.getUserInfoFn()
}, },
// 拆分保存 // 拆分保存
saveFameData() { okChai() {
var old = this.$u.clone(this.curTask);
var add = this.$u.clone(this.curTask);
old.quantity -= this.chaiNum;
add.quantity = this.chaiNum;
add.id = 0;
add.pid = old.id;
let params = { let params = {
isDispatch: 0,//派工是1,保存是0 isDispatch: 0, //派工是1,保存是0
entryList: this.listTask entryList: [old, add]
} };
Api.saveTeamentry(params).then((res) => { Api.saveTeamentry(params).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('拆分成功。') this.getUserInfoFn();
this.$Message.success("拆分成功。");
} else { } else {
this.$Message.error('拆分失败...') this.$Message.error("拆分失败...");
} }
}) });
}, },
// 删除行 // 删除行
removeDetail(item, index) { removeDetail(item, index) {
let delid = {id:item.id} let delid = { id: item.id };
Api.deleteItem(delid).then((res) => { Api.deleteItem(delid).then(res => {
if (res.success) { if (res.success) {
this.$Message.success('拆分项已删除。') this.$Message.success("拆分项已删除。");
this.getUserInfoFn() this.getUserInfoFn();
} else { } else {
this.$Message.error('拆分项删除失败!') this.$Message.error("拆分项删除失败!");
} }
}) });
// let oldList = this.listTask; // let oldList = this.listTask;
// let clickRow = oldList.filter(listRow=>listRow.process_name===item.process_name)[0]; // let clickRow = oldList.filter(listRow=>listRow.process_name===item.process_name)[0];
// clickRow.quantity += this.chaiNum // clickRow.quantity += this.chaiNum
// this.listTask.splice(index, 1) // this.listTask.splice(index, 1)
// this.$Message.success('拆分项已删除。') // this.$Message.success('拆分项已删除。')
}, },
cancle() {//取消 cancle() {
this.facilityModal = false //取消
this.manModal = false this.facilityModal = false;
this.footerToolbar=false this.manModal = false;
}, this.footerToolbar = false;
}
}, },
computed: { computed: {
ids() { ids() {
let ids = [] let ids = [];
this.listTask.map((u) => { this.listTask.map(u => {
if (u.checked) { if (u.checked) {
ids.push(u.id) ids.push(u.id);
} }
}) });
if (ids.length > 0) { if (ids.length > 0) {
this.footerToolbar = true this.footerToolbar = true;
} }
return ids return ids;
}, },
listOrder(){ listOrder() {
let orders= this.$u.group(this.listTask,u=>{ let orders = this.$u.group(this.listTask, u => {
return u.mesCode return u.mesCode;
}) });
console.warn("listOrder",orders) console.warn("listOrder", orders);
return orders; return orders;
}, },
peploeId() { peploeId() {
let peploeId = [] let peploeId = [];
this.listMan.map((u) => { this.listMan.map(u => {
if (u.checked) { if (u.checked) {
peploeId.push(u.id) peploeId.push(u.id);
} }
}) });
this.footerToolbar = true this.footerToolbar = true;
return peploeId return peploeId;
}, },
showOperate() { showOperate() {
return this.ids.length > 0 && (this.shebeiId > 0 || this.peploeId.length >0) return (
this.ids.length > 0 && (this.shebeiId > 0 || this.peploeId.length > 0)
);
} }
}, },
watch:{}, watch: {}
} };
</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