|
|
@@ -410,6 +410,41 @@
|
|
|
|
|
|
import { getteampage, listUserByIds } from '@/api/workforceManagement/team';
|
|
|
import { getCode } from '@/api/codeManagement/index.js';
|
|
|
+
|
|
|
+ const defaultForm = function () {
|
|
|
+ return {
|
|
|
+ code: '',
|
|
|
+ enabled: 1,
|
|
|
+ extInfo: {
|
|
|
+ factoryId: '', // 工厂
|
|
|
+ workshopPlanId: '', // 厂房
|
|
|
+ workshopId: '', // 车间
|
|
|
+ principalDep: '', // 负责人部门
|
|
|
+ meterTimeUnit: '时', // 节拍时间单位
|
|
|
+ meterTime: '', // 节拍时间
|
|
|
+ assetCode: '', //设备编码
|
|
|
+ assetName: '', //设备名称
|
|
|
+ meterMeasuringUnit: '', // 节拍计量单位
|
|
|
+ workCenterId: null, //所属工作中心
|
|
|
+ // produceId: null, //可执行工序
|
|
|
+ type: null,
|
|
|
+ teamId: null,
|
|
|
+ userIds: [],
|
|
|
+ criticalEquipment: '',
|
|
|
+ keyEquipment: ''
|
|
|
+ },
|
|
|
+ id: '',
|
|
|
+ leaderId: '', // 负责人
|
|
|
+ name: '',
|
|
|
+ productionLineId: '',
|
|
|
+ remark: '',
|
|
|
+ taskIds: [],
|
|
|
+ taskNames: [],
|
|
|
+ activeName: '',
|
|
|
+ workstationSubstanceList: []
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
AreaSelect,
|
|
|
@@ -428,39 +463,6 @@
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
- const defaultForm = function () {
|
|
|
- return {
|
|
|
- code: '',
|
|
|
- enabled: 1,
|
|
|
- extInfo: {
|
|
|
- factoryId: '', // 工厂
|
|
|
- workshopPlanId: '', // 厂房
|
|
|
- workshopId: '', // 车间
|
|
|
- principalDep: '', // 负责人部门
|
|
|
- meterTimeUnit: '时', // 节拍时间单位
|
|
|
- meterTime: '', // 节拍时间
|
|
|
- assetCode: '', //设备编码
|
|
|
- assetName: '', //设备名称
|
|
|
- meterMeasuringUnit: '', // 节拍计量单位
|
|
|
- workCenterId: null, //所属工作中心
|
|
|
- // produceId: null, //可执行工序
|
|
|
- type: null,
|
|
|
- teamId: null,
|
|
|
- userIds: [],
|
|
|
- criticalEquipment: '',
|
|
|
- keyEquipment: ''
|
|
|
- },
|
|
|
- id: '',
|
|
|
- leaderId: '', // 负责人
|
|
|
- name: '',
|
|
|
- productionLineId: '',
|
|
|
- remark: '',
|
|
|
- taskIds: [],
|
|
|
- taskNames: [],
|
|
|
- activeName: '',
|
|
|
- workstationSubstanceList: []
|
|
|
- };
|
|
|
- };
|
|
|
return {
|
|
|
defaultForm,
|
|
|
// 表单数据
|
|
|
@@ -729,10 +731,9 @@
|
|
|
if (!this.form.factoryWorkstationOperations.length) {
|
|
|
return this.$message.error('请添加工序');
|
|
|
} else {
|
|
|
- this.form.taskIds =
|
|
|
- this.form.factoryWorkstationOperations.map(
|
|
|
- (n) => n.operationId
|
|
|
- );
|
|
|
+ this.form.taskIds = this.form.factoryWorkstationOperations.map(
|
|
|
+ (n) => n.operationId
|
|
|
+ );
|
|
|
}
|
|
|
this.loading = true;
|
|
|
|
|
|
@@ -893,6 +894,8 @@
|
|
|
change_productionLineId() {},
|
|
|
// 请求详情
|
|
|
getData(id) {
|
|
|
+ console.log(this.form, '1122');
|
|
|
+
|
|
|
return getById(id).then((res) => {
|
|
|
if (
|
|
|
res.workstationSubstanceList &&
|
|
|
@@ -907,11 +910,21 @@
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
// console.log(res.tMainFactoryWorkstationOperationAddPOList);
|
|
|
- this.$refs.stationMeter.setValue(
|
|
|
- res.factoryWorkstationOperations
|
|
|
- );
|
|
|
+ this.$refs.stationMeter.setValue(res.factoryWorkstationOperations);
|
|
|
});
|
|
|
- this.form = Object.assign({}, this.form, res);
|
|
|
+ const baseForm = defaultForm();
|
|
|
+
|
|
|
+ this.form = {
|
|
|
+ ...baseForm,
|
|
|
+ ...res,
|
|
|
+ extInfo: {
|
|
|
+ ...baseForm.extInfo,
|
|
|
+ ...res.extInfo
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // this.form = this.deepCopy(Object.assign({}, this.form, res));
|
|
|
+
|
|
|
+ // console.log(this.form, 'this.form1');
|
|
|
if (
|
|
|
this.form?.extInfo?.teamId &&
|
|
|
typeof this.form?.extInfo?.teamId === 'string'
|
|
|
@@ -921,7 +934,24 @@
|
|
|
if (res.taskList?.length) {
|
|
|
this.form.taskNames = res.taskList.map((i) => i.name);
|
|
|
}
|
|
|
+
|
|
|
+ console.log(this.form, 'this.form2');
|
|
|
});
|
|
|
+ },
|
|
|
+ deepCopy(obj, hash = new WeakMap()) {
|
|
|
+ if (obj === null) return null;
|
|
|
+ if (obj instanceof Date) return new Date(obj);
|
|
|
+ if (obj instanceof RegExp) return new RegExp(obj);
|
|
|
+ if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
|
|
|
+ if (hash.has(obj)) return hash.get(obj);
|
|
|
+
|
|
|
+ const result = Array.isArray(obj) ? [] : {};
|
|
|
+ hash.set(obj, result);
|
|
|
+
|
|
|
+ return Object.keys(obj).reduce((acc, key) => {
|
|
|
+ acc[key] = this.deepCopy(obj[key], hash);
|
|
|
+ return acc;
|
|
|
+ }, result);
|
|
|
}
|
|
|
}
|
|
|
};
|