002201 2 years ago
parent
commit
260826f562

+ 20 - 3
src/api/business/purchase/contract.js

@@ -8,6 +8,13 @@ export function LIST(params) {
   });
 }
 
+export function ITEM(data) {
+  return request({
+    url: `/pu/contract/${data}`,
+    method: "GET",
+  });
+}
+
 export function ADD(data) {
   return request({
     url: "/pu/contract/add",
@@ -55,10 +62,20 @@ export function TERMINATION(params) {
   });
 }
 
-export function ITEM(data) {
+export function PIGEONHOLE(data, params) {
   return request({
-    url: `/pu/contract/${data}`,
-    method: "GET",
+    url: `/pu/contract/pigeonhole`,
+    method: "PUT",
+    data: data,
+    params: params,
+  });
+}
+
+export function ALTERATION(data) {
+  return request({
+    url: `/pu/contract/alteration`,
+    method: "POST",
+    data: data,
   });
 }
 

+ 44 - 0
src/views/purchase/contract/alteration/index.vue

@@ -0,0 +1,44 @@
+<script>
+import { ALTERATION } from "@/api/business/purchase/contract";
+
+export default {
+  name: "DeleteDialog",
+  data() {
+    return {};
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open(prop) {
+      this.$confirm("是否变更数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+      })
+        .then(async () => {
+          try {
+            // try
+            const { msg, code } = await ALTERATION(prop);
+            if (code === 200) {
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template></template>

+ 6 - 0
src/views/purchase/contract/column.js

@@ -5,6 +5,12 @@ export const FormColumns = [
   },
   { key: "code", title: "合同编码" },
   {
+    key: "status",
+    title: "状态",
+    inputType: "Select",
+    referName: "documents_status",
+  },
+  {
     key: "lastPuMoney",
     title: "上年度采购额",
   },

+ 14 - 3
src/views/purchase/contract/delete/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useMethods from "../hooks/function";
+import { REMOVE } from "@/api/business/purchase/contract";
 
 export default {
   name: "DeleteDialog",
@@ -17,8 +17,19 @@ export default {
         type: "info",
       })
         .then(async () => {
-          const { remove } = useMethods();
-          await remove({ _this: this, prop });
+          try {
+            // try
+            const { msg, code } = await REMOVE(prop);
+            if (code === 200) {
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+          }
         })
         .catch((err) => {
           console.error(err);

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

@@ -16,7 +16,11 @@ export default {
       ...useData(Column),
     };
   },
-  computed: {},
+  computed: {
+    hasPowerAlteration: function () {
+      return this.$parent.$parent.hasPowerAlteration;
+    },
+  },
   watch: {
     "params.contractType": watchContractType(),
   },
@@ -58,6 +62,11 @@ export default {
       const { submit } = useMethods();
       await submit({ _this: this, prop, type: "EDIT" });
     },
+    //
+    async useAlteration(prop) {
+      const { useAlteration } = this.$parent.$parent;
+      await useAlteration(prop);
+    },
   },
   created() {},
   mounted() {},
@@ -81,6 +90,15 @@ export default {
           @click="hide"
         ></el-button>
         <el-button
+          v-if="hasPowerAlteration([params])"
+          :size="size"
+          circle
+          icon="el-icon-check"
+          @click="useAlteration([params])"
+        >
+        </el-button>
+        <el-button
+          v-else
           :size="size"
           circle
           icon="el-icon-check"
@@ -190,7 +208,6 @@ export default {
                 :name="column.key"
                 lazy
               >
-                <el-divider></el-divider>
                 <el-table :size="size" :data="params[column.key]">
                   <el-table-column label="序号">
                     <template slot-scope="scope">

+ 1 - 40
src/views/purchase/contract/hooks/function.js

@@ -1,12 +1,5 @@
 import { REFER } from "@/components/popover-select/api";
-import {
-  ADD,
-  EDIT,
-  ITEM,
-  CODE,
-  REMOVE,
-  TERMINATION,
-} from "@/api/business/purchase/contract";
+import { ADD, EDIT, ITEM, CODE } from "@/api/business/purchase/contract";
 
 export default function useMethods() {
   const fetchCode = async ({ _this }) => {
@@ -105,42 +98,10 @@ export default function useMethods() {
       }
     });
   };
-  const remove = async ({ _this, prop }) => {
-    try {
-      // try
-      const { msg, code } = await REMOVE(prop);
-      if (code === 200) {
-        _this.$emit("success");
-        _this.$notify.success(msg);
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
-  const termination = async ({ _this, prop }) => {
-    try {
-      // try
-      const { code } = await TERMINATION({ id: prop });
-      if (code === 200) {
-        _this.$emit("success");
-        _this.$notify.success(msg);
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
   return {
     open,
     hide,
     submit,
-    remove,
-    termination,
     fetchRefer,
     fetchCode,
     fetchItem,

+ 80 - 57
src/views/purchase/contract/index.vue

@@ -14,6 +14,8 @@ export default {
     RecordModel: () => import("./record/index.vue"),
     DeleteModel: () => import("./delete/index.vue"),
     TerminationModel: () => import("./termination/index.vue"),
+    PigeonholeModel: () => import("./pigeonhole/index.vue"),
+    AlterationModel: () => import("./alteration/index.vue"),
   },
   data() {
     return {
@@ -22,7 +24,7 @@ export default {
       searchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableData: [],
-      currentData: [],
+      selectData: [],
       tableColumns: FormColumns,
       page: { pageNum: 1, pageSize: 10, total: 0 },
     };
@@ -57,6 +59,7 @@ export default {
     },
     // 查 询
     useQuery(prop, page) {
+      this.selectData = [];
       this.fetchList(prop, page);
     },
     // 重 置
@@ -67,7 +70,7 @@ export default {
     },
     // 选 择
     useSelect(prop) {
-      this.currentData = [prop];
+      this.selectData = prop;
     },
     // 新 增
     async useAdd() {
@@ -80,15 +83,29 @@ export default {
       const { open } = this.$refs.DeleteModel;
       await open(id);
     },
+    hasPowerDelete(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status !== "2") return true;
+        else return false;
+      }
+    },
     // 编 辑
     async useEdit(prop) {
       const [{ id }] = prop;
       const { open } = this.$refs.EditModel;
       await open(id);
     },
+    hasPowerEdit(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status !== "2") return true;
+        else return false;
+      }
+    },
     // 明 细
     async useSee(prop) {
-      const [{ id }] = prop;
+      const { id } = prop;
       const { open } = this.$refs.SeeModel;
       await open(id);
     },
@@ -98,6 +115,38 @@ export default {
       const { open } = this.$refs.TerminationModel;
       await open(id);
     },
+    hasPowerTermination(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "2") return true;
+        else return false;
+      }
+    },
+    // 归 档
+    async usePigeonhole(prop) {
+      const [{ id }] = prop;
+      const { open } = this.$refs.PigeonholeModel;
+      await open(id);
+    },
+    hasPowerPigeonhole(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "2") return true;
+        else return false;
+      }
+    },
+    // 变 更
+    async useAlteration(prop) {
+      const { open } = this.$refs.AlterationModel;
+      await open(prop[0]);
+    },
+    hasPowerAlteration(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "2") return true;
+        else return false;
+      }
+    },
     // 导 出
     async useExport(prop) {
       const { pageNum, pageSize } = this.page;
@@ -143,6 +192,14 @@ export default {
       ref="TerminationModel"
       @success="useQuery(params, page)"
     ></termination-model>
+    <pigeonhole-model
+      ref="PigeonholeModel"
+      @success="useQuery(params, page)"
+    ></pigeonhole-model>
+    <alteration-model
+      ref="AlterationModel"
+      @success="useQuery(params, page)"
+    ></alteration-model>
     <el-form
       :size="size"
       :model="params"
@@ -175,35 +232,37 @@ export default {
       <el-button :size="size" @click="useAdd"> 新 增 </el-button>
       <el-button :size="size" @click="useRecord"> 期初补录 </el-button>
       <el-button
+        v-show="hasPowerDelete(selectData)"
         :size="size"
-        :disabled="!currentData.length"
-        @click="useEdit(currentData)"
+        @click="useDelete(selectData)"
       >
-        编 辑
+        删 除
       </el-button>
       <el-button
+        v-show="hasPowerTermination(selectData)"
         :size="size"
-        :disabled="!currentData.length"
-        @click="useDelete(currentData)"
+        :disabled="!selectData.length"
+        @click="useTermination(selectData)"
       >
-        删 除
+        终 止
       </el-button>
       <el-button
+        v-show="hasPowerPigeonhole(selectData)"
         :size="size"
-        :disabled="!currentData.length"
-        @click="useTermination(currentData)"
+        @click="usePigeonhole(selectData)"
       >
-        终 止
+        归 档
       </el-button>
-      <el-button :size="size" :disabled="!currentData.length">
+      <el-button
+        v-show="hasPowerAlteration(selectData)"
+        :size="size"
+        @click="useAlteration(selectData)"
+      >
         变 更
       </el-button>
-      <el-button :size="size" :disabled="!currentData.length">
-        归 档
-      </el-button>
       <el-button
         :size="size"
-        :disabled="!currentData.length"
+        :disabled="!selectData.length"
         @click="useExport(params)"
       >
         导 出
@@ -214,10 +273,13 @@ export default {
       :size="size"
       :data="tableData"
       highlight-current-row
-      @row-click="useSelect"
       @row-dblclick="useSee"
+      @selection-change="useSelect"
+      @row-click="useSelect([$event])"
       style="width: 100%; margin: 20px 0 0 0"
     >
+      <el-table-column fixed width="55" align="center" type="selection">
+      </el-table-column>
       <el-table-column
         v-for="(column, index) in tableColumns"
         :key="index"
@@ -240,45 +302,6 @@ export default {
           <span v-else>{{ scope.row[column.key] }}</span>
         </template>
       </el-table-column>
-      <!-- <el-table-column fixed="right" label="操作" width="150">
-        <template slot-scope="scope">
-          <el-button
-            type="text"
-            size="small"
-            @click.native.prevent="useEdit(scope.row)"
-          >
-            编 辑
-          </el-button>
-          <el-button
-            type="text"
-            size="small"
-            @click.native.prevent="useEdit(scope.row)"
-          >
-            变 更
-          </el-button>
-          <el-button
-            type="text"
-            size="small"
-            @click.native.prevent="useEdit(scope.row)"
-          >
-            归 档
-          </el-button>
-          <el-button
-            type="text"
-            size="small"
-            @click.native.prevent="useTermination(scope.row)"
-          >
-            终 止
-          </el-button>
-          <el-button
-            type="text"
-            size="small"
-            @click.native.prevent="useDelete(scope.row)"
-          >
-            删 除
-          </el-button>
-        </template>
-      </el-table-column> -->
     </el-table>
     <pagination
       :total="page.total"

+ 97 - 0
src/views/purchase/contract/pigeonhole/index.vue

@@ -0,0 +1,97 @@
+<script>
+import { PIGEONHOLE } from "@/api/business/purchase/contract";
+
+export default {
+  name: "DeleteDialog",
+  data() {
+    return {
+      size: "mini",
+      title: "归 档",
+      visible: false,
+      loading: false,
+      params: { id: "", pigeonholeFile: "" },
+    };
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open(prop) {
+      this.visible = true;
+      this.params.id = prop;
+    },
+    //
+    hide() {
+      this.visible = false;
+      this.params.id = "";
+      this.params.pigeonholeFile = "";
+    },
+    //
+    async submit(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { id, pigeonholeFile } = prop;
+        const { msg, code } = await PIGEONHOLE({ id, pigeonholeFile });
+        if (code === 200) {
+          this.hide();
+          this.$emit("success");
+          this.$notify.success({ title: msg });
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // loading
+        this.loading = false;
+      }
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-dialog
+    width="25%"
+    :show-close="false"
+    :visible.sync="visible"
+    @close="hide"
+  >
+    <div
+      slot="title"
+      style="display: flex; justify-content: space-between; align-items: center"
+    >
+      <span>{{ title }}</span>
+      <span>
+        <el-button
+          :size="size"
+          :disabled="loading"
+          circle
+          icon="el-icon-close"
+          @click="visible = false"
+        >
+        </el-button>
+        <el-button
+          :size="size"
+          :disabled="!params.pigeonholeFile || loading"
+          circle
+          icon="el-icon-check"
+          @click="submit(params)"
+        >
+        </el-button>
+      </span>
+    </div>
+    <el-form
+      :size="size"
+      :model="params"
+      label-width="0px"
+      label-position="right"
+    >
+      <el-form-item prop="pigeonholeFile" label="">
+        <file-upload v-model="params.pigeonholeFile" :limit="1"></file-upload>
+      </el-form-item>
+    </el-form>
+  </el-dialog>
+</template>

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

@@ -15,7 +15,23 @@ export default {
       ...useData(Column),
     };
   },
-  computed: {},
+  computed: {
+    hasPowerEdit: function () {
+      return this.$parent.$parent.hasPowerEdit;
+    },
+    hasPowerDelete: function () {
+      return this.$parent.$parent.hasPowerDelete;
+    },
+    hasPowerAlteration: function () {
+      return this.$parent.$parent.hasPowerAlteration;
+    },
+    hasPowerPigeonhole: function () {
+      return this.$parent.$parent.hasPowerPigeonhole;
+    },
+    hasPowerTermination: function () {
+      return this.$parent.$parent.hasPowerTermination;
+    },
+  },
   watch: {},
   methods: {
     //
@@ -29,6 +45,31 @@ export default {
       const { hide } = useMethods();
       await hide({ _this: this });
     },
+    //
+    async useEdit(prop) {
+      const { useEdit } = this.$parent.$parent;
+      await useEdit(prop);
+    },
+    //
+    async useDelete(prop) {
+      const { useDelete } = this.$parent.$parent;
+      await useDelete(prop);
+    },
+    //
+    async useTermination(prop) {
+      const { useTermination } = this.$parent.$parent;
+      await useTermination(prop);
+    },
+    //
+    async usePigeonhole(prop) {
+      const { usePigeonhole } = this.$parent.$parent;
+      await usePigeonhole(prop);
+    },
+    //
+    async useAlteration(prop) {
+      const { useAlteration } = this.$parent.$parent;
+      await useAlteration(prop);
+    },
   },
   created() {},
   mounted() {},
@@ -51,6 +92,71 @@ export default {
           icon="el-icon-close"
           @click="hide"
         ></el-button>
+        <el-tooltip
+          v-if="hasPowerDelete([params])"
+          effect="dark"
+          content="删 除"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-delete"
+            @click="useDelete([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          v-if="hasPowerEdit([params])"
+          effect="dark"
+          content="编 辑"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-edit"
+            @click="useEdit([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          v-if="hasPowerTermination([params])"
+          effect="dark"
+          content="终 止"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-light-rain"
+            @click="useTermination([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          v-if="hasPowerPigeonhole([params])"
+          effect="dark"
+          content="归 档"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-lightning"
+            @click="usePigeonhole([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          v-if="hasPowerAlteration([params])"
+          effect="dark"
+          content="变 更"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-heavy-rain"
+            @click="useAlteration([params])"
+          ></el-button>
+        </el-tooltip>
       </span>
     </template>
     <el-descriptions :size="size" :column="column" border style="margin: 10px">

+ 14 - 3
src/views/purchase/contract/termination/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useMethods from "../hooks/function";
+import { TERMINATION } from "@/api/business/purchase/contract";
 
 export default {
   name: "TerminationDialog",
@@ -17,8 +17,19 @@ export default {
         type: "info",
       })
         .then(async () => {
-          const { termination } = useMethods();
-          await termination({ _this: this, prop });
+          try {
+            // try
+            const { code } = await TERMINATION({ id: prop });
+            if (code === 200) {
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+          }
         })
         .catch((err) => {
           console.error(err);

+ 2 - 2
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://172.16.100.107:8080/drp-admin`, //测试
-        target: `http://test-sy.derom.com/drp-admin`, //测试
+        // target: `http://test-sy.derom.com/drp-admin`, //测试
         // target: `http://release-sy.derom.com/drp-admin`, //预发
         // target: `http://sy.derom.com/drp-admin`, //生产
         // target: `http://172.16.63.202:8000/drp-admin`, // D本地
@@ -46,7 +46,7 @@ module.exports = {
         // target: `http://172.16.13.47:8000/drp-admin`, //这是一个美女的本地
         // target: `http://172.16.13.113:8000/drp-admin`, //DWT本地
         // target: `http://172.16.13.77:8000/drp-admin`, //TQ本地
-        // target: `http://172.16.13.21:8000/drp-admin`, // 雪豹的本地
+        target: `http://172.16.13.21:8000/drp-admin`, // 雪豹的本地
         changeOrigin: true,
         pathRewrite: {
           ["^" + process.env.VUE_APP_BASE_API]: "",