|
@@ -1,7 +1,8 @@
|
|
|
import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
|
|
|
+import { goodsPurchaseCodeList } from '@/api/goodsPurchasedStored.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
- return { codeInfoList: [] }
|
|
|
+ return {}
|
|
|
},
|
|
|
computed: {
|
|
|
formItems2() {
|
|
@@ -234,7 +235,7 @@ export default {
|
|
|
? [
|
|
|
this.formDialogType == 1 ? (
|
|
|
<div style="margin-bottom:10px">
|
|
|
- <el-button type="primary" onClick={this.addCodeInfo}>
|
|
|
+ <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
|
|
|
添加
|
|
|
</el-button>
|
|
|
</div>
|
|
@@ -254,7 +255,7 @@ export default {
|
|
|
<el-form-item
|
|
|
label=""
|
|
|
lebel-width="0px"
|
|
|
- prop={`items.${index}.${column.columnAttributes.prop}`}
|
|
|
+ prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-select
|
|
@@ -291,7 +292,7 @@ export default {
|
|
|
<el-form-item
|
|
|
label=""
|
|
|
lebel-width="0px"
|
|
|
- prop={`items.${index}.${column.columnAttributes.prop}`}
|
|
|
+ prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-select
|
|
@@ -335,7 +336,7 @@ export default {
|
|
|
<el-form-item
|
|
|
label=""
|
|
|
lebel-width="0px"
|
|
|
- prop={`items.${index}.${column.columnAttributes.prop}`}
|
|
|
+ prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-input
|
|
@@ -364,7 +365,7 @@ export default {
|
|
|
<el-form-item
|
|
|
label=""
|
|
|
lebel-width="0px"
|
|
|
- prop={`items.${index}.${column.columnAttributes.prop}`}
|
|
|
+ prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-input
|
|
@@ -398,16 +399,31 @@ export default {
|
|
|
: this.formDialogType == 1
|
|
|
? [
|
|
|
this.isEditIndex == index ? (
|
|
|
- <el-button type="text" onClick={() => {}}>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ onClick={() => {
|
|
|
+ this.addCode(row)
|
|
|
+ }}
|
|
|
+ >
|
|
|
保存
|
|
|
</el-button>
|
|
|
) : null,
|
|
|
- !this.isEditIndex == index ? (
|
|
|
- <el-button type="text" onClick={() => {}}>
|
|
|
+ this.isEditIndex == -1 ? (
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ onClick={() => {
|
|
|
+ this.isEditIndex = index
|
|
|
+ }}
|
|
|
+ >
|
|
|
编辑
|
|
|
</el-button>
|
|
|
) : null,
|
|
|
- <el-button type="text" onClick={() => {}}>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ onClick={() => {
|
|
|
+ this.delCode(row)
|
|
|
+ }}
|
|
|
+ >
|
|
|
删除
|
|
|
</el-button>
|
|
|
]
|
|
@@ -421,7 +437,7 @@ export default {
|
|
|
return []
|
|
|
})()
|
|
|
]}
|
|
|
- tableData={this.codeInfoList}
|
|
|
+ tableData={this.formData.codeInfoList}
|
|
|
tableAttributes={{
|
|
|
size: 'mini',
|
|
|
border: true
|
|
@@ -438,11 +454,12 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
activeName(newVal) {
|
|
|
+ this.isEditIndex = -1
|
|
|
if (newVal == 'codeInfo') {
|
|
|
- // 获取条码列表数据
|
|
|
+ this.getGoodsPurchaseCodeList()
|
|
|
} else {
|
|
|
// 清空条码数据列表
|
|
|
- this.codeInfoList = []
|
|
|
+ this.formData.codeInfoList = []
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -553,9 +570,30 @@ export default {
|
|
|
this.isEditIndex = -1
|
|
|
}
|
|
|
},
|
|
|
+ getCodeVfyKey() {
|
|
|
+ return [
|
|
|
+ `codeInfoList.${this.isEditIndex}.brandId`,
|
|
|
+ `codeInfoList.${this.isEditIndex}.mainId`,
|
|
|
+ `codeInfoList.${this.isEditIndex}.smallId`,
|
|
|
+ `codeInfoList.${this.isEditIndex}.goodsMaterialId`,
|
|
|
+ `codeInfoList.${this.isEditIndex}.qty`,
|
|
|
+ `codeInfoList.${this.isEditIndex}.price`
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ getGoodsPurchaseCodeList() {
|
|
|
+ if (this.formData.id) {
|
|
|
+ goodsPurchaseCodeList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: -1,
|
|
|
+ params: [{ param: 'a.id', compare: '=', value: this.formData.id }]
|
|
|
+ }).then(res => {
|
|
|
+ this.formData.codeInfoList = res.data.records
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 添加条码信息
|
|
|
addCodeInfo() {
|
|
|
- this.codeInfoList.unshift({
|
|
|
+ this.formData.codeInfoList.unshift({
|
|
|
brandId: '',
|
|
|
brandName: '',
|
|
|
mainId: '',
|
|
@@ -571,6 +609,9 @@ export default {
|
|
|
code: '',
|
|
|
codeQty: ''
|
|
|
})
|
|
|
- }
|
|
|
+ this.isEditIndex = 0
|
|
|
+ },
|
|
|
+ addCode(row) {},
|
|
|
+ delCode(row) {}
|
|
|
}
|
|
|
}
|