给商品管理增加复制商品的功能
This commit is contained in:
@@ -174,9 +174,7 @@
|
|||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a @click="handleEdit(record)">编辑</a>
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
|
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
|
||||||
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a v-if="btnEnableList.indexOf(1)>-1" @click="handleCopyAdd(record)">复制</a>
|
||||||
<a>删除</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</span>
|
</span>
|
||||||
<template slot="customPic" slot-scope="text, record">
|
<template slot="customPic" slot-scope="text, record">
|
||||||
<a-popover placement="right" trigger="click">
|
<a-popover placement="right" trigger="click">
|
||||||
@@ -480,7 +478,14 @@
|
|||||||
this.$refs.batchSetInfoModalForm.title = "批量编辑";
|
this.$refs.batchSetInfoModalForm.title = "批量编辑";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleAdd: function () {
|
||||||
|
this.$refs.modalForm.action = "add";
|
||||||
|
this.$refs.modalForm.add();
|
||||||
|
this.$refs.modalForm.title = "新增";
|
||||||
|
this.$refs.modalForm.disableSubmit = false;
|
||||||
|
},
|
||||||
handleEdit: function (record) {
|
handleEdit: function (record) {
|
||||||
|
this.$refs.modalForm.action = "edit";
|
||||||
this.$refs.modalForm.edit(record);
|
this.$refs.modalForm.edit(record);
|
||||||
this.$refs.modalForm.title = "编辑";
|
this.$refs.modalForm.title = "编辑";
|
||||||
this.$refs.modalForm.disableSubmit = false;
|
this.$refs.modalForm.disableSubmit = false;
|
||||||
@@ -488,6 +493,12 @@
|
|||||||
this.$refs.modalForm.showOkFlag = false
|
this.$refs.modalForm.showOkFlag = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleCopyAdd(record) {
|
||||||
|
this.$refs.modalForm.action = "copyAdd";
|
||||||
|
this.$refs.modalForm.edit(record);
|
||||||
|
this.$refs.modalForm.title = "复制新增";
|
||||||
|
this.$refs.modalForm.disableSubmit = false;
|
||||||
|
},
|
||||||
getImgUrl(imgName, type) {
|
getImgUrl(imgName, type) {
|
||||||
if(imgName && imgName.split(',')) {
|
if(imgName && imgName.split(',')) {
|
||||||
type = type? type + '/':''
|
type = type? type + '/':''
|
||||||
|
|||||||
@@ -288,9 +288,16 @@
|
|||||||
import UnitModal from '../../system/modules/UnitModal'
|
import UnitModal from '../../system/modules/UnitModal'
|
||||||
import JEditableTable from '@/components/jeecg/JEditableTable'
|
import JEditableTable from '@/components/jeecg/JEditableTable'
|
||||||
import { FormTypes, getRefPromise, VALIDATE_NO_PASSED, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
import { FormTypes, getRefPromise, VALIDATE_NO_PASSED, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
||||||
import { checkMaterial, checkMaterialBarCode, getMaterialAttributeNameList,
|
import {
|
||||||
getMaterialAttributeValueListById, getMaxBarCode, queryMaterialCategoryTreeList, changeNameToPinYin } from '@/api/api'
|
changeNameToPinYin,
|
||||||
import { removeByVal, autoJumpNextInput, handleIntroJs } from '@/utils/util'
|
checkMaterial,
|
||||||
|
checkMaterialBarCode,
|
||||||
|
getMaterialAttributeNameList,
|
||||||
|
getMaterialAttributeValueListById,
|
||||||
|
getMaxBarCode,
|
||||||
|
queryMaterialCategoryTreeList
|
||||||
|
} from '@/api/api'
|
||||||
|
import { autoJumpNextInput, handleIntroJs, removeByVal } from '@/utils/util'
|
||||||
import { getAction, httpAction } from '@/api/manage'
|
import { getAction, httpAction } from '@/api/manage'
|
||||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||||
import JDate from '@/components/jeecg/JDate'
|
import JDate from '@/components/jeecg/JDate'
|
||||||
@@ -316,6 +323,7 @@
|
|||||||
width: '1300px',
|
width: '1300px',
|
||||||
visible: false,
|
visible: false,
|
||||||
modalStyle: '',
|
modalStyle: '',
|
||||||
|
action: '',
|
||||||
categoryTree: [],
|
categoryTree: [],
|
||||||
unitList: [],
|
unitList: [],
|
||||||
depotList: [],
|
depotList: [],
|
||||||
@@ -495,9 +503,11 @@
|
|||||||
if(JSON.stringify(record) === '{}') {
|
if(JSON.stringify(record) === '{}') {
|
||||||
this.fileList = []
|
this.fileList = []
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
if(this.action === 'edit') {
|
||||||
this.fileList = record.imgName
|
setTimeout(() => {
|
||||||
}, 5)
|
this.fileList = record.imgName
|
||||||
|
}, 5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.form.setFieldsValue(pick(this.model, 'name', 'standard', 'unit', 'unitId', 'model', 'color', 'brand', 'mnemonic',
|
this.form.setFieldsValue(pick(this.model, 'name', 'standard', 'unit', 'unitId', 'model', 'color', 'brand', 'mnemonic',
|
||||||
@@ -545,6 +555,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tab.dataSource = res.data.rows || []
|
tab.dataSource = res.data.rows || []
|
||||||
|
//复制新增商品-初始化条码信息
|
||||||
|
if(this.action === 'copyAdd') {
|
||||||
|
getMaxBarCode({}).then((res)=> {
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
let maxBarCode = res.data.barCode - 0
|
||||||
|
let meTableData = []
|
||||||
|
for (let i = 0; i < tab.dataSource.length; i++) {
|
||||||
|
let meInfo = tab.dataSource[i]
|
||||||
|
meInfo.barCode = maxBarCode + i + 1
|
||||||
|
meTableData.push(meInfo)
|
||||||
|
}
|
||||||
|
tab.dataSource = meTableData
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
tab.loading = false
|
tab.loading = false
|
||||||
})
|
})
|
||||||
@@ -609,6 +634,13 @@
|
|||||||
},
|
},
|
||||||
/** 发起新增或修改的请求 */
|
/** 发起新增或修改的请求 */
|
||||||
requestAddOrEdit(formData) {
|
requestAddOrEdit(formData) {
|
||||||
|
//复制新增商品-初始化id和租户id
|
||||||
|
if(this.action === 'copyAdd') {
|
||||||
|
this.model.id = ''
|
||||||
|
this.model.tenantId = ''
|
||||||
|
formData.id = ''
|
||||||
|
formData.tenantId = ''
|
||||||
|
}
|
||||||
if(formData.meList.length === 0) {
|
if(formData.meList.length === 0) {
|
||||||
this.$message.warning('抱歉,请输入条码信息!');
|
this.$message.warning('抱歉,请输入条码信息!');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user