lilei 11 kuukautta sitten
vanhempi
commit
83fef9d63c

+ 39 - 21
src/views/expenseManagement/expenseReimbursement/add.vue

@@ -45,6 +45,7 @@
           <div style="display: flex;justify-content: space-between;align-items: center;">
             <div>费用明细</div>
             <div>
+              <a-button size="small" class="button-info" type="primary" @click="plEdit">变更记账名称</a-button>
               <a-button size="small" class="button-info" type="primary" @click="openGuideModal=true">导入费用明细</a-button>
               <a-button size="small" class="button-error" type="primary" @click="newExpenseDetail">新增费用明细</a-button>
             </div>
@@ -132,8 +133,9 @@
       :expenseAccountSn="$route.params.sn"
       :expenseAccountNo="detailData?detailData.expenseAccountNo:''"
       :expenseAccountDetailSn="expenseAccountDetailSn"
+      :isBatch="isBatch"
       @ok="epenseDetailOk"
-      @close="openEpenseDetailModal=false"></epenseDetailModal>
+      @close="epenseDetailClose"></epenseDetailModal>
     <!-- 产品信息设置 -->
     <productInfoModal
       ref="productInfo"
@@ -216,7 +218,8 @@ export default {
         { title: '销售单号', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '100px', align: 'center' }
-      ]
+      ],
+      isBatch: false // 是否变更记账名称
     }
   },
   methods: {
@@ -250,41 +253,43 @@ export default {
     },
     // 确认导入明细
     hanldeImprotOk (obj) {
-      console.log(obj)
       expenseInsertImport(obj).then(res => {
         if (res.status == 200) {
           this.getDetail(false)
         }
       })
     },
+    // 批量修改明细
+    plEdit () {
+      this.expenseAccountDetailSn = ''
+      this.openEpenseDetailModal = true
+      this.isBatch = true
+    },
     // 新增明细
     newExpenseDetail () {
       this.expenseAccountDetailSn = ''
       this.openEpenseDetailModal = true
     },
-    // 新增明细成功
-    epenseDetailOk () {
-      // 刷新列表
-      this.openEpenseDetailModal = false
-      this.getDetail(false)
-    },
-    // 设置产品
-    setProduct (row) {
-      this.openProductInfoModal = true
-      this.expenseAccountDetailSn = row.expenseAccountDetailSn
-      this.$refs.productInfo.setBaseData(row)
-    },
-    // 新增产品成功
-    productInfoOk () {
-      // 刷新列表
-      this.openProductInfoModal = false
-      this.getDetail(false)
-    },
     // 编辑明细
     handleEdit (row) {
       this.openEpenseDetailModal = true
       this.expenseAccountDetailSn = row.expenseAccountDetailSn
     },
+    // 新增明细成功
+    epenseDetailOk (data) {
+      // 如果是批量修改
+      if (this.isBatch) {
+        console.log(data)
+      } else {
+        this.openEpenseDetailModal = false
+        this.getDetail(false)// 刷新列表
+      }
+    },
+    // 明细弹框关闭
+    epenseDetailClose () {
+      this.openEpenseDetailModal = false
+      this.isBatch = false
+    },
     // 删除明细
     handleDel (row) {
       const _this = this
@@ -307,6 +312,19 @@ export default {
         }
       })
     },
+    // 设置产品
+    setProduct (row) {
+      this.openProductInfoModal = true
+      this.expenseAccountDetailSn = row.expenseAccountDetailSn
+      this.$refs.productInfo.setBaseData(row)
+    },
+    // 新增产品成功
+    productInfoOk () {
+      // 刷新列表
+      this.openProductInfoModal = false
+      this.getDetail(false)
+    },
+    // 提交前,选择审批人员
     beforeSubmit () {
       if (this.total) {
         this.openDepartUserModal = true

+ 83 - 56
src/views/expenseManagement/expenseReimbursement/epenseDetailModal.vue

@@ -4,7 +4,7 @@
     class="epenseDetailModal-modal"
     :footer="null"
     :maskClosable="false"
-    :title="title+'费用明细'"
+    :title="title"
     v-model="isShow"
     @cancel="isShow=false"
     width="60%">
@@ -33,16 +33,28 @@
               <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
                 <a-form-model-item label="记账名称" prop="accountNameSn">
                   <!-- 部门 -->
-                  <department v-show="form.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
+                  <department id="epenseDetailModal-accountName" v-show="form.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
                   <!-- 经销商 -->
-                  <custList v-show="form.accountType=='CUSTOMER'" cooperateFlag="1" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
+                  <custList
+                    id="epenseDetailModal-accountName1"
+                    v-show="form.accountType=='CUSTOMER'"
+                    cooperateFlag="1"
+                    ref="custList"
+                    @change="accountNameSnChange"
+                    placeholder="请选择记账名称(输入名称搜索)"></custList>
                   <!-- 供应商 -->
-                  <supplier v-show="form.accountType=='OUT_ACCOUNT'" enableFlag="1" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
+                  <supplier
+                    id="epenseDetailModal-accountName2"
+                    v-show="form.accountType=='OUT_ACCOUNT'"
+                    enableFlag="1"
+                    @change="accountNameSnChange"
+                    v-model="form.accountNameSn"
+                    placeholder="请选择记账名称(输入名称搜索)"></supplier>
                   <!-- 其它往来 -->
-                  <otherTransactions v-show="form.accountType=='OTHER_ACCOUNT'" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></otherTransactions>
+                  <otherTransactions id="epenseDetailModal-accountName3" v-show="form.accountType=='OTHER_ACCOUNT'" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></otherTransactions>
                   <span v-if="!form.accountType">
-                    <a-select style="width: 100%" placeholder="请选择记账名称">
-                      <a-select-option value="" :disabled="true">
+                    <a-select style="width: 100%" placeholder="请选择记账名称" id="epenseDetailModal-accountName4">
+                      <a-select-option value="" :disabled="true" id="epenseDetailModal-accountName-kong">
                         请先选择记账类型
                       </a-select-option>
                     </a-select>
@@ -82,7 +94,13 @@
                     v-model="form.citySn"></Area>
                 </a-form-model-item>
               </a-col>
-              <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-col
+                :xs="24"
+                :sm="24"
+                :md="12"
+                :lg="12"
+                :xl="12"
+                v-if="!isBatch">
                 <a-form-model-item label="记账费用">
                   <a-input
                     style="width: 100%;color: red;font-weight: bold;"
@@ -102,7 +120,7 @@
             </a-row>
           </a-form-model>
           <!-- 费用承担方 -->
-          <epenseCdfModal ref="epenseCdf" :list="form.detailSplitList" @fyTotal="getFyTotal"></epenseCdfModal>
+          <epenseCdfModal v-if="!isBatch" ref="epenseCdf" :list="form.detailSplitList" @fyTotal="getFyTotal"></epenseCdfModal>
         </div>
         <div class="btn-cont">
           <a-button id="epenseDetailModal-back" @click="isShow = false" style="margin-right: 15px;">取消</a-button>
@@ -139,9 +157,13 @@ export default {
       type: String,
       default: ''
     },
-    expenseAccountDetailSn: {
+    expenseAccountDetailSn: { // 明细sn
       type: String,
       default: ''
+    },
+    isBatch: { // 是否批量修改
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -198,9 +220,9 @@ export default {
           this.form.citySn = row.citySn
           this.form.provinceName = row.provinceName
           this.form.cityName = row.cityName
-          this.form.subareaArea.subareaName = row.subareaArea.subareaName
-          this.form.subareaArea.subareaAreaName = row.subareaArea.subareaAreaName
-          this.subareaList = [row.subareaArea.subareaName, row.subareaArea.subareaAreaName]
+          this.form.subareaArea.subareaName = row.subareaArea ? row.subareaArea.subareaName : ''
+          this.form.subareaArea.subareaAreaName = row.subareaArea ? row.subareaArea.subareaAreaName : ''
+          this.subareaList = row.subareaArea ? [row.subareaArea.subareaName, row.subareaArea.subareaAreaName] : []
         } else {
           this.form.accountNameSn = ''
           this.form.provinceSn = ''
@@ -224,7 +246,6 @@ export default {
     },
     // 省
     provinceChange (v, row) {
-      console.log(v, row)
       this.form.provinceName = row ? row.name : ''
       this.form.provinceSn = v || ''
       this.form.citySn = undefined
@@ -264,53 +285,58 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
-          const cdfList = this.$refs.epenseCdf.getList()
-          if (cdfList[0] == 1) {
-            this.$warning({
-              title: '是否存在以下情况,请按照要求填写',
-              content: <div><p>1、费用承担方至少有一个</p><p>2、带星号的列为必填项,不能为空</p></div>,
-              centered: true
-            })
-            return
-          }
-          if (cdfList[0] == 3) {
-            this.$warning({
-              title: '提示',
-              content: '请检查每行承担人员是否已经选择',
-              centered: true
-            })
-            return
-          }
-          if (cdfList[0] == 2) {
-            this.$warning({
-              title: '提示',
-              content: '请检查每行人员平摊费用合计是否等于承担金额',
-              centered: true
-            })
-            return
-          }
-          // 获取承担人列表数据
-          form.detailSplitList = cdfList[1]
           form.provinceName = form.provinceName ? form.provinceName : ''
           form.provinceSn = form.provinceSn ? form.provinceSn : ''
           form.citySn = form.citySn ? form.citySn : ''
           form.cityName = form.cityName ? form.cityName : ''
-          form.expense = Math.abs(form.expense)
 
-          console.log(form)
+          // 如果是批量修改记账名称
+          if (this.isBatch) {
+            _this.$emit('ok', form)
+          } else {
+            // 校验明细承担人列表
+            const cdfList = this.$refs.epenseCdf.getList()
+            if (cdfList[0] == 1) {
+              this.$warning({
+                title: '是否存在以下情况,请按照要求填写',
+                content: <div><p>1、费用承担方至少有一个</p><p>2、带星号的列为必填项,不能为空</p></div>,
+                centered: true
+              })
+              return
+            }
+            if (cdfList[0] == 3) {
+              this.$warning({
+                title: '提示',
+                content: '请检查每行承担人员是否已经选择',
+                centered: true
+              })
+              return
+            }
+            if (cdfList[0] == 2) {
+              this.$warning({
+                title: '提示',
+                content: '请检查每行人员平摊费用合计是否等于承担金额',
+                centered: true
+              })
+              return
+            }
+            // 获取承担人列表数据
+            form.detailSplitList = cdfList[1]
+            form.expense = Math.abs(form.expense) // 费用合计
 
-          _this.spinning = true
-          expenseAcctDetailSave(form).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              setTimeout(() => {
-                _this.$emit('ok')
+            _this.spinning = true
+            expenseAcctDetailSave(form).then(res => {
+              if (res.status == 200) {
+                _this.$message.success(res.message)
+                setTimeout(() => {
+                  _this.$emit('ok')
+                  _this.spinning = false
+                }, 200)
+              } else {
                 _this.spinning = false
-              }, 200)
-            } else {
-              _this.spinning = false
-            }
-          })
+              }
+            })
+          }
         } else {
           return false
         }
@@ -367,13 +393,14 @@ export default {
       } else {
         this.form.expenseAccountSn = this.expenseAccountSn
         this.form.expenseAccountNo = this.expenseAccountNo
+        // 编辑
         if (this.expenseAccountDetailSn) {
-          this.title = '编辑'
+          this.title = '编辑费用明细'
           this.form.expenseAccountDetailSn = this.expenseAccountDetailSn || ''
           this.getExpenseAccountDetail()
         } else {
           this.resetForm()
-          this.title = '新增'
+          this.title = this.isBatch ? '批量变更记账名称' : '新增费用明细'
         }
       }
     }