|
|
@@ -0,0 +1,306 @@
|
|
|
+<template>
|
|
|
+ <el-card shadow="never">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="supplyRef"
|
|
|
+ :columns="supplyColumns"
|
|
|
+ :need-page="false"
|
|
|
+ :datasource="list"
|
|
|
+ :toolkit="[]"
|
|
|
+ height="350px"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button type="primary" @click="handSelectSupply">新增</el-button>
|
|
|
+ <el-button type="primary" @click="save">确认修改</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-slot:purchasingCycle="scope">
|
|
|
+ <el-input v-model="scope.row.purchasingCycle" placeholder="请输入">
|
|
|
+ <template slot="append">天</template>
|
|
|
+ </el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:purchaseMultiplier="scope">
|
|
|
+ <el-input v-model="scope.row.purchaseMultiplier" placeholder="请输入">
|
|
|
+ </el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:minimumOrderQuantity="scope">
|
|
|
+ <el-input v-model="scope.row.minimumOrderQuantity" placeholder="请输入">
|
|
|
+ </el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:provenance="scope">
|
|
|
+ <DictSelection
|
|
|
+ dictName="产地"
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.provenance"
|
|
|
+ multiple
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 操作栏 -->
|
|
|
+ <template v-slot:action="scope">
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除此产品吗?"
|
|
|
+ @confirm="handleRemoveSupply(scope.$index)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ <product-list
|
|
|
+ ref="productListRef"
|
|
|
+ :data="list"
|
|
|
+ @changeParent="getSupplyList"
|
|
|
+ ></product-list>
|
|
|
+ </el-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { contactUpdate } from '@/api/saleManage/contact';
|
|
|
+ import { contactDetail } from '@/api/saleManage/contact';
|
|
|
+ import { reviewStatus, lbjtList } from '@/enum/dict';
|
|
|
+ import productList from '@/BIZComponents/product-list.vue';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: { productList },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ key: '',
|
|
|
+ list: [],
|
|
|
+ form: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ supplyColumns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ type: 'index',
|
|
|
+ width: 50,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ label: '序号'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productName',
|
|
|
+ label: '名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'purchasingCycle',
|
|
|
+ label: '采购周期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'purchasingCycle',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'purchaseMultiplier',
|
|
|
+ label: '倍数',
|
|
|
+ slot: 'purchaseMultiplier',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 100
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'minimumOrderQuantity',
|
|
|
+ label: '最低订购数量',
|
|
|
+ slot: 'minimumOrderQuantity',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'provenance',
|
|
|
+ label: '产地',
|
|
|
+ slot: 'provenance',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'manufacturer',
|
|
|
+ label: '生产厂家',
|
|
|
+ slot: 'manufacturer',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200,
|
|
|
+ show: this.getLabel == '供货列表'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'imgCode',
|
|
|
+ align: 'center',
|
|
|
+ label: '图号/件号',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'produceType',
|
|
|
+ align: 'center',
|
|
|
+ label: '属性类型',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ formatter: (row, column) => {
|
|
|
+ if (row.produceType) {
|
|
|
+ return row.produceType
|
|
|
+ .map((item) => {
|
|
|
+ return lbjtList[item];
|
|
|
+ })
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'packingSpecification',
|
|
|
+ align: 'center',
|
|
|
+ label: '包装规格',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'brandNum',
|
|
|
+ align: 'center',
|
|
|
+ label: '牌号',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'modelType',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'measuringUnit',
|
|
|
+ label: '计量单位',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ slot: 'action',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 90,
|
|
|
+ fixed: 'right',
|
|
|
+ label: '操作'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ //选择产品
|
|
|
+ handSelectSupply() {
|
|
|
+ this.$refs.productListRef.open(this.list, -1);
|
|
|
+ },
|
|
|
+ getSupplyList(obj) {
|
|
|
+ obj.forEach((item, index) => {
|
|
|
+ let params = {};
|
|
|
+ this.$set(params, 'contactId', this.form.base.id);
|
|
|
+ this.$set(params, 'productId', item.id);
|
|
|
+ this.$set(params, 'categoryName', item.name);
|
|
|
+ this.$set(params, 'productCategoryId', item.categoryLevelId);
|
|
|
+ this.$set(params, 'productBrand', item.brandNum);
|
|
|
+ this.$set(params, 'productCategoryName', item.categoryLevelPath);
|
|
|
+ this.$set(params, 'productCode', item.code);
|
|
|
+ this.$set(params, 'productName', item.name);
|
|
|
+ this.$set(params, 'modelType', item.modelType);
|
|
|
+ this.$set(params, 'availableCountBase', item.availableCountBase);
|
|
|
+ this.$set(params, 'measuringUnit', item.measuringUnit);
|
|
|
+ this.$set(params, 'specification', item.specification);
|
|
|
+ this.$set(params, 'weightUnit', item.weightUnit);
|
|
|
+ this.$set(params, 'imgCode', item.imgCode);
|
|
|
+ this.$set(params, 'produceType', item.componentAttribute);
|
|
|
+ this.$set(params, 'approvalNumber', item.approvalNumber);
|
|
|
+ this.$set(params, 'packingSpecification', item.packingSpecification);
|
|
|
+ if (item.purchaseOrigins?.length) {
|
|
|
+ item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
+ }
|
|
|
+ this.$set(params, 'provenance', item.purchaseOrigins || []);
|
|
|
+ this.list.push(params);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //删除供货产品
|
|
|
+ handleRemoveSupply(index) {
|
|
|
+ this.list.splice(index, 1);
|
|
|
+ },
|
|
|
+ async init(row) {
|
|
|
+ this.form = row;
|
|
|
+ this.list = row.productList;
|
|
|
+ },
|
|
|
+ handleBankDel(row, index) {
|
|
|
+ this.list.splice(index, 1);
|
|
|
+ },
|
|
|
+
|
|
|
+ save() {
|
|
|
+ this.form.productList = this.list;
|
|
|
+ contactUpdate(this.form)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success('修改成功');
|
|
|
+
|
|
|
+ contactDetail(this.form.base.id).then((res) => {
|
|
|
+ this.list = res.productList;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$emit('success');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ //this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .tree_col {
|
|
|
+ border: 1px solid #eee;
|
|
|
+ padding: 10px 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 500px;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .table_col {
|
|
|
+ padding-left: 10px;
|
|
|
+
|
|
|
+ ::v-deep .el-table th.el-table__cell {
|
|
|
+ background: #f2f2f2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .pagination {
|
|
|
+ text-align: right;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .btns {
|
|
|
+ text-align: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .topsearch {
|
|
|
+ margin-bottom: 15px;
|
|
|
+ }
|
|
|
+</style>
|