Kaynağa Gözat

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!232
黄梓星 1 yıl önce
ebeveyn
işleme
7a436bc108

+ 0 - 79
src/components/hide-table-column/index.vue

@@ -1,79 +0,0 @@
-<template>
-  <el-button v-bind="$attrs" v-on="$listeners" @click="onOpen">
-    隐藏列
-    <el-drawer size="20%" title="隐藏列" append-to-body :visible.sync="drawer">
-      <el-row :gutter="20" style="margin: 0">
-        <el-draggable
-          v-model="innerValue"
-          :group="{ item: 'key' }"
-          @start="onStart"
-          @end="onEnd"
-        >
-          <el-col
-            v-for="({ item, attr }, index) in innerValue"
-            :key="index"
-            :span="24"
-            style="
-              display: flex;
-              justify-content: space-between;
-              margin: 15px 0;
-            "
-          >
-            <span style="cursor: move">
-              <i class="el-icon-s-grid"></i>
-              {{ item.title }}
-            </span>
-            <el-switch v-model="attr.isHidden"> </el-switch>
-          </el-col>
-        </el-draggable>
-      </el-row>
-    </el-drawer>
-  </el-button>
-</template>
-
-<script>
-export default {
-  name: "HideTableColumn",
-  props: {
-    // v-model
-    value: {
-      type: [Array],
-      require: true,
-    },
-  },
-  components: {
-    ElDraggable: () => import("@/components/draggable/index.vue"),
-  },
-  data() {
-    return {
-      drawer: false,
-    };
-  },
-  computed: {
-    innerValue: {
-      get() {
-        return this.value;
-      },
-      set(value) {
-        this.$emit("input", value);
-      },
-    },
-  },
-  watch: {},
-  methods: {
-    onOpen() {
-      this.drawer = true;
-    },
-    onStart() {
-      console.log("开始拖拽事件", this.innerValue);
-    },
-    onEnd() {
-      console.log("拖拽结束事件", this.innerValue);
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<style scoped></style>

+ 39 - 10
src/components/super-table/index.vue

@@ -1,10 +1,10 @@
 <template>
-  <!-- v-if="innerValue.length" -->
   <el-table
     v-bind="$attrs"
     v-on="$listeners"
     :data="innerValue"
     border
+    ref="superTable"
     class="el-super-table"
   >
     <slot></slot>
@@ -46,7 +46,7 @@
       </template>
     </el-table-column>
     <el-table-column
-      v-if="showOperationColumns"
+      v-if="hideOperationColumns"
       width="50"
       fixed="right"
       align="center"
@@ -64,9 +64,13 @@
           :visible.sync="drawer"
         >
           <el-row :gutter="20" style="margin: 0">
-            <el-draggable v-model="columns" :group="{ item: 'key' }">
+            <el-draggable
+              v-model="selfColumns"
+              :group="{ item: 'key' }"
+              @change="changeColumns"
+            >
               <el-col
-                v-for="({ item }, index) in columns"
+                v-for="({ item }, index) in selfColumns"
                 :key="index"
                 :span="24"
                 style="
@@ -84,11 +88,16 @@
                     v-model="item.hidden"
                     :size="$attrs.size"
                     style="margin: 0 15px 0 0"
+                    @change="changeColumns"
                   >
                     <el-radio-button :label="true">显</el-radio-button>
                     <el-radio-button :label="false">隐</el-radio-button>
                   </el-radio-group>
-                  <el-radio-group v-model="item.fixed" :size="$attrs.size">
+                  <el-radio-group
+                    v-model="item.fixed"
+                    :size="$attrs.size"
+                    @change="changeColumns"
+                  >
                     <el-radio-button :label="false">不</el-radio-button>
                     <el-radio-button label="left">左</el-radio-button>
                     <el-radio-button label="right">右</el-radio-button>
@@ -123,9 +132,13 @@ export default {
       type: [Array],
       require: true,
     },
-    showOperationColumns: {
+    stroage: {
       type: Boolean,
-      default: true,
+      default: false,
+    },
+    hideOperationColumns: {
+      type: Boolean,
+      default: false,
     },
   },
   components: {
@@ -135,7 +148,15 @@ export default {
     ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
   },
   data() {
-    return { drawer: false };
+    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: {
@@ -148,12 +169,20 @@ export default {
     },
     showColumns: {
       get() {
-        return this.columns.filter(({ item }) => item.hidden);
+        return this.selfColumns.filter(({ item }) => item.hidden);
       },
     },
   },
   watch: {},
-  methods: {},
+  methods: {
+    changeColumns() {
+      this.$refs.superTable.doLayout();
+      localStorage.setItem(
+        this.$parent.$parent.$options.name,
+        JSON.stringify(this.selfColumns)
+      );
+    },
+  },
   created() {},
   mounted() {},
   destroyed() {},

+ 311 - 175
src/views/purchase/apply/add/index.vue

@@ -1,34 +1,124 @@
 <script>
 import Column from "./column";
-import useData from "../hooks/data";
-import useWatch from "../hooks/watch";
 import useMethods from "../hooks/function";
+import { initRules, initParams } from "@/utils/init.js";
 import { ITEM, SAVE } from "@/api/business/purchase/apply";
 
-const { watchPuOrgName: w1 } = useWatch();
 const { fetchTax, fetchUnit, fetchExist } = useMethods();
 
 export default {
   name: "AddDrawer",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+    addType: {
+      type: String,
+      default: "add",
+    },
+  },
   components: {
     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);
     return {
-      title: "新 增",
-      ...useData(Column),
+      width: "100%",
+      visible: false,
+      loading: false,
+      rules: rules,
+      params: params,
+      tabName,
+      TabColumns,
+      FormColumns,
     };
   },
   computed: {
     $dicts: {
       get: function () {
-        return this.$parent.$parent.$dicts;
+        return this.$parent.$parent.$parent.$dicts;
       },
     },
+    title: {
+      get() {
+        const { addType } = this;
+        if (addType === "add") {
+          return "新 增";
+        }
+        if (addType === "copy") {
+          return "复 制";
+        }
+        if (addType === "edit") {
+          return "编 辑";
+        }
+      },
+      set() {},
+    },
+    disabled: {
+      get() {
+        const {
+          addType,
+          selectData,
+          selectData: [{ status } = {}],
+        } = this.$props;
+        if (addType === "add") {
+          return false;
+        }
+        if (addType === "copy") {
+          if (selectData.length !== 1) {
+            return true;
+          }
+        }
+        if (addType === "edit") {
+          if (selectData.length !== 1) {
+            return true;
+          }
+          if (selectData.length === 1 && status === "1") {
+            return true;
+          }
+          if (selectData.length === 1 && status === "2") {
+            return true;
+          }
+        }
+      },
+      set() {},
+    },
   },
   watch: {
-    "params.puOrgName": w1(),
+    "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,
+          });
+        }
+      },
+      deep: true,
+    },
   },
   methods: {
     //
@@ -70,29 +160,6 @@ export default {
         const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
-          this.params.id = null;
-          this.params.createBy = null;
-          this.params.priceCode = null;
-          this.params.createByName = null;
-          this.params.effectiveDate = null;
-          this.params.priceApplyItems = this.params.priceApplyItems.map(
-            (item) => ({
-              ...item,
-              id: null,
-              applyId: null,
-              createByName: null,
-              updateByName: null,
-            })
-          );
-          this.params.priceApplyOrgs = this.params.priceApplyOrgs.map(
-            (item) => ({
-              ...item,
-              id: null,
-              applyId: null,
-              createByName: null,
-              updateByName: null,
-            })
-          );
           return true;
         } else {
           return false;
@@ -106,23 +173,52 @@ export default {
       }
     },
     //
-    async open(prop) {
-      this.visible = prop ? await this.fetchItem(prop) : true;
+    async open() {
+      const { addType, selectData } = this.$props;
+      if (addType === "add") {
+        this.visible = true;
+      }
+      if (addType === "copy") {
+        const [{ id }] = selectData;
+        this.visible = await this.fetchItem(id);
+        this.params.id = null;
+        this.params.createBy = null;
+        this.params.priceCode = null;
+        this.params.createByName = null;
+        this.params.effectiveDate = null;
+        this.params.priceApplyItems = this.params.priceApplyItems.map(
+          (item) => ({
+            ...item,
+            id: null,
+            applyId: null,
+            createByName: null,
+            updateByName: null,
+          })
+        );
+        this.params.priceApplyOrgs = this.params.priceApplyOrgs.map((item) => ({
+          ...item,
+          id: null,
+          applyId: null,
+          createByName: null,
+          updateByName: null,
+        }));
+      }
+      if (addType === "edit") {
+        const [{ id }] = selectData;
+        this.visible = await this.fetchItem(id);
+      }
     },
     //
     async hide() {
-      const { TabColumns, FormColumns, initParams } = this;
+      const { TabColumns, FormColumns } = this;
       this.visible = false;
       this.tabName = TabColumns[0].item.key;
       this.params = initParams([...TabColumns, ...FormColumns]);
-      this.params.priceApplyOrgs = [];
-      this.params.priceApplyItems = [];
     },
     //
     async useRowAdd(prop) {
       const {
         $notify,
-        initParams,
         TabColumns,
         params: { puOrgName, supplierName },
       } = this;
@@ -132,13 +228,29 @@ export default {
       if (!puOrgName) {
         return $notify.info("请选择采购组织");
       }
-      const { TableColumns } = TabColumns.find(({ item }) => item.key === prop);
-      this.params[prop].push(initParams(TableColumns));
+      const { TableColumns } = TabColumns.find(
+        ({ item: { key } }) => key === prop
+      );
+      this.params[prop].push({ ...initParams(TableColumns), delFlag: "0" });
     },
     //
     async useRowRemove(prop, scope) {
-      const { $index } = scope;
-      this.params[prop].splice($index, 1);
+      const { addType } = this.$props;
+      const {
+        row: { $index },
+      } = scope;
+      if (addType === "add") {
+        this.params[prop].splice($index, 1);
+      }
+      if (addType === "copy") {
+        this.params[prop].splice($index, 1);
+      }
+      if (addType === "edit") {
+        this.params[prop] = this.params[prop].map((item, index) => ({
+          ...item,
+          delFlag: index === $index ? "2" : item.delFlag,
+        }));
+      }
     },
     //
     async useSubmit(prop) {
@@ -146,7 +258,22 @@ export default {
         if (valid) {
           try {
             // try
-            const { msg, code } = await SAVE({ ...this.params });
+            this.loading = true;
+            const {
+              params,
+              params: { priceApplyOrgs, priceApplyItems },
+            } = this;
+            if (this.addType === "edit") {
+              params.priceApplyOrgs = priceApplyOrgs.filter(
+                (item) => item.orgName
+              );
+              params.priceApplyItems = priceApplyItems.filter(
+                (item) => item.materialName
+              );
+            }
+            console.log(this.params.priceApplyItems);
+            return;
+            const { msg, code } = await SAVE(params);
             if (code === 200) {
               this.hide();
               this.$emit("success");
@@ -171,144 +298,153 @@ 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"
   >
-    <template slot="title">
-      <span>{{ title }}</span>
-      <span>
-        <el-button
-          :size="size"
-          circle
-          icon="el-icon-check"
-          @click="useSubmit('ruleForm')"
-        >
-        </el-button>
-        <el-button
-          :size="size"
-          circle
-          type="danger"
-          icon="el-icon-close"
-          @click="hide"
-        ></el-button>
-      </span>
-    </template>
-    <el-form
-      ref="ruleForm"
-      v-loading="loading"
-      :size="size"
-      :rules="rules"
-      :model="params"
-      label-width="auto"
-      label-position="right"
-      style="padding: 10px"
+    {{ title }}
+    <el-drawer
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+      destroy-on-close
     >
-      <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"
-        >
-          <el-form-item
-            :prop="item.key"
-            :label="item.title"
-            :require="item.require"
+      <el-form
+        ref="ruleForm"
+        v-loading="loading"
+        :size="$attrs.size"
+        :rules="rules"
+        :model="params"
+        label-width="auto"
+        label-position="right"
+        style="padding: 10px"
+      >
+        <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"
           >
-            <component
-              v-bind="attr"
-              v-model="params[item.key]"
-              :source.sync="params"
-              style="width: 100%"
+            <el-form-item
+              :prop="item.key"
+              :label="item.title"
+              :require="item.require"
             >
-              <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, attr, TableColumns }, index) in TabColumns"
-                :key="index"
-                :label="item.title"
-                :name="item.key"
-                lazy
+              <component
+                v-bind="attr"
+                v-model="params[item.key]"
+                :source.sync="params"
+                style="width: 100%"
               >
-                <el-table :size="size" :data="params[item.key]">
-                  <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 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
+                >
+                  <el-table
+                    :size="$attrs.size"
+                    :data="
+                      params[item.key]
+                        .map((item, index) => ({ ...item, $index: index }))
+                        .filter(({ delFlag }) => delFlag === '0')
+                    "
                   >
-                    <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="size"
-                        @click="useRowAdd(tabName)"
-                      >
-                      </el-button>
-                    </template>
-                    <template slot-scope="scope">
-                      <el-button
-                        circle
-                        icon="el-icon-minus"
-                        :size="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-drawer>
+                    <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>
+      <div style="padding: 20px; text-align: right">
+        <el-button :size="$attrs.size" :loading="loading" @click="hide"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSubmit('ruleForm')"
+          >确 认</el-button
+        >
+      </div>
+    </el-drawer>
+  </el-button>
 </template>

+ 19 - 20
src/views/purchase/apply/column.js

@@ -1,38 +1,41 @@
 export const TableColumns = [
-  { item: { key: "priceName", title: "价格名称" }, attr: { isHidden: true } },
-  { item: { key: "priceCode", title: "价格编码" }, attr: { isHidden: true } },
+  { item: { key: "priceName", title: "价格名称" }, attr: {} },
+  { item: { key: "priceCode", title: "价格编码" }, attr: {} },
   {
     item: { key: "status", title: "状态" },
-    attr: { is: "el-dict-tag", dictName: "sys_status", isHidden: true },
+    attr: { is: "el-dict-tag", dictName: "sys_status" },
   },
-  { item: { key: "supplierName", title: "供应商" }, attr: { isHidden: true } },
-  { item: { key: "currencyName", title: "币种" }, attr: { isHidden: true } },
+  { item: { key: "supplierName", title: "供应商" }, attr: {} },
+  { item: { key: "currencyName", title: "币种" }, attr: {} },
   {
     item: { key: "explainStr", title: "价格合理性说明" },
-    attr: { isHidden: true },
+    attr: {},
   },
-  { item: { key: "buyerName", title: "采购员" }, attr: { isHidden: true } },
-  { item: { key: "puDeptName", title: "采购部门" }, attr: { isHidden: true } },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
+  { item: { key: "puDeptName", title: "采购部门" }, attr: {} },
   {
     item: { key: "file", title: "附件" },
-    attr: { is: "el-file-preview", isHidden: true },
+    attr: { is: "el-file-preview" },
   },
-  { item: { key: "createByName", title: "创建人" }, attr: { isHidden: true } },
+  { item: { key: "createByName", title: "创建人" }, attr: {} },
   {
     item: { key: "isEffective", title: "是否已推价格" },
-    attr: { is: "el-dict-tag", dictName: "is_effective", isHidden: true },
+    attr: { is: "el-dict-tag", dictName: "is_effective" },
   },
   {
     item: { key: "effectiveDate", title: "生效日期" },
-    attr: { isHidden: true },
+    attr: {},
   },
-  { item: { key: "id", title: "来源单据id" }, attr: { isHidden: true } },
-  { item: { key: "source", title: "来源单据号" }, attr: { isHidden: true } },
+  { item: { key: "id", title: "来源单据id" }, attr: {} },
+  { item: { key: "source", title: "来源单据号" }, attr: {} },
   {
     item: { key: "sourceType", title: "来源单据类型" },
-    attr: { isHidden: true },
+    attr: {},
   },
-];
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, fixed: false },
+}));
 
 export const SearchColumns = [
   {
@@ -52,10 +55,6 @@ export const SearchColumns = [
       valueKey: "name",
       dataMapping: { puOrg: "id", puOrgName: "name" },
     },
-    on: {
-      change: true,
-      "keyup.enter.native": true,
-    },
   },
   {
     item: { key: "buyerName", title: "采购员" },

+ 101 - 30
src/views/purchase/apply/delete/index.vue

@@ -3,40 +3,71 @@ import { REMOVE } from "@/api/business/purchase/apply";
 
 export default {
   name: "DeleteDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
   data() {
-    return {};
+    return {
+      title: "删 除",
+      visible: false,
+      loading: false,
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        const { selectData } = this;
+        if (selectData.length < 1) {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex(({ status }) => status === "1") > -1
+        ) {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex(({ status }) => status === "2") > -1
+        ) {
+          return true;
+        }
+      },
+      set() {},
+    },
   },
-  computed: {},
   watch: {},
   methods: {
     //
-    open(prop) {
-      return new Promise((resolve, reject) => {
-        this.$confirm("是否删除数据项?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async () => {
-            try {
-              // try
-              const ids = prop.map((item) => item.id).join(",");
-              const { msg, code } = await REMOVE(ids);
-              if (code === 200) {
-                resolve(true);
-                this.$emit("success");
-                this.$notify.success(msg);
-              }
-            } catch (err) {
-              // catch
-              reject(false);
-              console.error(err);
-            } finally {
-              // finally
-            }
-          })
-          .catch(() => reject(false));
-      });
+    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;
+      }
     },
   },
   created() {},
@@ -44,4 +75,44 @@ export default {
   destroyed() {},
 };
 </script>
-<template></template>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @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>

+ 0 - 313
src/views/purchase/apply/edit/index.vue

@@ -1,313 +0,0 @@
-<script>
-import Column from "../add/column";
-import useData from "../hooks/data";
-import useWatch from "../hooks/watch";
-import useMethods from "../hooks/function";
-import { ITEM, SAVE } from "@/api/business/purchase/apply";
-
-const { watchPuOrgName: w1 } = useWatch();
-const { fetchTax, fetchUnit, fetchExist } = useMethods();
-
-export default {
-  name: "EditDrawer",
-  components: {
-    ElComputedInput: () => import("@/components/computed-input/index.vue"),
-    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
-  },
-  data() {
-    return {
-      title: "更 新",
-      ...useData(Column),
-    };
-  },
-  computed: {
-    $dicts: {
-      get: function () {
-        return this.$parent.$parent.$dicts;
-      },
-    },
-  },
-  watch: {
-    "params.puOrgName": w1(),
-  },
-  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;
-        });
-      }
-    },
-    //
-    async fetchItem(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { code, data } = await ITEM(prop);
-        if (code === 200) {
-          this.params = data;
-          return true;
-        } else {
-          return false;
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
-    },
-    //
-    async open(prop) {
-      this.visible = await this.fetchItem(prop);
-    },
-    //
-    async hide() {
-      const { TabColumns, FormColumns, initParams } = this;
-      this.visible = false;
-      this.tabName = TabColumns[0].item.key;
-      this.params = initParams([...TabColumns, ...FormColumns]);
-    },
-    //
-    async useRowAdd(prop) {
-      const {
-        $notify,
-        TabColumns,
-        initParams,
-        params: { puOrgName, supplierName },
-      } = this;
-      if (!supplierName) {
-        return $notify.info("请选择供应商");
-      }
-      if (!puOrgName) {
-        return $notify.info("请选择采购组织");
-      }
-      const { TableColumns } = TabColumns.find(({ item }) => item.key === prop);
-      this.params[prop].push({ ...initParams(TableColumns), delFlag: "0" });
-    },
-    //
-    async useRowRemove(prop, scope) {
-      const {
-        row: { $index },
-      } = scope;
-      this.params[prop] = this.params[prop].map((item, index) => ({
-        ...item,
-        delFlag: index === $index ? "2" : item.delFlag,
-      }));
-    },
-    //
-    async useSubmit(prop) {
-      this.$refs[prop].validate(async (valid) => {
-        if (valid) {
-          try {
-            // try
-            this.loading = true;
-            const {
-              params,
-              params: { priceApplyOrgs, priceApplyItems },
-            } = this;
-            params.priceApplyOrgs = priceApplyOrgs.filter(
-              (item) => item.orgName
-            );
-            params.priceApplyItems = priceApplyItems.filter(
-              (item) => item.materialName
-            );
-            const { msg, code } = await SAVE(params);
-            if (code === 200) {
-              this.hide();
-              this.$emit("success");
-              this.$notify.success(msg);
-            }
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-            this.loading = false;
-          }
-        } else {
-          return false;
-        }
-      });
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<template>
-  <el-drawer
-    :size="width"
-    :title="title"
-    :show-close="false"
-    :visible.sync="visible"
-  >
-    <template slot="title">
-      <span>{{ title }}</span>
-      <span>
-        <el-button
-          :size="size"
-          :loading="loading"
-          circle
-          icon="el-icon-check"
-          @click="useSubmit('ruleForm')"
-        >
-        </el-button>
-        <el-button
-          :size="size"
-          circle
-          type="danger"
-          icon="el-icon-close"
-          @click="hide"
-        ></el-button>
-      </span>
-    </template>
-    <el-form
-      ref="ruleForm"
-      v-loading="loading"
-      :size="size"
-      :rules="rules"
-      :model="params"
-      label-width="auto"
-      label-position="right"
-      style="padding: 10px"
-    >
-      <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"
-        >
-          <el-form-item
-            :prop="item.key"
-            :label="item.title"
-            :require="item.require"
-          >
-            <component
-              v-bind="attr"
-              v-model="params[item.key]"
-              :source.sync="params"
-              style="width: 100%"
-            >
-              <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, attr, TableColumns }, index) in TabColumns"
-                :key="index"
-                :label="item.title"
-                :name="item.key"
-                lazy
-              >
-                <el-table
-                  :size="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="size"
-                        @click="useRowAdd(tabName)"
-                      >
-                      </el-button>
-                    </template>
-                    <template slot-scope="scope">
-                      <el-button
-                        circle
-                        icon="el-icon-minus"
-                        :size="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-drawer>
-</template>

+ 0 - 24
src/views/purchase/apply/hooks/data.js

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

+ 0 - 46
src/views/purchase/apply/hooks/watch.js

@@ -1,46 +0,0 @@
-import { REFER } from "@/components/popover-select/api";
-
-const fetchOrg = async (prop) => {
-  try {
-    // try
-    const { code, rows } = await REFER({
-      search: prop,
-      type: "ORG_PARAM",
-    });
-    if (code === 200) {
-      return rows[0] || {};
-    }
-  } catch (err) {
-    // catch
-    console.error(err);
-  } finally {
-    // finally
-  }
-};
-
-export default function useWatch() {
-  const watchPuOrgName = () => ({
-    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,
-        });
-      }
-    },
-    deep: true,
-  });
-
-  return { watchPuOrgName };
-}

+ 47 - 135
src/views/purchase/apply/index.vue

@@ -6,13 +6,10 @@ export default {
   name: "PuchaseApply",
   dicts: [...initDicts([...TableColumns, ...SearchColumns]), "sys_price_type"],
   components: {
-    AddModel: () => import("./add/index.vue"),
-    SeeModel: () => import("./see/index.vue"),
-    EditModel: () => import("./edit/index.vue"),
-    SubmitModel: () => import("./submit/index.vue"),
-    DeleteModel: () => import("./delete/index.vue"),
-    ElHideTableColumnButton: () =>
-      import("@/components/hide-table-column/index.vue"),
+    SeeButton: () => import("./see/index.vue"),
+    AddButton: () => import("./add/index.vue"),
+    DeleButton: () => import("./delete/index.vue"),
+    SubmButton: () => import("./submit/index.vue"),
     ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
@@ -20,7 +17,6 @@ export default {
     return {
       size: "mini",
       loading: false,
-      batching: false,
       SearchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableData: [],
@@ -35,44 +31,12 @@ export default {
         return this.dict.type;
       },
     },
-    $power: {
-      get() {
-        const {
-          selectData,
-          selectData: [{ status } = {}],
-        } = this;
-        const rule1 = selectData.length === 1;
-        const rule2 = selectData.length > 1;
-        const rule3 = status === "0" || status === "3";
-        return {
-          // 复 制
-          copy: rule1,
-          // 修 改
-          edit: rule1 && rule3,
-          // 删 除
-          delt: rule1 ? rule1 && rule3 : rule2,
-          // 审 核
-          subm: rule1 ? rule1 && rule3 : rule2,
-        };
-      },
-    },
   },
   created() {
-    this.params.status = "0";
     this.useQuery(this.params, this.page);
   },
   methods: {
     //
-    setSelectable(row) {
-      const { status } = row;
-      // 审批中
-      if (status === "1") return false;
-      // 已完成
-      else if (status === "2") return false;
-      // other
-      else return true;
-    },
-    //
     async fetchList(prop, page) {
       try {
         this.loading = true;
@@ -109,139 +73,87 @@ export default {
       this.useQuery(this.params, this.page);
     },
     // 选 择
-    useRowClick(prop) {
-      if (!this.batching) this.selectData = prop;
-    },
-    // 选 择
     useSelect(prop) {
-      if (this.batching) this.selectData = prop;
-    },
-    // 批 量
-    useBatch() {
-      this.selectData = [];
-      this.batching = !this.batching;
-    },
-    // 新 增
-    async useAdd() {
-      const { open } = this.$refs.AddModel;
-      await open();
-    },
-    // 复 制
-    async useCopy(prop) {
-      const [{ id }] = prop;
-      const { open } = this.$refs.AddModel;
-      await open(id);
-    },
-    // 删 除
-    async useDelete(prop) {
-      const { open } = this.$refs.DeleteModel;
-      await open(prop);
-    },
-    // 编 辑
-    async useEdit(prop) {
-      const [{ id }] = prop;
-      const { open } = this.$refs.EditModel;
-      await open(id);
+      this.selectData = prop;
     },
     // 明 细
     async useSee(prop) {
       const { $index } = prop;
-      const { open } = this.$refs.SeeModel;
+      const { open } = this.$refs.SeeButton;
       await open($index);
     },
-    // 审 核
-    async useSubmit(prop, done) {
-      const { open } = this.$refs.SubmitModel;
-      await open(prop, done);
-    },
   },
 };
 </script>
 
 <template>
   <el-card v-loading="loading" :body-style="{ padding: 0 }">
-    <see-model ref="SeeModel" @success="useQuery(params, page)"></see-model>
-    <add-model ref="AddModel" @success="useReset"></add-model>
-    <edit-model ref="EditModel" @success="useQuery(params, page)"></edit-model>
-    <submit-model
-      ref="SubmitModel"
-      @success="useQuery(params, page)"
-    ></submit-model>
-    <delete-model
-      ref="DeleteModel"
-      @success="useQuery(params, page)"
-    ></delete-model>
     <el-super-search
       v-model="params"
       :size="size"
       :dict="dict"
       :columns="SearchColumns"
+      @reset="useReset"
       @submit="useQuery(params, page)"
     ></el-super-search>
-    <div style="padding: 0 20px; display: flex; justify-content: space-between">
-      <div>
-        <el-button :size="size" @click="useQuery(params, page)">
-          查 询
-        </el-button>
-        <el-button :size="size" @click="useReset">重 置</el-button>
-        <el-divider direction="vertical"></el-divider>
-        <el-button :size="size" @click="useAdd">新 增</el-button>
-        <el-button
-          v-show="$power.copy"
+    <div style="padding: 0 20px; text-align: right">
+      <el-button-group style="margin: 0 10px 0 0">
+        <add-button
           :size="size"
-          @click="useCopy(selectData)"
-        >
-          复 制
-        </el-button>
-        <el-button
-          v-show="$power.edit"
+          :select-data="[]"
+          add-type="add"
+          @success="useQuery(params, page)"
+        ></add-button>
+        <add-button
           :size="size"
-          @click="useEdit(selectData)"
-          >编 辑</el-button
+          :select-data="selectData"
+          add-type="copy"
+          @success="useQuery(params, page)"
         >
-        <el-button
-          v-show="$power.delt"
+        </add-button>
+      </el-button-group>
+      <el-button-group style="margin: 0 10px 0 0">
+        <see-button
+          v-show="false"
+          ref="SeeButton"
           :size="size"
-          @click="useDelete(selectData)"
-          >删 除</el-button
-        >
-        <el-button
-          v-show="$power.subm"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></see-button>
+        <add-button
           :size="size"
-          @click="useSubmit(selectData)"
-          >审 核</el-button
-        >
-      </div>
-      <div>
-        <el-button :size="size" @click="useBatch"> 批 量 </el-button>
-        <el-divider direction="vertical"></el-divider>
-        <el-hide-table-column-button
-          v-model="TableColumns"
+          :select-data="selectData"
+          add-type="edit"
+          @success="useQuery(params, page)"
+        ></add-button>
+        <dele-button
+          :size="size"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></dele-button>
+      </el-button-group>
+      <el-button-group>
+        <subm-button
           :size="size"
-        ></el-hide-table-column-button>
-      </div>
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></subm-button>
+      </el-button-group>
     </div>
     <el-super-table
       v-model="tableData"
       :size="size"
       :dict="dict"
       :columns="TableColumns"
+      stroage
+      hideOperationColumns
       @row-dblclick="useSee"
       @selection-change="useSelect"
-      @row-click="useRowClick([$event])"
     >
-      <el-table-column
-        v-if="batching"
-        fixed
-        width="55"
-        align="center"
-        type="selection"
-        :selectable="setSelectable"
-      >
+      <el-table-column fixed width="55" align="center" type="selection">
       </el-table-column>
     </el-super-table>
     <pagination
-      v-if="tableData.length"
       :total="page.total"
       :page.sync="page.pageNum"
       :limit.sync="page.pageSize"

+ 129 - 166
src/views/purchase/apply/see/index.vue

@@ -1,34 +1,56 @@
 <script>
 import Column from "../add/column";
-import useData from "../hooks/data";
+import { initRules, initParams } from "@/utils/init.js";
 import { ITEM, LIST } from "@/api/business/purchase/apply";
 
 export default {
   name: "SeeDrawer",
+
   data() {
+    const {
+      TabColumns,
+      FormColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = Column;
+    const params = initParams([...TabColumns, ...FormColumns]);
+    const rules = initRules(FormColumns);
     return {
-      column: 3,
+      width: "50%",
+      column: 2,
       title: "明 细",
-      ...useData(Column),
+      visible: false,
+      loading: false,
+      rules: rules,
+      params: params,
+      tabName,
+      TabColumns,
+      FormColumns,
     };
   },
   props: {
-    // v-model
-    value: {
-      type: Boolean,
+    selectData: {
+      type: [Array],
       require: true,
     },
   },
   computed: {
-    $father: {
+    $dicts: {
       get() {
-        return this.$parent.$parent;
+        return this.$parent.$parent.$parent.$dicts;
       },
     },
-    $dicts: {
+    disabled: {
       get() {
-        return this.$father.$dicts;
+        const { selectData } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
       },
+      set() {},
     },
   },
   watch: {},
@@ -38,7 +60,7 @@ export default {
       try {
         // try
         this.loading = true;
-        const { params } = this.$father;
+        const { params } = this.$parent.$parent.$parent;
         const {
           total,
           rows: [{ id }],
@@ -71,24 +93,6 @@ export default {
       this.tabName = TabColumns[0].item.key;
       this.params = initParams([...TabColumns, ...FormColumns]);
     },
-    // //
-    // async useDelete(prop) {
-    //   await this.$father
-    //     .useDelete(prop)
-    //     .then(() => {
-    //       this.hide();
-    //     })
-    //     .catch(() => {});
-    // },
-    // //
-    // async useSubmit(prop) {
-    //   await this.$father
-    //     .useSubmit(prop)
-    //     .then(() => {
-    //       this.hide();
-    //     })
-    //     .catch(() => {});
-    // },
   },
   created() {},
   mounted() {},
@@ -96,147 +100,106 @@ 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])"
   >
-    <div
-      style="
-        z-index: 6666;
-        position: fixed;
-        right: 20px;
-        top: 50%;
-        transform: translateY(-50%);
-        display: flex;
-        flex-direction: column;
-      "
+    {{ title }}
+    <el-drawer
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
     >
-      <el-button
-        :size="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"
-        :disabled="params.$index === params.$total"
-        circle
-        icon="el-icon-bottom"
-        @click="fetchItem(params.$index + 1)"
-        style="margin: 0"
-      ></el-button>
-    </div>
-    <template slot="title">
-      <span>{{ title }}</span>
-      <span>
-        <!-- <el-tooltip effect="dark" content="删 除" placement="bottom-end">
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-delete"
-            @click="useDelete([params])"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip effect="dark" content="复 制" placement="bottom-end">
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-document-copy"
-            @click="$father.useCopy([params])"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip
-          v-if="$father.hasPowerEdit([params])"
-          effect="dark"
-          content="编 辑"
-          placement="bottom-end"
-        >
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-edit"
-            @click="$father.useEdit([params])"
-          ></el-button>
-        </el-tooltip>
-        <el-tooltip
-          v-if="$father.hasPowerSubmit([params])"
-          effect="dark"
-          content="审 核"
-          placement="bottom-end"
-        >
-          <el-button
-            :size="size"
-            circle
-            icon="el-icon-check"
-            @click="useSubmit([params])"
-          ></el-button>
-        </el-tooltip> -->
+      <div
+        style="
+          z-index: 6666;
+          position: fixed;
+          right: 20px;
+          top: 50%;
+          transform: translateY(-50%);
+          display: flex;
+          flex-direction: column;
+        "
+      >
         <el-button
-          :size="size"
+          :size="$attrs.size"
+          :disabled="params.$index === 1"
           circle
-          type="danger"
-          icon="el-icon-close"
-          @click="hide"
+          icon="el-icon-top"
+          @click="fetchItem(params.$index - 1)"
+          style="margin: 0 0 10px 0"
         ></el-button>
-      </span>
-    </template>
-    <el-descriptions :size="size" :column="column" border style="margin: 10px">
-      <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="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-tabs v-model="tabName" :size="size" style="margin: 10px">
-      <el-tab-pane
-        v-for="({ item, attr, TableColumns }, index) in TabColumns"
-        :key="index"
-        :name="item.key"
-        :label="item.title"
-        lazy
+        <el-button
+          :size="$attrs.size"
+          :disabled="params.$index === params.$total"
+          circle
+          icon="el-icon-bottom"
+          @click="fetchItem(params.$index + 1)"
+          style="margin: 0"
+        ></el-button>
+      </div>
+      <el-descriptions
+        :size="$attrs.size"
+        :column="column"
+        border
+        style="margin: 10px"
       >
-        <el-table :size="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="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-tab-pane>
-    </el-tabs>
-  </el-drawer>
+        <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-tabs v-model="tabName" :size="$attrs.size" style="margin: 10px">
+        <el-tab-pane
+          v-for="({ item, attr, TableColumns }, 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-tab-pane>
+      </el-tabs>
+    </el-drawer>
+  </el-button>
 </template>

+ 101 - 30
src/views/purchase/apply/submit/index.vue

@@ -3,40 +3,71 @@ import { SUBMIT } from "@/api/business/purchase/apply";
 
 export default {
   name: "SubmitDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
   data() {
-    return {};
+    return {
+      title: "提交OA",
+      visible: false,
+      loading: false,
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        const { selectData } = this;
+        if (selectData.length < 1) {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex(({ status }) => status === "1") > -1
+        ) {
+          return true;
+        }
+        if (
+          selectData.length >= 1 &&
+          selectData.findIndex(({ status }) => status === "2") > -1
+        ) {
+          return true;
+        }
+      },
+      set() {},
+    },
   },
-  computed: {},
   watch: {},
   methods: {
     //
-    open(prop) {
-      return new Promise((resolve, reject) => {
-        this.$confirm("是否提交审核数据项?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async () => {
-            try {
-              // try
-              const ids = prop.map((item) => item.id).join(",");
-              const { msg, code } = await SUBMIT(ids);
-              if (code === 200) {
-                resolve(true);
-                this.$emit("success");
-                this.$notify.success(msg);
-              }
-            } catch (err) {
-              // catch
-              reject(false);
-              console.error(err);
-            } finally {
-              // finally
-            }
-          })
-          .catch(() => reject(false));
-      });
+    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;
+      }
     },
   },
   created() {},
@@ -44,4 +75,44 @@ export default {
   destroyed() {},
 };
 </script>
-<template></template>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @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>

+ 11 - 9
src/views/purchase/contract/delete/index.vue

@@ -19,15 +19,17 @@ export default {
   computed: {
     disabled: {
       get() {
-        if (this.selectData.length === 1) {
-          const [{ status }] = this.selectData;
-          if (status === "1") {
-            return true;
-          }
-          if (status === "2") {
-            return true;
-          }
-        } else {
+        const {
+          selectData,
+          selectData: [{ status } = {}],
+        } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
+        if (selectData.length === 1 && status === "1") {
+          return true;
+        }
+        if (selectData.length === 1 && status === "2") {
           return true;
         }
       },

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

@@ -55,7 +55,10 @@ export default {
     },
     disabled: {
       get() {
-        return this.selectData.length !== 1;
+        const { selectData } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
       },
       set() {},
     },

+ 2 - 26
src/views/purchase/contract/index.vue

@@ -25,7 +25,6 @@ export default {
     return {
       size: "mini",
       loading: false,
-      batching: false,
       SearchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableData: [],
@@ -87,12 +86,6 @@ export default {
       const { open } = this.$refs.SeeButton;
       await open(id);
     },
-    // 归 档
-    async usePigeonhole(prop) {
-      const { open } = this.$refs.PigeButton;
-      const [{ id }] = prop;
-      await open(id);
-    },
     // 导 出
     async useExport(prop, page) {
       const { pageNum, pageSize } = page;
@@ -176,6 +169,8 @@ export default {
       :size="size"
       :dict="dict"
       :columns="TableColumns"
+      stroage
+      hideOperationColumns
       @row-dblclick="useSee"
       @selection-change="useSelect"
     >
@@ -196,24 +191,5 @@ 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;
-    }
-  }
 }
 </style>

+ 10 - 9
src/views/purchase/contract/pigeonhole/index.vue

@@ -20,13 +20,14 @@ export default {
   computed: {
     disabled: {
       get() {
-        if (this.selectData.length === 1) {
-          const [{ pigeonhole }] = this.selectData;
-          if (pigeonhole === "Y") {
-            return true;
-          }
-          return false;
-        } else {
+        const {
+          selectData,
+          selectData: [{ pigeonhole } = {}],
+        } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
+        if (selectData.length === 1 && pigeonhole === "Y") {
           return true;
         }
       },
@@ -77,7 +78,7 @@ export default {
     v-bind="$attrs"
     v-on="$listeners"
     :disabled="disabled"
-    @click="open"
+    @click="open(selectData[0].id)"
   >
     {{ title }}
     <el-dialog
@@ -98,7 +99,7 @@ export default {
           type="primary"
           :size="$attrs.size"
           :loading="loading"
-          @click="submit(selectData[0].id)"
+          @click="submit(params)"
           >确 认</el-button
         >
       </div>

+ 4 - 2
src/views/purchase/contract/see/index.vue

@@ -47,7 +47,10 @@ export default {
     },
     disabled: {
       get() {
-        return this.selectData.length !== 1;
+        const { selectData } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
       },
       set() {},
     },
@@ -109,7 +112,6 @@ export default {
     <el-drawer
       :size="width"
       :title="title"
-      :show-close="false"
       :visible.sync="visible"
       append-to-body
     >

+ 11 - 3
src/views/purchase/contract/submit/index.vue

@@ -19,9 +19,17 @@ export default {
   computed: {
     disabled: {
       get() {
-        if (this.selectData.length === 1) {
-          return false;
-        } else {
+        const {
+          selectData,
+          selectData: [{ status } = {}],
+        } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
+        if (selectData.length === 1 && status === "1") {
+          return true;
+        }
+        if (selectData.length === 1 && status === "2") {
           return true;
         }
       },

+ 11 - 8
src/views/purchase/contract/termination/index.vue

@@ -19,14 +19,17 @@ export default {
   computed: {
     disabled: {
       get() {
-        if (this.selectData.length === 1) {
-          const [{ status }] = this.selectData;
-          if (status !== "2") {
-            return true;
-          } else {
-            return false;
-          }
-        } else {
+        const {
+          selectData,
+          selectData: [{ status } = {}],
+        } = this;
+        if (selectData.length !== 1) {
+          return true;
+        }
+        if (selectData.length === 1 && status === "0") {
+          return true;
+        }
+        if (selectData.length === 1 && status === "3") {
           return true;
         }
       },

+ 1 - 6
src/views/purchase/purchase-order/index.vue

@@ -25,8 +25,7 @@ export default {
     SeeDrawer: () => import('./see/index.vue'),
     EditDrawer: () => import('./edit/index.vue'),
     PurchaseReturnDrawer: () => import('./purchaseReturn/index.vue'),
-    ElHideTableColumnButton: () =>
-      import("@/components/hide-table-column/index.vue"),
+
     ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
     },
@@ -650,10 +649,6 @@ export default {
 
         </el-button-group>
 
-        <!-- <el-hide-table-column-button
-          v-model="tableColumns"
-          size="mini"
-        ></el-hide-table-column-button> -->
 
       </el-col>
     </el-row>

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

@@ -161,6 +161,8 @@ export default {
       :size="size"
       :dict="dict"
       :columns="TableColumns"
+      stroage
+      hideOperationColumns
       @row-dblclick="useSee"
       @selection-change="useSelect"
     >