|
@@ -50,6 +50,24 @@
|
|
|
style="width: 100%;"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
+ <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
|
|
+ <a-form-model-item
|
|
|
+ label="费用归属品牌"
|
|
|
+ prop="productBrandSn"
|
|
|
+ :required="form.expenseTypeName=='促销费用'"
|
|
|
+ >
|
|
|
+ <ProductBrand id="expenseReimbursementAddform-productBrandSn" @change="changeBrand" showAllBrand v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
|
|
|
+ <a-form-model-item
|
|
|
+ label="费用归属品类"
|
|
|
+ prop="productTypeSn2"
|
|
|
+ :required="form.expenseTypeName=='促销费用'"
|
|
|
+ >
|
|
|
+ <productTypeAll placeholder="请选择费用归属品类(单选,至少选到二级或三级)" showAllType @change="changeProductType" v-model="productType" id="expenseReimbursementAddform-productType"></productTypeAll>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
<a-form-model-item label="主题" prop="title" :label-col="{span:3}" :wrapper-col="{span:19}">
|
|
|
<a-textarea
|
|
@@ -106,10 +124,12 @@ import moment from 'moment'
|
|
|
import department from './department.js'
|
|
|
import employee from './employee.js'
|
|
|
import expenseType from '@/views/common/expenseType.js'
|
|
|
+import ProductBrand from '@/views/common/productBrand.js'
|
|
|
+import productTypeAll from '@/views/common/productTypeAll.js'
|
|
|
import { expenseAccountDetail, expenseAccountSave } from '@/api/expenseManagement.js'
|
|
|
export default {
|
|
|
name: 'BaseDataModal',
|
|
|
- components: { VSelect, Upload, STable, department, employee, expenseType },
|
|
|
+ components: { VSelect, Upload, STable, department, employee, expenseType, ProductBrand, productTypeAll },
|
|
|
props: {
|
|
|
show: [Boolean],
|
|
|
itemSn: {
|
|
@@ -131,6 +151,7 @@ export default {
|
|
|
attachList: [], // 附件列表
|
|
|
attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo', // 附件上传地址
|
|
|
expenseTypes: [], // 费用类型值
|
|
|
+ productType: [],
|
|
|
form: {
|
|
|
applyPersonSn: undefined, // 申请人
|
|
|
applyDepartmentSn: undefined, // 申请部门
|
|
@@ -140,6 +161,10 @@ export default {
|
|
|
expenseTypeName: undefined, // 费用类型1
|
|
|
expenseTypeName2: undefined, // 费用类型2
|
|
|
expenseTypeName3: undefined, // 费用类型3
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
expenseDate: moment().locale('zh-cn').format('YYYY-MM'), // 费用产生月
|
|
|
title: '', // 主题
|
|
|
content: '' // 费用说明
|
|
@@ -194,16 +219,36 @@ export default {
|
|
|
expenseTypeName: undefined, // 费用类型1
|
|
|
expenseTypeName2: undefined, // 费用类型2
|
|
|
expenseTypeName3: undefined, // 费用类型3
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
expenseDate: moment().locale('zh-cn').format('YYYY-MM'), // 费用产生月
|
|
|
title: '', // 主题
|
|
|
content: '' // 费用说明
|
|
|
}
|
|
|
+ this.productType = []
|
|
|
this.attachList = []
|
|
|
this.form.expenseAccountFilesList = ''
|
|
|
this.$refs.attachList.setFileList('')
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.expenseTypes = []
|
|
|
},
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, id, opt) {
|
|
|
+ console.log(val, opt, '------------')
|
|
|
+ this.form.productTypeSn1 = val && val[0] ? val[0] : ''
|
|
|
+ this.form.productTypeSn2 = val && val[1] ? val[1] : ''
|
|
|
+ this.form.productTypeSn3 = val && val[2] ? val[2] : ''
|
|
|
+ // 名称
|
|
|
+ this.form.productTypeName1 = opt && opt[0] ? opt[0].productTypeName : ''
|
|
|
+ this.form.productTypeName2 = opt && opt[1] ? opt[1].productTypeName : ''
|
|
|
+ this.form.productTypeName3 = opt && opt[2] ? opt[2].productTypeName : ''
|
|
|
+ },
|
|
|
+ // 品牌
|
|
|
+ changeBrand (val, id, opt) {
|
|
|
+ this.form.productBrandName = opt ? opt.brandName : ''
|
|
|
+ },
|
|
|
// 申请人员
|
|
|
employeeChange (v, r) {
|
|
|
if (r.departmentSn) {
|
|
@@ -237,6 +282,19 @@ export default {
|
|
|
this.form.expenseTypeName = opts && opts[0] ? opts[0].name : ''
|
|
|
this.form.expenseTypeName2 = opts && opts[1] ? opts[1].name : ''
|
|
|
this.form.expenseTypeName3 = opts && opts[2] ? opts[2].name : ''
|
|
|
+ // 校验规则
|
|
|
+ this.$refs.ruleForm.clearValidate()
|
|
|
+ this.setValidBrandType()
|
|
|
+ },
|
|
|
+ // 判断是否促销费用类型,必填品牌和分类
|
|
|
+ setValidBrandType () {
|
|
|
+ if (this.form.expenseTypeName == '促销费用') {
|
|
|
+ this.rules.productBrandSn = [{ required: true, message: '请选择归属品牌', trigger: 'change' }]
|
|
|
+ this.rules.productTypeSn2 = [{ required: true, message: '请选择归属分类(至少选择到2级或3级分类)', trigger: 'change' }]
|
|
|
+ } else {
|
|
|
+ this.rules.productBrandSn = []
|
|
|
+ this.rules.productTypeSn2 = []
|
|
|
+ }
|
|
|
},
|
|
|
// 附件上传
|
|
|
changeAttach (file) {
|
|
@@ -257,9 +315,16 @@ export default {
|
|
|
this.attachList = data.expenseAccountFilesList
|
|
|
this.$refs.attachList.setFileList(this.attachList)
|
|
|
}
|
|
|
+ if (data.productTypeSn1) {
|
|
|
+ this.productType = [data.productTypeSn1, data.productTypeSn2, data.productTypeSn3]
|
|
|
+ }
|
|
|
+ if (!data.productBrandSn) {
|
|
|
+ this.form.productBrandSn = undefined
|
|
|
+ }
|
|
|
setTimeout(() => {
|
|
|
this.expenseTypes = data.expenseType ? [this.form.expenseType, this.form.expenseType2, this.form.expenseType3] : []
|
|
|
}, 500)
|
|
|
+ this.setValidBrandType()
|
|
|
},
|
|
|
// 获取详情
|
|
|
getDetail () {
|