|
@@ -3,14 +3,14 @@ import { materialCategoryList } from '@/api/auxiliaryMaterialClass'
|
|
|
import { materialNormList } from '@/api/auxiliaryPriceManagement'
|
|
|
import { listPageV2 as peijianList } from '@/api/auxiliaryFittings/attachmentProfile'
|
|
|
import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
|
|
|
+import { storageListPageV2 } from '@/api/storage'
|
|
|
+import { getCategory } from '@/api/auxiliaryFittings/auxiliarySalesOrder'
|
|
|
+import { getGoods } from '@/api/auxiliaryFittings/auxiliarySalesOrder'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- materialCategoryListL1: [],
|
|
|
- materialCategoryListL2: [],
|
|
|
materialNormList: [],
|
|
|
- peijianList: [],
|
|
|
- listPageV2Data: []
|
|
|
+ peijianList: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -35,6 +35,7 @@ export default {
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-select
|
|
|
+ disabled={this.formDialogType == 2}
|
|
|
value={row[column.columnAttributes.prop]}
|
|
|
onInput={val => {
|
|
|
row[column.columnAttributes.prop] = val
|
|
@@ -47,7 +48,7 @@ export default {
|
|
|
this.materialNormList = []
|
|
|
this.qkrow(row)
|
|
|
if (val) {
|
|
|
- row['parentCategoryName'] = this.materialCategoryListL1.find(
|
|
|
+ row['parentCategoryName'] = this.mainList.find(
|
|
|
item => item.categoryId == val
|
|
|
).categoryName
|
|
|
} else {
|
|
@@ -57,7 +58,7 @@ export default {
|
|
|
}}
|
|
|
placeholder="请选择"
|
|
|
>
|
|
|
- {this.materialCategoryListL1.map((item, index_) => (
|
|
|
+ {this.mainList.map((item, index_) => (
|
|
|
<el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>
|
|
|
))}
|
|
|
</el-select>
|
|
@@ -81,13 +82,11 @@ export default {
|
|
|
prop: 'goodsCategoryId'
|
|
|
},
|
|
|
render: (h, { row, column, index }) => {
|
|
|
- var selectList = row['parentCategoryId']
|
|
|
- ? this.materialCategoryListL2.filter(item => item.parentCategoryId == row['parentCategoryId'])
|
|
|
- : []
|
|
|
return row.isEditRow ? (
|
|
|
<div class="redbordererr">
|
|
|
<el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsCategoryId`} rules={required}>
|
|
|
<el-select
|
|
|
+ disabled={this.formDialogType == 2}
|
|
|
value={row[column.columnAttributes.prop]}
|
|
|
onInput={val => {
|
|
|
row[column.columnAttributes.prop] = val
|
|
@@ -98,7 +97,10 @@ export default {
|
|
|
row['goodsName'] = ''
|
|
|
this.qkrow(row)
|
|
|
if (val) {
|
|
|
- row['goodsCategoryName'] = selectList.find(item => item.categoryId == val).categoryName
|
|
|
+ row['goodsCategoryName'] = (
|
|
|
+ this.mainList.find(item => item.categoryId == this.formData.parentCategoryId)?.items ||
|
|
|
+ []
|
|
|
+ ).find(item => item.categoryId == val).categoryName
|
|
|
materialNormList({
|
|
|
isShowStockQty: true,
|
|
|
websitId: this.formData.websitId,
|
|
@@ -119,7 +121,9 @@ export default {
|
|
|
this.$nextTick(this.jiaoyan)
|
|
|
}}
|
|
|
>
|
|
|
- {selectList.map((item, index_) => (
|
|
|
+ {(
|
|
|
+ this.mainList.find(item => item.categoryId == this.formData.parentCategoryId)?.items || []
|
|
|
+ ).map((item, index_) => (
|
|
|
<el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>
|
|
|
))}
|
|
|
</el-select>
|
|
@@ -147,6 +151,7 @@ export default {
|
|
|
<div class="redbordererr">
|
|
|
<el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
|
|
|
<el-select
|
|
|
+ disabled={this.formDialogType == 2}
|
|
|
value={row[column.columnAttributes.prop]}
|
|
|
onInput={val => {
|
|
|
row[column.columnAttributes.prop] = val
|
|
@@ -205,6 +210,7 @@ export default {
|
|
|
<div class="redbordererr">
|
|
|
<el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
|
|
|
<el-select
|
|
|
+ disabled={this.formDialogType == 2}
|
|
|
value={row[column.columnAttributes.prop]}
|
|
|
onInput={val => {
|
|
|
row[column.columnAttributes.prop] = val
|
|
@@ -272,6 +278,7 @@ export default {
|
|
|
rules={required}
|
|
|
>
|
|
|
<el-input
|
|
|
+ disabled={this.formDialogType == 2}
|
|
|
type="number"
|
|
|
value={row[column.columnAttributes.prop]}
|
|
|
onInput={val => {
|
|
@@ -423,32 +430,32 @@ export default {
|
|
|
<div style="margin-bottom:8px">
|
|
|
<el-button
|
|
|
onClick={() => {
|
|
|
- // this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
- // if (valid || (Object.keys(invalidFields).length == 1 && invalidFields.items)) {
|
|
|
- // this.formData.items.map(item => {
|
|
|
- // item.isEditRow = false
|
|
|
- // })
|
|
|
- this.formData.items.push({
|
|
|
- isEditRow: true,
|
|
|
- brand: '',
|
|
|
- goodsCategoryId: '',
|
|
|
- goodsCategoryName: '',
|
|
|
- goodsCode: '',
|
|
|
- goodsId: '',
|
|
|
- goodsName: '',
|
|
|
- goodsSpecification: '',
|
|
|
- goodsStockUnit: '',
|
|
|
- goodsType: '',
|
|
|
- parentCategoryId: '',
|
|
|
- parentCategoryName: '',
|
|
|
- productCategory: '',
|
|
|
- qty: 0,
|
|
|
- websitGoodsMoveId: '',
|
|
|
- websitId: '',
|
|
|
- websitName: ''
|
|
|
+ this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
+ if (valid || (Object.keys(invalidFields).length == 1 && invalidFields.items)) {
|
|
|
+ this.formData.items.map(item => {
|
|
|
+ item.isEditRow = false
|
|
|
+ })
|
|
|
+ this.formData.items.push({
|
|
|
+ isEditRow: true,
|
|
|
+ brand: '',
|
|
|
+ goodsCategoryId: '',
|
|
|
+ goodsCategoryName: '',
|
|
|
+ goodsCode: '',
|
|
|
+ goodsId: '',
|
|
|
+ goodsName: '',
|
|
|
+ goodsSpecification: '',
|
|
|
+ goodsStockUnit: '',
|
|
|
+ goodsType: '',
|
|
|
+ parentCategoryId: '',
|
|
|
+ parentCategoryName: '',
|
|
|
+ productCategory: '',
|
|
|
+ qty: 0,
|
|
|
+ websitGoodsMoveId: '',
|
|
|
+ websitId: '',
|
|
|
+ websitName: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
- // }
|
|
|
- // })
|
|
|
}}
|
|
|
>
|
|
|
添加
|
|
@@ -471,67 +478,64 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- 'formData.type'(newVal) {
|
|
|
- if (newVal === 'M') {
|
|
|
- listPageV2({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- params: [
|
|
|
- { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
- { param: 'a.vender_type', compare: 'like', value: '辅材' }
|
|
|
- ]
|
|
|
- }).then(res => {
|
|
|
- this.listPageV2Data = res.data.records
|
|
|
- })
|
|
|
- materialCategoryList({
|
|
|
+ 'formData.websitId'(newVal) {
|
|
|
+ this.formData.outStorageId = ''
|
|
|
+ this.formData.inStorageId = ''
|
|
|
+ this.formData.items = []
|
|
|
+ if (newVal) {
|
|
|
+ storageListPageV2({
|
|
|
pageNum: 1,
|
|
|
pageSize: -1,
|
|
|
params: [
|
|
|
- { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
- { param: 'a.category_level', compare: '=', value: '1' }
|
|
|
+ { param: 'a.websit_id', compare: '=', value: newVal },
|
|
|
+ { param: 'a.status', compare: '=', value: 'true' },
|
|
|
+ {
|
|
|
+ param: 'a.type',
|
|
|
+ compare: 'like',
|
|
|
+ value: (() => {
|
|
|
+ if (this.formData.type == 'M') {
|
|
|
+ return '辅材'
|
|
|
+ } else if (this.formData.type == 'P') {
|
|
|
+ return '配件'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ })()
|
|
|
+ }
|
|
|
]
|
|
|
}).then(res => {
|
|
|
- this.materialCategoryListL1 = res.data.records
|
|
|
+ this.warehouseList = res.data.records
|
|
|
})
|
|
|
- materialCategoryList({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- params: [
|
|
|
- { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
- { param: 'a.category_level', compare: '=', value: '2' }
|
|
|
- ]
|
|
|
- }).then(res => {
|
|
|
- this.materialCategoryListL2 = res.data.records
|
|
|
+ getCategory({ websitId: newVal }).then(res => {
|
|
|
+ this.mainList = res.data
|
|
|
})
|
|
|
- } else if (newVal === 'P') {
|
|
|
- listPageV2({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- params: [
|
|
|
- { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
- { param: 'a.vender_type', compare: 'like', value: '配件' }
|
|
|
- ]
|
|
|
- }).then(res => {
|
|
|
- this.listPageV2Data = res.data.records
|
|
|
- })
|
|
|
- peijianList({
|
|
|
- isShowStockQty: true,
|
|
|
+ if (this.formData.outStorageId) {
|
|
|
+ getGoods({
|
|
|
+ websitId: this.formData.websitId,
|
|
|
+ type: 'P',
|
|
|
+ saleType: '零售',
|
|
|
+ storageId: this.formData.outStorageId
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.warehouseList = []
|
|
|
+ this.mainList = []
|
|
|
+ this.peijianList = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'formData.outStorageId'(newValue) {
|
|
|
+ if (newValue && this.formData.websitId) {
|
|
|
+ getGoods({
|
|
|
websitId: this.formData.websitId,
|
|
|
- storageId: this.formData.storageId,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: -1,
|
|
|
- params: [
|
|
|
- { param: 'a.status', compare: '=', value: 'ON' },
|
|
|
- { param: 'a.norm_type', compare: '=', value: 'M' }
|
|
|
- ]
|
|
|
+ type: 'P',
|
|
|
+ saleType: '零售',
|
|
|
+ storageId: this.formData.outStorageId
|
|
|
}).then(res => {
|
|
|
- this.peijianList = res.data.records
|
|
|
+ console.log(res.data)
|
|
|
})
|
|
|
} else {
|
|
|
- this.listPageV2Data = []
|
|
|
this.peijianList = []
|
|
|
- this.materialCategoryListL1 = []
|
|
|
- this.materialCategoryListL2 = []
|
|
|
}
|
|
|
}
|
|
|
},
|