Przeglądaj źródła

经销商授权管理-页面优化-新增、编辑、查看

002390 1 rok temu
rodzic
commit
d1287addac

+ 42 - 10
src/views/marketing/dealer-authorization/add/index.vue

@@ -1,5 +1,6 @@
 <script>
 import useColumns from "./columns";
+import dealerApi from "@/api/marketing/dealer-authorization";
 export default {
   name: "authprivAdd",
   props: {
@@ -20,6 +21,8 @@ export default {
       FormColumns: FormColumns,
       params: params,
       rules: rules,
+      width: "500px",
+      option: "add",
     };
   },
   computed: {
@@ -32,7 +35,20 @@ export default {
     },
     title: {
       get() {
-        return this.isAdd ? "新增" : "编辑";
+        if (this.option === "edit") {
+          return "编 辑";
+        } else if (this.option === "check") {
+          return "查 看";
+        } else {
+          return "新 增";
+        }
+      },
+      set() {},
+    },
+    disabled: {
+      get() {
+        if (this.option === "check") return true;
+        return false;
       },
       set() {},
     },
@@ -42,7 +58,8 @@ export default {
     setVisible(val) {
       this.visible = val;
     },
-    setFormData(data) {
+    setFormData(data, op) {
+      this.option = op;
       if (data.id) {
         this.loading = true;
 
@@ -89,7 +106,7 @@ export default {
             updatePerson: nickName,
             updateBy: name,
             updateTime: new Date().Format(),
-            ...(this.isAdd
+            ...(this.option === "add"
               ? {
                   status: "0",
                   createPerson: nickName,
@@ -103,7 +120,7 @@ export default {
 
           try {
             this.loading = true;
-            let { code, msg } = await (this.isAdd
+            let { code, msg } = await (this.option === "add"
               ? dealerApi.insert(params)
               : dealerApi.update(params));
 
@@ -131,6 +148,7 @@ export default {
 
 <template>
   <el-dialog
+    :width="width"
     :title="title"
     :visible.sync="visible"
     :close-on-click-modal="false"
@@ -143,6 +161,7 @@ export default {
       :dict="dict"
       :rules="rules"
       :size="$attrs.size"
+      :disabled="disabled"
       :columns="FormColumns"
       ref="authprivAdd"
       label-width="auto"
@@ -158,12 +177,25 @@ export default {
         >
         </component
       ></template> -->
-      <div slot="footer">
-        <el-button @click="handleCancel">取 消</el-button>
-        <el-button type="primary" @click="handleConfirm('authprivAdd')"
-          >确 定</el-button
-        >
-      </div>
     </el-super-form>
+    <div slot="footer" v-if="this.option !== 'check'">
+      <el-button
+        type="primary"
+        :size="$attrs.size"
+        @click="handleConfirm('authprivAdd')"
+        >确 定</el-button
+      >
+      <el-button :size="$attrs.size" @click="handleCancel">取 消</el-button>
+    </div>
   </el-dialog>
 </template>
+
+<style scoped>
+>>> .el-dialog__body {
+  padding: 0px 20px;
+}
+
+::v-deep.superForm .el-form-item {
+  margin: 0 0 16px !important;
+}
+</style>

+ 15 - 11
src/views/marketing/dealer-authorization/index.vue

@@ -68,14 +68,17 @@ export default {
     // 新增、编辑授权信息
     handleOpenAddDialog(rows) {
       const { setVisible, setFormData } = this.$refs.addDialogRef;
-      setFormData(rows);
+      setFormData(rows, rows.id ? "edit" : "add");
       setVisible(true);
     },
     // 查看
     handleOpenSeeDialog(rows) {
-      const { setVisible, setFormData } = this.$refs.seeDialogRef;
-      setFormData(rows);
+      const { setVisible, setFormData } = this.$refs.addDialogRef;
+      setFormData(rows, "check");
       setVisible(true);
+      // const { setVisible, setFormData } = this.$refs.seeDialogRef;
+      // setFormData(rows);
+      // setVisible(true);
     },
     // 删除
     handleDelDialog(rows) {
@@ -201,9 +204,10 @@ export default {
     <authprivAdd
       ref="addDialogRef"
       :dict="dict"
+      :size="size"
       @close="useQuery"
     ></authprivAdd>
-    <authprivSee ref="seeDialogRef"></authprivSee>
+    <!-- <authprivSee ref="seeDialogRef"></authprivSee> -->
     <el-super-search
       v-model="params"
       :size="size"
@@ -217,14 +221,14 @@ export default {
     <el-row :gutter="24" style="margin: 16px 0px">
       <el-col :span="24" style="text-align: right">
         <el-button
-          size="mini"
+          :size="size"
           type="primary"
           @click="handleOpenAddDialog"
           v-hasPermi="['pu:authorization:add']"
           >新增</el-button
         >
-        <!-- <el-button size="mini" @click="handleSubmit">提交</el-button> -->
-        <!-- <el-button size="mini" @click="handleDownload">下载授权书</el-button> -->
+        <!-- <el-button :size="size" @click="handleSubmit">提交</el-button> -->
+        <!-- <el-button :size="size" @click="handleDownload">下载授权书</el-button> -->
       </el-col>
     </el-row>
 
@@ -247,7 +251,7 @@ export default {
         <template slot-scope="scope">
           <el-button
             type="text"
-            size="mini"
+            :size="size"
             @click="handleOpenAddDialog(scope.row)"
             v-if="scope.row.status == '0' || scope.row.status == '3'"
             v-hasPermi="['pu:authorization:edit']"
@@ -255,7 +259,7 @@ export default {
           >
           <el-button
             type="text"
-            size="mini"
+            :size="size"
             @click="handleDelDialog(scope.row)"
             v-if="scope.row.status == '0' || scope.row.status == '3'"
             v-hasPermi="['pu:authorization:remove']"
@@ -263,14 +267,14 @@ export default {
           >
           <el-button
             type="text"
-            size="mini"
+            :size="size"
             v-if="scope.row.status == '0' || scope.row.status == '3'"
             @click="handleSubmit(scope.row)"
             >提交</el-button
           >
           <el-button
             type="text"
-            size="mini"
+            :size="size"
             v-if="scope.row.status == '2'"
             @click="handleDownload(scope.row)"
             >下载授权书</el-button

+ 0 - 0
src/views/marketing/dealer-authorization/see/index.vue