From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化

---
 src/views/place/components/auditBase.vue |  176 ++++++++++++++++++++++++++--------------------------------
 1 files changed, 80 insertions(+), 96 deletions(-)

diff --git a/src/views/place/components/auditBase.vue b/src/views/place/components/auditBase.vue
index 4181e69..c70f425 100644
--- a/src/views/place/components/auditBase.vue
+++ b/src/views/place/components/auditBase.vue
@@ -1,109 +1,93 @@
 <template>
-    <div class="cur-container-box">
-        <div class="content-box">
-            审核当前项
-        </div>
-        <div class="footer-btn-box">
-            <el-button type="primary" size="small" @click="auditPass">通 过</el-button>
-            <el-button size="small" @click="auditTurnDown">驳 回</el-button>
-        </div>
+  <div class="cur-container-box">
+    <avue-form ref="replyForm" :option="option" v-model="form" :close-on-click-modal="false">
 
-        <el-dialog append-to-body :visible.sync="auditTurnDownPopup" width="30%" :close-on-click-modal="false"
-            @close="popupClose" :show-close="false">
-            <avue-form ref="replyForm" :option="option" v-model="form" @submit="handleSubmit" @reset-change="handleReset">
-            </avue-form>
-        </el-dialog>
-    </div>
+      <template slot-scope="{size}" slot="menuForm">
+        <el-button type="primary" :size="size" @click="handleSubmit">通 过</el-button>
+        <el-button :size="size" @click="handleReset">驳 回</el-button>
+      </template>
+
+    </avue-form>
+  </div>
 </template>
 
 <script>
-import {
+  import {
     setCheckPlaceExt
-} from "@/api/place/place"
+  } from "@/api/place/place"
 
-export default {
+  export default {
     inject: ["placeElement"],
 
-    data () {
-        return {
-            auditTurnDownPopup: false,
-
-            form: {},
-            option: {
-                submitBtn: true,
-                submitText: '确定',
-                emptyBtn: true,
-                emptyText: '取消',
-                column: [
-                    {
-                        span: 24,
-                        label: "驳回原因",
-                        prop: "confirmNotion",
-                        type: 'textarea',
-                        minRows: 3,
-                        maxRows: 5,
-                        rules: [{
-                            required: true,
-                            message: "请输入驳回原因",
-                            trigger: "blur",
-                        }],
-                    }
-                ]
-            },
-        }
+    data() {
+      return {
+        form: {},
+        option: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [{
+            span: 23,
+            row: true,
+            label: "审批意见",
+            prop: "confirmNotion",
+            type: 'textarea',
+            minRows: 3,
+            maxRows: 5,
+            rules: [],
+          }]
+        },
+      }
     },
 
     methods: {
-        popupClose () {
-            this.$refs.replyForm && this.$refs.replyForm.resetForm()
-        },
+      handleSubmit() {
+        setCheckPlaceExt({
+          confirmFlag: 2,
+          id: this.placeElement.curAuditRow.placeExtId,
+          confirmNotion: this.form.confirmNotion
+        }).then(() => {
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          })
+          this.$refs.replyForm && this.$refs.replyForm.resetForm()
+          this.placeElement.auditBasePopup = false
 
-        auditPass () {
-            setCheckPlaceExt({
-                confirmFlag: 2,
-                id: this.placeElement.curAuditRow.placeExtId
-            }).then(() => {
-                this.placeElement.auditBasePopup = false
-                this.$message({
-                    type: "success",
-                    message: "操作成功!",
-                })
+          this.placeElement.onLoad(this.placeElement.page)
+        })
+      },
 
-                this.placeElement.onLoad(this.placeElement.page)
-            })
-        },
+      handleReset() {
+        if ('confirmNotion' in this.form && this.form.confirmNotion.trim() == '' || !this.form.confirmNotion) {
+          this.$message({
+            type: 'warning',
+            message: "请输入审批意见!",
+          })
 
-        auditTurnDown () {
-            this.placeElement.auditBasePopup = false
-            this.auditTurnDownPopup = true
-        },
-
-        handleSubmit (form, done) {
-            setCheckPlaceExt({
-                confirmFlag: 3,
-                id: this.placeElement.curAuditRow.placeExtId,
-                confirmNotion: form.confirmNotion
-            }).then(() => {
-                this.auditTurnDownPopup = false
-                this.$message({
-                    type: "success",
-                    message: "操作成功!",
-                })
-
-                this.placeElement.onLoad(this.placeElement.page)
-                done()
-            })
-        },
-
-        handleReset () {
-            this.auditTurnDownPopup = false
+          return
         }
+
+        setCheckPlaceExt({
+          confirmFlag: 3,
+          id: this.placeElement.curAuditRow.placeExtId,
+          confirmNotion: this.form.confirmNotion
+        }).then(() => {
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          })
+          this.$refs.replyForm && this.$refs.replyForm.resetForm()
+          this.placeElement.auditBasePopup = false
+
+          this.placeElement.onLoad(this.placeElement.page)
+        })
+      },
     }
-}
+  }
 </script>
 
 <style lang="scss" scoped>
-.cur-container-box {
+  .cur-container-box {
     display: flex;
     flex-direction: column;
     width: 100%;
@@ -111,18 +95,18 @@
     overflow: hidden;
 
     .content-box {
-        margin: 0 4px;
-        padding: 0 16px;
-        height: 0;
-        flex: 1;
-        overflow: hidden;
-        overflow-y: auto;
+      margin: 0 4px;
+      padding: 0 16px;
+      height: 0;
+      flex: 1;
+      overflow: hidden;
+      overflow-y: auto;
     }
 
     .footer-btn-box {
-        margin-top: 10px;
-        display: flex;
-        justify-content: center;
+      margin-top: 10px;
+      display: flex;
+      justify-content: center;
     }
-}
+  }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3