Jelajahi Sumber

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!234
李园 1 tahun lalu
induk
melakukan
2c81502111
47 mengubah file dengan 1991 tambahan dan 1822 penghapusan
  1. 1 1
      src/components/file-preview/index.vue
  2. 1 1
      src/components/popover-select-v2/index.vue
  3. 77 0
      src/components/super-descriptions/index.vue
  4. 133 0
      src/components/super-form/index.vue
  5. 120 77
      src/components/super-search/index.vue
  6. 137 101
      src/components/super-table/index.vue
  7. 8 2
      src/main.js
  8. 14 14
      src/views/purchase/apply/add/columns.js
  9. 232 192
      src/views/purchase/apply/add/index.vue
  10. 6 2
      src/views/purchase/apply/columns.js
  11. 33 58
      src/views/purchase/apply/delete/index.vue
  12. 14 0
      src/views/purchase/apply/dicts.js
  13. 0 55
      src/views/purchase/apply/hooks/function.js
  14. 20 16
      src/views/purchase/apply/index.vue
  15. 208 0
      src/views/purchase/apply/see/columns.js
  16. 34 74
      src/views/purchase/apply/see/index.vue
  17. 33 58
      src/views/purchase/apply/submit/index.vue
  18. 0 131
      src/views/purchase/catalogue/column.js
  19. 129 0
      src/views/purchase/catalogue/columns.js
  20. 14 0
      src/views/purchase/catalogue/dicts.js
  21. 81 17
      src/views/purchase/catalogue/enable/index.vue
  22. 44 15
      src/views/purchase/catalogue/export/index.vue
  23. 0 21
      src/views/purchase/catalogue/hooks/data.js
  24. 0 16
      src/views/purchase/catalogue/hooks/dicts.js
  25. 78 222
      src/views/purchase/catalogue/index.vue
  26. 54 16
      src/views/purchase/catalogue/invalid/index.vue
  27. 0 71
      src/views/purchase/catalogue/see/column.js
  28. 72 0
      src/views/purchase/catalogue/see/columns.js
  29. 87 133
      src/views/purchase/catalogue/see/index.vue
  30. 0 0
      src/views/purchase/contract/add/columns.js
  31. 1 1
      src/views/purchase/contract/add/index.vue
  32. 7 16
      src/views/purchase/contract/columns.js
  33. 34 57
      src/views/purchase/contract/delete/index.vue
  34. 14 0
      src/views/purchase/contract/dicts.js
  35. 0 0
      src/views/purchase/contract/edit/columns.js
  36. 1 1
      src/views/purchase/contract/edit/index.vue
  37. 30 69
      src/views/purchase/contract/export/index.vue
  38. 19 19
      src/views/purchase/contract/index.vue
  39. 0 0
      src/views/purchase/contract/see/columns.js
  40. 1 1
      src/views/purchase/contract/see/index.vue
  41. 34 56
      src/views/purchase/contract/submit/index.vue
  42. 34 49
      src/views/purchase/contract/termination/index.vue
  43. 113 133
      src/views/purchase/purchase-order/column.js
  44. 19 111
      src/views/purchase/purchase-order/index.vue
  45. 4 1
      src/views/purchase/task/column.js
  46. 6 2
      src/views/purchase/task/index.vue
  47. 44 13
      src/views/purchase/transferOrder/add.vue

+ 1 - 1
src/components/file-preview/index.vue

@@ -4,7 +4,7 @@
       :size="size"
       type="text"
       @click="visible = true"
-      style="font-size: 12px"
+      style="font-size: 12px; padding: 0"
     >
       附 件
     </el-button>

+ 1 - 1
src/components/popover-select-v2/index.vue

@@ -149,7 +149,7 @@ export default {
     },
     // select
     useSelect(prop) {
-      this.selectData = prop;
+      this.selectData = prop[0];
     },
     // confirm
     useConfirm(prop) {

+ 77 - 0
src/components/super-descriptions/index.vue

@@ -0,0 +1,77 @@
+<script>
+export default {
+  name: "SuperDescriptions",
+  props: {
+    value: {
+      type: [Object],
+      require: true,
+    },
+    dict: {
+      type: [Object],
+      require: true,
+    },
+    columns: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElDictTag: () => import("@/components/DictTag/index.vue"),
+    ElFilePreview: () => import("@/components/file-preview/index.vue"),
+    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
+  },
+  data() {
+    return {};
+  },
+  computed: {
+    innerValue: {
+      get() {
+        return this.value;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {},
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<style scoped></style>
+<template>
+  <el-descriptions
+    v-bind="$attrs"
+    v-on="$listeners"
+    border
+    style="margin: 10px"
+  >
+    <el-descriptions-item
+      v-if="innerValue[item.key]"
+      v-for="{ item, attr } in columns"
+      :key="item.key"
+      :label="item.title"
+      :labelStyle="{ width: '150px' }"
+      :contentStyle="{ width: 'auto' }"
+    >
+      <component
+        v-if="attr.is === 'el-dict-tag'"
+        v-bind="attr"
+        v-model="innerValue[item.key]"
+        :size="$attrs.size"
+        :options="dict.type[attr.dictName]"
+      ></component>
+      <component
+        v-else-if="attr.is === 'el-file-preview'"
+        v-bind="attr"
+        v-model="innerValue[item.key]"
+      ></component>
+      <component
+        v-else-if="attr.is === 'el-computed-input-v2'"
+        v-bind="attr"
+        v-model="innerValue[item.key]"
+      ></component>
+      <component is="span" v-else>{{ innerValue[item.key] }}</component>
+    </el-descriptions-item>
+  </el-descriptions>
+</template>

+ 133 - 0
src/components/super-form/index.vue

@@ -0,0 +1,133 @@
+<script>
+export default {
+  name: "SuperForm",
+  props: {
+    value: {
+      type: [Object],
+      require: true,
+    },
+    dict: {
+      type: [Object],
+      require: true,
+    },
+    columns: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElFileUpload: () => import("@/components/FileUpload/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElPopoverMultipleSelectV2: () =>
+      import("@/components/popover-select-v2/multiple.vue"),
+    ElPopoverTreeSelect: () =>
+      import("@/components/popover-tree-select/index.vue"),
+    ElPopoverMultipleTreeSelect: () =>
+      import("@/components/popover-tree-select/multiple.vue"),
+  },
+  data() {
+    const { columns } = this.$props;
+    const innerColumns = columns;
+    return {
+      drawer: false,
+      visible: false,
+      innerColumns: innerColumns,
+    };
+  },
+  computed: {
+    innerValue: {
+      get() {
+        return this.value;
+      },
+      set(value) {
+        this.$emit("input", value);
+      },
+    },
+  },
+  watch: {},
+  methods: {},
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
+<template>
+  <el-form
+    ref="superForm"
+    v-bind="$attrs"
+    v-on="$listeners"
+    :model="innerValue"
+    @submit.native.prevent
+  >
+    <el-row :gutter="24" style="display: flex; flex-wrap: wrap">
+      <el-col
+        v-for="({ item, attr }, index) in innerColumns"
+        :key="index"
+        :span="item.span"
+      >
+        <el-form-item :prop="item.key" :label="item.title">
+          <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"
+              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"
+              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]"
+              style="width: 100%"
+            >
+            </component>
+          </slot>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<style scoped></style>

+ 120 - 77
src/components/super-search/index.vue

@@ -1,5 +1,78 @@
+<script>
+export default {
+  name: "SuperSearch",
+  props: {
+    value: {
+      type: [Object],
+      require: true,
+    },
+    dict: {
+      type: [Object],
+      require: true,
+    },
+    columns: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElDraggable: () => import("@/components/draggable/index.vue"),
+    ElFileUpload: () => import("@/components/FileUpload/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElPopoverMultipleSelectV2: () =>
+      import("@/components/popover-select-v2/multiple.vue"),
+    ElPopoverTreeSelect: () =>
+      import("@/components/popover-tree-select/index.vue"),
+    ElPopoverMultipleTreeSelect: () =>
+      import("@/components/popover-tree-select/multiple.vue"),
+  },
+  data() {
+    const { columns } = this.$props;
+    const stroageKey = (
+      this.$parent.$parent.$options.name + "_search"
+    ).toUpperCase();
+    const loaclColumns = JSON.parse(localStorage.getItem(stroageKey));
+    const innerColumns = !!loaclColumns ? loaclColumns : columns;
+    return {
+      drawer: false,
+      visible: false,
+      stroageKey: stroageKey,
+      innerColumns: innerColumns,
+    };
+  },
+  computed: {
+    innerValue: {
+      get() {
+        return this.value;
+      },
+      set(value) {
+        this.$emit("input", value);
+      },
+    },
+    showColumns: {
+      get() {
+        const columns = this.innerColumns.filter(({ item }) => item.hidden);
+        return this.visible ? columns : columns.slice(0, 4);
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    changeColumns() {
+      const { stroageKey, innerColumns } = this;
+      localStorage.setItem(stroageKey, JSON.stringify(innerColumns));
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
 <template>
   <el-form
+    ref="superForm"
     v-bind="$attrs"
     v-on="$listeners"
     :model="innerValue"
@@ -9,12 +82,12 @@
     style="padding: 20px 20px 0"
   >
     <el-row :gutter="20">
-      <el-col :span="21">
+      <el-col :span="20">
         <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
           <el-col
             v-for="({ item, attr }, index) in showColumns"
             :key="index"
-            :span="item.span || 6"
+            :span="item.span"
           >
             <el-form-item :prop="item.key" :label="item.title">
               <component
@@ -90,13 +163,56 @@
           </el-col>
         </el-row>
       </el-col>
-      <el-col :span="3" style="text-align: right">
+      <el-col :span="4" style="text-align: right">
         <el-button :size="$attrs.size" type="primary" @click="$emit('submit')">
           查 询
         </el-button>
         <el-button :size="$attrs.size" @click="$emit('reset')">
           重 置
         </el-button>
+        <el-button :size="$attrs.size" @click="drawer = true"
+          >设 置
+          <el-drawer
+            size="25%"
+            title="操作列"
+            append-to-body
+            :visible.sync="drawer"
+          >
+            <el-row :gutter="20" style="margin: 0">
+              <el-draggable
+                v-model="innerColumns"
+                :group="{ item: 'key' }"
+                @change="changeColumns"
+              >
+                <el-col
+                  v-for="({ item }, index) in innerColumns"
+                  :key="index"
+                  :span="24"
+                  style="
+                    display: flex;
+                    justify-content: space-between;
+                    padding: 15px 20px;
+                  "
+                >
+                  <span style="cursor: move">
+                    <i class="el-icon-rank"></i>
+                    {{ item.title }}
+                  </span>
+                  <div>
+                    <el-radio-group
+                      v-model="item.hidden"
+                      :size="$attrs.size"
+                      @change="changeColumns"
+                    >
+                      <el-radio-button :label="true">显</el-radio-button>
+                      <el-radio-button :label="false">隐</el-radio-button>
+                    </el-radio-group>
+                  </div>
+                </el-col>
+              </el-draggable>
+            </el-row>
+          </el-drawer>
+        </el-button>
       </el-col>
     </el-row>
     <el-divider>
@@ -109,77 +225,4 @@
   </el-form>
 </template>
 
-<script>
-export default {
-  name: "SuperSearch",
-  props: {
-    value: {
-      type: [Object],
-      require: true,
-    },
-    dict: {
-      type: [Object],
-      require: true,
-    },
-    columns: {
-      type: [Array],
-      require: true,
-    },
-  },
-  components: {
-    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
-    ElPopoverMultipleSelectV2: () =>
-      import("@/components/popover-select-v2/multiple.vue"),
-    ElPopoverTreeSelect: () =>
-      import("@/components/popover-tree-select/index.vue"),
-    ElPopoverMultipleTreeSelect: () =>
-      import("@/components/popover-tree-select/multiple.vue"),
-  },
-  data() {
-    return {
-      visible: false,
-    };
-  },
-  computed: {
-    innerValue: {
-      get() {
-        return this.value;
-      },
-      set(value) {
-        this.$emit("input", value);
-      },
-    },
-    showColumns: {
-      get() {
-        return this.visible ? this.columns : this.columns.slice(0, 4);
-      },
-      set() {},
-    },
-    hideColumns: {
-      get() {
-        return this.columns.slice(4);
-      },
-      set() {},
-    },
-  },
-  watch: {},
-  methods: {},
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<style scoped>
-.transition-box {
-  margin-bottom: 10px;
-  width: 200px;
-  height: 100px;
-  border-radius: 4px;
-  background-color: #409eff;
-  text-align: center;
-  color: #fff;
-  padding: 40px 20px;
-  box-sizing: border-box;
-  margin-right: 20px;
-}
-</style>
+<style scoped></style>

+ 137 - 101
src/components/super-table/index.vue

@@ -1,3 +1,81 @@
+<script>
+export default {
+  name: "SuperTable",
+  props: {
+    value: {
+      type: [Array],
+      require: true,
+    },
+    dict: {
+      type: [Object],
+      require: true,
+    },
+    columns: {
+      type: [Array],
+      require: true,
+    },
+    stroage: {
+      type: Boolean,
+      default: false,
+    },
+    hideOperationColumns: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  components: {
+    ElDictTag: () => import("@/components/DictTag/index.vue"),
+    ElDraggable: () => import("@/components/draggable/index.vue"),
+    ElFilePreview: () => import("@/components/file-preview/index.vue"),
+    ElComputedInput: () => import("@/components/computed-input/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
+  },
+  data() {
+    const { columns, stroage } = this.$props;
+    const stroageKey = (
+      this.$parent.$parent.$options.name + "_table"
+    ).toUpperCase();
+    const loaclColumns = JSON.parse(localStorage.getItem(stroageKey));
+    const innerColumns = stroage && !!loaclColumns ? loaclColumns : columns;
+    return {
+      drawer: false,
+      stroageKey: stroageKey,
+      innerColumns: innerColumns,
+    };
+  },
+  computed: {
+    innerValue: {
+      get() {
+        return this.value;
+      },
+      set(value) {
+        this.$emit("input", value);
+      },
+    },
+    showColumns: {
+      get() {
+        const { stroage, hideOperationColumns } = this.$props;
+        return stroage && hideOperationColumns
+          ? this.innerColumns.filter(({ item }) => item.hidden)
+          : this.innerColumns;
+      },
+    },
+  },
+  watch: {},
+  methods: {
+    changeColumns() {
+      const { stroageKey, innerColumns } = this;
+      this.$refs.superTable.doLayout();
+      localStorage.setItem(stroageKey, JSON.stringify(innerColumns));
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
 <template>
   <el-table
     v-bind="$attrs"
@@ -14,35 +92,60 @@
       :prop="item.key"
       :label="item.title"
       :fixed="item.fixed"
-      :width="item.width || 225"
+      :width="item.width || 250"
       show-overflow-tooltip
     >
       <template slot-scope="scope">
-        <component
-          v-if="attr.is === 'el-dict-tag'"
-          v-bind="attr"
-          :size="$attrs.size"
-          :value="scope.row[item.key]"
-          :options="dict.type[attr.dictName]"
-        ></component>
-        <component
-          v-else-if="attr.is === 'el-file-preview'"
-          v-bind="attr"
-          v-model="scope.row[item.key]"
-        ></component>
-        <component
-          v-else-if="attr.is === 'el-computed-input-v2'"
-          v-bind="attr"
-          v-model="scope.row[item.key]"
-        ></component>
-        <component
-          v-else-if="attr.is === 'el-checkbox'"
-          v-bind="attr"
-          v-model="scope.row[item.key]"
-        ></component>
-        <component v-else is="span">{{
-          scope.row[item.key] || "--"
-        }}</component>
+        <slot :name="item.key" v-bind="scope" :item="item" :attr="attr">
+          <template v-if="attr.is">
+            <component
+              v-if="attr.is === 'el-dict-tag'"
+              v-bind="attr"
+              :size="$attrs.size"
+              :value="scope.row[item.key]"
+              :options="dict.type[attr.dictName]"
+            ></component>
+            <component
+              v-else-if="attr.is === 'el-popover-select-v2'"
+              v-bind="attr"
+              v-model="scope.row[item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+            >
+            </component>
+            <component
+              v-else-if="attr.is === 'el-select'"
+              v-bind="attr"
+              v-model="scope.row[item.key]"
+              :size="$attrs.size"
+            >
+              <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
+              v-bind="attr"
+              v-model="scope.row[item.key]"
+              :size="$attrs.size"
+            >
+            </component
+          ></template>
+          <template v-else>
+            <component v-if="attr.formatter" is="span">{{
+              attr.formatter(scope.row)
+            }}</component>
+            <component v-else is="span">{{
+              scope.row[item.key] || "--"
+            }}</component>
+          </template>
+        </slot>
       </template>
     </el-table-column>
     <el-table-column
@@ -65,12 +168,12 @@
         >
           <el-row :gutter="20" style="margin: 0">
             <el-draggable
-              v-model="selfColumns"
+              v-model="innerColumns"
               :group="{ item: 'key' }"
               @change="changeColumns"
             >
               <el-col
-                v-for="({ item }, index) in selfColumns"
+                v-for="({ item }, index) in innerColumns"
                 :key="index"
                 :span="24"
                 style="
@@ -110,82 +213,15 @@
       </template>
 
       <template slot-scope="scope">
-        <slot name="operation" v-bind="scope"> </slot>
+        <slot name="operation" v-bind="scope">
+          <el-tag :size="$attrs.size" type="info">
+            {{ scope.row.$index }}
+          </el-tag>
+        </slot>
       </template>
     </el-table-column>
+    <slot v-else name="operation"> </slot>
   </el-table>
 </template>
 
-<script>
-export default {
-  name: "SuperTable",
-  props: {
-    value: {
-      type: [Array],
-      require: true,
-    },
-    dict: {
-      type: [Object],
-      require: true,
-    },
-    columns: {
-      type: [Array],
-      require: true,
-    },
-    stroage: {
-      type: Boolean,
-      default: false,
-    },
-    hideOperationColumns: {
-      type: Boolean,
-      default: false,
-    },
-  },
-  components: {
-    ElDictTag: () => import("@/components/DictTag/index.vue"),
-    ElDraggable: () => import("@/components/draggable/index.vue"),
-    ElFilePreview: () => import("@/components/file-preview/index.vue"),
-    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
-  },
-  data() {
-    const { columns, stroage } = this.$props;
-    const loaclColumns = JSON.parse(
-      localStorage.getItem(this.$parent.$parent.$options.name)
-    );
-    const selfColumns = stroage && !!loaclColumns ? loaclColumns : columns;
-    return {
-      drawer: false,
-      selfColumns: selfColumns,
-    };
-  },
-  computed: {
-    innerValue: {
-      get() {
-        return this.value;
-      },
-      set(value) {
-        this.$emit("input", value);
-      },
-    },
-    showColumns: {
-      get() {
-        return this.selfColumns.filter(({ item }) => item.hidden);
-      },
-    },
-  },
-  watch: {},
-  methods: {
-    changeColumns() {
-      this.$refs.superTable.doLayout();
-      localStorage.setItem(
-        this.$parent.$parent.$options.name,
-        JSON.stringify(this.selfColumns)
-      );
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
 <style scoped></style>

+ 8 - 2
src/main.js

@@ -29,6 +29,7 @@ import {
   selectDictLabels,
   handleTree,
 } from "@/utils/ruoyi";
+import { initParams, initRules, initDicts } from "@/utils/init.js";
 // 分页组件
 import Pagination from "@/components/Pagination";
 // 自定义表格工具组件
@@ -56,7 +57,7 @@ import ComputedInput from "@/components/computed-input";
 // 附件标签组件
 import FilePreview from "@/components/file-preview";
 //打印
-import Print from 'vue-print-nb'
+import Print from "vue-print-nb";
 
 // 全局方法挂载
 Vue.prototype.getDicts = getDicts;
@@ -68,6 +69,11 @@ Vue.prototype.selectDictLabel = selectDictLabel;
 Vue.prototype.selectDictLabels = selectDictLabels;
 Vue.prototype.download = download;
 Vue.prototype.handleTree = handleTree;
+Vue.prototype.$init = {
+  params: initParams,
+  dicts: initDicts,
+  rules: initRules,
+};
 
 // 全局组件挂载
 Vue.component("DictTag", DictTag);
@@ -85,7 +91,7 @@ Vue.component("DrFilePreview", FilePreview);
 Vue.use(directive);
 Vue.use(plugins);
 Vue.use(VueMeta);
-Vue.use(Print);  //注册
+Vue.use(Print); //注册
 DictData.install();
 
 /**

+ 14 - 14
src/views/purchase/apply/add/column.js → src/views/purchase/apply/add/columns.js

@@ -1,4 +1,6 @@
-export const FormColumns = [
+import CONFIG from "@/config";
+
+export const TableColumns = [
   {
     item: { key: "priceName", title: "价格名称" },
     attr: { is: "el-input", value: "价格申报单" },
@@ -73,10 +75,6 @@ export const FormColumns = [
     attr: { is: "el-input", disabled: true, readonly: true },
   },
   {
-    item: { key: "id", title: "来源单据id" },
-    attr: { is: "el-input", disabled: true, readonly: true },
-  },
-  {
     item: { key: "isEffective", title: "是否已推价格" },
     attr: {
       is: "el-select",
@@ -89,7 +87,7 @@ export const FormColumns = [
   },
   {
     item: { key: "file", title: "附件", require: true, span: 24 },
-    attr: { is: "file-upload" },
+    attr: { is: "el-file-upload" },
   },
   {
     item: { key: "sourceType", title: "来源单据类型" },
@@ -105,7 +103,10 @@ export const FormColumns = [
       value: "0",
     },
   },
-];
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
 
 export const TabColumns = [
   {
@@ -162,7 +163,7 @@ export const TabColumns = [
         item: { key: "conversionRate", title: "采购换算率", require: true },
         attr: {
           is: "el-input-number",
-          precision: 6,
+          precision: CONFIG.precision,
         },
       },
       {
@@ -178,19 +179,18 @@ export const TabColumns = [
         item: { key: "taxPrice", title: "含税单价", require: true },
         attr: {
           is: "el-input-number",
-          precision: 6,
-          formatter: (prop) => (prop ? (prop * 1).toFixed(6) : null),
+          precision: CONFIG.precision,
         },
       },
       {
         item: { key: "price", title: "无税单价", require: true },
         attr: {
-          is: "el-computed-input",
           formatter: (prop) => {
             const { tax, taxPrice } = prop;
             const newTax = Number(tax) / 100;
-            const price = (taxPrice / (1 + newTax)).toFixed(6);
-            return price === "NaN" ? null : price;
+            const price = (taxPrice / (1 + newTax)).toFixed(CONFIG.precision);
+            prop.price = price === "NaN" ? null : price;
+            return prop.price;
           },
         },
       },
@@ -309,4 +309,4 @@ export const TabColumns = [
   },
 ];
 
-export default { FormColumns, TabColumns };
+export default { TableColumns, TabColumns };

+ 232 - 192
src/views/purchase/apply/add/index.vue

@@ -1,14 +1,64 @@
 <script>
-import Column from "./column";
-import useMethods from "../hooks/function";
-import { initRules, initParams } from "@/utils/init.js";
+import { TabColumns, TableColumns } from "./columns";
+import { REFER } from "@/components/popover-select/api";
+import { EXIST } from "@/api/business/purchase/catalogue";
 import { ITEM, SAVE } from "@/api/business/purchase/apply";
 
-const { fetchTax, fetchUnit, fetchExist } = useMethods();
+const fetchTax = async (prop) => {
+  try {
+    // try
+    const { code, rows } = await REFER({
+      search: prop,
+      type: "TAX_RATE_PARAM",
+    });
+    if (code === 200) {
+      return rows[0] || {};
+    }
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+const fetchUnit = async (prop) => {
+  try {
+    // try
+    const { code, rows } = await REFER({
+      search: prop,
+      type: "UNIT_PARAM",
+    });
+    if (code === 200) {
+      return rows[0] || {};
+    }
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+const fetchExist = async (prop) => {
+  try {
+    // try
+    const { code, data } = await EXIST(prop);
+    if (code === 200) return data;
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
 
 export default {
   name: "AddDrawer",
   props: {
+    dict: {
+      type: Object,
+    },
     selectData: {
       type: [Array],
       require: true,
@@ -19,38 +69,31 @@ export default {
     },
   },
   components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElComputedInput: () => import("@/components/computed-input/index.vue"),
     ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
   },
   data() {
-    const {
-      TabColumns,
-      FormColumns,
-      TabColumns: [
-        {
-          item: { key: tabName },
-        },
-      ],
-    } = Column;
-    const params = initParams([...TabColumns, ...FormColumns]);
-    const rules = initRules(FormColumns);
+    const [
+      {
+        item: { key: tabName },
+      },
+    ] = TabColumns;
+    const rules = this.$init.rules([...TabColumns, ...TableColumns]);
+    const params = this.$init.params([...TabColumns, ...TableColumns]);
     return {
       width: "100%",
       visible: false,
       loading: false,
       rules: rules,
       params: params,
-      tabName,
-      TabColumns,
-      FormColumns,
+      tabName: tabName,
+      TabColumns: TabColumns,
+      TableColumns: TableColumns,
     };
   },
   computed: {
-    $dicts: {
-      get: function () {
-        return this.$parent.$parent.$parent.$dicts;
-      },
-    },
     title: {
       get() {
         const { addType } = this;
@@ -95,64 +138,84 @@ export default {
       },
       set() {},
     },
-  },
-  watch: {
-    "params.puOrgName": {
-      handler: async function (newProp) {
-        const index = this.params.priceApplyOrgs.findIndex(
-          (item) => item.orgName === newProp
-        );
-        if (index === -1 && newProp) {
-          const {
-            id: org,
-            code: orgCode,
-            name: orgName,
-          } = await fetchOrg(this.params.puOrgName);
-          await this.params.priceApplyOrgs.push({
-            org,
-            orgCode,
-            orgName,
-            createByName: undefined,
-            updateByName: undefined,
-          });
-        }
+    priceApply: {
+      get() {
+        const {
+          params: { priceApplyOrgs, priceApplyItems },
+        } = this;
+        return {
+          priceApplyOrgs: priceApplyOrgs.filter(
+            ({ delFlag }) => delFlag !== "2"
+          ),
+          priceApplyItems: priceApplyItems.filter(
+            ({ delFlag }) => delFlag !== "2"
+          ),
+        };
       },
-      deep: true,
+      set() {},
     },
   },
+  watch: {},
   methods: {
     //
-    async fetchRefer(row, prop = {}) {
-      const { source, referName } = prop;
-      if (referName === "MATERIAL_PARAM") {
-        const { puOrg, customer, supplier } = this.params;
-        const { rateCode, unitIdName, code: materialCode } = row;
-        // task 1
-        fetchTax(rateCode).then((res) => {
-          const { ntaxrate } = res;
-          source.tax =
-            ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
-        });
-        // task 2
-        fetchUnit(unitIdName).then((res) => {
-          const { id, code, name } = res;
-          source.unit = id;
-          source.unitCode = code;
-          source.unitName = name;
-          source.puUnit = id;
-          source.puUnitCode = code;
-          source.puUnitName = name;
-        });
-        // task 3
-        fetchExist({ puOrg, customer, supplier, materialCode }).then((res) => {
-          const { recentlyPrice, isApprovalFirst, isPriceAdjustment } = res;
-          source.recentlyPrice = recentlyPrice;
-          source.isApprovalFirst = isApprovalFirst;
-          source.isPriceAdjustment = isPriceAdjustment;
+    rowClassName(prop) {
+      const {
+        row: { delFlag },
+      } = prop;
+      if (delFlag === "2") {
+        return "is-hidden";
+      } else {
+        return "";
+      }
+    },
+    //
+    changePuOrgName(prop) {
+      const {
+        select: { id: org, code: orgCode, name: orgName },
+      } = prop;
+      const index = this.params.priceApplyOrgs.findIndex(
+        (item) => item.org === org
+      );
+      if (index === -1) {
+        this.params.priceApplyOrgs.push({
+          org,
+          orgCode,
+          orgName,
+          createByName: undefined,
+          updateByName: undefined,
         });
       }
     },
     //
+    changeMaterialName(prop) {
+      const { row } = prop;
+      const { puOrg, customer, supplier } = this.params;
+      const { rateCode, unitIdName, code: materialCode } = row;
+      // task 1
+      fetchTax(rateCode).then((res) => {
+        const { ntaxrate } = res;
+        row.tax = ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
+      });
+      // task 2
+      fetchUnit(unitIdName).then((res) => {
+        const { id, code, name } = res;
+        row.unit = id;
+        row.unitCode = code;
+        row.unitName = name;
+        row.puUnit = id;
+        row.puUnitCode = code;
+        row.puUnitName = name;
+      });
+      // task 3
+      fetchExist({ puOrg, customer, supplier, materialCode }).then((res) => {
+        const { recentlyPrice, isApprovalFirst, isPriceAdjustment } = res;
+        row.recentlyPrice = recentlyPrice;
+        row.isApprovalFirst = isApprovalFirst;
+        row.isPriceAdjustment = isPriceAdjustment;
+      });
+    },
+
+    //
     async fetchItem(prop) {
       try {
         // try
@@ -206,14 +269,28 @@ export default {
       if (addType === "edit") {
         const [{ id }] = selectData;
         this.visible = await this.fetchItem(id);
+        this.params.priceApplyItems = this.params.priceApplyItems.map(
+          (item, index) => ({
+            ...item,
+            $index: index,
+          })
+        );
+        this.params.priceApplyOrgs = this.params.priceApplyOrgs.map(
+          (item, index) => ({
+            ...item,
+            $index: index,
+          })
+        );
       }
     },
     //
     async hide() {
-      const { TabColumns, FormColumns } = this;
+      const { TabColumns, TableColumns } = this;
       this.visible = false;
       this.tabName = TabColumns[0].item.key;
-      this.params = initParams([...TabColumns, ...FormColumns]);
+      this.params = this.$init.params([...TabColumns, ...TableColumns]);
+      this.params.priceApplyOrgs = [];
+      this.params.priceApplyItems = [];
     },
     //
     async useRowAdd(prop) {
@@ -231,7 +308,11 @@ export default {
       const { TableColumns } = TabColumns.find(
         ({ item: { key } }) => key === prop
       );
-      this.params[prop].push({ ...initParams(TableColumns), delFlag: "0" });
+      this.params[prop].push({
+        delFlag: "0",
+        $index: this.params[prop].length,
+        ...this.$init.params(TableColumns),
+      });
     },
     //
     async useRowRemove(prop, scope) {
@@ -254,10 +335,9 @@ export default {
     },
     //
     async useSubmit(prop) {
-      this.$refs[prop].validate(async (valid) => {
+      this.$refs[prop].$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
-            // try
             this.loading = true;
             const {
               params,
@@ -271,8 +351,6 @@ export default {
                 (item) => item.materialName
               );
             }
-            console.log(this.params.priceApplyItems);
-            return;
             const { msg, code } = await SAVE(params);
             if (code === 200) {
               this.hide();
@@ -311,128 +389,84 @@ export default {
       :visible.sync="visible"
       append-to-body
       destroy-on-close
+      @close="hide"
     >
-      <el-form
-        ref="ruleForm"
-        v-loading="loading"
-        :size="$attrs.size"
+      <el-super-form
+        v-model="params"
+        :dict="dict"
         :rules="rules"
-        :model="params"
+        :size="$attrs.size"
+        :columns="TableColumns"
+        ref="superForm"
         label-width="auto"
         label-position="right"
-        style="padding: 10px"
+        style="padding: 20px"
       >
-        <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
-          <el-col
-            v-for="({ item, attr }, index) in FormColumns"
-            :key="index"
-            :span="item.span || 8"
+        <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"
+            @change="changePuOrgName({ ...scope, select: $event })"
           >
-            <el-form-item
-              :prop="item.key"
-              :label="item.title"
-              :require="item.require"
-            >
+          </component
+        ></template>
+      </el-super-form>
+      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+        <el-tab-pane
+          v-for="({ item, TableColumns: columns }, index) in TabColumns"
+          :key="index"
+          :label="item.title"
+          :name="item.key"
+          lazy
+        >
+          <el-super-table
+            v-model="priceApply[item.key]"
+            :dict="dict"
+            :ref="tabName"
+            :columns="columns"
+            :size="$attrs.size"
+            :row-class-name="rowClassName"
+          >
+            <template slot="materialName" slot-scope="scope">
               <component
-                v-bind="attr"
-                v-model="params[item.key]"
-                :source.sync="params"
-                style="width: 100%"
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                @change="changeMaterialName(scope)"
               >
-                <template v-if="attr.dictName">
-                  <el-option
-                    v-for="item in $dicts[attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </template>
               </component>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label-width="0">
-              <el-tabs v-model="tabName">
-                <el-tab-pane
-                  v-for="({ item, TableColumns }, index) in TabColumns"
-                  :key="index"
-                  :label="item.title"
-                  :name="item.key"
-                  lazy
+            </template>
+            <el-table-column
+              slot="operation"
+              fixed="right"
+              label="操作"
+              width="100"
+            >
+              <template slot="header" slot-scope="scope">
+                <el-button
+                  circle
+                  icon="el-icon-plus"
+                  :size="$attrs.size"
+                  @click="useRowAdd(tabName)"
                 >
-                  <el-table
-                    :size="$attrs.size"
-                    :data="
-                      params[item.key]
-                        .map((item, index) => ({ ...item, $index: index }))
-                        .filter(({ delFlag }) => delFlag === '0')
-                    "
-                  >
-                    <el-table-column label="序号">
-                      <template slot-scope="scope">
-                        {{ scope.$index + 1 }}
-                      </template>
-                    </el-table-column>
-                    <el-table-column
-                      v-for="(
-                        { item: cItem, attr: cAttr }, cIndex
-                      ) in TableColumns"
-                      :key="cIndex"
-                      :prop="cItem.key"
-                      :label="cItem.title"
-                      :width="cItem.width || 250"
-                      show-overflow-tooltip
-                    >
-                      <template slot-scope="scope">
-                        <component
-                          v-if="cAttr.is"
-                          v-bind="cAttr"
-                          v-model="scope.row[cItem.key]"
-                          :source.sync="scope.row"
-                          @change="fetchRefer"
-                          style="width: 100%"
-                        >
-                          <template v-if="cAttr.dictName">
-                            <el-option
-                              v-for="item in $dicts[cAttr.dictName]"
-                              :key="item.value"
-                              :label="item.label"
-                              :value="item.value"
-                            >
-                            </el-option>
-                          </template>
-                        </component>
-                        <span v-else> {{ scope.row[cItem.key] }}</span>
-                      </template>
-                    </el-table-column>
-                    <el-table-column fixed="right" label="操作" width="100">
-                      <template slot="header" slot-scope="scope">
-                        <el-button
-                          circle
-                          icon="el-icon-plus"
-                          :size="$attrs.size"
-                          @click="useRowAdd(tabName)"
-                        >
-                        </el-button>
-                      </template>
-                      <template slot-scope="scope">
-                        <el-button
-                          circle
-                          icon="el-icon-minus"
-                          :size="$attrs.size"
-                          @click.native.prevent="useRowRemove(tabName, scope)"
-                        >
-                        </el-button>
-                      </template>
-                    </el-table-column>
-                  </el-table>
-                </el-tab-pane>
-              </el-tabs>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
+                </el-button>
+              </template>
+              <template slot-scope="scope">
+                <el-button
+                  circle
+                  icon="el-icon-minus"
+                  :size="$attrs.size"
+                  @click.native.prevent="useRowRemove(tabName, scope)"
+                >
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-super-table>
+        </el-tab-pane>
+      </el-tabs>
       <div style="padding: 20px; text-align: right">
         <el-button :size="$attrs.size" :loading="loading" @click="hide"
           >取 消</el-button
@@ -441,10 +475,16 @@ export default {
           type="primary"
           :size="$attrs.size"
           :loading="loading"
-          @click="useSubmit('ruleForm')"
+          @click="useSubmit('superForm')"
           >确 认</el-button
         >
       </div>
     </el-drawer>
   </el-button>
 </template>
+
+<style scoped>
+::v-deep .el-table__row.is-hidden {
+  display: none;
+}
+</style>

+ 6 - 2
src/views/purchase/apply/column.js → src/views/purchase/apply/columns.js

@@ -26,7 +26,6 @@ export const TableColumns = [
     item: { key: "effectiveDate", title: "生效日期" },
     attr: {},
   },
-  { item: { key: "id", title: "来源单据id" }, attr: {} },
   { item: { key: "source", title: "来源单据号" }, attr: {} },
   {
     item: { key: "sourceType", title: "来源单据类型" },
@@ -99,4 +98,9 @@ export const SearchColumns = [
       clearable: true,
     },
   },
-];
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
+
+export default { TableColumns, SearchColumns };

+ 33 - 58
src/views/purchase/apply/delete/index.vue

@@ -12,8 +12,6 @@ export default {
   data() {
     return {
       title: "删 除",
-      visible: false,
-      loading: false,
     };
   },
   computed: {
@@ -43,31 +41,39 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const ids = prop.map((item) => item.id).join(",");
-        const { msg, code } = await REMOVE(ids);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+      this.$confirm(`是否删除数据项?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
+            try {
+              // try
+              const { selectData } = this.$props;
+              const ids = selectData.map((item) => item.id).join(",");
+              const { msg, code } = await REMOVE(ids);
+              if (code === 200) {
+                done();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -83,36 +89,5 @@ export default {
     @click="open"
   >
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(selectData)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert
-        title="是否删除数据项?"
-        type="info"
-        show-icon
-        :closable="false"
-        style="margin-bottom: 10px"
-      >
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 14 - 0
src/views/purchase/apply/dicts.js

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

+ 0 - 55
src/views/purchase/apply/hooks/function.js

@@ -1,55 +0,0 @@
-import { REFER } from "@/components/popover-select/api";
-import { EXIST } from "@/api/business/purchase/catalogue";
-
-export default function useMethods() {
-  const fetchTax = async (prop) => {
-    try {
-      // try
-      const { code, rows } = await REFER({
-        search: prop,
-        type: "TAX_RATE_PARAM",
-      });
-      if (code === 200) {
-        return rows[0] || {};
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
-
-  const fetchUnit = async (prop) => {
-    try {
-      // try
-      const { code, rows } = await REFER({
-        search: prop,
-        type: "UNIT_PARAM",
-      });
-      if (code === 200) {
-        return rows[0] || {};
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
-
-  const fetchExist = async (prop) => {
-    try {
-      // try
-      const { code, data } = await EXIST(prop);
-      if (code === 200) return data;
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
-
-  return { fetchTax, fetchUnit, fetchExist };
-}

+ 20 - 16
src/views/purchase/apply/index.vue

@@ -1,10 +1,11 @@
 <script>
+import { dicts } from "./dicts";
 import { LIST } from "@/api/business/purchase/apply";
-import { TableColumns, SearchColumns } from "./column";
-import { initDicts, initParams } from "@/utils/init.js";
+import { TableColumns, SearchColumns } from "./columns";
+
 export default {
   name: "PuchaseApply",
-  dicts: [...initDicts([...TableColumns, ...SearchColumns]), "sys_price_type"],
+  dicts: dicts,
   components: {
     SeeButton: () => import("./see/index.vue"),
     AddButton: () => import("./add/index.vue"),
@@ -14,24 +15,19 @@ export default {
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
   data() {
+    const params = this.$init.params(SearchColumns);
     return {
       size: "mini",
       loading: false,
-      SearchColumns: SearchColumns,
-      params: initParams(SearchColumns),
+      params: params,
       tableData: [],
       selectData: [],
+      SearchColumns: SearchColumns,
       TableColumns: TableColumns,
       page: { pageNum: 1, pageSize: 10, total: 0 },
     };
   },
-  computed: {
-    $dicts: {
-      get: function () {
-        return this.dict.type;
-      },
-    },
-  },
+  computed: {},
   created() {
     this.useQuery(this.params, this.page);
   },
@@ -69,7 +65,7 @@ export default {
     useReset() {
       this.page.pageNum = 1;
       this.page.pageSize = 10;
-      this.params = initParams(SearchColumns);
+      this.params = this.$init.params(SearchColumns);
       this.useQuery(this.params, this.page);
     },
     // 选 择
@@ -97,31 +93,35 @@ export default {
       @submit="useQuery(params, page)"
     ></el-super-search>
     <div style="padding: 0 20px; text-align: right">
-      <el-button-group style="margin: 0 10px 0 0">
+      <el-button-group>
         <add-button
           :size="size"
           :select-data="[]"
+          :dict="dict"
           add-type="add"
           @success="useQuery(params, page)"
         ></add-button>
         <add-button
           :size="size"
+          :dict="dict"
           :select-data="selectData"
           add-type="copy"
           @success="useQuery(params, page)"
         >
         </add-button>
       </el-button-group>
-      <el-button-group style="margin: 0 10px 0 0">
+      <el-button-group>
         <see-button
           v-show="false"
-          ref="SeeButton"
           :size="size"
+          :dict="dict"
           :select-data="selectData"
+          ref="SeeButton"
           @success="useQuery(params, page)"
         ></see-button>
         <add-button
           :size="size"
+          :dict="dict"
           :select-data="selectData"
           add-type="edit"
           @success="useQuery(params, page)"
@@ -158,6 +158,7 @@ export default {
       :page.sync="page.pageNum"
       :limit.sync="page.pageSize"
       @pagination="useQuery(params, page)"
+      style="margin: 20px"
     />
   </el-card>
 </template>
@@ -168,4 +169,7 @@ export default {
   margin: 10px;
   padding: 0 0 20px 0;
 }
+.el-button-group + .el-button-group {
+  margin: 0 0 0 10px;
+}
 </style>

+ 208 - 0
src/views/purchase/apply/see/columns.js

@@ -0,0 +1,208 @@
+import CONFIG from "@/config";
+
+export const TableColumns = [
+  {
+    item: { key: "priceName", title: "价格名称" },
+    attr: {},
+  },
+  {
+    item: { key: "priceCode", title: "价格编码" },
+    attr: {},
+  },
+  {
+    item: { key: "supplierName", title: "供应商" },
+    attr: {},
+  },
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {},
+  },
+  {
+    item: { key: "currencyName", title: "币种" },
+    attr: {},
+  },
+  {
+    item: { key: "explainStr", title: "价格合理性说明" },
+    attr: {},
+  },
+  {
+    item: { key: "buyerName", title: "采购员" },
+    attr: {},
+  },
+  {
+    item: { key: "puDeptName", title: "采购部门" },
+    attr: {},
+  },
+  {
+    item: { key: "createByName", title: "创建人" },
+    attr: {},
+  },
+  {
+    item: { key: "source", title: "来源单据号" },
+    attr: {},
+  },
+  {
+    item: { key: "isEffective", title: "是否已推价格" },
+    attr: {
+      is: "el-dict-tag",
+      dictName: "is_effective",
+    },
+  },
+  {
+    item: { key: "effectiveDate", title: "生效日期" },
+    attr: {},
+  },
+  {
+    item: { key: "file", title: "附件" },
+    attr: { is: "el-file-preview" },
+  },
+  {
+    item: { key: "sourceType", title: "来源单据类型" },
+    attr: {},
+  },
+  {
+    item: { key: "status", title: "单据状态" },
+    attr: {
+      is: "el-dict-tag",
+      dictName: "sys_status",
+    },
+  },
+];
+
+export const TabColumns = [
+  {
+    item: {
+      title: "物料信息表",
+      key: "priceApplyItems",
+    },
+    attr: {
+      value: [],
+    },
+    TableColumns: [
+      {
+        item: { key: "materialName", title: "物料名称" },
+        attr: {},
+      },
+      { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+      { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
+      { item: { key: "specification", title: "规格" }, attr: {} },
+      { item: { key: "model", title: "型号" }, attr: {} },
+      {
+        item: { key: "unitName", title: "单位" },
+        attr: {},
+      },
+      {
+        item: { key: "puUnitName", title: "采购单位" },
+        attr: {},
+      },
+      {
+        item: { key: "conversionRate", title: "采购换算率" },
+        attr: {
+          is: "el-computed-input-v2",
+          formatter: (prop) => {
+            return (prop * 1).toFixed(CONFIG.precision);
+          },
+        },
+      },
+      {
+        item: { key: "tax", title: "税率%" },
+        attr: {
+          is: "el-computed-input-v2",
+          formatter: (prop) => {
+            return (prop * 1).toFixed(CONFIG.precision);
+          },
+        },
+      },
+      {
+        item: { key: "taxPrice", title: "含税单价" },
+        attr: {
+          is: "el-computed-input-v2",
+          formatter: (prop) => {
+            return (prop * 1).toFixed(CONFIG.precision);
+          },
+        },
+      },
+      {
+        item: { key: "price", title: "无税单价" },
+        attr: {
+          is: "el-computed-input-v2",
+          formatter: (prop) => {
+            return (prop * 1).toFixed(CONFIG.precision);
+          },
+        },
+      },
+      {
+        item: { key: "currencyName", title: "币种" },
+        attr: {},
+      },
+      {
+        item: { key: "periodBegin", title: "价格有效期(起)" },
+        attr: {},
+      },
+      {
+        item: { key: "periodEnd", title: "价格有效期(止)" },
+        attr: {},
+      },
+      {
+        item: { key: "customerName", title: "客户" },
+        attr: {},
+      },
+      { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
+      {
+        item: { key: "isApprovalFirst", title: "首次报批" },
+        attr: {
+          is: "el-dict-tag",
+          dictName: "is_effective",
+        },
+      },
+      {
+        item: { key: "isPriceAdjustment", title: "价格调整" },
+        attr: {
+          is: "el-dict-tag",
+          dictName: "is_effective",
+        },
+      },
+      {
+        item: { key: "priceType", title: "价格类型" },
+        attr: {
+          is: "el-dict-tag",
+          dictName: "sys_price_type",
+        },
+      },
+      {
+        item: { key: "isDistributionPrice", title: "配送价" },
+        attr: {
+          is: "el-dict-tag",
+          dictName: "is_effective",
+        },
+      },
+      { item: { key: "createByName", title: "创建人名称" }, attr: {} },
+      { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
+    ],
+  },
+  {
+    item: {
+      title: "合同执行组织范围",
+      key: "priceApplyOrgs",
+    },
+    attr: {
+      value: [],
+    },
+    TableColumns: [
+      {
+        item: { key: "orgName", title: "组织", width: "auto" },
+        attr: {},
+      },
+      {
+        item: { key: "createByName", title: "创建人名称", width: "auto" },
+        attr: {},
+      },
+      {
+        item: { key: "updateByName", title: "更新人名称", width: "auto" },
+        attr: {},
+      },
+    ],
+  },
+];
+
+export default { TableColumns, TabColumns };

+ 34 - 74
src/views/purchase/apply/see/index.vue

@@ -1,48 +1,42 @@
 <script>
-import Column from "../add/column";
-import { initRules, initParams } from "@/utils/init.js";
+import { TabColumns, TableColumns } from "./columns";
 import { ITEM, LIST } from "@/api/business/purchase/apply";
 
 export default {
   name: "SeeDrawer",
-
+  components: {
+    ElSuperDescriptions: () =>
+      import("@/components/super-descriptions/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+  },
   data() {
-    const {
-      TabColumns,
-      FormColumns,
-      TabColumns: [
-        {
-          item: { key: tabName },
-        },
-      ],
-    } = Column;
-    const params = initParams([...TabColumns, ...FormColumns]);
-    const rules = initRules(FormColumns);
+    const [
+      {
+        item: { key: tabName },
+      },
+    ] = TabColumns;
     return {
       width: "50%",
       column: 2,
       title: "明 细",
       visible: false,
       loading: false,
-      rules: rules,
-      params: params,
+      params: {},
       tabName,
-      TabColumns,
-      FormColumns,
+      TabColumns: TabColumns,
+      TableColumns: TableColumns,
     };
   },
   props: {
+    dict: {
+      type: Object,
+    },
     selectData: {
       type: [Array],
       require: true,
     },
   },
   computed: {
-    $dicts: {
-      get() {
-        return this.$parent.$parent.$parent.$dicts;
-      },
-    },
     disabled: {
       get() {
         const { selectData } = this;
@@ -88,10 +82,10 @@ export default {
     },
     //
     async hide() {
-      const { TabColumns, FormColumns, initParams } = this;
+      const { TabColumns, TableColumns, initParams } = this;
       this.visible = false;
       this.tabName = TabColumns[0].item.key;
-      this.params = initParams([...TabColumns, ...FormColumns]);
+      this.params = initParams([...TabColumns, ...TableColumns]);
     },
   },
   created() {},
@@ -104,7 +98,7 @@ export default {
     v-bind="$attrs"
     v-on="$listeners"
     :disabled="disabled"
-    @click="open(selectData[0])"
+    @click="open(selectData[0].$index)"
   >
     {{ title }}
     <el-drawer
@@ -141,63 +135,29 @@ export default {
           style="margin: 0"
         ></el-button>
       </div>
-      <el-descriptions
-        :size="$attrs.size"
+      <el-super-descriptions
+        v-model="params"
+        :dict="dict"
         :column="column"
-        border
-        style="margin: 10px"
+        :size="$attrs.size"
+        :columns="TableColumns"
       >
-        <el-descriptions-item
-          v-if="params[item.key]"
-          v-for="({ item, attr }, index) in FormColumns"
-          :key="index"
-          :label="item.title"
-        >
-          <dict-tag
-            v-if="attr.is === 'el-select'"
-            :size="$attrs.size"
-            :value="params[item.key]"
-            :options="$dicts[attr.dictName]"
-          />
-          <dr-file-preview
-            v-else-if="attr.is === 'file-upload'"
-            v-model="params[item.key]"
-          ></dr-file-preview>
-          <span v-else>{{ params[item.key] }}</span>
-        </el-descriptions-item>
-      </el-descriptions>
+      </el-super-descriptions>
       <el-tabs v-model="tabName" :size="$attrs.size" style="margin: 10px">
         <el-tab-pane
-          v-for="({ item, attr, TableColumns }, index) in TabColumns"
+          v-for="({ item, TableColumns: columns }, index) in TabColumns"
           :key="index"
           :name="item.key"
           :label="item.title"
           lazy
         >
-          <el-table :size="$attrs.size" :data="params[item.key]">
-            <el-table-column
-              v-for="({ item: cItem, attr: cAttr }, cIndex) in TableColumns"
-              :key="cIndex"
-              :prop="cItem.key"
-              :label="cItem.title"
-              :width="cItem.width || 250"
-              show-overflow-tooltip
-            >
-              <template slot-scope="scope">
-                <dict-tag
-                  v-if="cAttr.is === 'el-select'"
-                  :size="$attrs.size"
-                  :value="scope.row[cItem.key]"
-                  :options="$dicts[cAttr.dictName]"
-                />
-                <span v-else>{{
-                  cAttr.formatter
-                    ? cAttr.formatter(scope.row[cItem.key])
-                    : scope.row[cItem.key]
-                }}</span>
-              </template>
-            </el-table-column>
-          </el-table>
+          <el-super-table
+            v-model="params[item.key]"
+            :size="$attrs.size"
+            :dict="dict"
+            :columns="columns"
+          >
+          </el-super-table>
         </el-tab-pane>
       </el-tabs>
     </el-drawer>

+ 33 - 58
src/views/purchase/apply/submit/index.vue

@@ -12,8 +12,6 @@ export default {
   data() {
     return {
       title: "提交OA",
-      visible: false,
-      loading: false,
     };
   },
   computed: {
@@ -43,31 +41,39 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const ids = prop.map((item) => item.id).join(",");
-        const { msg, code } = await SUBMIT(ids);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+      this.$confirm(`是否提交数据项至OA系统?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
+            try {
+              // try
+              const { selectData } = this.$props;
+              const ids = selectData.map((item) => item.id).join(",");
+              const { msg, code } = await SUBMIT(ids);
+              if (code === 200) {
+                done();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -83,36 +89,5 @@ export default {
     @click="open"
   >
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(selectData)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert
-        title="是否提交数据项至OA系统"
-        type="info"
-        show-icon
-        :closable="false"
-        style="margin-bottom: 10px"
-      >
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 0 - 131
src/views/purchase/catalogue/column.js

@@ -1,131 +0,0 @@
-export const FormColumns = [
-  {
-    key: "puOrgName",
-    title: "采购组织",
-  },
-  // {
-  //   key: "puOrg",
-  //   title: "采购组织编码",
-  // },
-  { key: "materialName", title: "物料" },
-  { key: "materialCode", title: "物料编码" },
-  { key: "materialClassifyName", title: "物料一级分类" },
-  { key: "manufacturerName", title: "生产厂家名称" },
-  // { key: "manufacturer", title: "生产厂家" },
-  { key: "model", title: "物料型号" },
-  { key: "specification", title: "物料规格" },
-  // { key: "supplier", title: "供应商" },
-  {
-    key: "supplierName",
-    title: "供应商名称",
-  },
-  // { key: "customer", title: "客户" },
-  { key: "customerName", title: "客户" },
-  {
-    key: "taxPrice",
-    title: "主含税单价",
-    formatter: (prop) => (prop ? prop.toFixed(6) : null),
-  },
-  // { key: "unit", title: "主单位" },
-  { key: "unitName", title: "主单位" },
-  { key: "effectiveDate", title: "价格生效日期" },
-  { key: "endDate", title: "价格失效日期" },
-  // { key: "buyer", title: "采购员" },
-  { key: "buyerName", title: "采购员" },
-  { key: "source", title: "来源单据编号" },
-  {
-    key: "convertRate",
-    title: "换算率",
-    formatter: (prop) => (prop ? prop.toFixed(6) : null),
-  },
-  {
-    key: "status",
-    title: "有效状态",
-    inputType: "Select",
-    referName: "is_effective",
-    width: 100,
-  },
-  {
-    key: "enableStatus",
-    title: "启用状态",
-    inputType: "Select",
-    referName: "is_effective",
-    width: 100,
-  },
-  {
-    key: "materialStatus",
-    title: "物料启用状态",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-  {
-    key: "isDistribution",
-    title: "配送价",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-  {
-    key: "priceType",
-    title: "价格类型",
-    inputType: "Select",
-    referName: "sys_price_type",
-  },
-  { key: "demandCode", title: "采购需求单号" },
-  { key: "expiryEarly", title: "效期预警" },
-  { key: "priority", title: "含税/无税优先" },
-  { key: "createByName", title: "创建人" },
-  { key: "updateByName", title: "更新人名称" },
-];
-
-export const SearchColumns = [
-  {
-    key: "puOrgName",
-    title: "采购组织",
-    inputType: "PopoverSelect",
-    referName: "ORG_PARAM",
-    dataMapping: {
-      puOrg: "id",
-      puOrgName: "name",
-    },
-  },
-  {
-    key: "manufacturer",
-    title: "生产厂家",
-    inputType: "Input",
-  },
-  {
-    key: "supplierName",
-    title: "供应商",
-    inputType: "PopoverSelect",
-    referName: "SUPPLIER_PARAM",
-    dataMapping: {
-      supplier: "id",
-      supplierName: "name",
-    },
-  },
-  { key: "source", title: "来源单据编号", inputType: "Input" },
-  {
-    key: "materialCode",
-    title: "物料编码",
-    inputType: "PopoverSelect",
-    referName: "MATERIAL_PARAM",
-    dataMapping: {
-      material: "id",
-      materialCode: "code",
-    },
-  },
-  {
-    key: "status",
-    title: "有效状态",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-  {
-    key: "enableStatus",
-    title: "启用状态",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-];
-
-export default { FormColumns, SearchColumns };

+ 129 - 0
src/views/purchase/catalogue/columns.js

@@ -0,0 +1,129 @@
+import CONFIG from "@/config";
+
+export const TableColumns = [
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {},
+  },
+  { item: { key: "materialName", title: "物料" }, attr: {} },
+  { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+  { item: { key: "materialClassifyName", title: "物料一级分类" }, attr: {} },
+  { item: { key: "manufacturerName", title: "生产厂家名称" }, attr: {} },
+  { item: { key: "model", title: "物料型号" }, attr: {} },
+  { item: { key: "specification", title: "物料规格" }, attr: {} },
+  {
+    item: { key: "supplierName", title: "供应商名称" },
+    attr: {},
+  },
+  { item: { key: "customerName", title: "客户" }, attr: {} },
+  {
+    item: { key: "taxPrice", title: "主含税单价" },
+    attr: {
+      is: "el-computed-input-v2",
+      formatter: (prop) => {
+        return (prop * 1).toFixed(CONFIG.precision);
+      },
+    },
+  },
+  { item: { key: "unitName", title: "主单位" }, attr: {} },
+  { item: { key: "effectiveDate", title: "价格生效日期" }, attr: {} },
+  { item: { key: "endDate", title: "价格失效日期" }, attr: {} },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
+  { item: { key: "source", title: "来源单据" }, attr: {} },
+  {
+    item: { key: "convertRate", title: "换算率" },
+    attr: {
+      is: "el-computed-input-v2",
+      formatter: (prop) => {
+        return (prop * 1).toFixed(CONFIG.precision);
+      },
+    },
+  },
+  {
+    item: { key: "status", title: "有效状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "enableStatus", title: "启用状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "materialStatus", title: "物料启用状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "isDistribution", title: "配送价" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "priceType", title: "价格类型" },
+    attr: { is: "el-dict-tag", dictName: "sys_price_type" },
+  },
+  { item: { key: "demandCode", title: "采购需求单号" }, attr: {} },
+  { item: { key: "expiryEarly", title: "效期预警" }, attr: {} },
+  { item: { key: "priority", title: "含税/无税优先" }, attr: {} },
+  { item: { key: "createByName", title: "创建人" }, attr: {} },
+  { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, fixed: false },
+}));
+
+export const SearchColumns = [
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {
+      is: "el-popover-select-v2",
+      referName: "ORG_PARAM",
+      valueKey: "name",
+      dataMapping: {
+        puOrg: "id",
+        puOrgName: "name",
+      },
+    },
+  },
+  {
+    item: { key: "manufacturer", title: "生产厂家" },
+    attr: { is: "el-input" },
+  },
+  {
+    item: { key: "supplierName", title: "供应商" },
+    attr: {
+      is: "el-popover-select-v2",
+      referName: "SUPPLIER_PARAM",
+      valueKey: "name",
+      dataMapping: {
+        supplier: "id",
+        supplierName: "name",
+      },
+    },
+  },
+  {
+    item: { key: "source", title: "来源单据" },
+    attr: { is: "el-input" },
+  },
+  {
+    item: { key: "materialCode", title: "物料编码" },
+    attr: {
+      is: "el-popover-select-v2",
+      referName: "MATERIAL_PARAM",
+      dataMapping: {
+        material: "id",
+        materialCode: "code",
+      },
+    },
+  },
+  {
+    item: { key: "status", title: "有效状态" },
+    attr: { is: "el-select", dictName: "is_effective" },
+  },
+  {
+    item: { key: "enableStatus", title: "启用状态" },
+    attr: { is: "el-select", dictName: "is_effective" },
+  },
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
+
+export default { TableColumns, SearchColumns };

+ 14 - 0
src/views/purchase/catalogue/dicts.js

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

+ 81 - 17
src/views/purchase/catalogue/enable/index.vue

@@ -3,40 +3,95 @@ import { ENABLE } from "@/api/business/purchase/catalogue";
 
 export default {
   name: "EnableDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+    status: {
+      type: String,
+    },
+  },
   data() {
     return {};
   },
-  computed: {},
+  computed: {
+    title: {
+      get() {
+        const { status } = this.$props;
+        if (status === "Y") {
+          return "启 用";
+        }
+        if (status === "N") {
+          return "停 用";
+        }
+      },
+      set() {},
+    },
+    disabled: {
+      get() {
+        const {
+          selectData,
+          status: enableStatus,
+          selectData: [{ status } = {}],
+        } = this.$props;
+        if (selectData.length < 1) {
+          return true;
+        }
+        if (selectData.length >= 1 && status === "N") {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex((item) => item.enableStatus === enableStatus) >
+            -1
+        ) {
+          return true;
+        }
+      },
+      set() {},
+    },
+  },
   watch: {},
   methods: {
     //
-    open(prop, status) {
-      return new Promise((resolve, reject) => {
-        this.$confirm("是否启停数据项?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async () => {
+    open() {
+      this.$confirm(`是否${this.title.replace(/\s*/g,"")}数据项?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
             try {
               // try
-              const ids = prop.map((item) => item.id);
-              const { msg, code } = await ENABLE({ ids, enableStatus: status });
+              const { status, selectData } = this.$props;
+              const ids = selectData.map((item) => item.id);
+              const { msg, code } = await ENABLE({
+                ids,
+                enableStatus: status,
+              });
               if (code === 200) {
-                resolve(true);
+                done();
                 this.$emit("success");
                 this.$notify.success(msg);
               }
             } catch (err) {
               // catch
-              reject(false);
               console.error(err);
+              instance.confirmButtonText = "确认";
             } finally {
               // finally
+              instance.confirmButtonLoading = false;
             }
-          })
-          .catch(() => reject(false));
-      });
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -44,4 +99,13 @@ export default {
   destroyed() {},
 };
 </script>
-<template></template>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open"
+  >
+    {{ title }}
+  </el-button>
+</template>

+ 44 - 15
src/views/purchase/catalogue/export/index.vue

@@ -1,8 +1,16 @@
 <script>
-import { EXPORT } from "@/api/business/purchase/catalogue";
-
 export default {
   name: "ExportDialog",
+  props: {
+    data: {
+      type: Object,
+      require: true,
+    },
+    page: {
+      type: Object,
+      require: true,
+    },
+  },
   data() {
     return {};
   },
@@ -10,23 +18,42 @@ export default {
   watch: {},
   methods: {
     //
-    open(prop, page) {
+    open() {
       this.$confirm("是否确认导出所有数据项?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "下载中...";
+            try {
+              // try
+              const {
+                data,
+                page: { pageNum, pageSize },
+              } = this.$props;
+              await this.download(
+                "pu/price/catalogue/export",
+                { ...data, pageNum, pageSize },
+                `catalogue_${new Date().getTime()}.xlsx`
+              );
+              await done();
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
       })
-        .then(async () => {
-          const { pageNum, pageSize } = page;
-          this.download(
-            "pu/price/catalogue/export",
-            { ...prop, pageNum, pageSize },
-            `catalogue_${new Date().getTime()}.xlsx`
-          );
-        })
-        .catch((err) => {
-          console.error(err);
-        });
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -34,4 +61,6 @@ export default {
   destroyed() {},
 };
 </script>
-<template></template>
+<template>
+  <el-button v-bind="$attrs" v-on="$listeners" @click="open"> 导 出 </el-button>
+</template>

+ 0 - 21
src/views/purchase/catalogue/hooks/data.js

@@ -1,21 +0,0 @@
-import { initRules, initParams } from "@/utils/init/index.js";
-
-export default function useData(prop) {
-  const { FormColumns } = prop;
-  const size = "mini";
-  const width = "100%";
-  const visible = false;
-  const loading = false;
-  const formColumns = FormColumns;
-  const rules = initRules(FormColumns);
-  const params = initParams(FormColumns);
-  return {
-    size,
-    width,
-    visible,
-    loading,
-    formColumns,
-    rules,
-    params,
-  };
-}

+ 0 - 16
src/views/purchase/catalogue/hooks/dicts.js

@@ -1,16 +0,0 @@
-import { initDicts } from "@/utils/init/index.js";
-
-export default function useDicts(prop) {
-  const { FormColumns = [], TabColumns = [] } = prop;
-  const dicts = Array.from(
-    new Set([
-      ...initDicts(FormColumns),
-      ...initDicts(
-        TabColumns.map((item) => item.tableColumns)
-          .flat()
-          .filter((item) => item.inputType === "Select")
-      ),
-    ])
-  );
-  return dicts;
-}

+ 78 - 222
src/views/purchase/catalogue/index.vue

@@ -1,43 +1,38 @@
 <script>
-import { FormColumns, SearchColumns } from "./column";
+import { dicts } from "./dicts";
+import { TableColumns, SearchColumns } from "./columns";
 import { LIST } from "@/api/business/purchase/catalogue";
-import { initPage, initDicts, initParams } from "@/utils/init/index.js";
+
 export default {
   name: "PuchaseCatalogue",
-  dicts: [...initDicts(SearchColumns), ...initDicts(FormColumns)],
+  dicts: dicts,
   components: {
-    SeeModel: () => import("./see/index.vue"),
-    InvalidModel: () => import("./invalid/index.vue"),
-    EnableModel: () => import("./enable/index.vue"),
-    ExportModel: () => import("./export/index.vue"),
+    SeeButton: () => import("./see/index.vue"),
+    InvButton: () => import("./invalid/index.vue"),
+    EnaButton: () => import("./enable/index.vue"),
+    ExpButton: () => import("./export/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
   data() {
+    const params = this.$init.params(SearchColumns);
     return {
       size: "mini",
       loading: false,
-      searchColumns: SearchColumns,
-      params: initParams(SearchColumns),
+      params: params,
       tableData: [],
       selectData: [],
-      tableColumns: FormColumns,
+      SearchColumns: SearchColumns,
+      TableColumns: TableColumns,
       page: { pageNum: 1, pageSize: 10, total: 0 },
     };
   },
   computed: {},
   created() {
-    this.params.status = "0";
     this.useQuery(this.params, this.page);
   },
   methods: {
     //
-    setSelectable(row) {
-      const { status } = row;
-      // 失效
-      if (status === "2") return false;
-      // other
-      else return true;
-    },
-    //
     async fetchList(prop, page) {
       try {
         this.loading = true;
@@ -52,9 +47,6 @@ export default {
             $index: (pageNum - 1) * pageSize + index + 1,
           }));
           this.page.total = total;
-          this.page.pageNum = pageNum;
-          this.page.pageSize = pageSize;
-          return this.tableData;
         }
       } catch (err) {
         // catch
@@ -70,8 +62,9 @@ export default {
     },
     // 重 置
     useReset() {
-      this.page = initPage();
-      this.params = initParams(SearchColumns);
+      this.page.pageNum = 1;
+      this.page.pageSize = 10;
+      this.params = this.$init.params(SearchColumns);
       this.useQuery(this.params, this.page);
     },
     // 选 择
@@ -80,42 +73,9 @@ export default {
     },
     // 明 细
     async useSee(prop) {
-      const { id, $index } = prop;
-      const { open } = this.$refs.SeeModel;
-      await open(id, $index, this.page);
-    },
-    // 失 效
-    async useInvalid(prop) {
-      const { open } = this.$refs.InvalidModel;
-      await open(prop);
-    },
-    hasPowerInvalid(prop) {
-      if (prop.length === 1) {
-        const [{ status }] = prop;
-        if (status === "2") return false;
-        else return true;
-      } else {
-        return !!prop.length;
-      }
-    },
-    // 启 停
-    async useEnable(prop, status) {
-      const { open } = this.$refs.EnableModel;
-      await open(prop, status);
-    },
-    hasPowerEnable(prop) {
-      if (prop.length === 1) {
-        const [{ status }] = prop;
-        if (status === "2") return false;
-        else return true;
-      } else {
-        return !!prop.length;
-      }
-    },
-    // 导 出
-    async useExport(prop, page) {
-      const { open } = this.$refs.ExportModel;
-      await open(prop, page);
+      const { $index } = prop;
+      const { open } = this.$refs.SeeButton;
+      await open($index);
     },
   },
 };
@@ -123,160 +83,72 @@ export default {
 
 <template>
   <el-card v-loading="loading" :body-style="{ padding: 0 }">
-    <see-model ref="SeeModel"></see-model>
-    <export-model ref="ExportModel"></export-model>
-    <invalid-model
-      ref="InvalidModel"
-      @success="useQuery(params, page)"
-    ></invalid-model>
-    <enable-model
-      ref="EnableModel"
-      @success="useQuery(params, page)"
-    ></enable-model>
-    <el-form
+    <el-super-search
+      v-model="params"
       :size="size"
-      :model="params"
-      label-width="auto"
-      label-position="right"
-    >
-      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
-        <el-col
-          v-for="column in searchColumns"
-          :key="column.title"
-          :span="column.span || 6"
-        >
-          <el-form-item :prop="column.key" :label="column.title">
-            <el-input
-              v-if="column.inputType === 'Input'"
-              v-model="params[column.key]"
-              :placeholder="column.placeholder"
-              style="width: 100%"
-              @keyup.enter.native="useQuery(params, page)"
-            ></el-input>
-            <el-select
-              v-if="column.inputType === 'Select'"
-              v-model="params[column.key]"
-              :disabled="column.disabled"
-              :clearable="column.clearable"
-              :placeholder="column.placeholder"
-              style="width: 100%"
-              @change="useQuery(params, page)"
-              @keyup.enter.native="useQuery(params, page)"
-            >
-              <el-option
-                v-for="item in dict.type[column.referName]"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              >
-              </el-option>
-            </el-select>
-            <dr-popover-select
-              v-if="column.inputType === 'PopoverSelect'"
-              v-model="params[column.key]"
-              :size="size"
-              :source.sync="params"
-              :title="column.title"
-              :type="column.referName"
-              :multiple="column.multiple"
-              :readonly="column.readonly"
-              :value-key="column.valueKey"
-              :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
-              @change="useQuery(params, page)"
-              @keyup.enter.native="useQuery(params, page)"
-            >
-            </dr-popover-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <el-row style="padding: 0 20px">
-      <el-button :size="size" @click="useQuery(params, page)">
-        查 询
-      </el-button>
-      <el-button :size="size" @click="useReset"> 重 置 </el-button>
-      <el-button :size="size" @click="useExport(params, page)">
-        导 出
-      </el-button>
-      <el-button
-        v-show="hasPowerInvalid(selectData)"
-        :size="size"
-        @click="useInvalid(selectData)"
-      >
-        失 效
-      </el-button>
-      <el-button
-        v-show="hasPowerEnable(selectData)"
-        :size="size"
-        @click="useEnable(selectData, '0')"
-      >
-        启 用
-      </el-button>
-      <el-button
-        v-show="hasPowerEnable(selectData)"
-        :size="size"
-        @click="useEnable(selectData, '2')"
-      >
-        停 用
-      </el-button>
-    </el-row>
-    <el-table
-      v-if="tableData.length"
+      :dict="dict"
+      :columns="SearchColumns"
+      @reset="useReset"
+      @submit="useQuery(params, page)"
+    ></el-super-search>
+    <div style="padding: 0 20px; text-align: right">
+      <el-button-group>
+        <ena-button
+          :size="size"
+          :select-data="selectData"
+          status="Y"
+          @success="useQuery(params, page)"
+        ></ena-button>
+        <ena-button
+          :size="size"
+          :select-data="selectData"
+          status="N"
+          @success="useQuery(params, page)"
+        ></ena-button>
+      </el-button-group>
+      <el-button-group>
+        <inv-button
+          :size="size"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></inv-button>
+        <see-button
+          v-show="false"
+          ref="SeeButton"
+          :size="size"
+          :dict="dict"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></see-button
+      ></el-button-group>
+      <el-button-group>
+        <exp-button
+          :size="size"
+          :page="page"
+          :data="params"
+          @success="useQuery(params, page)"
+        ></exp-button>
+      </el-button-group>
+    </div>
+    <el-super-table
+      v-model="tableData"
       :size="size"
-      :data="tableData"
-      highlight-current-row
-      @row-click="useSelect([$event])"
+      :dict="dict"
+      :columns="TableColumns"
+      stroage
+      hideOperationColumns
       @row-dblclick="useSee"
       @selection-change="useSelect"
-      style="width: 100%; margin: 20px 0 0 0"
     >
-      <el-table-column
-        fixed
-        width="55"
-        align="center"
-        type="selection"
-        :selectable="setSelectable"
-      >
+      <el-table-column fixed width="55" align="center" type="selection">
       </el-table-column>
-      <el-table-column fixed width="55" align="center" type="index">
-        <template slot-scope="scope">
-          {{ scope.row.$index }}
-        </template>
-      </el-table-column>
-      <el-table-column
-        v-for="(column, index) in tableColumns"
-        :key="index"
-        :prop="column.key"
-        :label="column.title"
-        :width="column.width || 200"
-        show-overflow-tooltip
-      >
-        <template slot-scope="scope">
-          <dict-tag
-            v-if="column.inputType === 'Select'"
-            :size="size"
-            :value="scope.row[column.key]"
-            :options="dict.type[column.referName]"
-          />
-          <dr-file-preview
-            v-else-if="column.inputType === 'Upload'"
-            v-model="scope.row[column.key]"
-          ></dr-file-preview>
-          <span v-else>{{
-            column.formatter
-              ? column.formatter(scope.row[column.key])
-              : scope.row[column.key]
-          }}</span>
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-empty v-else :image-size="200"></el-empty>
+    </el-super-table>
     <pagination
       :total="page.total"
       :page.sync="page.pageNum"
       :limit.sync="page.pageSize"
       @pagination="useQuery(params, page)"
+      style="margin: 20px"
     />
   </el-card>
 </template>
@@ -286,24 +158,8 @@ export default {
   height: 100%;
   margin: 10px;
   padding: 0 0 20px 0;
-  .el-form {
-    padding: 20px 0 0;
-  }
-  .el-row {
-    display: flex;
-    flex-wrap: wrap;
-    padding: 0 20px;
-  }
-  ::v-deep .el-table--mini {
-    width: 100%;
-    margin: 20px 0 0 0;
-    .el-table__cell {
-      height: 50px;
-    }
-    td.el-table__cell {
-      border-right: 0;
-      // border-bottom: 0;
-    }
-  }
+}
+.el-button-group + .el-button-group {
+  margin: 0 0 0 10px;
 }
 </style>

+ 54 - 16
src/views/purchase/catalogue/invalid/index.vue

@@ -3,40 +3,69 @@ import { INVALID } from "@/api/business/purchase/catalogue";
 
 export default {
   name: "InvalidDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
   data() {
     return {};
   },
-  computed: {},
+  computed: {
+    disabled: {
+      get() {
+        const { selectData } = this.$props;
+        if (selectData.length < 1) {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex(({ status }) => status === "N") > -1
+        ) {
+          return true;
+        }
+      },
+      set() {},
+    },
+  },
   watch: {},
   methods: {
     //
-    open(prop) {
-      return new Promise((resolve, reject) => {
-        this.$confirm("是否失效数据项?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async () => {
+    open() {
+      this.$confirm("是否失效数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
             try {
               // try
-              const ids = prop.map((item) => item.id);
+              const { selectData } = this.$props;
+              const ids = selectData.map((item) => item.id);
               const { msg, code } = await INVALID({ ids });
               if (code === 200) {
-                resolve(true);
+                done();
                 this.$emit("success");
                 this.$notify.success(msg);
               }
             } catch (err) {
               // catch
-              reject(false);
               console.error(err);
+              instance.confirmButtonText = "确认";
             } finally {
               // finally
+              instance.confirmButtonLoading = false;
             }
-          })
-          .catch(() => reject(false));
-      });
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -44,4 +73,13 @@ export default {
   destroyed() {},
 };
 </script>
-<template></template>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open"
+  >
+    失 效
+  </el-button>
+</template>

+ 0 - 71
src/views/purchase/catalogue/see/column.js

@@ -1,71 +0,0 @@
-export const FormColumns = [
-  {
-    key: "puOrgName",
-    title: "采购组织",
-  },
-  { key: "materialName", title: "物料" },
-  { key: "materialCode", title: "物料编码" },
-  { key: "materialClassifyName", title: "物料一级分类" },
-  { key: "manufacturerName", title: "生产厂家" },
-  { key: "model", title: "物料型号" },
-  { key: "specification", title: "物料规格" },
-  {
-    key: "supplierName",
-    title: "供应商",
-  },
-  { key: "customerName", title: "客户" },
-  {
-    key: "taxPrice",
-    title: "主含税单价",
-    formatter: (prop) => (prop ? prop.toFixed(6) : null),
-  },
-  { key: "unitName", title: "主单位" },
-  { key: "effectiveDate", title: "价格生效日期" },
-  { key: "endDate", title: "价格失效日期" },
-  { key: "buyerName", title: "采购员" },
-  { key: "source", title: "来源单据编号" },
-  {
-    key: "convertRate",
-    title: "换算率",
-    formatter: (prop) => (prop ? prop.toFixed(6) : null),
-  },
-  {
-    key: "status",
-    title: "有效状态",
-    inputType: "Select",
-    referName: "is_effective",
-    width: 100,
-  },
-  {
-    key: "enableStatus",
-    title: "启用状态",
-    inputType: "Select",
-    referName: "is_effective",
-    width: 100,
-  },
-  {
-    key: "materialStatus",
-    title: "物料启用状态",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-  {
-    key: "isDistribution",
-    title: "配送价",
-    inputType: "Select",
-    referName: "is_effective",
-  },
-  {
-    key: "priceType",
-    title: "价格类型",
-    inputType: "Select",
-    referName: "sys_price_type",
-  },
-  { key: "demandCode", title: "采购需求单号" },
-  { key: "expiryEarly", title: "效期预警" },
-  { key: "priority", title: "含税/无税优先" },
-  { key: "createByName", title: "创建人" },
-  { key: "updateByName", title: "更新人名称" },
-];
-
-export default { FormColumns };

+ 72 - 0
src/views/purchase/catalogue/see/columns.js

@@ -0,0 +1,72 @@
+import CONFIG from "@/config";
+
+export const TableColumns = [
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {},
+  },
+  { item: { key: "materialName", title: "物料" }, attr: {} },
+  { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+  { item: { key: "materialClassifyName", title: "物料一级分类" }, attr: {} },
+  { item: { key: "manufacturerName", title: "生产厂家名称" }, attr: {} },
+  { item: { key: "model", title: "物料型号" }, attr: {} },
+  { item: { key: "specification", title: "物料规格" }, attr: {} },
+  {
+    item: { key: "supplierName", title: "供应商名称" },
+    attr: {},
+  },
+  { item: { key: "customerName", title: "客户" }, attr: {} },
+  {
+    item: { key: "taxPrice", title: "主含税单价" },
+    attr: {
+      is: "el-computed-input-v2",
+      formatter: (prop) => {
+        return (prop * 1).toFixed(CONFIG.precision);
+      },
+    },
+  },
+  { item: { key: "unitName", title: "主单位" }, attr: {} },
+  { item: { key: "effectiveDate", title: "价格生效日期" }, attr: {} },
+  { item: { key: "endDate", title: "价格失效日期" }, attr: {} },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
+  { item: { key: "source", title: "来源单据" }, attr: {} },
+  {
+    item: { key: "convertRate", title: "换算率" },
+    attr: {
+      is: "el-computed-input-v2",
+      formatter: (prop) => {
+        return (prop * 1).toFixed(CONFIG.precision);
+      },
+    },
+  },
+  {
+    item: { key: "status", title: "有效状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "enableStatus", title: "启用状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "materialStatus", title: "物料启用状态" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "isDistribution", title: "配送价" },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
+  },
+  {
+    item: { key: "priceType", title: "价格类型" },
+    attr: { is: "el-dict-tag", dictName: "sys_price_type" },
+  },
+  { item: { key: "demandCode", title: "采购需求单号" }, attr: {} },
+  { item: { key: "expiryEarly", title: "效期预警" }, attr: {} },
+  { item: { key: "priority", title: "含税/无税优先" }, attr: {} },
+  { item: { key: "createByName", title: "创建人" }, attr: {} },
+  { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, fixed: false },
+}));
+
+export default { TableColumns };

+ 87 - 133
src/views/purchase/catalogue/see/index.vue

@@ -1,36 +1,61 @@
 <script>
-import Column from "./column";
-import useData from "../hooks/data";
-import useDicts from "../hooks/dicts";
-import { ITEM } from "@/api/business/purchase/catalogue";
+import { TableColumns } from "./columns";
+import { ITEM, LIST } from "@/api/business/purchase/catalogue";
 
 export default {
   name: "SeeDrawer",
-  dicts: useDicts(Column),
+  components: {
+    ElSuperDescriptions: () =>
+      import("@/components/super-descriptions/index.vue"),
+  },
   data() {
     return {
-      column: 3,
+      column: 1,
       title: "明 细",
-      lastPage: {},
-      ...useData(Column),
+      width: "25%",
+      visible: false,
+      loading: false,
+      params: {},
+      TableColumns: TableColumns,
     };
   },
+  props: {
+    dict: {
+      type: Object,
+    },
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
   computed: {
-    root: function () {
-      return this.$parent.$parent;
+    disabled: {
+      get() {
+        const { selectData } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
+      },
+      set() {},
     },
   },
   watch: {},
   methods: {
     //
-    async fetchItem(prop, index) {
+    async fetchItem(prop) {
       try {
         // try
         this.loading = true;
-        const { code, data } = await ITEM(prop);
+        const { params } = this.$parent.$parent.$parent;
+        const {
+          total,
+          rows: [{ id }],
+        } = await LIST({ ...params }, { pageNum: prop, pageSize: 1 });
+        const { code, data } = await ITEM(id);
         if (code === 200) {
           this.params = data;
-          this.params.$index = index;
+          this.params.$index = prop;
+          this.params.$total = total;
           return true;
         } else {
           return false;
@@ -44,49 +69,13 @@ export default {
       }
     },
     //
-    async open(prop, index, page) {
-      this.lastPage = { ...page };
-      this.visible = await this.fetchItem(prop, index);
+    async open(prop) {
+      this.visible = await this.fetchItem(prop);
     },
     //
     async hide() {
       this.visible = false;
-      const { params, fetchList } = this.root;
-      fetchList(params, this.lastPage);
-    },
-    //
-    async useQueryLast(prop) {
-      const { params, fetchList } = this.root;
-      if (prop >= 1) {
-        const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
-        this.params = row;
-      }
-    },
-    //
-    async useQueryPrev(prop) {
-      const { params, fetchList } = this.root;
-      const [row] = await fetchList(params, { pageSize: 1, pageNum: prop });
-      this.params = row;
-    },
-    //
-    async useInvalid(prop) {
-      await this.root
-        .useInvalid(prop)
-        .then(() => {
-          this.fetchItem(this.params.id);
-        })
-        .catch(() => {});
-    },
-    //
-    async useEnable(prop) {
-      const [{ enableStatus }] = prop;
-      const status = enableStatus === "2" ? "0" : "2";
-      await this.root
-        .useEnable(prop, status)
-        .then(() => {
-          this.fetchItem(this.params.id);
-        })
-        .catch(() => {});
+      this.params = initParams(this.TableColumns);
     },
   },
   created() {},
@@ -95,90 +84,55 @@ export default {
 };
 </script>
 <template>
-  <el-drawer
-    :size="width"
-    :title="title"
-    :show-close="false"
-    :visible.sync="visible"
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open(selectData[0].$index)"
   >
-    <template slot="title">
-      <span>{{ title }}</span>
-      <span>
-        <el-tooltip effect="dark" content="上一页" placement="bottom-end">
-          <el-button
-            :size="size"
-            :disabled="params.$index === 1"
-            circle
-            icon="el-icon-top"
-            @click="useQueryLast(params.$index - 1)"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip effect="dark" content="下一页" placement="bottom-end">
-          <el-button
-            :size="size"
-            :disabled="params.$index === root.page.total"
-            circle
-            icon="el-icon-bottom"
-            @click="useQueryPrev(params.$index + 1)"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip
-          v-if="root.hasPowerInvalid([params])"
-          effect="dark"
-          content="失 效"
-          placement="bottom-end"
-        >
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-no-smoking"
-            @click="useInvalid([params])"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip
-          v-if="root.hasPowerEnable([params])"
-          effect="dark"
-          :content="params.enableStatus === '2' ? '启 用' : '停 用'"
-          placement="bottom-end"
-        >
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-turn-off-microphone"
-            @click="useEnable([params])"
-          ></el-button>
-        </el-tooltip>
+    {{ title }}
+    <el-drawer
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+    >
+      <div
+        style="
+          z-index: 6666;
+          position: fixed;
+          right: 20px;
+          top: 50%;
+          transform: translateY(-50%);
+          display: flex;
+          flex-direction: column;
+        "
+      >
+        <el-button
+          :size="$attrs.size"
+          :disabled="params.$index === 1"
+          circle
+          icon="el-icon-top"
+          @click="fetchItem(params.$index - 1)"
+          style="margin: 0 0 10px 0"
+        ></el-button>
         <el-button
-          :size="size"
+          :size="$attrs.size"
+          :disabled="params.$index === params.$total"
           circle
-          type="danger"
-          icon="el-icon-close"
-          @click="hide"
+          icon="el-icon-bottom"
+          @click="fetchItem(params.$index + 1)"
+          style="margin: 0"
         ></el-button>
-      </span>
-    </template>
-    <el-descriptions :size="size" :column="column" border style="margin: 10px">
-      <el-descriptions-item
-        v-if="params[column.key]"
-        v-for="(column, index) in formColumns"
-        :key="index"
-        :label="column.title"
+      </div>
+      <el-super-descriptions
+        v-model="params"
+        :dict="dict"
+        :column="column"
+        :size="$attrs.size"
+        :columns="TableColumns"
       >
-        <dict-tag
-          v-if="column.inputType === 'Select'"
-          :size="size"
-          :value="params[column.key]"
-          :options="dict.type[column.referName]"
-        />
-        <span v-else-if="column.inputType === 'Upload'">
-          <dr-file-preview v-model="params[column.key]"></dr-file-preview>
-        </span>
-        <span v-else>{{
-          column.formatter
-            ? column.formatter(params[column.key])
-            : params[column.key]
-        }}</span>
-      </el-descriptions-item>
-    </el-descriptions>
-  </el-drawer>
+      </el-super-descriptions>
+    </el-drawer>
+  </el-button>
 </template>

+ 0 - 0
src/views/purchase/contract/add/column.js → src/views/purchase/contract/add/columns.js


+ 1 - 1
src/views/purchase/contract/add/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useColumns from "./column";
+import useColumns from "./columns";
 import { initParams, initRules } from "@/utils/init.js";
 import { REFER } from "@/components/popover-select/api";
 import { ADD, CODE } from "@/api/business/purchase/contract";

+ 7 - 16
src/views/purchase/contract/column.js → src/views/purchase/contract/columns.js

@@ -14,7 +14,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return (prop * 1).toFixed(CONFIG.precision);
       },
-      isHidden: true,
     },
   },
   { item: { key: "buyerName", title: "采购员" }, attr: {} },
@@ -24,7 +23,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_contract_type",
-      isHidden: true,
     },
   },
   {
@@ -34,7 +32,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return (prop * 1).toFixed(CONFIG.precision);
       },
-      isHidden: true,
     },
   },
   { item: { key: "puDeptName", title: "采购部门" }, attr: {} },
@@ -43,7 +40,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_supplier_tier",
-      isHidden: true,
     },
   },
   {
@@ -57,7 +53,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return (prop * 1).toFixed(CONFIG.precision);
       },
-      isHidden: true,
     },
   },
   {
@@ -65,7 +60,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_approve_flow",
-      isHidden: true,
     },
   },
   {
@@ -73,7 +67,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_consumable_class",
-      isHidden: true,
     },
   },
   {
@@ -87,7 +80,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return (prop * 1).toFixed(CONFIG.precision);
       },
-      isHidden: true,
     },
   },
   {
@@ -95,7 +87,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_contract_format",
-      isHidden: true,
     },
   },
   {
@@ -110,7 +101,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return (prop * 1).toFixed(CONFIG.precision);
       },
-      isHidden: true,
     },
   },
   {
@@ -118,7 +108,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_emergency_degree",
-      isHidden: true,
     },
   },
   { item: { key: "project", title: "项目医院" }, attr: {} },
@@ -127,7 +116,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_delivery_type",
-      isHidden: true,
     },
   },
   { item: { key: "source", title: "合同来源" }, attr: {} },
@@ -144,7 +132,6 @@ export const TableColumns = [
     attr: {
       is: "el-dict-tag",
       dictName: "puarchase_contract_freight_methods",
-      isHidden: true,
     },
   },
   {
@@ -226,7 +213,6 @@ export const TableColumns = [
       formatter: (prop) => {
         return prop ? (prop * 1).toFixed(CONFIG.precision) : "0.000000";
       },
-      isHidden: true,
     },
   },
   { item: { key: "currencyName", title: "币种" }, attr: {} },
@@ -239,7 +225,7 @@ export const TableColumns = [
   item: { ...item, hidden: true, fixed: false },
 }));
 
-export const FormColumns = [
+export const SearchColumns = [
   {
     item: {
       key: "contractName",
@@ -266,4 +252,9 @@ export const FormColumns = [
       dictName: "sys_yes_no",
     },
   },
-];
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
+
+export default { TableColumns, SearchColumns };

+ 34 - 57
src/views/purchase/contract/delete/index.vue

@@ -12,8 +12,6 @@ export default {
   data() {
     return {
       title: "删 除",
-      visible: false,
-      loading: false,
     };
   },
   computed: {
@@ -40,30 +38,40 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { msg, code } = await REMOVE(prop);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+      this.$confirm("是否删除数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
+            try {
+              // try
+              const {
+                selectData: [{ id }],
+              } = this.$props;
+              const { msg, code } = await REMOVE(id);
+              if (code === 200) {
+                done();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -79,36 +87,5 @@ export default {
     @click="open"
   >
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(selectData[0].id)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert
-        title="是否删除数据项?"
-        type="info"
-        show-icon
-        :closable="false"
-        style="margin-bottom: 10px"
-      >
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 14 - 0
src/views/purchase/contract/dicts.js

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

+ 0 - 0
src/views/purchase/contract/edit/column.js → src/views/purchase/contract/edit/columns.js


+ 1 - 1
src/views/purchase/contract/edit/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useColumns from "./column";
+import useColumns from "./columns";
 import { initParams, initRules } from "@/utils/init.js";
 import { REFER } from "@/components/popover-select/api";
 import {

+ 30 - 69
src/views/purchase/contract/export/index.vue

@@ -14,8 +14,6 @@ export default {
   data() {
     return {
       title: "导 出",
-      visible: false,
-      loading: false,
     };
   },
   computed: {},
@@ -23,48 +21,41 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop, page) {
-      try {
-        // try
-        this.loading = true;
-        const { pageNum, pageSize } = page;
-        await this.download(
-          "pu/order/generate/export",
-          { ...prop, pageNum, pageSize },
-          `task_${new Date().getTime()}.xlsx`
-        );
-        await this.hide();
-      } catch (err) {
-        // catch
-      } finally {
-        // loading
-        this.loading = false;
-      }
-    },
-    //
-    open(prop) {
       this.$confirm("是否确认导出所有数据项?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "下载中...";
+            try {
+              // try
+              const {
+                data,
+                page: { pageNum, pageSize },
+              } = this.$props;
+              await this.download(
+                "pu/contract/export",
+                { ...data, pageNum, pageSize },
+                `contract_${new Date().getTime()}.xlsx`
+              );
+              await done();
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
       })
-        .then(() => {
-          this.download(
-            "pu/contract/export",
-            { ...prop },
-            `contract_${new Date().getTime()}.xlsx`
-          );
-        })
-        .catch((err) => {
-          console.error(err);
-        });
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -75,35 +66,5 @@ export default {
 <template>
   <el-button v-bind="$attrs" v-on="$listeners" @click="open">
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(params, page)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert
-        title="是否确认导出所有数据项?"
-        type="info"
-        show-icon
-        :closable="false"
-      >
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 19 - 19
src/views/purchase/contract/index.vue

@@ -1,14 +1,11 @@
 <script>
-import { TableColumns, FormColumns as SearchColumns } from "./column";
+import { dicts } from "./dicts";
 import { LIST } from "@/api/business/purchase/contract";
-import { initDicts, initParams } from "@/utils/init.js";
+import { TableColumns, SearchColumns } from "./columns";
+console.log(dicts);
 export default {
   name: "PuchaseContract",
-  dicts: [
-    ...initDicts(SearchColumns),
-    ...initDicts(TableColumns),
-    "puarchase_contract_origin",
-  ],
+  dicts: [...dicts, "puarchase_contract_origin"],
   components: {
     AddButton: () => import("./add/index.vue"),
     SeeButton: () => import("./see/index.vue"),
@@ -22,13 +19,14 @@ export default {
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
   data() {
+    const params = this.$init.params(SearchColumns);
     return {
       size: "mini",
       loading: false,
-      SearchColumns: SearchColumns,
-      params: initParams(SearchColumns),
+      params: params,
       tableData: [],
       selectData: [],
+      SearchColumns: SearchColumns,
       TableColumns: TableColumns,
       page: { pageNum: 1, pageSize: 10, total: 0 },
     };
@@ -73,7 +71,7 @@ export default {
     useReset() {
       this.page.pageNum = 1;
       this.page.pageSize = 10;
-      this.params = initParams(SearchColumns);
+      this.params = this.$init.params(SearchColumns);
       this.useQuery(this.params, this.page);
     },
     // 选 择
@@ -86,12 +84,6 @@ export default {
       const { open } = this.$refs.SeeButton;
       await open(id);
     },
-    // 导 出
-    async useExport(prop, page) {
-      const { pageNum, pageSize } = page;
-      const { open } = this.$refs.ExportButton;
-      await open({ ...prop, pageNum, pageSize });
-    },
   },
 };
 </script>
@@ -107,22 +99,26 @@ export default {
       @submit="useQuery(params, page)"
     ></el-super-search>
     <div style="padding: 0 20px; text-align: right">
-      <el-button-group style="margin: 0 10px 0 0">
+      <el-button-group>
         <add-button
           :size="size"
+          :dict="dict"
+          :add-type="'add'"
           :select-data="selectData"
           @success="useQuery(params, page)"
         ></add-button>
         <add-button
           :size="size"
+          :dict="dict"
           :add-type="'record'"
           :select-data="selectData"
           @success="useQuery(params, page)"
         ></add-button>
       </el-button-group>
-      <el-button-group style="margin: 0 10px 0 0">
+      <el-button-group>
         <edit-button
           :size="size"
+          :dict="dict"
           :select-data="selectData"
           @success="useQuery(params, page)"
         ></edit-button>
@@ -134,11 +130,12 @@ export default {
         <see-button
           v-show="false"
           :size="size"
+          :dict="dict"
           :select-data="selectData"
           ref="SeeButton"
         ></see-button
       ></el-button-group>
-      <el-button-group style="margin: 0 10px 0 0">
+      <el-button-group>
         <subm-button
           :size="size"
           :select-data="selectData"
@@ -192,4 +189,7 @@ export default {
   margin: 10px;
   padding: 0 0 20px 0;
 }
+.el-button-group + .el-button-group {
+  margin: 0 0 0 10px;
+}
 </style>

+ 0 - 0
src/views/purchase/contract/see/column.js → src/views/purchase/contract/see/columns.js


+ 1 - 1
src/views/purchase/contract/see/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useColumns from "./column";
+import useColumns from "./columns";
 import { initParams } from "@/utils/init.js";
 import { ITEM } from "@/api/business/purchase/contract";
 

+ 34 - 56
src/views/purchase/contract/submit/index.vue

@@ -12,8 +12,6 @@ export default {
   data() {
     return {
       title: "提交OA",
-      visible: false,
-      loading: false,
     };
   },
   computed: {
@@ -40,30 +38,40 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { msg, code } = await SUBMIT(prop);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+      this.$confirm("是否提交数据项至OA系统?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
+            try {
+              // try
+              const {
+                selectData: [{ id }],
+              } = this.$props;
+              const { msg, code } = await SUBMIT(id);
+              if (code === 200) {
+                done();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -79,35 +87,5 @@ export default {
     @click="open"
   >
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(selectData[0].id)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert
-        title="是否提交数据项至OA系统?"
-        type="info"
-        show-icon
-        :closable="false"
-      >
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 34 - 49
src/views/purchase/contract/termination/index.vue

@@ -40,30 +40,40 @@ export default {
   methods: {
     //
     open() {
-      this.visible = true;
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { msg, code } = await TERMINATION({ id: prop });
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+      this.$confirm("是否终止数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+        beforeClose: async (action, instance, done) => {
+          if (action === "confirm") {
+            instance.confirmButtonLoading = true;
+            instance.confirmButtonText = "执行中...";
+            try {
+              // try
+              const {
+                selectData: [{ id }],
+              } = this.$props;
+              const { msg, code } = await TERMINATION({ id });
+              if (code === 200) {
+                done();
+                this.$emit("success");
+                this.$notify.success(msg);
+              }
+            } catch (err) {
+              // catch
+              console.error(err);
+              instance.confirmButtonText = "确认";
+            } finally {
+              // finally
+              instance.confirmButtonLoading = false;
+            }
+          } else {
+            done();
+          }
+        },
+      })
+        .then(() => {})
+        .catch(() => {});
     },
   },
   created() {},
@@ -79,30 +89,5 @@ export default {
     @click="open"
   >
     {{ title }}
-    <el-dialog
-      :title="title"
-      :visible.sync="visible"
-      width="25%"
-      append-to-body
-      @close="hide"
-    >
-      <div slot="footer">
-        <el-button
-          :size="$attrs.size"
-          :loading="loading"
-          @click="visible = false"
-          >取 消</el-button
-        >
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="submit(selectData[0].id)"
-          >确 认</el-button
-        >
-      </div>
-      <el-alert title="是否终止数据项?" type="info" show-icon :closable="false">
-      </el-alert>
-    </el-dialog>
   </el-button>
 </template>

+ 113 - 133
src/views/purchase/purchase-order/column.js

@@ -1,7 +1,3 @@
-// import {
-//   initColumns,
-//   initDicts,
-// } from "@/utils/init/index.js";
 
 export const TableColumns = [
   { 
@@ -913,202 +909,186 @@ export const TabColumns = [
   },
 ];
 
-// export const SearchColumns = TableColumns.filter((element) => element.search);
 export const SearchColumns = [
   {
-    key: "source",
-    title: "订单来源",  
-    inputType: "Select",
-    referName: "order_source", // 字典名
-    clearable:true,
+    item:{
+      key: "source",
+      title: "订单来源",  
+    },
     attr:{
-      is: "el-dict-tag",
+      clearable:true,
+      is: "el-select",
       dictName: "order_source",
     },
   },
   {
-    key: "code",
-    title: "订单编号",  
-    inputType: "Input",
-    clearable:true,
+    item:{
+      key: "code",
+      title: "订单编号",  
+    },
     attr: {
+      clearable:true,
       is: "el-input",
     },
   },
   {
-    key: "date",
-    title: "订单日期",  
-    type: "daterange",
-    inputType: "DatePicker",
-    unlinkPanels: true,
-    rangeSeparator: "至",
-    valueFormat: "yyyy-MM-dd",
-    endPlaceholder: "结束日期",
-    startPlaceholder: "开始日期",
-    clearable:true,
+    item:{
+      key: "date",
+      title: "订单日期",  
+     
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-date-picker",
+      type: "daterange",
+      unlinkPanels: true,
+      rangeSeparator: "至",
+      valueFormat: "yyyy-MM-dd",
+      endPlaceholder: "结束日期",
+      startPlaceholder: "开始日期",
+      value: [],
     },
   },
   {
-    key: "status",
-    title: "单据状态",
-    inputType: "Select",
-    referName: "documents_status", // 字典名
-    clearable:true,
+    item:{
+      key: "status",
+      title: "单据状态",
+    },
     attr:{
-      is: "el-dict-tag",
+      clearable:true,
+      is: "el-select",
       dictName: "documents_status",
     },
   },
   { 
-    key: "supplierName", 
-    title: "供应商", 
-    inputType: "PopoverSelect",
-    valueKey: "id",
-    referName: "SUPPLIER_PARAM",
-    dataMapping: {
-      // supplier: "id",
-      supplierName: "name",
+    item:{
+      key: "supplierName", 
+      title: "供应商", 
     },
-    queryParams: () => ({}),
-    clearable:true,
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "SUPPLIER_PARAM",
     },
   },
   {
-    key: "puOrgIds",
-    title: "采购组织",
-    inputType: "PopoverSelect",
-    multiple:true,
-    valueKey: "id",
-    referName: "ORG_PARAM",
-    dataMapping: {},
-    queryParams: () => ({}),
-    clearable:true,
+    item:{
+      key: "puOrgIds",
+      title: "采购组织",
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-multiple-select-v2",
+      valueKey: "id",
+      referName: "ORG_PARAM",
     },
   },
   {
-    key: "materialCode",
-    title: "物料编码",
-    inputType: "PopoverSelect",
-    valueKey: "code",
-    referName: "MATERIAL_PARAM",
-    dataMapping: {},
-    queryParams: () => ({}),
-    clearable:true,
+    item:{
+      key: "materialCode",
+      title: "物料编码",
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-select-v2",
+      valueKey: "code",
+      referName: "MATERIAL_PARAM",
     },
   },
   {
-    key: "materialName",
-    title: "物料名称",
-    inputType: "PopoverSelect",
-    valueKey: "name",
-    referName: "MATERIAL_PARAM",
-    dataMapping: {},
-    queryParams: () => ({}),
-    clearable:true,
+    item:{
+      key: "materialName",
+      title: "物料名称",
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "MATERIAL_PARAM",
     },
   },
   { 
-    key: "deliveryStatus",
-    title: "erp发送状态", 
-    inputType: "Select",
-    referName: "order_delivery_status", // 字典名
-    clearable:true,
+    item:{
+      key: "deliveryStatus",
+      title: "erp发送状态", 
+    },
     attr:{
-      is: "el-dict-tag",
+      clearable:true,
+      is: "el-select",
       dictName: "order_delivery_status",
     },
   },
   { 
-    key: "contractNo",
-    title: "合同号", 
-    inputType: "Input",
-    clearable:true,
+    item:{
+      key: "contractNo",
+      title: "合同号", 
+    },
     attr: {
+      clearable:true,
       is: "el-input",
     },
   },
   {
-    key: "projectNowName",
-    title: "在建工程项目",
-    inputType: "PopoverSelect",
-    require: true,
-    valueKey: "name",
-    referName: "PROJECT_PARAM",
-    dataMapping: {},
-    queryParams: () => ({}),
-    clearable:true,
+    item:{
+      key: "projectNowName",
+      title: "在建工程项目",
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-select-v2",
+      valueKey: "name",
+      referName: "PROJECT_PARAM",
     },
   },
   {
-    key: "buyers",
-    title: "采购员",
-    inputType: "PopoverSelect",
-    multiple:true,
-    valueKey: "code",
-    referName: "CONTACTS_PARAM",
-    dataMapping: {},
-    queryParams: () => ({}),
-    clearable:true,
+    item:{
+      key: "buyers",
+      title: "采购员",
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-popover-multiple-select-v2",
+      referName: "CONTACTS_PARAM",
+      valueKey: "code",
     },
   },
   {
-    key: "billTypes",
-    title: "订单类型",
-    inputType: "Select",
-    referName: "sys_order_type", // 字典名
-    multiple:true,
-    tags:true,
-    clearable:true,
+    item:{
+      key: "billTypes",
+      title: "订单类型",
+    },
     attr:{
-      is: "el-dict-tag",
+      is: "el-select",
+      multiple:true,
+      tags:true,
+      clearable:true,
       dictName: "sys_order_type",
     },
   },
   { 
-    key: "demandCode",
-    title: "采购需求单号", 
-    inputType: "Input",
-    clearable:true,
+    item:{
+      key: "demandCode",
+      title: "采购需求单号", 
+    },
     attr: {
+      clearable:true,
       is: "el-input",
     },
   },
   { 
-    key: "isDrug",
-    title: "物料药品属性", 
-    inputType: "SelectCheck",
-    clearable:true,
+    item:{
+      key: "isDrug",
+      title: "物料药品属性", 
+    },
     attr: {
-      is: "el-input",
+      clearable:true,
+      is: "el-select",
+      dictName: "sys_yes_no",
     },
   },
-];
-
-// const NewColumns = initColumns(TableColumns);
-// const NewSearchColumns = initColumns(SearchColumns);
-// const NewTabColumns = TabColumns.map((element) => ({
-//   ...element,
-//   tableColumns: initColumns(element.tableColumns),
-// }));
-// 
-// export const SelectColumns = NewColumns.filter(column => column.inputType === 'Select')
-
-// NewTabColumns.forEach(column => {
-//   SelectColumns.push(...column.tableColumns.filter(cColumn => cColumn.inputType === 'Select'))
-// });
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
 
-// SelectColumns.push(...NewSearchColumns.filter(column => column.inputType === 'Select'))

+ 19 - 111
src/views/purchase/purchase-order/index.vue

@@ -25,7 +25,6 @@ export default {
     SeeDrawer: () => import('./see/index.vue'),
     EditDrawer: () => import('./edit/index.vue'),
     PurchaseReturnDrawer: () => import('./purchaseReturn/index.vue'),
-
     ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
     },
@@ -58,11 +57,11 @@ export default {
     };
   },
   computed: {
-    showSearchColumns() {
-      return this.isSimpleSearch
-        ? this.searchColumns.slice(0, 4)
-        : this.searchColumns;
-    },
+    // showSearchColumns() {
+    //   return this.isSimpleSearch
+    //     ? this.searchColumns.slice(0, 4)
+    //     : this.searchColumns;
+    // },
     // tableShowColumns:{
     //   get() {
     //     return this.tableColumns.filter(({ attr }) => attr.isHidden);
@@ -519,116 +518,21 @@ export default {
     <EditDrawer ref="editDrawerRef" @close="handleRefreshList"></EditDrawer>
     <PurchaseReturnDrawer ref="PurchaseReturnDrawerRef" @close="handleRefreshList"></PurchaseReturnDrawer>
 
-    <el-form 
-      size="mini" 
-      label-position="right" 
-      label-width="100px" 
-      :model="params" 
-      style="padding: 20px 0 0 0"
-    >
-      <el-row :gutter="24" >
-        <el-col :span="20">
-          <el-row :gutter="20" style="display:flex; flex-wrap: wrap;">
-            <el-col 
-              v-for="column in showSearchColumns" 
-              :key="column.title" 
-              :xl="6" :lg="6" :md="8" :sm="12" :xs="24"
-            >
-              <el-form-item :prop="column.key" :label="column.title">
-
-                <el-input v-if="column.inputType === 'Input'" 
-                  v-model="params[column.key]" 
-                  :placeholder="column.placeholder"
-                  @keyup.enter.native="fetchList(params, page)"
-                ></el-input>
-                <dr-popover-select v-if="column.inputType === 'PopoverSelect'"
-                  v-model="params[column.key]"
-                  :source.sync="params"
-                  :title="column.title"
-                  :type="column.referName"
-                  :multiple="column.multiple"
-                  :readonly="column.readonly"
-                  :value-key="column.valueKey"
-                  :placeholder="column.placeholder"
-                  :data-mapping="column.dataMapping"
-                  :query-params="column.queryParams"
-                  :clearable="column.clearable"
-                  @keyup.enter.native="fetchList(params, page)"
-                ></dr-popover-select>
-                <!-- @keyup.enter.native="useQuery(params, page)" -->
-
-                <el-select v-if="column.inputType === 'Select'" 
-                v-model="params[column.key]" 
-                :disabled="column.disabled"
-                :clearable="column.clearable" 
-                :placeholder="column.placeholder" 
-                :multiple="column.multiple"
-                :collapse-tags="column.tags"
-                style="width: 100%"
-                @keyup.enter.native="fetchList(params, page)"
-                >
-                <el-option 
-                  v-for="item in dict.type[column.referName]" 
-                  :key="item.value" 
-                  :label="item.label"
-                  :value="item.value"
-                  ></el-option>
-              </el-select>
-              <!-- 只有是否 -->
-              <el-select v-if="column.inputType === 'SelectCheck'" 
-                v-model="params[column.key]" 
-                :disabled="column.disabled"
-                :clearable="column.clearable" 
-                :placeholder="column.placeholder" 
-                style="width: 100%"
-                @keyup.enter.native="fetchList(params, page)"
-                >
-                <el-option key="N" label="否" value="N"></el-option>
-                <el-option key="Y" label="是" value="Y"></el-option>
-              </el-select>
-
-              <el-date-picker v-if="column.inputType === 'DatePicker'" 
-                v-model="params[column.key]"
-                size="mini"
-                type="daterange"
-                :value-format="column.valueFormat"
-                :unlink-panels="column.unlinkPanels"
-                :picker-options="column.pickerOptions"
-                :range-separator="column.rangeSeparator"
-                :end-placeholder="column.endPlaceholder"
-                :start-placeholder="column.startPlaceholder"
-                :clearable="column.clearable"
-                style="width: 100%"
-                @keyup.enter.native="fetchList(params, page)"
-              >
-              </el-date-picker>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-col>
-        <el-col :span="4" style="text-align: right; padding-right: 40px">
-          <el-button type="primary" size="mini" @click="handleQueryList"
-            v-hasPermi="['material:order:query']">搜索</el-button>
-          <el-button size="mini" @click="handleResetList">重置</el-button>
-        </el-col>
-      </el-row>
-    </el-form>
-
-    <el-divider>
-      <i :class="isSimpleSearch ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" style="cursor: pointer"
-        @click="handleSearchChange"></i>
-    </el-divider>
-
+    <el-super-search
+      v-model="params"
+      :size="'mini'"
+      :dict="dict"
+      :columns="searchColumns"
+      @reset="handleResetList"
+      @submit="handleQueryList"
+    ></el-super-search>
+  
     <!-- 操作 -->
     <el-row :gutter="24" style="padding: 0 20px">
-      <!-- <el-col :span="6">123</el-col> -->
       <el-col :span="24" style="text-align: right;margin: 0 10px 0 0">
-
-        <!-- <el-button-group style="margin-left: 10px"> -->
         <el-button size="mini" type="primary" @click="handleOpenAddDrawer"
           v-hasPermi="['material:order:add']">新增</el-button>
-        <!-- </el-button-group> -->
-
+       
         <el-button-group style="margin-left: 10px">
           <el-button type="primary" size="mini" :disabled="checkedList.length != 1" @click="handleCopy">复制</el-button>
           <el-button type="primary" size="mini" @click="handleBatchSubmit">批量提交</el-button>
@@ -658,6 +562,8 @@ export default {
       size="mini"
       :dict="dict"
       :columns="tableColumns"
+      hideOperationColumns
+      stroage
       @row-dblclick="handleOpenSeeDrawer" 
       @row-click="handleDetailsData" 
       @select="handleSelect"
@@ -732,6 +638,8 @@ export default {
             v-model="tabTableDatas[column.key]"
             size="mini"
             :dict="dict"
+            hideOperationColumns
+            stroage
             :columns="column.tableColumns"
             @select="handleTabSelect"
           >

+ 4 - 1
src/views/purchase/task/column.js

@@ -210,7 +210,10 @@ export const SearchColumns = [
       placeholder: "请输入物料编码,多个用,分隔",
     },
   },
-];
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, span: item.span || 6 },
+}));
 
 const pickerOptions = {
   shortcuts: [

+ 6 - 2
src/views/purchase/task/index.vue

@@ -47,9 +47,13 @@ export default {
     async fetchList(prop, page) {
       try {
         this.loading = true;
-        const { code, rows, total } = await LIST(prop, page);
+        const { pageNum, pageSize } = page;
+        const { code, rows, total } = await LIST(prop, { pageNum, pageSize });
         if (code === 200) {
-          this.tableData = rows;
+          this.tableData = rows.map((item, index) => ({
+            ...item,
+            $index: (pageNum - 1) * pageSize + index + 1,
+          }));
           this.page.total = total;
         }
       } catch (err) {

+ 44 - 13
src/views/purchase/transferOrder/add.vue

@@ -95,7 +95,12 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="币种">
-              <el-select clearable size="mini" v-model="basicForm.currency" :disabled="sonDisable" @focus="chooseRefer('CURRENCY_PARAM', true, '币种')" style="width: 200px">
+              <el-select clearable size="mini" 
+                v-model="basicForm.currency" 
+                :disabled="sonDisable" 
+                @focus="chooseRefer('CURRENCY_PARAM', true, '币种')" 
+                style="width: 200px"
+              >
                 <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -106,8 +111,8 @@
                 v-model="basicForm.rate"
                 size="mini"
                 disabled
-                :precision="2" 
-                :step="0.1" 
+                :precision="2"
+                :step="0.1"
                 :max="10"
                 style="width: 200px"
               ></el-input-number>
@@ -149,18 +154,34 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="客户">
-              <el-input
+              <el-select clearable size="mini" 
+                v-model="basicForm.customer" 
+                @clear="clean('客户')" 
+                @focus="chooseRefer('CUSTOMER_PARAM', true, '客户')" 
+                style="width: 200px"
+              >
+              <!-- @change="controlDRHW"  -->
+                <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
+              <!-- <el-input
                 v-model="basicForm.customer"
                 size="mini"
                 :disabled="sonDisable"
                 clearable
                 style="width: 200px"
-              />
+              /> -->
             </el-form-item>
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调入仓库">
-              <el-select clearable size="mini" v-model="basicForm.storageWarehouse" :disabled="sonDisable || isOrg" @clear="clean('调入仓库')" @change="controlDRHW" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventoryOrg, 'N', 'N')" style="width: 200px">
+              <el-select clearable size="mini" 
+                v-model="basicForm.storageWarehouse" 
+                :disabled="sonDisable || isOrg" 
+                @clear="clean('调入仓库')"
+                @change="controlDRHW" 
+                @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventoryOrg, 'N', 'N')" 
+                style="width: 200px"
+              >
                 <el-option v-for="item in ruHouseOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -207,7 +228,7 @@
             </el-form-item>
         </el-col>
       </el-row>
-      
+
       <el-row>
         <el-col :span="1.5">
           <el-form-item label="NC单据号">
@@ -242,7 +263,7 @@
             <el-button type="primary" size="mini" v-if="!sonDisable" @click="addLine">增行</el-button>
           </div>
           <el-table
-          :data="materialInfo" 
+          :data="materialInfo"
           fit
           max-height="480"
           style="font-size: 12px;"
@@ -388,7 +409,7 @@
 
         <el-tab-pane label="收发货信息">
           <el-table
-          :data="receiveInfo" 
+          :data="receiveInfo"
           fit
           max-height="480"
           style="font-size: 12px;"
@@ -427,7 +448,7 @@
 
         <el-tab-pane label="价格费用">
           <el-table
-          :data="priceList" 
+          :data="priceList"
           fit
           max-height="480"
           style="font-size: 12px;"
@@ -462,7 +483,7 @@
 
         <el-tab-pane label="执行结果">
           <el-table
-          :data="resultList" 
+          :data="resultList"
           fit
           max-height="480"
           style="font-size: 12px;"
@@ -715,6 +736,7 @@ export default {
       manOptions: [],
       deptOptions: [],
       currencyOptions: [],
+      customerOptions:[],
       ruHouseOptions: [],
       chuHouseOptions: [],
       liacenterOptions: [],
@@ -956,6 +978,9 @@ export default {
         if (type == 'LIACENTER_PARAM') {
           this.liacenterOptions = res.rows
         }
+        if (type == 'CUSTOMER_PARAM') {
+          this.customerOptions = res.rows
+        }
         if (type == 'WAREHOUSE_PARAM' && title == '调入仓库') {
           this.ruHouseOptions = res.rows
         }
@@ -1081,6 +1106,11 @@ export default {
         this.basicForm.currency = selection[0].id
         this.basicForm.currencyName = selection[0].name
       }
+      if (this.referCondition.title == '客户') {
+        this.customerOptions = selection
+        this.basicForm.customer = selection[0].id
+        this.basicForm.customerName = selection[0].name
+      }
       if (this.referCondition.title == '调入仓库') {
         this.ruHouseOptions = selection
         this.basicForm.storageWarehouse = selection[0].id
@@ -1194,6 +1224,7 @@ export default {
       this.referCondition.isPage = isPage
       this.referCondition.title = title
       this.referCondition.pkOrg = pkOrg
+      this.referCondition.drpOrg = pkOrg
       this.$refs.refer.init(this.referCondition)
     },
     // 选择框彻底清空
@@ -1268,7 +1299,7 @@ export default {
   margin: 20px 0;
   display: flex;
   justify-content: center;
-} 
+}
 .btn_grooup {
   margin-bottom: 10px;
   display: flex;
@@ -1280,4 +1311,4 @@ export default {
 .hang ::v-deep .el-form-item__content{
   margin-left: 0px !important;
 }
-</style>
+</style>