chenrui 2 年 前
コミット
d80913d5d7

+ 1 - 1
src/views/allocationManagement/transferOut/list.vue

@@ -135,7 +135,7 @@
           <a-button
             size="small"
             type="link"
-            v-if="record.state == 'WAIT_AUDIT'&&record.printState=='UNABLE_PRINT' && $hasPermissions('B_tfo_yxPrint')"
+            v-if="record.state == 'WAIT_AUDIT' && record.printState!='UNABLE_PRINT' && $hasPermissions('B_tfo_yxPrint')"
             class="button-warning"
             @click="handleYxPrint(record)"
             id="allocateBillList-examine-btn">允许打印</a-button>

+ 37 - 35
src/views/allocationManagement/transferOut/printStatusModal.vue

@@ -12,26 +12,24 @@
         id="chooseCustom-form"
         ref="ruleForm"
         :model="form"
+        :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
-        <a-form-model-item label="调拨单号:" prop="no"> <span>{{ form.no }}{{ form.printState=='UNABLE_PRINT'?'(暂不打印)':form.printStatus=='CANCEL_PRINT'?'(取消打印)':'' }}</span>
+        <a-form-model-item label="调拨单号:" prop="no">
+          <span>{{ form.no }}{{ form.printState == 'UNABLE_PRINT' ? '(暂不打印)' : form.printState == 'CANCEL_PRINT' ? '(取消打印)' : '' }}</span>
         </a-form-model-item>
-        <a-form-model-item label="调往对象:" prop="targetName"> <span>{{ form.targetName }}</span>
+        <a-form-model-item label="调往对象:" prop="targetName">
+          <span>{{ form.targetName }}</span>
         </a-form-model-item>
-        <a-form-model-item label="调拨打印:" prop="printState">
-          <a-radio-group v-model="printState">
-            <a-radio value="NO_PRINT">
-              允许打印
-            </a-radio>
-            <a-radio value="CANCEL_PRINT" v-if="form.printState=='UNABLE_PRINT'">
-              取消打印
-            </a-radio>
+        <a-form-model-item label="调拨打印:" prop="printStateInfo">
+          <a-radio-group v-model="form.printStateInfo">
+            <a-radio value="NO_PRINT">允许打印</a-radio>
+            <a-radio value="CANCEL_PRINT" v-if="form.printState == 'UNABLE_PRINT'">取消打印</a-radio>
           </a-radio-group>
         </a-form-model-item>
         <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top: 50px;">
           <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
-          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定
-          </a-button>
+          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
         </a-form-model-item>
       </a-form-model>
     </a-spin>
@@ -39,9 +37,7 @@
 </template>
 
 <script>
-import {
-  updatePrintState
-} from '@/api/allocateBill.js'
+import { updatePrintState } from '@/api/allocateBill.js'
 export default {
   name: 'PrintModal',
   props: {
@@ -72,36 +68,44 @@ export default {
         no: undefined,
         payerName: undefined,
         printStatus: '',
-        allocateSn: ''
+        allocateSn: '',
+        printStateInfo: ''
       },
-      printState: ''
+      rules: { printStateInfo: [{ required: true, message: '请选择调拨打印状态', trigger: 'change' }] }
     }
   },
   methods: {
     //  保存
     handleSubmit () {
       const _this = this
-      const ajax_form = {
-        allocateSn: this.form.allocateSn,
-        printState: this.printState
-      }
-      _this.spinning = true
-      _this.confirmLoading = true
-      updatePrintState(ajax_form).then(res => {
-        if (res.status == 200) {
-          _this.$message.success(res.message)
-          _this.cancel()
-          _this.spinning = false
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const ajax_form = {
+            allocateSn: _this.form.allocateSn,
+            printState: _this.form.printStateInfo
+          }
+          _this.spinning = true
+          _this.confirmLoading = true
+          updatePrintState(ajax_form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.cancel()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+            _this.confirmLoading = false
+          })
         } else {
-          _this.spinning = false
+          console.log('error submit!!')
+          return false
         }
-        _this.confirmLoading = false
       })
     },
     cancel () {
       this.opened = false
       this.$emit('cancel')
-      this.printState = ''
+      this.form.printStateInfo = ''
       this.$refs.ruleForm.resetFields()
     }
   },
@@ -118,9 +122,7 @@ export default {
 }
 </script>
 <style lang="less" scoped>
-#chooseCustom-form{
-.chooseCustom-form{
-  margin-bottom:0 !important;
-}
+.ant-form-item {
+  margin-bottom: 10px !important;
 }
 </style>