Переглянути джерело

经销商授权管理-详情:必填校验;列表:提交提醒

002390 1 рік тому
батько
коміт
2511b262d6

+ 23 - 6
src/views/marketing/dealer-authorization/add/columns.js

@@ -2,35 +2,52 @@ export default function useColumns() {
 
   const FormColumns = [
     {
-      item: { title: '经销商名称', key: 'dealerName', },
+      item: {
+        title: '经销商名称', key: 'dealerName',
+        required: true,
+      },
       attr: {
         is: "el-input",
         clearable: true,
       }
     },
     {
-      item: { title: '授权区/医院', key: 'authorizedAreaName', },
+      item: {
+        title: '授权区/医院', key: 'authorizedAreaName',
+        required: true,
+      },
       attr: {
         is: "el-input",
         clearable: true,
       }
     },
     {
-      item: { title: '授权产品', key: 'authorizedProductsName', },
+      item: {
+        title: '授权产品', key: 'authorizedProductsName',
+        required: true,
+      },
       attr: {
         is: "el-input",
         clearable: true,
       }
     },
     {
-      item: { title: '授权期限', key: 'time', },
+      item: {
+        title: '授权期限', key: 'time',
+        required: true,
+      },
       attr: {
-        is: "el-date-wrapper",
+        is: "el-date-picker",
+        type: "daterange",
+        rangeSeparator: "至",
         clearable: true,
       }
     },
     {
-      item: { title: '授权书开具时间', key: 'issueTime', },
+      item: {
+        title: '授权书开具时间', key: 'issueTime',
+        required: true,
+      },
       attr: {
         is: "el-date-picker",
         valueFormat: "yyyy-MM-dd",

+ 5 - 28
src/views/marketing/dealer-authorization/add/index.vue

@@ -14,6 +14,7 @@ export default {
   data() {
     const { FormColumns } = useColumns();
     const rules = this.$init.rules([...FormColumns]);
+    console.log(rules, "rules");
     const params = this.$init.params(FormColumns);
     return {
       visible: false,
@@ -26,13 +27,6 @@ export default {
     };
   },
   computed: {
-    isAdd: {
-      get() {
-        if (this.params.id) return false;
-        return true;
-      },
-      set() {},
-    },
     title: {
       get() {
         if (this.option === "edit") {
@@ -76,15 +70,12 @@ export default {
         return;
       }
     },
-    // 重置表单数据
-    handleResetData() {
-      this.params = this.$init.params(this.FormColumns);
-      this.$refs["authprivAdd"].clearValidate();
-    },
     // 取消
     handleCancel() {
-      this.handleResetData();
+      this.params = this.$init.params(this.FormColumns);
+      this.$refs["authprivAdd"].resetFields();
       this.setVisible(false);
+      this.$emit("close");
     },
     // 确定
     handleConfirm(formName) {
@@ -138,10 +129,6 @@ export default {
         }
       });
     },
-    beforeClose(done) {
-      this.handleResetData();
-      done();
-    },
   },
 };
 </script>
@@ -153,8 +140,7 @@ export default {
     :visible.sync="visible"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
-    :before-close="beforeClose"
-    @close="$emit('close')"
+    @close="handleCancel"
   >
     <el-super-form
       v-model="params"
@@ -168,15 +154,6 @@ export default {
       label-position="right"
       style="padding: 20px"
     >
-      <!-- <template slot="puOrgName" slot-scope="scope">
-        <component
-          v-bind="scope.attr"
-          v-model="scope.row[scope.item.key]"
-          :size="$attrs.size"
-          :source.sync="scope.row"
-        >
-        </component
-      ></template> -->
     </el-super-form>
     <div slot="footer" v-if="this.option !== 'check'">
       <el-button

+ 39 - 36
src/views/marketing/dealer-authorization/index.vue

@@ -102,48 +102,51 @@ export default {
             this.loading = false;
           }
         })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "已取消删除",
-          });
-        });
+        .catch(() => {});
     },
     // 提交OA
     async handleSubmit(row) {
-      try {
-        // name:工号   nickName:名字
-        const { name, nickName } = this.$store.state.user;
+      this.$confirm("此操作将提交该条数据, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            // name:工号   nickName:名字
+            const { name, nickName } = this.$store.state.user;
 
-        const {
-          id,
-          authorizedProductsCode,
-          dealerName,
-          authorizedProductsName,
-          authorizedAreaName,
-        } = row;
+            const {
+              id,
+              authorizedProductsCode,
+              dealerName,
+              authorizedProductsName,
+              authorizedAreaName,
+            } = row;
 
-        let data = {
-          authorizedProductsCode,
-          id,
-          createPerson: nickName,
-          createBy: name,
-          date: new Date().Format(),
-          dealerName,
-          authorizedProductsName,
-          authorizedAreaName,
-        };
+            let data = {
+              authorizedProductsCode,
+              id,
+              createPerson: nickName,
+              createBy: name,
+              date: new Date().Format(),
+              dealerName,
+              authorizedProductsName,
+              authorizedAreaName,
+            };
 
-        this.loading = true;
-        let { code, msg } = await dealerApi.submitOA(data);
-        if (code == 200) {
-          this.useQuery();
-        }
-      } catch (error) {
-        console.log(error);
-      } finally {
-        this.loading = false;
-      }
+            this.loading = true;
+            let { code, msg } = await dealerApi.submitOA(data);
+            if (code == 200) {
+              this.useQuery();
+            }
+          } catch (error) {
+            console.log(error);
+          } finally {
+            this.loading = false;
+          }
+        })
+        .catch(() => {});
     },
     // 下载
     async handleDownload(row) {