|
@@ -17,7 +17,7 @@
|
|
|
type="primary"
|
|
type="primary"
|
|
|
icon="el-icon-plus"
|
|
icon="el-icon-plus"
|
|
|
class="ele-btn-icon"
|
|
class="ele-btn-icon"
|
|
|
- @click="handlAdd"
|
|
|
|
|
|
|
+ @click="handlAdd('', -1)"
|
|
|
>
|
|
>
|
|
|
新增
|
|
新增
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -53,7 +53,6 @@
|
|
|
:prop="'datasource.' + $index + '.customerReqFiles'"
|
|
:prop="'datasource.' + $index + '.customerReqFiles'"
|
|
|
>
|
|
>
|
|
|
<fileMain v-model="row.customerReqFiles" type="view"></fileMain>
|
|
<fileMain v-model="row.customerReqFiles" type="view"></fileMain>
|
|
|
-
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -92,16 +91,13 @@
|
|
|
:prop="'datasource.' + scope.$index + '.warehouseId'"
|
|
:prop="'datasource.' + scope.$index + '.warehouseId'"
|
|
|
:rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
|
|
:rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
|
|
|
>
|
|
>
|
|
|
- <el-select
|
|
|
|
|
- v-model="scope.row.warehouseId"
|
|
|
|
|
- placeholder="请选择"
|
|
|
|
|
- @change="warehouseChange(scope.$index, scope.row)"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-select v-model="scope.row.warehouseId" placeholder="请选择">
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in warehouseList"
|
|
v-for="item in warehouseList"
|
|
|
:key="item.id"
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
:label="item.name"
|
|
|
:value="item.id"
|
|
:value="item.id"
|
|
|
|
|
+ @click.native="warehouseChange(scope.$index, scope.row, item)"
|
|
|
>
|
|
>
|
|
|
</el-option>
|
|
</el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
@@ -135,7 +131,7 @@
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
<product-list
|
|
<product-list
|
|
|
ref="productListRef"
|
|
ref="productListRef"
|
|
|
- :orderId="orderId"
|
|
|
|
|
|
|
+ classType="1"
|
|
|
@changeParent="changeParent"
|
|
@changeParent="changeParent"
|
|
|
></product-list>
|
|
></product-list>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -143,7 +139,8 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { emailReg, phoneReg, numberReg } from 'ele-admin';
|
|
import { emailReg, phoneReg, numberReg } from 'ele-admin';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
- import productList from './product-list.vue';
|
|
|
|
|
|
|
+ import productList from '@/BIZComponents/product-list.vue';
|
|
|
|
|
+
|
|
|
import {
|
|
import {
|
|
|
getWarehouseList,
|
|
getWarehouseList,
|
|
|
getWarehouseOutStock
|
|
getWarehouseOutStock
|
|
@@ -155,7 +152,7 @@
|
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- mixins: [dictMixins,tabMixins],
|
|
|
|
|
|
|
+ mixins: [dictMixins, tabMixins],
|
|
|
props: {
|
|
props: {
|
|
|
orderId: String,
|
|
orderId: String,
|
|
|
isShowAdd: {
|
|
isShowAdd: {
|
|
@@ -186,7 +183,7 @@
|
|
|
allPrice: 0.0,
|
|
allPrice: 0.0,
|
|
|
numberReg,
|
|
numberReg,
|
|
|
defaultForm,
|
|
defaultForm,
|
|
|
- cacheKeyUrl:'eos-saleManage-entrustedReceive-inventoryTable',
|
|
|
|
|
|
|
+ cacheKeyUrl: 'eos-saleManage-entrustedReceive-inventoryTable',
|
|
|
warehouseList: [],
|
|
warehouseList: [],
|
|
|
form: {
|
|
form: {
|
|
|
datasource: []
|
|
datasource: []
|
|
@@ -418,6 +415,7 @@
|
|
|
slot: 'guaranteePeriod',
|
|
slot: 'guaranteePeriod',
|
|
|
formatter: (_row, _column, cellValue) => {
|
|
formatter: (_row, _column, cellValue) => {
|
|
|
return (
|
|
return (
|
|
|
|
|
+ _row.guaranteePeriod &&
|
|
|
(_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
|
|
(_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
@@ -505,23 +503,7 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- downloadFile(file) {
|
|
|
|
|
- getFile({ objectName: file.storePath }, file.name);
|
|
|
|
|
- },
|
|
|
|
|
- async warehouseChange(index, row) {
|
|
|
|
|
- let warehouseIds =
|
|
|
|
|
- this.form.datasource
|
|
|
|
|
- .filter(
|
|
|
|
|
- (item, i) => row.productCode == item.productCode && index != i
|
|
|
|
|
- )
|
|
|
|
|
- .map((item) => item.warehouseId) || [];
|
|
|
|
|
- const data = this.warehouseList.find(
|
|
|
|
|
- (item) => item.id == row.warehouseId
|
|
|
|
|
- );
|
|
|
|
|
- if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
|
|
|
|
|
- row.warehouseId = '';
|
|
|
|
|
- return this.$message.error('同一个产品不能选择相同的仓库');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ async warehouseChange(index, row, data) {
|
|
|
this.$set(this.form.datasource[index], 'warehouseName', data.name);
|
|
this.$set(this.form.datasource[index], 'warehouseName', data.name);
|
|
|
this.$set(this.form.datasource[index], 'warehouseCode', data.code);
|
|
this.$set(this.form.datasource[index], 'warehouseCode', data.code);
|
|
|
const warehouseOutStock = await getWarehouseOutStock({
|
|
const warehouseOutStock = await getWarehouseOutStock({
|
|
@@ -537,7 +519,6 @@
|
|
|
|
|
|
|
|
//修改数量更新合计
|
|
//修改数量更新合计
|
|
|
changeNum(val, row, index) {
|
|
changeNum(val, row, index) {
|
|
|
- console.log(val, row, index);
|
|
|
|
|
this.$set(
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
this.form.datasource[index],
|
|
|
'receiveTotalWeight',
|
|
'receiveTotalWeight',
|
|
@@ -557,44 +538,23 @@
|
|
|
},
|
|
},
|
|
|
getTotalPrice(row) {
|
|
getTotalPrice(row) {
|
|
|
let num = 0;
|
|
let num = 0;
|
|
|
- if (row.pricingWay == 1) {
|
|
|
|
|
|
|
+ if (row.singlePrice && row.totalCount) {
|
|
|
num = Number(row.singlePrice) * Number(row.totalCount);
|
|
num = Number(row.singlePrice) * Number(row.totalCount);
|
|
|
}
|
|
}
|
|
|
- if (row.pricingWay == 2) {
|
|
|
|
|
- num =
|
|
|
|
|
- Number(row.singlePrice) *
|
|
|
|
|
- Number(row.totalCount) *
|
|
|
|
|
- Number(row.singleWeight);
|
|
|
|
|
- }
|
|
|
|
|
return num;
|
|
return num;
|
|
|
},
|
|
},
|
|
|
getDiscountTotalPrice(row) {
|
|
getDiscountTotalPrice(row) {
|
|
|
let num = 0;
|
|
let num = 0;
|
|
|
- if (row.pricingWay == 1) {
|
|
|
|
|
|
|
+ if (row.discountSinglePrice && row.totalCount) {
|
|
|
num = Number(row.discountSinglePrice) * Number(row.totalCount);
|
|
num = Number(row.discountSinglePrice) * Number(row.totalCount);
|
|
|
}
|
|
}
|
|
|
- if (row.pricingWay == 2) {
|
|
|
|
|
- num =
|
|
|
|
|
- Number(row.discountSinglePrice) *
|
|
|
|
|
- Number(row.totalCount) *
|
|
|
|
|
- Number(row.singleWeight);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
return num;
|
|
return num;
|
|
|
},
|
|
},
|
|
|
- //选择产品回调
|
|
|
|
|
- changeParent(obj, idx) {
|
|
|
|
|
- obj.orderTotalCount = obj.totalCount;
|
|
|
|
|
- obj.id = '';
|
|
|
|
|
- obj['pricingWay'] = obj.pricingWay || this.pricingWay;
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.datasource,
|
|
|
|
|
- this.form.datasource.length,
|
|
|
|
|
- copyObj(obj)
|
|
|
|
|
- );
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
validateTotalCount(row) {
|
|
validateTotalCount(row) {
|
|
|
return (rule, value, callback) => {
|
|
return (rule, value, callback) => {
|
|
|
|
|
+ callback();
|
|
|
if (isNaN(value) || Number(value) <= 0) {
|
|
if (isNaN(value) || Number(value) <= 0) {
|
|
|
callback(new Error('请输入大于0的数字'));
|
|
callback(new Error('请输入大于0的数字'));
|
|
|
} else if (
|
|
} else if (
|
|
@@ -613,7 +573,7 @@
|
|
|
if (comitDatasource.length === 0) return [];
|
|
if (comitDatasource.length === 0) return [];
|
|
|
comitDatasource.forEach(async (v) => {
|
|
comitDatasource.forEach(async (v) => {
|
|
|
v.totalCount = Number(v.totalCount);
|
|
v.totalCount = Number(v.totalCount);
|
|
|
- item['pricingWay'] = item.pricingWay || this.pricingWay;
|
|
|
|
|
|
|
+ // item['pricingWay'] = item.pricingWay || this.pricingWay;
|
|
|
v.technicalDrawings = Array.isArray(v.technicalDrawings)
|
|
v.technicalDrawings = Array.isArray(v.technicalDrawings)
|
|
|
? v.technicalDrawings
|
|
? v.technicalDrawings
|
|
|
: [];
|
|
: [];
|
|
@@ -650,33 +610,12 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- //选择产品
|
|
|
|
|
- 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) {
|
|
remove(i) {
|
|
|
this.form.datasource.splice(i, 1);
|
|
this.form.datasource.splice(i, 1);
|
|
|
this.setSort();
|
|
this.setSort();
|
|
|
},
|
|
},
|
|
|
- // 清空表格
|
|
|
|
|
- restTable() {
|
|
|
|
|
- this.form.datasource = [];
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
// 重新排序
|
|
// 重新排序
|
|
|
setSort() {
|
|
setSort() {
|
|
|
this.form.datasource.forEach((n, index) => {
|
|
this.form.datasource.forEach((n, index) => {
|
|
@@ -686,9 +625,52 @@
|
|
|
// 添加
|
|
// 添加
|
|
|
handlAdd() {
|
|
handlAdd() {
|
|
|
if (!this.orderId) return this.$message.error('请先选择订单');
|
|
if (!this.orderId) return this.$message.error('请先选择订单');
|
|
|
- this.$refs.productListRef.open(this.form.datasource);
|
|
|
|
|
|
|
+ this.$refs.productListRef.open('', -1);
|
|
|
},
|
|
},
|
|
|
|
|
+ //选择产品回调
|
|
|
|
|
+ changeParent(obj, idx) {
|
|
|
|
|
+ obj.forEach((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, 'singleWeight', item.netWeight);
|
|
|
|
|
+ this.$set(parasm, 'pricingWay', 1);
|
|
|
|
|
+ this.$set(parasm, 'goodsLevel', item.level);
|
|
|
|
|
|
|
|
|
|
+ this.$set(parasm, 'discountSinglePrice', 0);
|
|
|
|
|
+ this.$set(parasm, 'singlePrice', 0);
|
|
|
|
|
+
|
|
|
|
|
+ this.$set(parasm, 'imgCode', item.imgCode);
|
|
|
|
|
+ this.$set(parasm, 'produceType', item.componentAttribute);
|
|
|
|
|
+
|
|
|
|
|
+ this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ parasm,
|
|
|
|
|
+ 'packingSpecification',
|
|
|
|
|
+ item.extField.packingSpecification
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
|
|
+
|
|
|
|
|
+ if (idx == -1) {
|
|
|
|
|
+ this.form.datasource.push(row);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
validateForm(callback) {
|
|
validateForm(callback) {
|
|
|
//开始表单校验
|
|
//开始表单校验
|
|
|
this.$refs.form.validate((valid, obj) => {
|
|
this.$refs.form.validate((valid, obj) => {
|