|
|
@@ -49,9 +49,9 @@
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in workCenterList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ :key="item.centerId"
|
|
|
+ :label="item.centerName"
|
|
|
+ :value="item.centerId"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -67,9 +67,9 @@
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in teamList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ :key="item.teamId"
|
|
|
+ :label="item.teamName"
|
|
|
+ :value="item.teamId"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -112,6 +112,7 @@
|
|
|
:loading="toolbarLoading"
|
|
|
type="primary"
|
|
|
@click="dispatch(item, 1)"
|
|
|
+ :disabled="!item.isDisable"
|
|
|
>
|
|
|
派单
|
|
|
</el-button>
|
|
|
@@ -119,6 +120,7 @@
|
|
|
:loading="toolbarLoading"
|
|
|
type="primary"
|
|
|
@click="dispatch(item, 2)"
|
|
|
+ :disabled="!item.isDisable"
|
|
|
>
|
|
|
撤回
|
|
|
</el-button>
|
|
|
@@ -126,6 +128,7 @@
|
|
|
:loading="toolbarLoading"
|
|
|
type="primary"
|
|
|
@click="dispatch(item, 3)"
|
|
|
+ :disabled="!item.isDisable"
|
|
|
>
|
|
|
保存
|
|
|
</el-button>
|
|
|
@@ -281,6 +284,7 @@
|
|
|
taskSave,
|
|
|
listByFactoryId
|
|
|
} from '@/api/mainData/index.js';
|
|
|
+ import { getUserInfo } from '@/api/produceOrder/index.js';
|
|
|
|
|
|
export default {
|
|
|
components: {},
|
|
|
@@ -339,7 +343,8 @@
|
|
|
factoriesId: '', // 工厂id
|
|
|
dispatchType: 1,
|
|
|
time_calc_code: '0', // 是否进行时间赋值 0 否 1 是
|
|
|
- validDate
|
|
|
+ validDate,
|
|
|
+ userTeamList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -532,21 +537,44 @@
|
|
|
return `${year}-${month}-${date}`;
|
|
|
},
|
|
|
// 查询工作中心
|
|
|
+ // async workCenterData() {
|
|
|
+ // const res = await listWorkCenter(this.current.taskInstanceId);
|
|
|
+ // this.workCenterList = res;
|
|
|
+ // if (res.length > 0) {
|
|
|
+ // console.log(res, '工作中心');
|
|
|
+ // this.form.factoryName = res[0].factoryName;
|
|
|
+ // const userData = await getUserInfo(
|
|
|
+ // this.$store.state.user.info.userId
|
|
|
+ // );
|
|
|
+ // console.log(userData, '用户的数据111111111');
|
|
|
+ // this.form.workCenterId = res[0].id;
|
|
|
+ // this.factoriesId = res[0].factoryId;
|
|
|
+ // // 查首工序
|
|
|
+ // this.changeWork(res[0].id); // 选择工作中心
|
|
|
+ // this.getProductionData(res[0].id); // 查询产线
|
|
|
+ // this.FirstTaskIdFn(); // 查询工位数据
|
|
|
+ // this.getClassesData();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
async workCenterData() {
|
|
|
- const res = await listWorkCenter(this.current.taskInstanceId);
|
|
|
- this.workCenterList = res;
|
|
|
- if (res.length > 0) {
|
|
|
- console.log(res, '工作中心');
|
|
|
- this.form.factoryName = res[0].factoryName;
|
|
|
- this.form.workCenterId = res[0].id;
|
|
|
- this.factoriesId = res[0].factoryId;
|
|
|
- // 查首工序
|
|
|
- this.changeWork(res[0].id); // 选择工作中心
|
|
|
- this.getProductionData(res[0].id); // 查询产线
|
|
|
+ const userData = await getUserInfo(this.$store.state.user.info.userId);
|
|
|
+ this.factoriesId = userData.factoryId ? userData.factoryId : '';
|
|
|
+ this.form.factoryName = userData.factoryName
|
|
|
+ ? userData.factoryName
|
|
|
+ : '';
|
|
|
+
|
|
|
+ if (userData.centerList.length != 0) {
|
|
|
+ this.form.workCenterId = userData.centerList[0].centerId;
|
|
|
+ this.workCenterList = userData.centerList;
|
|
|
+ this.userTeamList = userData.teamList;
|
|
|
+ this.changeWork(userData.centerList[0].centerId);
|
|
|
+ this.getProductionData(userData.centerList[0].centerId);
|
|
|
this.FirstTaskIdFn(); // 查询工位数据
|
|
|
this.getClassesData();
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// 查询工序列表数据
|
|
|
async changeDispatch(e) {
|
|
|
this.tabsLoading = true;
|
|
|
@@ -668,16 +696,38 @@
|
|
|
} catch (err) {}
|
|
|
},
|
|
|
|
|
|
+ // // 选择工作中心
|
|
|
+ // async changeWork(e) {
|
|
|
+ // this.form.workCenterId = e;
|
|
|
+ // // this.changeDispatch(); // 查询工序列表
|
|
|
+ // let data = this.workCenterList.find((item) => item.id == e);
|
|
|
+ // this.form.workCenterName = data.name;
|
|
|
+ // this.teamList = data.teamList || [];
|
|
|
+ // if (this.teamList.length > 0) {
|
|
|
+ // this.form.teamId = this.teamList[0].id;
|
|
|
+ // await this.changeGroups(this.teamList[0].id);
|
|
|
+ // } else {
|
|
|
+ // // 如果没有 班组数据 将人员数据清空 并且判断
|
|
|
+ // this.crewList = [];
|
|
|
+ // this.form.teamId = '';
|
|
|
+ // let data = this.processList.find((item) => item.id == this.processId);
|
|
|
+ // if (data.assignType == 2) {
|
|
|
+ // this.$set(data, 'list', []);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
// 选择工作中心
|
|
|
async changeWork(e) {
|
|
|
this.form.workCenterId = e;
|
|
|
- // this.changeDispatch(); // 查询工序列表
|
|
|
- let data = this.workCenterList.find((item) => item.id == e);
|
|
|
- this.form.workCenterName = data.name;
|
|
|
- this.teamList = data.teamList || [];
|
|
|
- if (this.teamList.length > 0) {
|
|
|
- this.form.teamId = this.teamList[0].id;
|
|
|
- await this.changeGroups(this.teamList[0].id);
|
|
|
+
|
|
|
+ let data = this.userTeamList.filter((item) =>
|
|
|
+ item.workCenterIds.includes(e)
|
|
|
+ );
|
|
|
+
|
|
|
+ this.teamList = data || [];
|
|
|
+ if (this.teamList.length != 0) {
|
|
|
+ this.form.teamId = this.teamList[0].teamId;
|
|
|
+ await this.changeGroups(this.teamList[0].teamId);
|
|
|
} else {
|
|
|
// 如果没有 班组数据 将人员数据清空 并且判断
|
|
|
this.crewList = [];
|
|
|
@@ -690,7 +740,7 @@
|
|
|
},
|
|
|
// 选择班组 查询人员的数据
|
|
|
async changeGroups(e) {
|
|
|
- let data = this.teamList.find((item) => item.id == e);
|
|
|
+ let data = this.teamList.find((item) => item.teamId == e);
|
|
|
this.form.teamName = data.name;
|
|
|
try {
|
|
|
const res = await listUserByIds([e]);
|