|
|
@@ -17,7 +17,7 @@
|
|
|
type="primary"
|
|
|
icon="el-icon-plus"
|
|
|
class="ele-btn-icon"
|
|
|
- @click="handlAdd"
|
|
|
+ @click="handlAdd('', -1)"
|
|
|
>
|
|
|
新增
|
|
|
</el-button>
|
|
|
@@ -29,18 +29,6 @@
|
|
|
:prop="'datasource.' + $index + '.technicalDrawings'"
|
|
|
>
|
|
|
<fileMain v-model="row.technicalDrawings" type="view"></fileMain>
|
|
|
- <!-- <div v-if="row.technicalDrawings && row.technicalDrawings?.length">-->
|
|
|
- <!-- <el-link-->
|
|
|
- <!-- v-for="link in row.technicalDrawings"-->
|
|
|
- <!-- :key="link.id"-->
|
|
|
- <!-- type="primary"-->
|
|
|
- <!-- :underline="false"-->
|
|
|
- <!-- @click="downloadFile(link)"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- {{ link.name }}-->
|
|
|
- <!-- </el-link-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </div>-->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-slot:industryArtFiles="{ row, $index }">
|
|
|
@@ -49,18 +37,6 @@
|
|
|
:prop="'datasource.' + $index + '.industryArtFiles'"
|
|
|
>
|
|
|
<fileMain v-model="row.industryArtFiles" type="view"></fileMain>
|
|
|
- <!-- <div v-if="row.industryArtFiles && row.industryArtFiles?.length">-->
|
|
|
- <!-- <el-link-->
|
|
|
- <!-- v-for="link in row.industryArtFiles"-->
|
|
|
- <!-- :key="link.id"-->
|
|
|
- <!-- type="primary"-->
|
|
|
- <!-- :underline="false"-->
|
|
|
- <!-- @click="downloadFile(link)"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- {{ link.name }}-->
|
|
|
- <!-- </el-link-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </div>-->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-slot:otherFiles="{ row, $index }">
|
|
|
@@ -69,18 +45,6 @@
|
|
|
:prop="'datasource.' + $index + '.otherFiles'"
|
|
|
>
|
|
|
<fileMain v-model="row.otherFiles" type="view"></fileMain>
|
|
|
- <!-- <div v-if="row.otherFiles && row.otherFiles?.length">-->
|
|
|
- <!-- <el-link-->
|
|
|
- <!-- v-for="link in row.otherFiles"-->
|
|
|
- <!-- :key="link.id"-->
|
|
|
- <!-- type="primary"-->
|
|
|
- <!-- :underline="false"-->
|
|
|
- <!-- @click="downloadFile(link)"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- {{ link.name }}-->
|
|
|
- <!-- </el-link-->
|
|
|
- <!-- >-->
|
|
|
- <!-- </div>-->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-slot:customerReqFiles="{ row, $index }">
|
|
|
@@ -123,7 +87,6 @@
|
|
|
{ required: true, message: '请输入发货数量', trigger: 'blur' }
|
|
|
]"
|
|
|
>
|
|
|
- <!-- { validator: validateTotalCount(scope.row), trigger: 'blur' }-->
|
|
|
<el-input
|
|
|
v-model="scope.row.totalCount"
|
|
|
@input="(val) => changeNum(val, scope.row, scope.$index)"
|
|
|
@@ -136,17 +99,13 @@
|
|
|
:prop="'datasource.' + scope.$index + '.warehouseId'"
|
|
|
:rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
|
|
|
>
|
|
|
- <el-select
|
|
|
- v-model="scope.row.warehouseId"
|
|
|
- placeholder="请选择"
|
|
|
-
|
|
|
- >
|
|
|
+ <el-select v-model="scope.row.warehouseId" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in scope.row.warehouseList"
|
|
|
:key="item.warehouseId"
|
|
|
:label="item.warehouseName"
|
|
|
:value="item.warehouseId"
|
|
|
- @click.native="warehouseChange(scope.$index, scope.row,item)"
|
|
|
+ @click.native="warehouseChange(scope.$index, scope.row, item)"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -180,16 +139,17 @@
|
|
|
</ele-pro-table>
|
|
|
<product-list
|
|
|
ref="productListRef"
|
|
|
- :orderId="orderId"
|
|
|
+ classType="1"
|
|
|
+ :isGetInventoryTotal="true"
|
|
|
@changeParent="changeParent"
|
|
|
- :productType="productType"
|
|
|
></product-list>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { emailReg, phoneReg, numberReg } from 'ele-admin';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
- import productList from './product-list.vue';
|
|
|
+ // import productList from './product-list.vue';
|
|
|
+ import productList from '@/BIZComponents/product-list.vue';
|
|
|
import {
|
|
|
getWarehouseList,
|
|
|
getWarehouseOutStock,
|
|
|
@@ -199,6 +159,7 @@
|
|
|
import { copyObj } from '@/utils/util';
|
|
|
import { getFile } from '@/api/system/file';
|
|
|
import fileMain from '@/components/addDoc/index.vue';
|
|
|
+ import { getCode } from '@/components/addDoc/api/index.js';
|
|
|
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
@@ -427,9 +388,7 @@
|
|
|
prop: 'taxRate',
|
|
|
label: '税率',
|
|
|
formatter: (_row, _column, cellValue) => {
|
|
|
- return _row.taxRate
|
|
|
- ? _row.taxRate+'%'
|
|
|
- : '';
|
|
|
+ return _row.taxRate ? _row.taxRate + '%' : '';
|
|
|
},
|
|
|
align: 'center',
|
|
|
show: !this.detailType
|
|
|
@@ -466,7 +425,6 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
-
|
|
|
{
|
|
|
prop: 'provenance',
|
|
|
label: '产地',
|
|
|
@@ -503,9 +461,13 @@
|
|
|
label: '质保期',
|
|
|
slot: 'guaranteePeriod',
|
|
|
formatter: (_row, _column, cellValue) => {
|
|
|
- return (
|
|
|
- (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
|
|
|
- );
|
|
|
+ let val = '';
|
|
|
+ if (_row.guaranteePeriod) {
|
|
|
+ val += _row.guaranteePeriod;
|
|
|
+ }
|
|
|
+ if (_row.guaranteePeriodUnitName) {
|
|
|
+ val += _row.guaranteePeriodUnitName;
|
|
|
+ }
|
|
|
},
|
|
|
align: 'center'
|
|
|
},
|
|
|
@@ -596,12 +558,19 @@
|
|
|
downloadFile(file) {
|
|
|
getFile({ objectName: file.storePath }, file.name);
|
|
|
},
|
|
|
- async warehouseChange(index, row,item) {
|
|
|
+ async warehouseChange(index, row, item) {
|
|
|
+ console.log(item, 'row');
|
|
|
|
|
|
- console.log(item,'row')
|
|
|
-
|
|
|
- this.$set(this.form.datasource[index], 'warehouseName', item.warehouseName);
|
|
|
- this.$set(this.form.datasource[index], 'warehouseCode', item.warehouseCode||0);
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'warehouseName',
|
|
|
+ item.warehouseName
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'warehouseCode',
|
|
|
+ item.warehouseCode || 0
|
|
|
+ );
|
|
|
const warehouseOutStock = await getWarehouseOutStock({
|
|
|
warehouseId: item.warehouseId,
|
|
|
code: row.productCode
|
|
|
@@ -659,16 +628,72 @@
|
|
|
|
|
|
return num;
|
|
|
},
|
|
|
+ // //选择产品回调
|
|
|
+ // changeParent(obj, idx) {
|
|
|
+ // obj.orderTotalCount = obj.totalCount;
|
|
|
+ // obj.id = '';
|
|
|
+ // this.$set(
|
|
|
+ // this.form.datasource,
|
|
|
+ // this.form.datasource.length,
|
|
|
+ // copyObj(obj)
|
|
|
+ // );
|
|
|
+ // },
|
|
|
+
|
|
|
//选择产品回调
|
|
|
- changeParent(obj, idx) {
|
|
|
- obj.orderTotalCount = obj.totalCount;
|
|
|
- obj.id = '';
|
|
|
- this.$set(
|
|
|
- this.form.datasource,
|
|
|
- this.form.datasource.length,
|
|
|
- copyObj(obj)
|
|
|
- );
|
|
|
+ changeParent(obj = [], idx) {
|
|
|
+ obj.forEach(async (item, index) => {
|
|
|
+ let i = idx == -1 ? index : idx;
|
|
|
+ let row = JSON.parse(JSON.stringify(this.defaultForm));
|
|
|
+ row.key = this.form.datasource.length + 1;
|
|
|
+ let parasm = idx == -1 ? row : this.form.datasource[i];
|
|
|
+ this.$set(parasm, 'productId', item.id);
|
|
|
+ this.$set(parasm, 'categoryName', item.name);
|
|
|
+ this.$set(parasm, 'productCategoryId', item.categoryLevelId);
|
|
|
+ this.$set(parasm, 'productBrand', item.brandNum);
|
|
|
+ this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
|
|
|
+ this.$set(parasm, 'productCode', item.code);
|
|
|
+ this.$set(parasm, 'productName', item.name);
|
|
|
+ this.$set(parasm, 'modelType', item.modelType);
|
|
|
+ this.$set(parasm, 'availableCountBase', item.availableCountBase);
|
|
|
+ this.$set(parasm, 'measuringUnit', item.measuringUnit);
|
|
|
+ this.$set(parasm, 'specification', item.specification);
|
|
|
+ this.$set(parasm, 'weightUnit', item.weightUnit);
|
|
|
+ this.$set(parasm, 'imgCode', item.imgCode);
|
|
|
+ this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
+ this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
+ this.$set(parasm, 'singleWeight', item.netWeight);
|
|
|
+ this.$set(parasm, 'pricingWay', item.pricingWay || 1);
|
|
|
+ this.$set(parasm, 'singlePrice', 0);
|
|
|
+ this.$set(parasm, 'discountSinglePrice', 0);
|
|
|
+
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'warehouseList',
|
|
|
+ await getIdWarehouseList({
|
|
|
+ categoryId: item.id
|
|
|
+ })
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'packingSpecification',
|
|
|
+ item.extField?.packingSpecification
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'supplierMark',
|
|
|
+ this.form.datasource[0]?.supplierMark
|
|
|
+ );
|
|
|
+ this.$set(parasm, 'batchNo', await getCode('1900101420390125570'));
|
|
|
+ if (item.purchaseOrigins?.length > 0) {
|
|
|
+ item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
+ }
|
|
|
+ this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
+ if (idx == -1) {
|
|
|
+ this.form.datasource.push(row);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
validateTotalCount(row) {
|
|
|
return (rule, value, callback) => {
|
|
|
if (isNaN(value) || Number(value) <= 0) {
|
|
|
@@ -735,24 +760,6 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- //选择产品
|
|
|
- handParent(row, index) {
|
|
|
- let item = {
|
|
|
- id: row.productCode
|
|
|
- };
|
|
|
- this.$refs.productListRef.open(item, index);
|
|
|
- },
|
|
|
- //选择技术人回调
|
|
|
- changeAnswer(obj, idx) {
|
|
|
- this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
|
|
|
- this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
|
|
|
- },
|
|
|
- handHead(row, index) {
|
|
|
- let item = {
|
|
|
- id: row.technicalAnswerId
|
|
|
- };
|
|
|
- this.$refs.headRef.open(item, index);
|
|
|
- },
|
|
|
|
|
|
remove(i) {
|
|
|
this.form.datasource.splice(i, 1);
|
|
|
@@ -769,9 +776,9 @@
|
|
|
});
|
|
|
},
|
|
|
// 添加
|
|
|
- handlAdd() {
|
|
|
+ handlAdd(item, index) {
|
|
|
if (!this.orderId) return this.$message.error('请先选择订单');
|
|
|
- this.$refs.productListRef.open(this.form.datasource);
|
|
|
+ this.$refs.productListRef.open(item, index);
|
|
|
},
|
|
|
|
|
|
validateForm(callback) {
|