Pārlūkot izejas kodu

feat: 添加冲红发票支持,控制金额编辑权限

xieyong 3 nedēļas atpakaļ
vecāks
revīzija
71acaaf948

+ 15 - 1
src/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue

@@ -115,7 +115,7 @@
               :precision="2"
               :controls="false"
               style="width: 100%"
-              disabled
+              :disabled="Number(ifRedReversalInvoice) === 1"
               :min="0"
             >
               <template slot="append">
@@ -358,6 +358,7 @@
         :contactData="contactData"
         ref="tableInfoRef"
         :invoiceAmount="form.invoiceAmount"
+        :ifRedReversalInvoice="ifRedReversalInvoice"
         @invoiceAmountChange="invoiceAmountChange"
       ></table-info-new>
 
@@ -721,6 +722,8 @@
         accountStatementDialogFlag: false,
         enterprisePage: [],
         totalInvoiceAmount: 0,
+        // 是否冲红发票:1-是(不允许编辑金额),0-否(允许编辑金额)
+        ifRedReversalInvoice: 0,
         form: {
           applyDeptId: '',
           applyDeptName: '',
@@ -757,6 +760,8 @@
     methods: {
       //从发票管理新增发票初始化
       async init(row = {}, type) {
+        // 重置冲红标记,避免上次编辑状态污染本次
+        this.ifRedReversalInvoice = 0;
         this.businessId = type == 'reissue' ? '' : row.id || '';
         this.title =
           type == 'add'
@@ -766,6 +771,11 @@
             : '修改';
         console.log('row', row, type);
         this.dialogType = type;
+        // 修改时,先用列表行带过来的 ifRedReversalInvoice 占位(详情接口目前未返回该字段),
+        // 后续 getInfo() 若接口补上该字段,会被详情返回值覆盖
+        if (type ===  'update') {
+          this.ifRedReversalInvoice = Number(row?.ifRedReversalInvoice) || 0;
+        }
         if (type == 'add' || type == 'reissue') {
           this.form.applyDeptId = this.user.info.groupId;
           this.form.applyDeptName = this.user.info.groupName;
@@ -1123,6 +1133,10 @@
       async getInfo(id) {
         this.form = await invoiceApplyInfoV2API(id);
         this.form.type = Number(this.form.type);
+        if(this.form.ifRedReversalInvoice){
+          // 冲红发票标记:1 是 / 0 否。仅在 1 时禁止编辑金额相关字段
+          this.ifRedReversalInvoice = Number(this.form.ifRedReversalInvoice);
+        }
         this.$nextTick(() => {
           // 根据来源类型设置数据源:99 用 tableInfo(setValue),非 99 用 tableInfoNew(putValue)
           if (this.form.sourceType == 99) {

+ 7 - 2
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -18,8 +18,8 @@
           <el-form-item
             style="width: 100%;"
             :prop="'detailList.' + scope.$index + '.invoiceAmount'"
-          > 
-            <span v-if="dialogType === 'view'"> {{ scope.row.invoiceAmount }}</span>
+          >
+            <span v-if="dialogType === 'view' || Number(ifRedReversalInvoice) === 1"> {{ scope.row.invoiceAmount }}</span>
             <el-input v-else v-model="scope.row.invoiceAmount" type="number" @input="(val) => invoiceAmountChange(val, scope.row, scope.$index)"></el-input>
           </el-form-item>
         </template>
@@ -101,6 +101,11 @@
       invoiceAmount: {
         type: Number,
         default: 0
+      },
+      // 是否冲红发票:1-是(不允许编辑开票金额),0-否(允许编辑)
+      ifRedReversalInvoice: {
+        type: Number,
+        default: 0
       }
     },
     data() {