lilei 6 mēneši atpakaļ
vecāks
revīzija
375e0aa3d4

+ 25 - 6
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -62,13 +62,21 @@
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
-            <a-form-model-item label="费用归属品牌">
-              <ProductBrand id="allocateBill-basicInfo-productBrandSn" @change="changeBrand" v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
+            <a-form-model-item
+              label="费用归属品牌"
+              prop="productBrandSn"
+              :required="form.costTypeName=='促销费用'"
+            >
+              <ProductBrand id="allocateBill-basicInfo-productBrandSn" @change="changeBrand" showAllBrand v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
-            <a-form-model-item label="费用归属品类">
-              <productTypeAll placeholder="请选择费用归属品类(单选,可选二级或三级)" @change="changeProductType" v-model="productType" id="allocateBill-basicInfo-productType"></productTypeAll>
+            <a-form-model-item
+              label="费用归属品类"
+              prop="productTypeSn2"
+              :required="form.costTypeName=='促销费用'"
+            >
+              <productTypeAll placeholder="请选择费用归属品类(单选,至少选到二级或三级)" showAllType @change="changeProductType" v-model="productType" id="allocateBill-basicInfo-productType"></productTypeAll>
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
@@ -221,6 +229,18 @@ export default {
       this.form.costTypeName = opt && opt[0] ? opt[0].name : ''
       this.form.allocateSortName = opt && opt[1] ? opt[1].name : ''
       this.form.allocateTypeName = opt && opt[2] ? opt[2].name : ''
+      // 校验规则
+      this.$refs.ruleForm.clearValidate()
+      this.valiadBranType()
+    },
+    valiadBranType () {
+      if (this.form.costTypeName == '促销费用') {
+        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 = []
+      }
     },
     //  产品分类  change
     changeProductType (val, id, opt) {
@@ -235,7 +255,6 @@ export default {
     },
     // 品牌
     changeBrand (val, id, opt) {
-      console.log(val, opt, '------------')
       this.form.productBrandName = opt ? opt.brandName : ''
     },
     fetchUser (dealerName) {
@@ -356,7 +375,6 @@ export default {
           this.$nextTick(() => {
             this.$refs.attachList.setFileList(this.attachList)
           })
-
           this.allocateTypeVal = [this.detailData.costTypeSn, this.detailData.allocateSortSn, this.detailData.allocateTypeSn]
           if (this.detailData.productTypeSn1) {
             this.productType = [this.detailData.productTypeSn1, this.detailData.productTypeSn2, this.detailData.productTypeSn3]
@@ -367,6 +385,7 @@ export default {
           if (!this.form.productBrandSn) {
             this.form.productBrandSn = undefined
           }
+          this.valiadBranType()
         }
       }
     }

+ 10 - 0
src/views/common/productBrand.js

@@ -34,6 +34,11 @@ const ProductBrand = {
     disabled: {
       type: Boolean,
       default: false
+    },
+    // 是否显示全品牌
+    showAllBrand:{
+      type: Boolean,
+      default: false
     }
   },
   data() {
@@ -85,6 +90,11 @@ const ProductBrand = {
       }else{
         this.productBrandList = data
       }
+      // 是否显示全品牌
+      const hasAll = this.productBrandList.find(item => item.brandSn == 'ALL')
+      if(this.showAllBrand && !hasAll){
+        this.productBrandList.unshift({brandSn:'ALL',brandName:'全品牌'})
+      }
     },
     //  产品品牌列表,
     getProductBrand () {

+ 16 - 0
src/views/common/productTypeAll.js

@@ -36,6 +36,11 @@ const ProductType = {
     isAll: {
       type: Boolean,
       default: true
+    },
+    // 是否显示全分类
+    showAllType: {
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -71,6 +76,13 @@ const ProductType = {
       this.$emit('change', this.defaultVal, this.id,row)
       this.$emit('input', this.defaultVal)
     },
+    showALLtype(){
+      // 是否显示全分类
+      const hasAll = this.productTypeList.some(item => item.productTypeSn == 'ALL')
+      if(this.showAllType&&!hasAll){
+        this.productTypeList.unshift({productTypeName:'全分类',productTypeSn:'ALL',children:[{productTypeName:'全分类',productTypeSn:'ALL'}]})
+      }
+    },
     //  产品分类  列表
     getProductType () {
       if(this.isAll){
@@ -88,6 +100,8 @@ const ProductType = {
           }
           // 缓存数据
           this.$store.state.app.productTypeAllList = this.productTypeList
+          // 是否显示全分类
+          this.showALLtype()
         })
       }else{
         productTypeQuery({}).then(res => {
@@ -96,6 +110,8 @@ const ProductType = {
           } else {
             this.productTypeList = []
           }
+          // 是否显示全分类
+          this.showALLtype()
         })
       }
     },

+ 13 - 2
src/views/expenseManagement/expenseReimbursement/add.vue

@@ -24,6 +24,17 @@
           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用归属品牌">
+            {{ (detailData&&detailData.productBrandName) || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="费用归属品类">
+            <div>
+              <span v-if="detailData&&detailData.productTypeName1">{{ detailData.productTypeName1 || '--' }}</span>
+              <span v-else>--</span>
+              <span v-if="detailData&&detailData.productTypeName2">/{{ detailData.productTypeName2 || '--' }}</span>
+              <span v-if="detailData&&detailData.productTypeName3">/{{ detailData.productTypeName3 || '--' }}</span>
+            </div>
+          </a-descriptions-item>
           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
@@ -31,8 +42,8 @@
           <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
           <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
           <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
-          <a-descriptions-item label="详细说明" :span="3">{{ detailData&&detailData.content.join(',')||'' }}</a-descriptions-item>
-          <a-descriptions-item label="附件" :span="3">
+          <a-descriptions-item label="详细说明" :span="4">{{ detailData&&detailData.content.join(',')||'' }}</a-descriptions-item>
+          <a-descriptions-item label="附件" :span="4">
             <a
               target="_blank"
               style="color: #00aaff;text-decoration: underline;margin-right: 15px;"

+ 66 - 1
src/views/expenseManagement/expenseReimbursement/baseDataModal.vue

@@ -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 () {

+ 12 - 1
src/views/expenseManagement/expenseReimbursement/detail.vue

@@ -35,11 +35,22 @@
       </a-page-header>
       <!-- 基础信息 -->
       <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-show="showDetail">
-        <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}" v-if="detailData">
+        <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 3}" v-if="detailData">
           <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用归属品牌">
+            {{ (detailData&&detailData.productBrandName) || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="费用归属品类">
+            <div>
+              <span v-if="detailData&&detailData.productTypeName1">{{ detailData.productTypeName1 || '--' }}</span>
+              <span v-else>--</span>
+              <span v-if="detailData&&detailData.productTypeName2">/{{ detailData.productTypeName2 || '--' }}</span>
+              <span v-if="detailData&&detailData.productTypeName3">/{{ detailData.productTypeName3 || '--' }}</span>
+            </div>
+          </a-descriptions-item>
           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>