diff --git a/jshERP-web/src/views/material/MaterialList.vue b/jshERP-web/src/views/material/MaterialList.vue
index bce32a20..4882e0f3 100644
--- a/jshERP-web/src/views/material/MaterialList.vue
+++ b/jshERP-web/src/views/material/MaterialList.vue
@@ -174,9 +174,7 @@
编辑
- handleDelete(record.id)">
- 删除
-
+ 复制
@@ -480,7 +478,14 @@
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) {
+ this.$refs.modalForm.action = "edit";
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.disableSubmit = false;
@@ -488,6 +493,12 @@
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) {
if(imgName && imgName.split(',')) {
type = type? type + '/':''
diff --git a/jshERP-web/src/views/material/modules/MaterialModal.vue b/jshERP-web/src/views/material/modules/MaterialModal.vue
index 10c02e19..dbf91aa2 100644
--- a/jshERP-web/src/views/material/modules/MaterialModal.vue
+++ b/jshERP-web/src/views/material/modules/MaterialModal.vue
@@ -288,9 +288,16 @@
import UnitModal from '../../system/modules/UnitModal'
import JEditableTable from '@/components/jeecg/JEditableTable'
import { FormTypes, getRefPromise, VALIDATE_NO_PASSED, validateFormAndTables } from '@/utils/JEditableTableUtil'
- import { checkMaterial, checkMaterialBarCode, getMaterialAttributeNameList,
- getMaterialAttributeValueListById, getMaxBarCode, queryMaterialCategoryTreeList, changeNameToPinYin } from '@/api/api'
- import { removeByVal, autoJumpNextInput, handleIntroJs } from '@/utils/util'
+ import {
+ changeNameToPinYin,
+ checkMaterial,
+ checkMaterialBarCode,
+ getMaterialAttributeNameList,
+ getMaterialAttributeValueListById,
+ getMaxBarCode,
+ queryMaterialCategoryTreeList
+ } from '@/api/api'
+ import { autoJumpNextInput, handleIntroJs, removeByVal } from '@/utils/util'
import { getAction, httpAction } from '@/api/manage'
import JImageUpload from '@/components/jeecg/JImageUpload'
import JDate from '@/components/jeecg/JDate'
@@ -316,6 +323,7 @@
width: '1300px',
visible: false,
modalStyle: '',
+ action: '',
categoryTree: [],
unitList: [],
depotList: [],
@@ -495,9 +503,11 @@
if(JSON.stringify(record) === '{}') {
this.fileList = []
} else {
- setTimeout(() => {
- this.fileList = record.imgName
- }, 5)
+ if(this.action === 'edit') {
+ setTimeout(() => {
+ this.fileList = record.imgName
+ }, 5)
+ }
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'name', 'standard', 'unit', 'unitId', 'model', 'color', 'brand', 'mnemonic',
@@ -545,6 +555,21 @@
}
}
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(() => {
tab.loading = false
})
@@ -609,6 +634,13 @@
},
/** 发起新增或修改的请求 */
requestAddOrEdit(formData) {
+ //复制新增商品-初始化id和租户id
+ if(this.action === 'copyAdd') {
+ this.model.id = ''
+ this.model.tenantId = ''
+ formData.id = ''
+ formData.tenantId = ''
+ }
if(formData.meList.length === 0) {
this.$message.warning('抱歉,请输入条码信息!');
return;