|
|
@@ -178,29 +178,30 @@
|
|
|
class="table"
|
|
|
>
|
|
|
<template v-slot:toolbar>
|
|
|
- <el-button
|
|
|
- :loading="toolbarLoading"
|
|
|
- type="primary"
|
|
|
- @click="dispatch(item, 1)"
|
|
|
- >
|
|
|
- 派单
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- :loading="toolbarLoading"
|
|
|
- type="primary"
|
|
|
- @click="dispatch(item, 2)"
|
|
|
- >
|
|
|
- 撤回
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- :loading="toolbarLoading"
|
|
|
- type="primary"
|
|
|
- @click="dispatch(item, 3)"
|
|
|
- >
|
|
|
- 保存
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <div style="margin-left: 50px; display: inline-block">
|
|
|
+ <div style="display: inline-block;" v-if="!item.isSpecialField">
|
|
|
+ <el-button
|
|
|
+ :loading="toolbarLoading"
|
|
|
+ type="primary"
|
|
|
+ @click="dispatch(item, 1)"
|
|
|
+ >
|
|
|
+ 派单
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ :loading="toolbarLoading"
|
|
|
+ type="primary"
|
|
|
+ @click="dispatch(item, 2)"
|
|
|
+ >
|
|
|
+ 撤回
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ :loading="toolbarLoading"
|
|
|
+ type="primary"
|
|
|
+ @click="dispatch(item, 3)"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div style="margin-left: 50px; display: inline-block" v-if="!item.isSpecialField">
|
|
|
<span
|
|
|
class="text"
|
|
|
style="
|
|
|
@@ -232,11 +233,14 @@
|
|
|
</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
+ <div v-if="item.isSpecialField" class="describe" style="color: #67c23a;">
|
|
|
+ 该工序已完成派单!
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template v-slot:quantity="{ row }">
|
|
|
<el-input
|
|
|
v-model="row.quantity"
|
|
|
- :disabled="permissions(row)"
|
|
|
+ :disabled="permissions(row,item)"
|
|
|
placeholder="请输入数量"
|
|
|
type="number"
|
|
|
@input="(e) => handleQuantityInput(e, row, item)"
|
|
|
@@ -245,16 +249,32 @@
|
|
|
<template v-slot:weight="{ row }">
|
|
|
<el-input
|
|
|
v-model="row.weight"
|
|
|
- :disabled="permissions(row)"
|
|
|
+ :disabled="permissions(row,item)"
|
|
|
placeholder="请输入重量"
|
|
|
type="number"
|
|
|
@input="(e) => handleWeightInput(e, row, item)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
+ <template v-slot:teamTimeDetailId="{ row }">
|
|
|
+ <el-select
|
|
|
+ v-model="row.teamTimeDetailId"
|
|
|
+ placeholder="班次"
|
|
|
+ :disabled="permissions(row,item)"
|
|
|
+ @change="(e) => shiftSelection(e, row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in shiftList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
<template v-slot:startTime="{ row }">
|
|
|
<el-date-picker
|
|
|
v-model="row.startTime"
|
|
|
- :disabled="permissions(row)"
|
|
|
+ :disabled="permissions(row,item)"
|
|
|
:picker-options="{
|
|
|
disabledDate: (time) => {
|
|
|
return (
|
|
|
@@ -271,7 +291,7 @@
|
|
|
<template v-slot:endTime="{ row }">
|
|
|
<el-date-picker
|
|
|
v-model="row.endTime"
|
|
|
- :disabled="permissions(row)"
|
|
|
+ :disabled="permissions(row,item)"
|
|
|
:picker-options="{
|
|
|
disabledDate: (time) => {
|
|
|
return (
|
|
|
@@ -327,7 +347,8 @@
|
|
|
resetAssignee,
|
|
|
taskAssignment,
|
|
|
taskRevoked,
|
|
|
- taskSave
|
|
|
+ taskSave,
|
|
|
+ listByFactoryId
|
|
|
} from '@/api/mainData/index.js';
|
|
|
|
|
|
export default {
|
|
|
@@ -381,7 +402,9 @@
|
|
|
{ label: '要求生产重量:', prop: 'initialWeight' },
|
|
|
{ label: '计划开始时间:', prop: 'planStartTime' },
|
|
|
{ label: '计划结束时间:', prop: 'planCompleteTime' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ shiftList: [],
|
|
|
+ dateValue: ''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -415,7 +438,8 @@
|
|
|
},
|
|
|
// 列表输入框操作 已派单的不能操作
|
|
|
permissions() {
|
|
|
- return (row) => {
|
|
|
+ return (row,item) => {
|
|
|
+ if(item.isSpecialField) return true
|
|
|
if (!row.status) return false;
|
|
|
if (row.status.code == 1) return true;
|
|
|
};
|
|
|
@@ -463,40 +487,11 @@
|
|
|
return row.status.desc || '';
|
|
|
}
|
|
|
},
|
|
|
- // {
|
|
|
- // prop: 'name',
|
|
|
- // label: '名称',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // width: 180
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: 'model',
|
|
|
- // label: '型号',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // width: 180
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: 'specifications',
|
|
|
- // label: '规格',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // width: 180
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: 'brandNumber',
|
|
|
- // label: '牌号',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // width: 180
|
|
|
- // },
|
|
|
{
|
|
|
slot: 'quantity',
|
|
|
prop: 'quantity',
|
|
|
label: '数量',
|
|
|
align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
width: 140
|
|
|
},
|
|
|
{
|
|
|
@@ -504,15 +499,20 @@
|
|
|
prop: 'weight',
|
|
|
label: `重量(${this.current.weightUnit})`,
|
|
|
align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
width: 140
|
|
|
},
|
|
|
+ {
|
|
|
+ slot: 'teamTimeDetailId',
|
|
|
+ prop: 'teamTimeDetailId',
|
|
|
+ label: '班次',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
{
|
|
|
slot: 'startTime',
|
|
|
prop: 'startTime',
|
|
|
label: '计划开始时间',
|
|
|
align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
minWidth: 240
|
|
|
},
|
|
|
{
|
|
|
@@ -520,7 +520,6 @@
|
|
|
prop: 'endTime',
|
|
|
label: '计划完成时间',
|
|
|
align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
minWidth: 240
|
|
|
},
|
|
|
{
|
|
|
@@ -538,10 +537,36 @@
|
|
|
watch: {},
|
|
|
created() {
|
|
|
this.workCenterData();
|
|
|
- this.FirstTaskIdFn();
|
|
|
+ this.getClassesData();
|
|
|
this.form.singleReport = this.clientEnvironmentId == 2 ? 0 : 1;
|
|
|
+ this.dateValue = this.getFormattedDate();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 查询班次
|
|
|
+ getClassesData() {
|
|
|
+ if (!this.current.factoriesId) return;
|
|
|
+ listByFactoryId(this.current.factoriesId).then((res) => {
|
|
|
+ if (!res) return;
|
|
|
+ this.shiftList = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 选中班次
|
|
|
+ shiftSelection(e, row) {
|
|
|
+ let data = this.shiftList.find((item) => item.id == e);
|
|
|
+ let startTime = `${this.dateValue} ${data.startTime}`;
|
|
|
+ let endTime = `${this.dateValue} ${data.endTime}`;
|
|
|
+ this.$set(row, 'startTime', startTime);
|
|
|
+ this.$set(row, 'endTime', endTime);
|
|
|
+ },
|
|
|
+ // 获取当前年月日
|
|
|
+ getFormattedDate() {
|
|
|
+ const now = new Date();
|
|
|
+ const year = now.getFullYear();
|
|
|
+ const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
+ const date = String(now.getDate()).padStart(2, '0');
|
|
|
+ return `${year}-${month}-${date}`;
|
|
|
+ },
|
|
|
+ // 查询工作中心
|
|
|
async workCenterData() {
|
|
|
const res = await listWorkCenter(this.current.taskInstanceId);
|
|
|
this.workCenterList = res;
|
|
|
@@ -551,6 +576,7 @@
|
|
|
// 查首工序
|
|
|
this.changeWork(res[0].id); // 选择工作中心
|
|
|
this.getProductionData(res[0].id); // 查询产线
|
|
|
+ this.FirstTaskIdFn(); // 查询工位数据
|
|
|
}
|
|
|
},
|
|
|
// 查询工序列表数据
|
|
|
@@ -571,9 +597,17 @@
|
|
|
res = allRes;
|
|
|
} else {
|
|
|
// 先将 存在的工序数据 数组的 id 存入 Set
|
|
|
- const existIds = new Set(existRes.map((item) => item.taskId));
|
|
|
+ const existIds = new Map(
|
|
|
+ existRes.map((item) => [item.taskId, true])
|
|
|
+ );
|
|
|
// 过滤 全部工序数据 数组
|
|
|
- res = allRes.filter((aItem) => !existIds.has(aItem.sourceTaskId));
|
|
|
+ // res = allRes.map((aItem) => !existIds.has(aItem.sourceTaskId));
|
|
|
+ res = allRes.map((aItem) => {
|
|
|
+ return {
|
|
|
+ ...aItem,
|
|
|
+ isSpecialField: existIds.has(aItem.sourceTaskId)
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
// 如果没有首工序的数据 就不能选择工序任务派单
|
|
|
if (!res || res.length === 0) {
|
|
|
@@ -586,6 +620,7 @@
|
|
|
// this.procTaskDis = false;
|
|
|
let list = [];
|
|
|
res.forEach((item, index) => {
|
|
|
+ console.log(item, 'item 全部 ll');
|
|
|
let obj = {
|
|
|
id: item.sourceTaskId, //工序 id
|
|
|
name: item.name, //工序 名称
|
|
|
@@ -595,6 +630,7 @@
|
|
|
selection: [], // 当前工序下面的指派 选中的数据
|
|
|
code: item.code, // 工序 编码
|
|
|
index: index, // 当前工序数据的下标
|
|
|
+ isSpecialField: item.isSpecialField,
|
|
|
radioBun: {
|
|
|
// 指派按钮的操作状态 绑定 默认false(可操作)
|
|
|
stationDis: false,
|
|
|
@@ -633,14 +669,18 @@
|
|
|
const res = await listUserByIds([e]);
|
|
|
this.crewList = res || [];
|
|
|
// 查看当前的工序数据是不是 选择的人员 是的话同步更改
|
|
|
- if (this.form.taskAss == 1) {
|
|
|
+ // if (this.form.taskAss == 1) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ if (!this.processId || this.processId == 0) {
|
|
|
return;
|
|
|
}
|
|
|
let data = this.processList.find(
|
|
|
(item) => item.id === this.processId
|
|
|
);
|
|
|
if (data.assignType == 2) {
|
|
|
- this.$set(data, 'list', res);
|
|
|
+ this.handleClick({ name: this.processId });
|
|
|
+ // this.$set(data, 'list', res);
|
|
|
}
|
|
|
} catch {
|
|
|
this.crewList = [];
|
|
|
@@ -723,7 +763,7 @@
|
|
|
flag = false;
|
|
|
return;
|
|
|
}
|
|
|
- assignees.push({
|
|
|
+ let Aobj = {
|
|
|
assigneeId: item.id,
|
|
|
quantity: item.quantity,
|
|
|
weight: item.weight,
|
|
|
@@ -731,7 +771,11 @@
|
|
|
endTime: item.endTime,
|
|
|
assigneeType: row.assignType,
|
|
|
assigneeName: item.name
|
|
|
- });
|
|
|
+ };
|
|
|
+ if (item.teamTimeDetailId) {
|
|
|
+ Aobj.teamTimeDetailId = item.teamTimeDetailId;
|
|
|
+ }
|
|
|
+ assignees.push(Aobj);
|
|
|
changeIds.push(item.changeId);
|
|
|
});
|
|
|
if (!flag) {
|
|
|
@@ -789,100 +833,14 @@
|
|
|
}
|
|
|
this.getAssignData(row.index, arr);
|
|
|
},
|
|
|
- // 最后提交
|
|
|
- // async confirm() {
|
|
|
- // if (!this.form.singleReport) {
|
|
|
- // this.$message.warning('请先选择报工类型');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (!this.form.teamId) {
|
|
|
- // this.$message.warning('请先选择班组');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (this.form.taskAss == 1) {
|
|
|
- // this.issue();
|
|
|
- // // 按原来的逻辑
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // let params = {
|
|
|
- // teamId: this.form.teamId,
|
|
|
- // workCenterId: this.form.workCenterId,
|
|
|
- // workOrderId: this.current.id
|
|
|
- // };
|
|
|
- // this.toolbarLoading = true;
|
|
|
- // try {
|
|
|
- // const res = await checkAssignConfirm(params);
|
|
|
- // if (!res) {
|
|
|
- // this.toolbarLoading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // let paramsD = {
|
|
|
- // assignType: data.assignType,
|
|
|
- // singleReport: this.form.singleReport,
|
|
|
- // teamId: this.form.teamId,
|
|
|
- // crewIds: data.assignType == 2 ? dispatchArr : [], // 人员 2
|
|
|
- // workstationIds: data.assignType == 1 ? dispatchArr : [], // 工位 1
|
|
|
- // id: this.current.id
|
|
|
- // };
|
|
|
- // const response = await releaseWorkOrder(paramsD);
|
|
|
- // this.toolbarLoading = false;
|
|
|
- // if (response) {
|
|
|
- // this.$message.success('操作成功');
|
|
|
- // this.cancel();
|
|
|
- // this.$emit('createSuccess');
|
|
|
- // }
|
|
|
- // } catch (err) {
|
|
|
- // this.toolbarLoading = false;
|
|
|
- // this.$message.warning(err.message);
|
|
|
- // }
|
|
|
- // },
|
|
|
- // 下达
|
|
|
- // issue() {
|
|
|
- // if (this.form.assignType == 1) {
|
|
|
- // if (
|
|
|
- // !this.form.workstationIds ||
|
|
|
- // this.form.workstationIds.length == 0
|
|
|
- // ) {
|
|
|
- // this.$message.warning('请选择工位');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // let data = {
|
|
|
- // assignType: this.form.assignType,
|
|
|
- // singleReport: this.form.singleReport,
|
|
|
- // teamId: this.form.teamId,
|
|
|
- // crewIds: [],
|
|
|
- // workstationIds: [],
|
|
|
- // id: this.current.id
|
|
|
- // };
|
|
|
- // if (this.form.assignType == 1) {
|
|
|
- // data.workstationIds = this.form.workstationIds || [];
|
|
|
- // } else {
|
|
|
- // data.crewIds = this.form.crewIds || [];
|
|
|
- // }
|
|
|
- // this.toolbarLoading = true;
|
|
|
- // releaseWorkOrder(data)
|
|
|
- // .then((res) => {
|
|
|
- // this.toolbarLoading = false;
|
|
|
- // if (res) {
|
|
|
- // this.$message.success('操作成功');
|
|
|
- // this.cancel();
|
|
|
- // this.$emit('createSuccess');
|
|
|
- // }
|
|
|
- // })
|
|
|
- // .catch((err) => {
|
|
|
- // this.toolbarLoading = false;
|
|
|
- // this.$message.warning(err.message);
|
|
|
- // });
|
|
|
- // },
|
|
|
// 工序选择
|
|
|
handleClick(tab) {
|
|
|
let id = tab.name;
|
|
|
this.processId = id;
|
|
|
let data = this.processList.find((item) => item.id == this.processId);
|
|
|
- if (data.list.length == 0) {
|
|
|
- this.changeRadio(1, data.index);
|
|
|
- }
|
|
|
+ // if (data.list.length == 0) {
|
|
|
+ this.changeRadio(data.assignType, data.index);
|
|
|
+ // }
|
|
|
},
|
|
|
// 指派选择
|
|
|
changeRadio(e, index) {
|
|
|
@@ -996,6 +954,7 @@
|
|
|
listArr[idx].quantity = item.quantity;
|
|
|
listArr[idx].weight = item.weight;
|
|
|
listArr[idx].changeId = item.id;
|
|
|
+ listArr[idx].teamTimeDetailId = item.teamTimeDetailId;
|
|
|
}
|
|
|
});
|
|
|
this.$set(dataRow, 'list', listArr);
|
|
|
@@ -1013,6 +972,20 @@
|
|
|
// 更新绑定值
|
|
|
row.quantity = value;
|
|
|
this.calculateQuantity(row, item);
|
|
|
+ this.bringWeight(row.quantity, row);
|
|
|
+ },
|
|
|
+ // 自动算重量
|
|
|
+ bringWeight(value, row) {
|
|
|
+ if (!this.current.formingWeight) {
|
|
|
+ this.$set(row, 'weight', 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let weight =
|
|
|
+ (this.current.formingWeight / this.current.formingNum) * value;
|
|
|
+ if (weight > 0) {
|
|
|
+ weight = weight.toFixed(4) - 0;
|
|
|
+ }
|
|
|
+ this.$set(row, 'weight', weight);
|
|
|
},
|
|
|
calculateQuantity(row, item) {
|
|
|
// 如果没有该字段 就不做判断
|