|
@@ -766,7 +766,7 @@
|
|
|
><el-input
|
|
><el-input
|
|
|
:value="row.categoryName"
|
|
:value="row.categoryName"
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
- @click.native="categorySelect(row, $index)"
|
|
|
|
|
|
|
+ @click.native="categorySelect(row, $index, true)"
|
|
|
></el-input
|
|
></el-input
|
|
|
></div>
|
|
></div>
|
|
|
</template>
|
|
</template>
|
|
@@ -1002,7 +1002,7 @@
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import * as dayjs from 'dayjs';
|
|
import * as dayjs from 'dayjs';
|
|
|
import { getFile } from '@/api/system/file';
|
|
import { getFile } from '@/api/system/file';
|
|
|
- // import fileUpload from '@/components/addDoc/index.vue';
|
|
|
|
|
|
|
+ import fileUpload from '@/components/addDoc/index.vue';
|
|
|
import { workingProcedureUpdate } from '@/api/material/BOM';
|
|
import { workingProcedureUpdate } from '@/api/material/BOM';
|
|
|
import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
|
|
import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
|
|
|
import ProductModal from '@/components/select/bom/ProductModal.vue';
|
|
import ProductModal from '@/components/select/bom/ProductModal.vue';
|
|
@@ -1025,7 +1025,7 @@
|
|
|
components: {
|
|
components: {
|
|
|
userSearch,
|
|
userSearch,
|
|
|
ParamModal,
|
|
ParamModal,
|
|
|
- // fileUpload,
|
|
|
|
|
|
|
+ fileUpload,
|
|
|
ProductModal,
|
|
ProductModal,
|
|
|
jobDialog,
|
|
jobDialog,
|
|
|
ProductModalMultiple,
|
|
ProductModalMultiple,
|
|
@@ -1617,7 +1617,7 @@
|
|
|
this.$refs.jobTable.getData()
|
|
this.$refs.jobTable.getData()
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
- determineChoose(title, row, idx) {
|
|
|
|
|
|
|
+ determineChoose(title, rows, idx) {
|
|
|
let type = '';
|
|
let type = '';
|
|
|
if (this.activeName === '材料定额') {
|
|
if (this.activeName === '材料定额') {
|
|
|
type = 'materialQuota';
|
|
type = 'materialQuota';
|
|
@@ -1626,60 +1626,51 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (title == '选择物料') {
|
|
if (title == '选择物料') {
|
|
|
- console.log(row, 'row');
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'categoryName',
|
|
|
|
|
- row.name
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'categoryId',
|
|
|
|
|
- row.id
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'categoryCode',
|
|
|
|
|
- row.code
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'unit',
|
|
|
|
|
- row.measuringUnit
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'weightUnit',
|
|
|
|
|
- row.weightUnit
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'brandNum',
|
|
|
|
|
- row.brandNum
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'modelType',
|
|
|
|
|
- row.modelType
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'rootCategoryLevelId',
|
|
|
|
|
- row.categoryLevelPathIdParent
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'specification',
|
|
|
|
|
- row.specification
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // ProductModal 多选时回传数组,单选时回传单条;统一成数组处理
|
|
|
|
|
+ const list = Array.isArray(rows) ? rows : [rows];
|
|
|
|
|
+ const startIdx = idx; // 多选且空表时为 -1,含义是"没有可写的现有行"
|
|
|
|
|
+
|
|
|
|
|
+ list.forEach((row, i) => {
|
|
|
|
|
+ let targetIdx;
|
|
|
|
|
+ if (i === 0 && startIdx >= 0) {
|
|
|
|
|
+ // 多选首条(写到最后一行)或单选:写到现有 idx
|
|
|
|
|
+ targetIdx = startIdx;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 其余条目:调用 add() 新增空行,再回写
|
|
|
|
|
+ this.add();
|
|
|
|
|
+ targetIdx =
|
|
|
|
|
+ this.tableData.taskParam[this.currentIndex][type].length - 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.writeProductFields(type, targetIdx, row);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.tableData.taskParam[this.currentIndex][type][idx],
|
|
|
|
|
- 'id',
|
|
|
|
|
- row.id
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // 刷新对应 Tab 的表格 UI(仅多选追加了行才需要;单选不会触发分支)
|
|
|
|
|
+ if (type === 'resource' && this.$refs.resourceTable) {
|
|
|
|
|
+ this.$refs.resourceTable.setData(
|
|
|
|
|
+ this.tableData.taskParam[this.currentIndex][type]
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (type === 'materialQuota' && this.$refs.materialTable) {
|
|
|
|
|
+ this.$refs.materialTable.setData(
|
|
|
|
|
+ this.tableData.taskParam[this.currentIndex][type]
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 把 ProductModal 选中的物料字段写到指定行(资源表 / 材料定额表共用)
|
|
|
|
|
+ writeProductFields(type, idx, row) {
|
|
|
|
|
+ const target =
|
|
|
|
|
+ this.tableData.taskParam[this.currentIndex][type][idx];
|
|
|
|
|
+ this.$set(target, 'categoryName', row.name);
|
|
|
|
|
+ this.$set(target, 'categoryId', row.id);
|
|
|
|
|
+ this.$set(target, 'categoryCode', row.code);
|
|
|
|
|
+ this.$set(target, 'unit', row.measuringUnit);
|
|
|
|
|
+ this.$set(target, 'weightUnit', row.weightUnit);
|
|
|
|
|
+ this.$set(target, 'brandNum', row.brandNum);
|
|
|
|
|
+ this.$set(target, 'modelType', row.modelType);
|
|
|
|
|
+ this.$set(target, 'rootCategoryLevelId', row.categoryLevelPathIdParent);
|
|
|
|
|
+ this.$set(target, 'specification', row.specification);
|
|
|
|
|
+ this.$set(target, 'id', row.id);
|
|
|
|
|
+ },
|
|
|
uploadedSuccess(data, row) {
|
|
uploadedSuccess(data, row) {
|
|
|
row.bomArtFiles = data[0].storePath;
|
|
row.bomArtFiles = data[0].storePath;
|
|
|
this.filedList = [];
|
|
this.filedList = [];
|
|
@@ -1692,8 +1683,22 @@
|
|
|
downloadFile(url) {
|
|
downloadFile(url) {
|
|
|
getFile({ objectName: url }, '附件');
|
|
getFile({ objectName: url }, '附件');
|
|
|
},
|
|
},
|
|
|
- categorySelect(row, idx) {
|
|
|
|
|
- this.$refs.productRefs.open(row, '选择物料', '1', idx);
|
|
|
|
|
|
|
+ categorySelect(row, idx, isMultiple = false) {
|
|
|
|
|
+ // 多选时把"已在 resource 列表里的物料 id"传给 ProductModal,禁掉这些行的勾选
|
|
|
|
|
+ let existingIds = [];
|
|
|
|
|
+ if (isMultiple && this.activeName === '制造资源') {
|
|
|
|
|
+ const list =
|
|
|
|
|
+ this.tableData.taskParam[this.currentIndex]?.['resource'] || [];
|
|
|
|
|
+ existingIds = list.map((item) => item.id).filter(Boolean);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.productRefs.open(
|
|
|
|
|
+ row,
|
|
|
|
|
+ '选择物料',
|
|
|
|
|
+ '1',
|
|
|
|
|
+ idx,
|
|
|
|
|
+ isMultiple,
|
|
|
|
|
+ existingIds
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
handleDel(row, index) {
|
|
handleDel(row, index) {
|
|
|
let type = '';
|
|
let type = '';
|