Commit 0779965d authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

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