Parcourir la source

经销商授权管理列表、新增优化

002390 il y a 1 an
Parent
commit
b90436f86b

+ 72 - 62
src/components/super-form/index.vue

@@ -24,6 +24,7 @@ export default {
       import("@/components/popover-tree-select/index.vue"),
     ElPopoverMultipleTreeSelect: () =>
       import("@/components/popover-tree-select/multiple.vue"),
+    ElDateWrapper: () => import("@/components/date-wrapper/index.vue"),
   },
   data() {
     const { columns } = this.$props;
@@ -102,68 +103,77 @@ export default {
           :label="item.title"
           :required="getFormItemRequired(item, innerValue)"
         >
-        <template #default="form">
-          <slot :name="item.key" :row="innerValue" :item="item" :attr="attr">
-            <component
-              v-if="attr.is === 'el-select'"
-              v-bind="attr"
-              v-model="innerValue[item.key]"
-              style="width: 100%"
-            >
-              <template>
-                <el-option
-                  v-for="item in dict.type[attr.dictName]"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
-                </el-option>
-              </template>
-            </component>
-            <component
-              v-else-if="attr.is === 'el-popover-select-v2'"
-              v-bind="attr"
-              :title="item.title"
-              v-model="innerValue[item.key]"
-              :source.sync="innerValue"
-              style="width: 100%"
-            >
-            </component>
-            <component
-              v-else-if="attr.is === 'el-popover-multiple-select-v2'"
-              v-bind="attr"
-              :title="item.title"
-              v-model="innerValue[item.key]"
-              :source.sync="innerValue"
-              style="width: 100%"
-            >
-            </component>
-            <component
-              v-else-if="attr.is === 'el-popover-tree-select'"
-              v-bind="attr"
-              v-model="innerValue[item.key]"
-              :source.sync="innerValue"
-              style="width: 100%"
-            >
-            </component>
-            <component
-              v-else-if="attr.is === 'el-popover-multiple-tree-select'"
-              v-bind="attr"
-              v-model="innerValue[item.key]"
-              :source.sync="innerValue"
-              style="width: 100%"
-            >
-            </component>
-            <component
-              v-else
-              v-bind="attr"
-              v-model="innerValue[item.key]"
-              :disabled="getFormItemDisabled(attr, innerValue)"
-              style="width: 100%"
-            >
-            </component>
-          </slot>
-        </template>
+          <template #default="form">
+            <slot :name="item.key" :row="innerValue" :item="item" :attr="attr">
+              <component
+                v-if="attr.is === 'el-select'"
+                v-bind="attr"
+                v-model="innerValue[item.key]"
+                style="width: 100%"
+              >
+                <template>
+                  <el-option
+                    v-for="item in dict.type[attr.dictName]"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </template>
+              </component>
+              <component
+                v-else-if="attr.is === 'el-popover-select-v2'"
+                v-bind="attr"
+                :title="item.title"
+                v-model="innerValue[item.key]"
+                :source.sync="innerValue"
+                style="width: 100%"
+              >
+              </component>
+              <component
+                v-else-if="attr.is === 'el-popover-multiple-select-v2'"
+                v-bind="attr"
+                :title="item.title"
+                v-model="innerValue[item.key]"
+                :source.sync="innerValue"
+                style="width: 100%"
+              >
+              </component>
+              <component
+                v-else-if="attr.is === 'el-popover-tree-select'"
+                v-bind="attr"
+                v-model="innerValue[item.key]"
+                :source.sync="innerValue"
+                style="width: 100%"
+              >
+              </component>
+              <component
+                v-else-if="attr.is === 'el-popover-multiple-tree-select'"
+                v-bind="attr"
+                v-model="innerValue[item.key]"
+                :source.sync="innerValue"
+                style="width: 100%"
+              >
+              </component>
+              <component
+                v-if="attr.is === 'el-date-wrapper'"
+                v-bind="attr"
+                v-model="innerValue[item.key]"
+                :source.sync="innerValue"
+                @change="$emit('submit')"
+                style="width: 100%"
+              >
+              </component>
+              <component
+                v-else
+                v-bind="attr"
+                v-model="innerValue[item.key]"
+                :disabled="getFormItemDisabled(attr, innerValue)"
+                style="width: 100%"
+              >
+              </component>
+            </slot>
+          </template>
         </el-form-item>
       </el-col>
     </el-row>

+ 43 - 0
src/views/marketing/dealer-authorization/add/columns.js

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

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

@@ -0,0 +1,169 @@
+<script>
+import useColumns from "./columns";
+export default {
+  name: "authprivAdd",
+  props: {
+    dict: {
+      type: Object,
+    },
+  },
+  components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+  },
+  data() {
+    const { FormColumns } = useColumns();
+    const rules = this.$init.rules([...FormColumns]);
+    const params = this.$init.params(FormColumns);
+    return {
+      visible: false,
+      loading: false,
+      FormColumns: FormColumns,
+      params: params,
+      rules: rules,
+    };
+  },
+  computed: {
+    isAdd: {
+      get() {
+        if (this.params.id) return false;
+        return true;
+      },
+      set() {},
+    },
+    title: {
+      get() {
+        return this.isAdd ? "新增" : "编辑";
+      },
+      set() {},
+    },
+  },
+  methods: {
+    // 控制弹窗展示
+    setVisible(val) {
+      this.visible = val;
+    },
+    setFormData(data) {
+      if (data.id) {
+        this.loading = true;
+
+        this.params = {
+          ...data,
+
+          time: [data.startTime, data.endTime],
+        };
+
+        setTimeout(() => {
+          this.loading = false;
+        }, 250);
+
+        return;
+      }
+    },
+    // 重置表单数据
+    handleResetData() {
+      this.params = this.$init.params(this.FormColumns);
+      this.$refs["authprivAdd"].clearValidate();
+    },
+    // 取消
+    handleCancel() {
+      this.handleResetData();
+      this.setVisible(false);
+    },
+    // 确定
+    handleConfirm(formName) {
+      this.$refs[formName].validate(async (valid) => {
+        if (valid) {
+          // 校验通过
+          let isTime =
+            this.params.time &&
+            this.params.time != "" &&
+            this.params.time.length;
+
+          // name:工号   nickName:名字
+          const { name, nickName } = this.$store.state.user;
+
+          let params = {
+            ...this.params,
+            startTime: isTime ? this.params.time[0] : "",
+            endTime: isTime ? this.params.time[1] : "",
+            updatePerson: nickName,
+            updateBy: name,
+            updateTime: new Date().Format(),
+            ...(this.isAdd
+              ? {
+                  status: "0",
+                  createPerson: nickName,
+                  createBy: name,
+                  createTime: new Date().Format(),
+                }
+              : {}),
+          };
+          delete params["time"];
+          console.log(params, "params--------");
+
+          try {
+            this.loading = true;
+            let { code, msg } = await (this.isAdd
+              ? dealerApi.insert(params)
+              : dealerApi.update(params));
+
+            if (code === 200) {
+              this.handleCancel();
+            }
+          } catch (error) {
+            console.log(error, "error");
+          } finally {
+            this.loading = false;
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    beforeClose(done) {
+      this.handleResetData();
+      done();
+    },
+  },
+};
+</script>
+
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :before-close="beforeClose"
+    @close="$emit('close')"
+  >
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="$attrs.size"
+      :columns="FormColumns"
+      ref="authprivAdd"
+      label-width="auto"
+      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> -->
+      <div slot="footer">
+        <el-button @click="handleCancel">取 消</el-button>
+        <el-button type="primary" @click="handleConfirm('authprivAdd')"
+          >确 定</el-button
+        >
+      </div>
+    </el-super-form>
+  </el-dialog>
+</template>

+ 94 - 68
src/views/marketing/dealer-authorization/authprivAdd.vue

@@ -1,35 +1,75 @@
 <!-- 经销商授权信息 编辑新增-->
 <template>
-  <el-dialog :title="isAdd ? '新增' : '编辑'" :visible.sync="visible" :close-on-click-modal="false"
-    :close-on-press-escape="false" :before-close="beforeClose" @close="$emit('close')">
-    <el-form :model="formData" ref="authprivAdd" label-position="left" label-width="120px" v-loading="loading">
-
-      <el-form-item v-for="column in formColumns" :label="column.title" :prop="column.key"
-        :rules="{ required: true, message: `请输入${column.title}`, trigger: column.type == 'Input' ? 'blur' : 'change' }">
-
-        <el-input v-if="column.type == 'Input'" :clearable="column.clearable" v-model="formData[column.key]"
-          autocomplete="off"></el-input>
-
-        <el-date-picker v-if="column.type == 'DateRange'" :clearable="column.clearable" v-model="formData[column.key]"
-          format="yyyy-MM-dd " value-format="yyyy-MM-dd" type="daterange" range-separator="至" start-placeholder="开始日期"
-          end-placeholder="结束日期"></el-date-picker>
-
-        <el-date-picker v-if="column.type == 'Date'" :clearable="column.clearable" v-model="formData[column.key]"
-          format="yyyy-MM-dd " value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
-
+  <el-dialog
+    :title="isAdd ? '新增' : '编辑'"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :before-close="beforeClose"
+    @close="$emit('close')"
+  >
+    <el-form
+      :model="formData"
+      ref="authprivAdd"
+      label-position="left"
+      label-width="120px"
+      v-loading="loading"
+    >
+      <el-form-item
+        v-for="column in formColumns"
+        :label="column.title"
+        :prop="column.key"
+        :rules="{
+          required: true,
+          message: `请输入${column.title}`,
+          trigger: column.type == 'Input' ? 'blur' : 'change',
+        }"
+      >
+        <el-input
+          v-if="column.type == 'Input'"
+          :clearable="column.clearable"
+          v-model="formData[column.key]"
+          autocomplete="off"
+        ></el-input>
+
+        <el-date-picker
+          v-if="column.type == 'DateRange'"
+          :clearable="column.clearable"
+          v-model="formData[column.key]"
+          format="yyyy-MM-dd "
+          value-format="yyyy-MM-dd"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        ></el-date-picker>
+
+        <el-date-picker
+          v-if="column.type == 'Date'"
+          :clearable="column.clearable"
+          v-model="formData[column.key]"
+          format="yyyy-MM-dd "
+          value-format="yyyy-MM-dd"
+          type="date"
+          placeholder="选择日期"
+        ></el-date-picker>
       </el-form-item>
     </el-form>
     <div slot="footer">
       <el-button @click="handleCancel">取 消</el-button>
-      <el-button type="primary" @click="handleConfirm('authprivAdd')">确 定</el-button>
+      <el-button type="primary" @click="handleConfirm('authprivAdd')"
+        >确 定</el-button
+      >
     </div>
   </el-dialog>
 </template>
 
 <script>
-import dealerApi from '@/api/marketing/dealer-authorization';
-import { FormColumns } from './column';
-import { initParams } from '../utils/init'
+import dealerApi from "@/api/marketing/dealer-authorization";
+import useColumns from "./columns";
+import { initParams } from "../utils/init";
+
+const { FormColumns } = useColumns();
 
 const initFormColumns = () =>
   FormColumns.map((column) => {
@@ -41,19 +81,16 @@ const initFormColumns = () =>
   });
 
 export default {
-
-  name: 'authprivAdd',
+  name: "authprivAdd",
 
   data() {
-
     return {
       visible: false,
       isAdd: true,
       loading: false,
       formData: { ...initParams(initFormColumns()) },
       formColumns: initFormColumns(),
-
-    }
+    };
   },
   methods: {
     // 控制弹窗展示
@@ -61,26 +98,22 @@ export default {
       this.visible = val;
     },
     setFormData(data) {
-
       if (data.id) {
-
         this.loading = true;
 
         this.isAdd = false;
 
         this.formData = {
-
           ...data,
 
-          time: [data.startTime, data.endTime]
-
+          time: [data.startTime, data.endTime],
         };
 
         setTimeout(() => {
           this.loading = false;
         }, 250);
 
-        return
+        return;
       }
 
       this.isAdd = true;
@@ -88,9 +121,9 @@ export default {
     // 重置表单数据
     handleResetData() {
       this.formData = {
-        ...initParams(initFormColumns())
-      }
-      this.$refs['authprivAdd'].clearValidate();
+        ...initParams(initFormColumns()),
+      };
+      this.$refs["authprivAdd"].clearValidate();
     },
     // 取消
     handleCancel() {
@@ -99,56 +132,52 @@ export default {
     },
     // 确定
     handleConfirm(formName) {
-
       this.$refs[formName].validate(async (valid) => {
-
         if (valid) {
           // 校验通过
-          let isTime = this.formData.time && this.formData.time != '' && this.formData.time.length;
+          let isTime =
+            this.formData.time &&
+            this.formData.time != "" &&
+            this.formData.time.length;
 
           // name:工号   nickName:名字
           const { name, nickName } = this.$store.state.user;
 
           let params = {
             ...this.formData,
-            startTime: isTime ? this.formData.time[0] : '',
-            endTime: isTime ? this.formData.time[1] : '',
+            startTime: isTime ? this.formData.time[0] : "",
+            endTime: isTime ? this.formData.time[1] : "",
             updatePerson: nickName,
             updateBy: name,
             updateTime: new Date().Format(),
-            ...(
-              this.isAdd ? {
-                status: '0',
-                createPerson: nickName,
-                createBy: name,
-                createTime: new Date().Format(),
-              } : {}
-            )
-
-          }
-          delete params['time']
-          console.log(params, 'params--------');
+            ...(this.isAdd
+              ? {
+                  status: "0",
+                  createPerson: nickName,
+                  createBy: name,
+                  createTime: new Date().Format(),
+                }
+              : {}),
+          };
+          delete params["time"];
+          console.log(params, "params--------");
 
           try {
             this.loading = true;
-            let { code, msg } = await (
-              this.isAdd ?
-                dealerApi.insert(params) :
-                dealerApi.update(params)
-            )
+            let { code, msg } = await (this.isAdd
+              ? dealerApi.insert(params)
+              : dealerApi.update(params));
 
             if (code === 200) {
               this.handleCancel();
             }
-
           } catch (error) {
-            console.log(error, 'error');
+            console.log(error, "error");
           } finally {
             this.loading = false;
           }
-
         } else {
-          console.log('error submit!!');
+          console.log("error submit!!");
           return false;
         }
       });
@@ -158,17 +187,14 @@ export default {
       done();
     },
   },
-  created() {
-  }
-
-}
+  created() {},
+};
 </script>
 
-
 <style lang="scss" scoped>
 .authpriv {
   width: calc(100% - 24px);
   height: 100%;
-  margin: 10px
+  margin: 10px;
 }
-</style>
+</style>

+ 47 - 32
src/views/marketing/dealer-authorization/authprivSee.vue

@@ -1,20 +1,48 @@
 <!-- 经销商授权信息-查看 -->
 <template>
-  <el-dialog title="查看" :visible.sync="visible" :close-on-click-modal="false" :close-on-press-escape="false">
+  <el-dialog
+    title="查看"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+  >
     <el-form :model="formData" label-position="left" label-width="120px">
-      <el-form-item v-for="column in formColumns" :label="column.title" :prop="column.key">
-        <el-input v-if="column.type == 'Input'" readonly v-model="formData[column.key]" autocomplete="off">
+      <el-form-item
+        v-for="column in formColumns"
+        :label="column.title"
+        :prop="column.key"
+      >
+        <el-input
+          v-if="column.type == 'Input'"
+          readonly
+          v-model="formData[column.key]"
+          autocomplete="off"
+        >
         </el-input>
 
-        <el-date-picker v-if="column.type == 'DateRange'" readonly v-model="formData[column.key]" type="daterange"
-          format="yyyy-MM-dd " value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
-          end-placeholder="结束日期">
+        <el-date-picker
+          v-if="column.type == 'DateRange'"
+          readonly
+          v-model="formData[column.key]"
+          type="daterange"
+          format="yyyy-MM-dd "
+          value-format="yyyy-MM-dd"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
         </el-date-picker>
 
-        <el-date-picker v-if="column.type == 'Date'" readonly v-model="formData[column.key]" type="date"
-          format="yyyy-MM-dd " value-format="yyyy-MM-dd" placeholder="选择日期">
+        <el-date-picker
+          v-if="column.type == 'Date'"
+          readonly
+          v-model="formData[column.key]"
+          type="date"
+          format="yyyy-MM-dd "
+          value-format="yyyy-MM-dd"
+          placeholder="选择日期"
+        >
         </el-date-picker>
-
       </el-form-item>
     </el-form>
     <div slot="footer">
@@ -24,54 +52,41 @@
 </template>
 
 <script>
-import { FormColumns } from './column';
-import { initParams } from '../utils/init'
+import useColumns from "./columns";
+import { initParams } from "../utils/init";
 export default {
-
-  name: 'authprivSee',
+  name: "authprivSee",
   data() {
-
+    const { FormColumns } = useColumns();
     return {
       visible: false,
       formData: { ...initParams(FormColumns) },
       formColumns: FormColumns,
-
-    }
+    };
   },
   methods: {
     // 控制弹窗展示
     setVisible(val) {
-
       this.visible = val;
-
     },
     setFormData(data) {
-
       if (data.id) {
-
         this.formData = {
-
           ...data,
 
-          time: [data.startTime, data.endTime]
-
+          time: [data.startTime, data.endTime],
         };
-
       }
-
     },
   },
-  created() {
-  }
-
-}
+  created() {},
+};
 </script>
 
-
 <style lang="scss" scoped>
 .authpriv {
   width: calc(100% - 24px);
   height: 100%;
-  margin: 10px
+  margin: 10px;
 }
-</style>
+</style>

+ 0 - 56
src/views/marketing/dealer-authorization/column.js

@@ -1,56 +0,0 @@
-export const TableColumns = [
-  { key: "authorizedProductsCode", title: "授权产品 编码", show: true, width: 160 },
-  { key: "dealerName", title: "经销商名称", show: true, width: 200 },
-  { key: "authorizedAreaCode", title: "授权区域/医院 编码", show: false, },
-  { key: "authorizedAreaName", title: "授权区域/医院 名称", show: true, width: 200 },
-  { key: "authorizedProductsName", title: "授权产品 名称", show: true, width: 200 },
-  { key: "status", title: "状态", show: true },
-  { key: "createPerson", title: "创建人", show: true },
-  { key: "createTime", title: "创建时间", show: true, width: 160 },
-  { key: "updatePerson", title: "最后修改人", show: true },
-  { key: "updateTime", title: "最后修改时间", show: true, width: 160 },
-  { key: "id", title: "主键id----该值不显示", show: false },
-  { key: "startTime", title: "开始时间", show: false },
-  { key: "endTime", title: "结束时间", show: false },
-  { key: "issueTime", title: "授权书开具时间", show: false },
-]
-
-export const SearchColumns = [
-  { key: "dealerName", title: "经销商名称", type: "Input" },
-  { key: "authorizedAreaName", title: "授权区域/医院", type: "Input" },
-  { key: "authorizedProductsName", title: "授权产品", type: "Input" },
-  // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
-  {
-    key: "status", title: "状态", type: "Select", options: [
-      { value: 0, label: '自由态' },
-      { value: 1, label: '审批中' },
-      { value: 2, label: '已审核' },
-      { value: 3, label: '已驳回' },
-    ]
-  },
-  // { title: "授权时间", key: "time", type: "DateRange" },
-  {
-    title: "授权时间",
-    key: "startTime",
-    type: "Date",
-    config: {
-      placeholder: '开始时间'
-    }
-  },
-  {
-    title: "至",
-    key: "endTime",
-    type: "Date",
-    config: {
-      placeholder: '结束时间'
-    }
-  },
-]
-
-export const FormColumns = [
-  { title: '经销商名称', key: 'dealerName', type: 'Input' },
-  { title: '授权区/医院', key: 'authorizedAreaName', type: 'Input' },
-  { title: '授权产品', key: 'authorizedProductsName', type: 'Input' },
-  { title: '授权期限', key: 'time', type: 'DateRange' },
-  { title: '授权书开具时间', key: 'issueTime', type: 'Date' },
-]

+ 160 - 0
src/views/marketing/dealer-authorization/columns.js

@@ -0,0 +1,160 @@
+export default function useColumns() {
+
+  const TableColumns = [
+    {
+      item: {
+        key: "authorizedProductsCode",
+        title: "授权产品 编码",
+        width: 160,
+      },
+      attr: {}
+    },
+    {
+      item: { key: "dealerName", title: "经销商名称", width: 200 },
+      attr: {}
+    },
+    {
+      item: {
+        key: "authorizedAreaCode",
+        title: "授权区域/医院 编码",
+        hidden: false,
+      },
+      attr: {}
+    },
+    {
+      item: { key: "authorizedAreaName", title: "授权区域/医院 名称", width: 200 },
+      attr: {}
+    },
+    {
+      item: { key: "authorizedProductsName", title: "授权产品 名称", width: 200 },
+      attr: {}
+    },
+    {
+      item: { key: "status", title: "状态", width: 80 },
+      attr: {
+        is: "el-dict-tag",
+        dictName: "documents_status", // 字典名
+      }
+    },
+    {
+      item: { key: "createPerson", title: "创建人", width: 120 },
+      attr: {}
+    },
+    {
+      item: { key: "createTime", title: "创建时间", width: 160 },
+      attr: {}
+    },
+    {
+      item: { key: "updatePerson", title: "最后修改人", width: 120 },
+      attr: {}
+    },
+    {
+      item: { key: "updateTime", title: "最后修改时间", width: 160 },
+      attr: {}
+    },
+    {
+      item: {
+        key: "id",
+        title: "主键id----该值不显示",
+        hidden: false,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "startTime",
+        title: "开始时间",
+        hidden: false,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "endTime",
+        title: "结束时间",
+        hidden: false,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "issueTime",
+        title: "授权书开具时间",
+        hidden: false,
+      },
+      attr: {}
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
+  }));
+
+  const SearchColumns = [
+    {
+      item: { key: "dealerName", title: "经销商名称", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "authorizedAreaName", title: "授权区域/医院", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+      }
+    },
+    {
+      item: { key: "authorizedProductsName", title: "授权产品", },
+      attr: {
+        is: "el-input",
+        clearable: true,
+      }
+    },
+    // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
+    {
+      item: { key: "status", title: "状态", },
+      attr: {
+        is: "el-select",
+        dictName: "documents_status",
+        clearable: true,
+      },
+    },
+    {
+      item: {
+        key: "privilegedTime",
+        title: "授权时间",
+        span: 12,
+      },
+      attr: {
+        clearable: true,
+        is: "el-date-wrapper",
+      },
+    },
+    // {
+    //   title: "授权时间",
+    //   key: "startTime",
+    //   type: "Date",
+    //   config: {
+    //     placeholder: '开始时间'
+    //   }
+    // },
+    // {
+    //   title: "至",
+    //   key: "endTime",
+    //   type: "Date",
+    //   config: {
+    //     placeholder: '结束时间'
+    //   }
+    // },
+  ]
+
+
+  return { TableColumns, SearchColumns }
+}

+ 15 - 0
src/views/marketing/dealer-authorization/dicts.js

@@ -0,0 +1,15 @@
+import { initDicts } from "@/utils/init.js";
+const modules = require.context("./", true, /columns.js$/);
+const columns = [];
+console.log(modules('./columns.js'), "modules");
+modules.keys().forEach((fileName) => {
+  const data = modules(fileName).default();
+  for (const key in data) {
+    if (key === "TabColumns") {
+      columns.push(...data[key].map((item) => item.TableColumns).flat());
+    } else {
+      columns.push(...data[key]);
+    }
+  }
+});
+export const dicts = initDicts(columns);

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

@@ -0,0 +1,418 @@
+<!-- 经销商授权信息管理--列表 -->
+<template>
+  <el-card
+    class="dealerAuthorization"
+    v-loading="loading"
+    :body-style="{ padding: 0 }"
+  >
+    <authprivAdd ref="addDialogRef" @close="handleRefresh"></authprivAdd>
+    <authprivSee ref="seeDialogRef"></authprivSee>
+
+    <!-- 检索区 -->
+    <el-form
+      :inline="true"
+      size="mini"
+      label-position="right"
+      label-width="100px"
+      :model="searchParams"
+      style="padding: 10px 0 0 0"
+    >
+      <el-form-item
+        v-for="column in searchColumns"
+        :label="column.title"
+        :key="column.key"
+      >
+        <el-input
+          v-if="column.type == 'Input'"
+          v-model="searchParams[column.key]"
+          clearable
+        ></el-input>
+
+        <el-select
+          v-else-if="column.type == 'Select'"
+          v-model="searchParams[column.key]"
+          clearable
+        >
+          <el-option
+            v-for="op in column.options"
+            :label="op.label"
+            :value="op.value"
+          ></el-option>
+        </el-select>
+
+        <el-date-picker
+          v-else-if="column.type == 'DateRange'"
+          v-model="searchParams[column.key]"
+          clearable
+          type="daterange"
+          format="yyyy-MM-dd "
+          value-format="yyyy-MM-dd"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
+        </el-date-picker>
+
+        <el-date-picker
+          v-else-if="column.type == 'Date'"
+          v-model="searchParams[column.key]"
+          format="yyyy-MM-dd "
+          clearable
+          value-format="yyyy-MM-dd"
+          type="date"
+          :placeholder="column.config.placeholder"
+          style="width: 192px"
+        >
+        </el-date-picker>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          @click="handelSearch"
+          v-hasPermi="['pu:authorization:list']"
+          >查询</el-button
+        >
+        <el-button icon="el-icon-refresh" @click="handelResetSearch"
+          >重置</el-button
+        >
+      </el-form-item>
+    </el-form>
+
+    <!-- 操作区 -->
+    <el-row :gutter="24" style="padding: 0 10px">
+      <el-col :span="24" style="text-align: right">
+        <el-button
+          size="mini"
+          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-col>
+    </el-row>
+
+    <!-- 数据展示 -->
+
+    <el-table
+      class="da-table"
+      @row-dblclick="handleOpenSeeDialog"
+      @select="handleSelect"
+      :data="tableData"
+      highlight-current-row
+      max-height="500"
+    >
+      <el-table-column type="selection" width="45"></el-table-column>
+      <el-table-column type="index" width="55" label="序号"></el-table-column>
+      <el-table-column
+        v-for="column in tableColumns"
+        :label="column.title"
+        v-if="column.show"
+        :width="column.width || 120"
+        show-overflow-tooltip
+      >
+        <template slot-scope="scope">
+          {{
+            column.key == "status"
+              ? judgeStatus(scope.row[column.key])
+              : scope.row[column.key]
+          }}
+        </template>
+      </el-table-column>
+      <el-table-column fixed="right" label="操作" width="120">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="mini"
+            @click="handleOpenAddDialog(scope.row)"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            v-hasPermi="['pu:authorization:edit']"
+            >编辑</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            @click="handleDelDialog(scope.row)"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            v-hasPermi="['pu:authorization:remove']"
+            >删除</el-button
+          >
+          <!-- <el-button @click="handleOpenSeeDialog(scope.row)" type="text" size="small">查看</el-button> -->
+          <el-button
+            type="text"
+            size="mini"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            @click="handleSubmit(scope.row)"
+            >提交</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            v-if="scope.row.status == '2'"
+            @click="handleDownload(scope.row)"
+            >下载授权书</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-pagination
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :total="page.total"
+      :page-sizes="pageSizes"
+      :page-size="page.pageSize"
+      :current-page="page.pageNum"
+      hide-on-single-page
+      :layout="layout"
+    >
+    </el-pagination>
+  </el-card>
+</template>
+
+<script>
+import dealerApi from "@/api/marketing/dealer-authorization";
+import useColumns from "./columns";
+
+export default {
+  name: "dealerAuthorization",
+  components: {
+    authprivAdd: () => import("./authprivAdd.vue"),
+    authprivSee: () => import("./authprivSee.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
+  },
+
+  data() {
+    const { TableColumns, SearchColumns } = useColumns();
+    const page = this.$init.page();
+    const params = this.$init.params(SearchColumns);
+    return {
+      params: params,
+      loading: false,
+      size: "mini",
+      searchColumns: SearchColumns,
+      searchParams: {
+        ...initParams(SearchColumns),
+      },
+      tableColumns: TableColumns,
+      tableData: [],
+      checkedList: [],
+      page: page,
+    };
+  },
+  methods: {
+    // 查询---列表查询
+    async handelSearch() {
+      this.loading = true;
+
+      let { pageNum, pageSize } = this.page;
+      let params = {
+        ...this.searchParams,
+        // startTime: isTime ? this.searchParams.time[0] : '',
+        // endTime: isTime ? this.searchParams.time[1] : '',
+        pageNum: pageNum,
+        pageSize: pageSize,
+      };
+      delete params["time"];
+      console.log(params, "params--------");
+
+      try {
+        let { code, rows, total } = await dealerApi.list(params);
+        if (code == 200) {
+          this.tableData = rows;
+          this.page.total = total;
+        }
+      } catch (error) {
+        console.log(error);
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 重置
+    handelResetSearch() {
+      console.log("重置");
+      this.searchParams = {
+        ...initParams(SearchColumns),
+      };
+    },
+    // 判断状态
+    judgeStatus(status) {
+      // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
+      let statusName = "";
+      switch (status) {
+        case "0":
+          statusName = "自由态";
+          break;
+        case "1":
+          statusName = "审批中";
+          break;
+        case "2":
+          statusName = "已审核";
+          break;
+        case "3":
+          statusName = "已驳回";
+          break;
+        default:
+          break;
+      }
+
+      return statusName;
+    },
+    // 刷新
+    handleRefresh() {
+      this.handelSearch();
+    },
+    handleSizeChange(e) {
+      this.page.pageSize = e;
+      this.handelSearch();
+    },
+    handleCurrentChange(e) {
+      this.page.pageNum = e;
+      this.handelSearch();
+    },
+
+    // 选择列表
+    handleSelect(selection, row) {
+      console.log("selection/////////", selection, "row/////////", row);
+      this.checkedList = [...selection];
+    },
+    // 新增、编辑授权信息
+    handleOpenAddDialog(rows) {
+      const { setVisible, setFormData } = this.$refs.addDialogRef;
+      setFormData(rows);
+      setVisible(true);
+    },
+    // 查看
+    handleOpenSeeDialog(rows) {
+      const { setVisible, setFormData } = this.$refs.seeDialogRef;
+      setFormData(rows);
+      setVisible(true);
+    },
+    // 删除
+    handleDelDialog(rows) {
+      let { id } = rows;
+
+      this.$confirm("此操作将删除该条数据, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            this.loading = true;
+            let { code, msg } = await dealerApi.remove({ id });
+            if (code == 200) {
+              this.handleRefresh();
+            }
+          } catch (error) {
+            console.log(error);
+          } finally {
+            this.loading = false;
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    // 提交OA
+    async handleSubmit(row) {
+      try {
+        // name:工号   nickName:名字
+        const { name, nickName } = this.$store.state.user;
+
+        const {
+          id,
+          authorizedProductsCode,
+          dealerName,
+          authorizedProductsName,
+          authorizedAreaName,
+        } = row;
+
+        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.handleRefresh();
+        }
+      } catch (error) {
+        console.log(error);
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 下载
+    async handleDownload(row) {
+      console.log("下载", row);
+      try {
+        const {
+          id,
+          authorizedProductsCode,
+          dealerName,
+          authorizedAreaName,
+          authorizedProductsName,
+        } = row;
+
+        const data = {
+          dealerName,
+          authorizedAreaName,
+          authorizedProductsName,
+          id,
+          authorizedProductsCode,
+        };
+
+        // await this.download('/dealer/download', data, `授权书${new Date().getTime()}.doc`);
+        let file = await dealerApi.download(data);
+        let blob = new Blob([file], {
+          type: `application/msword`, //word文档为msword,pdf文档为pdf,msexcel 为excel
+        });
+        let objectUrl = URL.createObjectURL(blob);
+        let link = document.createElement("a");
+        let fname = `授权书.doc`; //下载文件的名字+后缀名
+        link.href = objectUrl;
+        link.setAttribute("download", fname);
+        document.body.appendChild(link);
+        link.click();
+      } catch (error) {
+        console.log(error);
+      } finally {
+      }
+    },
+  },
+  created() {
+    this.handelSearch();
+    console.log(this.$store.state.user, "this.$store.state.user");
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.dealerAuthorization {
+  width: calc(100% - 24px);
+  height: 100%;
+  margin: 10px;
+  padding: 10px;
+  box-sizing: border-box;
+
+  .da-table {
+    width: 100%;
+    margin: 20px 0 0 0;
+  }
+}
+</style>

+ 182 - 215
src/views/marketing/dealer-authorization/index.vue

@@ -1,137 +1,48 @@
-<!-- 经销商授权信息管理--列表 -->
-<template>
-  <el-card class="dealerAuthorization" v-loading="loading" :body-style="{ padding: 0 }">
-
-    <authprivAdd ref="addDialogRef" @close="handleRefresh"></authprivAdd>
-    <authprivSee ref="seeDialogRef"></authprivSee>
-
-    <!-- 检索区 -->
-    <el-form :inline="true" size="mini" label-position="right" label-width="100px" :model="searchParams"
-      style="padding: 10px 0 0 0">
-
-      <el-form-item v-for="column in searchColumns " :label="column.title" :key="column.key">
-
-        <el-input v-if="column.type == 'Input'" v-model="searchParams[column.key]" clearable></el-input>
-
-        <el-select v-else-if="column.type == 'Select'" v-model="searchParams[column.key]" clearable>
-          <el-option v-for="op in column.options" :label="op.label" :value="op.value"></el-option>
-        </el-select>
-
-        <el-date-picker v-else-if="column.type == 'DateRange'" v-model="searchParams[column.key]" clearable
-          type="daterange" format="yyyy-MM-dd " value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
-          end-placeholder="结束日期">
-        </el-date-picker>
-
-        <el-date-picker v-else-if="column.type == 'Date'" v-model="searchParams[column.key]" format="yyyy-MM-dd "
-          clearable value-format="yyyy-MM-dd" type="date" :placeholder="column.config.placeholder" style="width: 192px;">
-        </el-date-picker>
-      </el-form-item>
-
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" @click="handelSearch"
-          v-hasPermi="['pu:authorization:list']">查询</el-button>
-        <el-button icon="el-icon-refresh" @click="handelResetSearch">重置</el-button>
-      </el-form-item>
-
-    </el-form>
-
-    <!-- 操作区 -->
-    <el-row :gutter="24" style="padding: 0 10px">
-      <el-col :span="24" style="text-align: right">
-        <el-button size="mini" 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-col>
-    </el-row>
-
-    <!-- 数据展示 -->
-    <el-table class="da-table" @row-dblclick="handleOpenSeeDialog" @select="handleSelect" :data="tableData"
-      highlight-current-row max-height="500">
-      <el-table-column type="selection" width="45"></el-table-column>
-      <el-table-column type="index" width="55" label="序号"></el-table-column>
-      <el-table-column v-for="column in tableColumns" :label="column.title" v-if="column.show"
-        :width="column.width || 120" show-overflow-tooltip>
-        <template slot-scope="scope">
-          {{ column.key == 'status' ? judgeStatus(scope.row[column.key]) : scope.row[column.key] }}
-        </template>
-      </el-table-column>
-      <el-table-column fixed="right" label="操作" width="120">
-        <template slot-scope="scope">
-          <el-button type="text" size="mini" @click="handleOpenAddDialog(scope.row)"
-            v-if="scope.row.status == '0' || scope.row.status == '3'"
-            v-hasPermi="['pu:authorization:edit']">编辑</el-button>
-          <el-button type="text" size="mini" @click="handleDelDialog(scope.row)"
-            v-if="scope.row.status == '0' || scope.row.status == '3'"
-            v-hasPermi="['pu:authorization:remove']">删除</el-button>
-          <!-- <el-button @click="handleOpenSeeDialog(scope.row)" type="text" size="small">查看</el-button> -->
-          <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'"
-            @click="handleSubmit(scope.row)">提交</el-button>
-          <el-button type="text" size="mini" v-if="scope.row.status == '2'"
-            @click="handleDownload(scope.row)">下载授权书</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="page.total"
-      :page-sizes="pageSizes" :page-size="page.pageSize" :current-page="page.pageNum" hide-on-single-page
-      :layout="layout">
-    </el-pagination>
-
-  </el-card>
-</template>
-
 <script>
-import dealerApi from '@/api/marketing/dealer-authorization';
-import { TableColumns, SearchColumns } from './column';
-import { initParams } from '../utils/init';
+import dealerApi from "@/api/marketing/dealer-authorization";
+import useColumns from "./columns";
+import { dicts } from "./dicts";
 
 export default {
-
-  name: 'dealerAuthorization',
+  name: "dealerAuthorization",
+  dicts: [...dicts],
   components: {
-    authprivAdd: () => import('./authprivAdd.vue'),
-    authprivSee: () => import('./authprivSee.vue'),
+    authprivAdd: () => import("./add/index.vue"),
+    // authprivAdd: () => import("./authprivAdd.vue"),
+    authprivSee: () => import("./authprivSee.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
 
   data() {
-
+    const { TableColumns, SearchColumns } = useColumns();
+    const page = this.$init.page();
+    const params = this.$init.params(SearchColumns);
     return {
+      params: params,
       loading: false,
-      searchColumns: SearchColumns,
-      searchParams: {
-        ...initParams(SearchColumns),
-      },
-      tableColumns: TableColumns,
+      size: "mini",
+      SearchColumns: SearchColumns,
+      TableColumns: TableColumns,
       tableData: [],
       checkedList: [],
-      page: {
-        pageNum: 1,
-        pageSize: 25,
-        total: 0
-      },
-      pageSizes: [10, 20, 50, 100],
-      layout: 'total, prev, pager, next, sizes, jumper',
-    }
+      page: page,
+    };
   },
   methods: {
     // 查询---列表查询
-    async handelSearch() {
+    async useQuery() {
       this.loading = true;
-      console.log(this.searchParams, '查询');
-      // let isTime = this.searchParams.time && this.searchParams.time != '' && this.searchParams.time.length;
-      let { pageNum, pageSize } = this.page;
-      let params = {
-        ...this.searchParams,
-        // startTime: isTime ? this.searchParams.time[0] : '',
-        // endTime: isTime ? this.searchParams.time[1] : '',
-        pageNum: pageNum,
-        pageSize: pageSize,
-      }
-      delete params['time']
-      console.log(params, 'params--------');
 
       try {
+        let { privilegedTime } = this.params;
+        let params = {
+          ...this.params,
+          startTime: privilegedTime && privilegedTime[0],
+          endTime: privilegedTime && privilegedTime[1],
+          ...this.page,
+        };
+        delete params["privilegedTime"];
         let { code, rows, total } = await dealerApi.list(params);
         if (code == 200) {
           this.tableData = rows;
@@ -142,55 +53,16 @@ export default {
       } finally {
         this.loading = false;
       }
-
     },
     // 重置
-    handelResetSearch() {
-
-      console.log('重置');
-      this.searchParams = {
-        ...initParams(SearchColumns),
-      }
-    },
-    // 判断状态
-    judgeStatus(status) {
-      // 单据状态0=自由态,1=审批中,2=已审核,3=已驳回
-      let statusName = '';
-      switch (status) {
-        case '0':
-          statusName = '自由态';
-          break;
-        case '1':
-          statusName = '审批中';
-          break;
-        case '2':
-          statusName = '已审核';
-          break;
-        case '3':
-          statusName = '已驳回';
-          break;
-        default:
-          break;
-      }
-
-      return statusName;
-    },
-    // 刷新
-    handleRefresh() {
-      this.handelSearch();
-    },
-    handleSizeChange(e) {
-      this.page.pageSize = e;
-      this.handelSearch();
-    },
-    handleCurrentChange(e) {
-      this.page.pageNum = e;
-      this.handelSearch();
+    reset() {
+      this.page = this.$init.page();
+      this.params = this.$init.params(this.SearchColumns);
+      this.useQuery();
     },
 
     // 选择列表
     handleSelect(selection, row) {
-      console.log('selection/////////', selection, 'row/////////', row);
       this.checkedList = [...selection];
     },
     // 新增、编辑授权信息
@@ -198,7 +70,6 @@ export default {
       const { setVisible, setFormData } = this.$refs.addDialogRef;
       setFormData(rows);
       setVisible(true);
-
     },
     // 查看
     handleOpenSeeDialog(rows) {
@@ -210,29 +81,30 @@ export default {
     handleDelDialog(rows) {
       let { id } = rows;
 
-      this.$confirm('此操作将删除该条数据, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(async () => {
-        try {
-          this.loading = true;
-          let { code, msg } = await dealerApi.remove({ id });
-          if (code == 200) {
-            this.handleRefresh();
+      this.$confirm("此操作将删除该条数据, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            this.loading = true;
+            let { code, msg } = await dealerApi.remove({ id });
+            if (code == 200) {
+              this.useQuery();
+            }
+          } catch (error) {
+            console.log(error);
+          } finally {
+            this.loading = false;
           }
-        } catch (error) {
-          console.log(error);
-        } finally {
-          this.loading = false;
-        }
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消删除'
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
         });
-      });
-
     },
     // 提交OA
     async handleSubmit(row) {
@@ -240,7 +112,13 @@ export default {
         // 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,
@@ -250,29 +128,31 @@ export default {
           date: new Date().Format(),
           dealerName,
           authorizedProductsName,
-          authorizedAreaName
-        }
+          authorizedAreaName,
+        };
 
         this.loading = true;
         let { code, msg } = await dealerApi.submitOA(data);
         if (code == 200) {
-          this.handleRefresh();
+          this.useQuery();
         }
       } catch (error) {
         console.log(error);
       } finally {
         this.loading = false;
-
       }
-
-
-
     },
     // 下载
     async handleDownload(row) {
-      console.log('下载', row);
+      console.log("下载", row);
       try {
-        const { id, authorizedProductsCode, dealerName, authorizedAreaName, authorizedProductsName } = row;
+        const {
+          id,
+          authorizedProductsCode,
+          dealerName,
+          authorizedAreaName,
+          authorizedProductsName,
+        } = row;
 
         const data = {
           dealerName,
@@ -280,12 +160,12 @@ export default {
           authorizedProductsName,
           id,
           authorizedProductsCode,
-        }
+        };
 
         // await this.download('/dealer/download', data, `授权书${new Date().getTime()}.doc`);
-        let file = await dealerApi.download(data)
+        let file = await dealerApi.download(data);
         let blob = new Blob([file], {
-          type: `application/msword` //word文档为msword,pdf文档为pdf,msexcel 为excel
+          type: `application/msword`, //word文档为msword,pdf文档为pdf,msexcel 为excel
         });
         let objectUrl = URL.createObjectURL(blob);
         let link = document.createElement("a");
@@ -294,32 +174,119 @@ export default {
         link.setAttribute("download", fname);
         document.body.appendChild(link);
         link.click();
-
       } catch (error) {
         console.log(error);
-      } finally { }
+      } finally {
+      }
     },
-
   },
   created() {
-    this.handelSearch();
-    console.log(this.$store.state.user, 'this.$store.state.user');
-  }
-
-}
+    this.useQuery();
+    console.log(this.$store.state.user, "this.$store.state.user");
+  },
+};
 </script>
 
-<style lang="scss" scoped>
-.dealerAuthorization {
-  width: calc(100% - 24px);
-  height: 100%;
-  margin: 10px;
-  padding: 10px;
-  box-sizing: border-box;
+<!-- 经销商授权信息管理--列表 -->
+<template>
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
+    <authprivAdd
+      ref="addDialogRef"
+      :dict="dict"
+      @close="useQuery"
+    ></authprivAdd>
+    <authprivSee ref="seeDialogRef"></authprivSee>
+    <el-super-search
+      v-model="params"
+      :size="size"
+      :dict="dict"
+      :columns="SearchColumns"
+      @reset="reset"
+      @submit="useQuery"
+    ></el-super-search>
+
+    <!-- 操作区 -->
+    <el-row :gutter="24" style="margin: 16px 0px">
+      <el-col :span="24" style="text-align: right">
+        <el-button
+          size="mini"
+          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-col>
+    </el-row>
 
-  .da-table {
-    width: 100%;
-    margin: 20px 0 0 0;
-  }
+    <el-super-ux-table
+      v-model="tableData"
+      :dict="dict"
+      :columns="TableColumns"
+      :size="size"
+      pagination
+      index
+      checkbox
+      convenitentOperation
+      :page="page"
+      storage-key="DealerAuthorizationSuperTable"
+      @pagination="useQuery"
+      @row-dblclick="handleOpenSeeDialog"
+      @select="handleSelect"
+    >
+      <ux-table-column fixed="right" title="操作" align="center" width="180">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="mini"
+            @click="handleOpenAddDialog(scope.row)"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            v-hasPermi="['pu:authorization:edit']"
+            >编辑</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            @click="handleDelDialog(scope.row)"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            v-hasPermi="['pu:authorization:remove']"
+            >删除</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
+            @click="handleSubmit(scope.row)"
+            >提交</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            v-if="scope.row.status == '2'"
+            @click="handleDownload(scope.row)"
+            >下载授权书</el-button
+          >
+        </template>
+      </ux-table-column>
+    </el-super-ux-table>
+  </el-card>
+</template>
+
+<style lang="scss" scoped>
+.el-card {
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
 }
-</style>
+</style>

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