Quellcode durchsuchen

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!135
黄梓星 vor 2 Jahren
Ursprung
Commit
c9299c75f6
29 geänderte Dateien mit 295 neuen und 154 gelöschten Zeilen
  1. 1 1
      src/views/purchase/apply/add/column.js
  2. 4 4
      src/views/purchase/apply/add/index.vue
  3. 5 3
      src/views/purchase/apply/column.js
  4. 15 3
      src/views/purchase/apply/delete/index.vue
  5. 1 1
      src/views/purchase/apply/edit/column.js
  6. 4 4
      src/views/purchase/apply/edit/index.vue
  7. 0 0
      src/views/purchase/apply/hooks/data.js
  8. 0 0
      src/views/purchase/apply/hooks/dicts.js
  9. 2 34
      src/views/purchase/apply/hooks/function.js
  10. 0 0
      src/views/purchase/apply/hooks/table-function.js
  11. 58 18
      src/views/purchase/apply/index.vue
  12. 6 4
      src/views/purchase/apply/see/index.vue
  13. 15 3
      src/views/purchase/apply/submit/index.vue
  14. 5 5
      src/views/purchase/contract/add/index.vue
  15. 1 1
      src/views/purchase/contract/delete/index.vue
  16. 5 5
      src/views/purchase/contract/edit/index.vue
  17. 0 0
      src/views/purchase/contract/hooks/data.js
  18. 0 0
      src/views/purchase/contract/hooks/dicts.js
  19. 0 0
      src/views/purchase/contract/hooks/function.js
  20. 0 0
      src/views/purchase/contract/hooks/table-function.js
  21. 0 0
      src/views/purchase/contract/hooks/watch.js
  22. 5 5
      src/views/purchase/contract/record/index.vue
  23. 3 3
      src/views/purchase/contract/see/index.vue
  24. 1 1
      src/views/purchase/contract/termination/index.vue
  25. 0 1
      src/views/purchase/task/column.js
  26. 46 13
      src/views/purchase/task/documents-return/index.vue
  27. 41 21
      src/views/purchase/task/first-direct/index.vue
  28. 39 10
      src/views/purchase/task/index.vue
  29. 38 14
      src/views/purchase/task/modify-buyer/index.vue

+ 1 - 1
src/views/purchase/apply/add/column.js

@@ -128,7 +128,7 @@ export const FormColumns = [
     key: "isEffective",
     title: "是否已推价格",
     inputType: "Select",
-    referName: "sys_yes_no",
+    referName: "is_effective",
   },
   {
     key: "effectiveDate",

+ 4 - 4
src/views/purchase/apply/add/index.vue

@@ -1,9 +1,9 @@
 <script>
 import Column from "./column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useTable from "../hooks/use-table";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useTable from "../hooks/table-function";
+import useMethods from "../hooks/function";
 
 export default {
   name: "AddDrawer",

+ 5 - 3
src/views/purchase/apply/column.js

@@ -54,7 +54,7 @@ export const FormColumns = [
     key: "isEffective",
     title: "是否已推价格",
     inputType: "Select",
-    referName: "sys_yes_no",
+    referName: "is_effective",
   },
   {
     key: "effectiveDate",
@@ -123,14 +123,16 @@ export const SearchColumns = [
   },
   {
     key: "isEffective",
-    title: "是否推价",
+    title: "是否推价",
     inputType: "Select",
-    referName: "sys_yes_no",
+    referName: "is_effective",
+    clearable: true,
   },
   {
     key: "status",
     title: "状态",
     inputType: "Select",
     referName: "sys_status",
+    clearable: true,
   },
 ];

+ 15 - 3
src/views/purchase/apply/delete/index.vue

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

+ 1 - 1
src/views/purchase/apply/edit/column.js

@@ -128,7 +128,7 @@ export const FormColumns = [
     key: "isEffective",
     title: "是否已推价格",
     inputType: "Select",
-    referName: "sys_yes_no",
+    referName: "is_effective",
   },
   {
     key: "effectiveDate",

+ 4 - 4
src/views/purchase/apply/edit/index.vue

@@ -1,9 +1,9 @@
 <script>
 import Column from "./column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useTable from "../hooks/use-table";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useTable from "../hooks/table-function";
+import useMethods from "../hooks/function";
 
 export default {
   name: "EditDrawer",

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


+ 0 - 0
src/views/purchase/apply/hooks/use-dicts.js → src/views/purchase/apply/hooks/dicts.js


+ 2 - 34
src/views/purchase/apply/hooks/use-methods.js → src/views/purchase/apply/hooks/function.js

@@ -1,5 +1,5 @@
 import { REFER } from "@/components/popover-select/api";
-import { SAVE, ITEM, REMOVE, SUBMIT } from "@/api/business/purchase/apply";
+import { SAVE, ITEM } from "@/api/business/purchase/apply";
 
 export default function useMethods() {
   const fetchItem = async ({ _this, prop }) => {
@@ -116,44 +116,12 @@ 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 submit = async ({ _this, prop }) => {
-    try {
-      // try
-      const ids = prop.map((item) => item.id).join(",");
-      const { msg, code } = await SUBMIT(ids);
-      if (code === 200) {
-        _this.$emit("success");
-        _this.$notify.success(msg);
-      }
-    } catch (err) {
-      // catch
-      console.error(err);
-    } finally {
-      // finally
-    }
-  };
+
   return {
     open,
     hide,
     add,
     edit,
-    remove,
-    submit,
     fetchItem,
     fetchRefer,
   };

+ 0 - 0
src/views/purchase/apply/hooks/use-table.js → src/views/purchase/apply/hooks/table-function.js


+ 58 - 18
src/views/purchase/apply/index.vue

@@ -19,17 +19,28 @@ export default {
       searchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableData: [],
-      currentData: [],
+      selectData: [],
       tableColumns: FormColumns,
       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 === "1") return false;
+      // 已完成
+      else if (status === "2") return false;
+      // other
+      else return true;
+    },
+    //
     async fetchList(prop, page) {
       try {
         this.loading = true;
@@ -54,6 +65,7 @@ export default {
     },
     // 查 询
     useQuery(prop, page) {
+      this.selectData = [];
       this.fetchList(prop, page);
     },
     // 重 置
@@ -64,7 +76,7 @@ export default {
     },
     // 选 择
     useSelect(prop) {
-      this.currentData = [prop];
+      this.selectData = prop;
     },
     // 新 增
     async useAdd() {
@@ -77,16 +89,23 @@ export default {
       const { open } = this.$refs.AddModel;
       await open(id);
     },
+    hasPowerCopy(prop) {
+      return prop.length === 1;
+    },
     // 删 除
     async useDelete(prop) {
-      const [{ id }] = prop;
       const { open } = this.$refs.DeleteModel;
-      await open(id);
+      await open(prop);
     },
     hasPowerDelete(prop) {
-      if (!prop.length) return true;
-      const [{ status = undefined }] = prop;
-      return status === "1" || status === "2";
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "1") return false;
+        else if (status === "2") return false;
+        else return true;
+      } else {
+        return !!prop.length;
+      }
     },
     // 编 辑
     async useEdit(prop) {
@@ -95,9 +114,14 @@ export default {
       await open(id);
     },
     hasPowerEdit(prop) {
-      if (!prop.length) return true;
-      const [{ status = undefined }] = prop;
-      return status === "1" || status === "2";
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "1") return false;
+        else if (status === "2") return false;
+        else return true;
+      } else {
+        return !!prop.length;
+      }
     },
     // 明 细
     async useSee(prop) {
@@ -111,9 +135,14 @@ export default {
       await open(prop, done);
     },
     hasPowerSubmit(prop) {
-      if (!prop.length) return true;
-      const [{ status = undefined }] = prop;
-      return status === "1" || status === "2";
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "1") return false;
+        else if (status === "2") return false;
+        else return true;
+      } else {
+        return !!prop.length;
+      }
     },
   },
 };
@@ -169,6 +198,7 @@ export default {
               :clearable="column.clearable"
               :placeholder="column.placeholder"
               style="width: 100%"
+              @change="useQuery(params, page)"
               @keyup.enter.native="useQuery(params, page)"
             >
               <el-option
@@ -191,6 +221,7 @@ export default {
               :value-key="column.valueKey"
               :placeholder="column.placeholder"
               :data-mapping="column.dataMapping"
+              @change="useQuery(params, page)"
               @keyup.enter.native="useQuery(params, page)"
             >
             </dr-popover-select>
@@ -205,16 +236,16 @@ export default {
       <el-button :size="size" @click="useReset"> 重 置 </el-button>
       <el-button :size="size" @click="useAdd"> 新 增 </el-button>
       <el-button
+        v-show="hasPowerCopy(selectData)"
         :size="size"
-        :disabled="!currentData.length"
-        @click="useCopy(currentData)"
+        @click="useCopy(selectData)"
       >
         复 制
       </el-button>
       <el-button
-        v-if="!hasPowerDelete(currentData)"
+        v-show="hasPowerDelete(selectData)"
         :size="size"
-        @click="useDelete(currentData)"
+        @click="useDelete(selectData)"
       >
         删 除
       </el-button>
@@ -223,11 +254,20 @@ export default {
       :size="size"
       :data="tableData"
       highlight-current-row
-      @row-click="useSelect"
+      @row-click="useSelect([$event])"
       @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>
+      <el-table-column
         v-for="(column, index) in tableColumns"
         :key="index"
         :prop="column.key"

+ 6 - 4
src/views/purchase/apply/see/index.vue

@@ -1,8 +1,8 @@
 <script>
 import Column from "../add/column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useMethods from "../hooks/function";
 
 export default {
   name: "SeeDrawer",
@@ -91,7 +91,7 @@ export default {
           ></el-button>
         </el-tooltip>
         <el-tooltip
-          v-if="!hasPowerEdit([params])"
+          v-if="hasPowerEdit([params])"
           class="item"
           effect="dark"
           content="编 辑"
@@ -105,6 +105,7 @@ export default {
           ></el-button>
         </el-tooltip>
         <el-tooltip
+          v-if="hasPowerSubmit([params])"
           class="item"
           effect="dark"
           content="审 核"
@@ -153,6 +154,7 @@ export default {
             :prop="cColumn.key"
             :label="cColumn.title"
             :width="cColumn.width || 200"
+            show-overflow-tooltip
           >
             <template slot-scope="scope">
               <dict-tag

+ 15 - 3
src/views/purchase/apply/submit/index.vue

@@ -1,5 +1,5 @@
 <script>
-import useMethods from "../hooks/use-methods";
+import { SUBMIT } from "@/api/business/purchase/apply";
 
 export default {
   name: "SubmitDialog",
@@ -17,8 +17,20 @@ export default {
         type: "info",
       })
         .then(async () => {
-          const { submit } = useMethods();
-          await submit({ _this: this, prop });
+          try {
+            // try
+            const ids = prop.map((item) => item.id).join(",");
+            const { msg, code } = await SUBMIT(ids);
+            if (code === 200) {
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+          }
         })
         .catch((err) => {
           console.error(err);

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

@@ -1,10 +1,10 @@
 <script>
 import Column from "./column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useTable from "../hooks/use-table";
-import useWatch from "../hooks/use-watch";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useTable from "../hooks/table-function";
+import useWatch from "../hooks/watch";
+import useMethods from "../hooks/function";
 const { watchContractType } = useWatch();
 
 export default {

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

@@ -1,5 +1,5 @@
 <script>
-import useMethods from "../hooks/use-methods";
+import useMethods from "../hooks/function";
 
 export default {
   name: "DeleteDialog",

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

@@ -1,10 +1,10 @@
 <script>
 import Column from "../add/column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useTable from "../hooks/use-table";
-import useWatch from "../hooks/use-watch";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useTable from "../hooks/table-function";
+import useWatch from "../hooks/watch";
+import useMethods from "../hooks/function";
 const { watchContractType } = useWatch();
 
 export default {

+ 0 - 0
src/views/purchase/contract/hooks/use-data.js → src/views/purchase/contract/hooks/data.js


+ 0 - 0
src/views/purchase/contract/hooks/use-dicts.js → src/views/purchase/contract/hooks/dicts.js


+ 0 - 0
src/views/purchase/contract/hooks/use-methods.js → src/views/purchase/contract/hooks/function.js


+ 0 - 0
src/views/purchase/contract/hooks/use-table.js → src/views/purchase/contract/hooks/table-function.js


+ 0 - 0
src/views/purchase/contract/hooks/use-watch.js → src/views/purchase/contract/hooks/watch.js


+ 5 - 5
src/views/purchase/contract/record/index.vue

@@ -1,10 +1,10 @@
 <script>
 import Column from "../add/column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useTable from "../hooks/use-table";
-import useWatch from "../hooks/use-watch";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useTable from "../hooks/table-function";
+import useWatch from "../hooks/watch";
+import useMethods from "../hooks/function";
 const { watchContractType } = useWatch();
 
 export default {

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

@@ -1,8 +1,8 @@
 <script>
 import Column from "../add/column";
-import useData from "../hooks/use-data";
-import useDicts from "../hooks/use-dicts";
-import useMethods from "../hooks/use-methods";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useMethods from "../hooks/function";
 
 export default {
   name: "SeeDrawer",

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

@@ -1,5 +1,5 @@
 <script>
-import useMethods from "../hooks/use-methods";
+import useMethods from "../hooks/function";
 
 export default {
   name: "TerminationDialog",

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

@@ -109,7 +109,6 @@ export const SearchColumns = [
     title: "状态",
     inputType: "Select",
     referName: "purchase_task_status",
-    value: "0",
     clearable: true,
   },
   {

+ 46 - 13
src/views/purchase/task/documents-return/index.vue

@@ -6,6 +6,7 @@ export default {
   data() {
     return {
       size: "mini",
+      title: "退回需求",
       visible: false,
       loading: false,
       params: { baskCause: "", documentIds: [] },
@@ -29,22 +30,22 @@ export default {
     //
     async submit(prop) {
       try {
+        // try
         this.loading = true;
         const { baskCause, documentIds } = prop;
-        const { code, msg } = await DOCUMENTSRETURN({
+        const { msg, code } = await DOCUMENTSRETURN({
           baskCause,
           documentIds,
         });
         if (code === 200) {
           this.hide();
           this.$emit("success");
-          
-        } else {
-          this.$notify.warning({ title: msg });
+          this.$notify.success({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
@@ -56,7 +57,36 @@ export default {
 </script>
 
 <template>
-  <el-dialog width="25%" :visible.sync="visible" title="退回需求" @close="hide">
+  <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="loading"
+          circle
+          icon="el-icon-check"
+          @click="submit(params)"
+        >
+        </el-button>
+      </span>
+    </div>
     <el-alert
       title="请填写退单原因"
       type="info"
@@ -65,13 +95,16 @@ export default {
       style="margin-bottom: 10px"
     >
     </el-alert>
-    <el-input v-model="params.baskCause" :size="size"></el-input>
-    <span slot="footer">
-      <el-button :size="size" @click="visible = false">取 消</el-button>
-      <el-button :size="size" type="primary" @click="submit(params)"
-        >确 定</el-button
-      >
-    </span>
+    <el-form
+      :size="size"
+      :model="params"
+      label-width="0px"
+      label-position="right"
+    >
+      <el-form-item prop="" label="">
+        <el-input v-model="params.baskCause" :size="size"></el-input>
+      </el-form-item>
+    </el-form>
   </el-dialog>
 </template>
 

+ 41 - 21
src/views/purchase/task/first-direct/index.vue

@@ -1,9 +1,9 @@
 <script>
 import { TableColumns } from "./column";
-import { initColumns } from "@/utils/init";
+import { initDicts, initColumns } from "@/utils/init";
 import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
 export default {
-  name: "FirstDirectPurchaseDialog",
+  name: "FirstDirectPurchaseDrawer",
   dicts: initDicts(TableColumns),
   components: {},
   data() {
@@ -22,9 +22,8 @@ export default {
   watch: {},
   methods: {
     //
-    open(prop) {
-      this.visible = true;
-      this.fetchItem(prop);
+    async open(prop) {
+      this.visible = await this.fetchItem(prop);
     },
     //
     hide() {
@@ -33,23 +32,26 @@ export default {
     //
     async fetchItem(prop) {
       try {
+        // try
         this.loading = true;
         const { code, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
-          this.data = data;
+          prop = data;
+          return true;
         } else {
-          this.hide();
-          this.$notify.warning({ title: msg });
+          return false;
         }
       } catch (err) {
-        this.hide();
+        // catch
+        console.error(err);
       } finally {
+        // finally
         this.loading = false;
       }
     },
     //
-    async submit() {
-      const params = this.data
+    async submit(prop) {
+      const params = prop
         .map((item) => ({
           ...item,
           orderPriceVos: item.orderPriceVos.filter(
@@ -58,18 +60,17 @@ export default {
         }))
         .filter((item) => item.orderPriceVos.length);
       try {
-        const { code, msg } = await ADD(params);
+        // try
+        const { msg, code } = await ADD(params);
         if (code === 200) {
           this.hide();
           this.$emit("success");
           this.$notify.success({ title: msg, duration: 0 });
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
-        //
+        // finally
       }
     },
   },
@@ -80,7 +81,30 @@ export default {
 </script>
 
 <template>
-  <el-drawer :visible.sync="visible" :size="width" :title="title">
+  <el-drawer
+    :size="width"
+    :title="title"
+    :show-close="false"
+    :visible.sync="visible"
+  >
+    <template slot="title">
+      <span>{{ title }}</span>
+      <span>
+        <el-button
+          :size="size"
+          circle
+          icon="el-icon-close"
+          @click="visible = false"
+        ></el-button>
+        <el-button
+          :size="size"
+          circle
+          icon="el-icon-check"
+          @click="submit(data)"
+        >
+        </el-button>
+      </span>
+    </template>
     <div v-for="(item, index) in data" :key="index" style="margin: 10px">
       <el-descriptions :size="size" :column="column" border>
         <template #title>
@@ -146,10 +170,6 @@ export default {
           </template>
         </el-table-column>
       </el-table>
-      <div slot="footer" style="text-align: right; margin-top: 10px">
-        <el-button :size="size" @click="hide">取 消</el-button>
-        <el-button :size="size" @click="submit">提 交</el-button>
-      </div>
     </div>
   </el-drawer>
 </template>

+ 39 - 10
src/views/purchase/task/index.vue

@@ -28,15 +28,22 @@ export default {
   computed: {},
   watch: {},
   created() {
+    this.params.status = "0";
     this.useQuery(this.params, this.page);
   },
   methods: {
     //
     setSelectable(row) {
       const { status } = row;
-      if (status === "1") return true;
-      else if (status === "3") return true;
-      else return true;
+      if (status === "1") {
+        // 已执行协议直采
+        return false;
+      } else if (status === "3") {
+        // 已退回
+        return false;
+      } else {
+        return true;
+      }
     },
     //
     async fetchList(prop, page) {
@@ -95,12 +102,18 @@ export default {
       const { open } = this.$refs.ReturnModel;
       await open(prop);
     },
+    hasPowerReturn(prop) {
+      return !!prop.length;
+    },
     // 转 派
     async useShift(prop) {
       const { id } = prop;
       const { open } = this.$refs.ShiftModel;
       await open(id);
     },
+    hasPowerShift(prop) {
+      return prop.length === 1;
+    },
     // 明 细
     async useSee(prop) {
       const { id } = prop;
@@ -109,9 +122,13 @@ export default {
     },
     // 直 采
     async useDirect(prop) {
+      console.log(this);
       const { open } = this.$refs.DirectModel;
       await open(prop);
     },
+    hasPowerDirect(prop) {
+      return !!prop.length;
+    },
     // 导 出
     async useExport(prop, page) {
       const { open } = this.$refs.ExportModel;
@@ -134,10 +151,22 @@ export default {
   >
     <see-model ref="SeeModel"></see-model>
     <export-model ref="ExportModel"></export-model>
-    <close-model ref="CloseModel" @success="useReset"></close-model>
-    <shift-model ref="ShiftModel" @success="useReset"></shift-model>
-    <direct-model ref="DirectModel" @success="useReset"></direct-model>
-    <return-model ref="ReturnModel" @success="useReset"></return-model>
+    <close-model
+      ref="CloseModel"
+      @success="useQuery(params, page)"
+    ></close-model>
+    <shift-model
+      ref="ShiftModel"
+      @success="useQuery(params, page)"
+    ></shift-model>
+    <direct-model
+      ref="DirectModel"
+      @success="useQuery(params, page)"
+    ></direct-model>
+    <return-model
+      ref="ReturnModel"
+      @success="useQuery(params, page)"
+    ></return-model>
     <el-backtop target=".el-scrollbar__wrap"></el-backtop>
     <el-form
       :size="size"
@@ -239,15 +268,15 @@ export default {
         导 出
       </el-button> -->
       <el-button
+        v-show="hasPowerShift(selectData)"
         :size="size"
-        :disabled="selectData.length !== 1"
         @click="useShift(selectData[0])"
       >
         转 派
       </el-button>
       <el-button
+        v-show="hasPowerReturn(selectData)"
         :size="size"
-        :disabled="!selectData.length"
         @click="useReturn(selectData)"
       >
         退回需求
@@ -260,8 +289,8 @@ export default {
           行关闭
         </el-button> -->
       <el-button
+        v-show="hasPowerDirect(selectData)"
         :size="size"
-        :disabled="!selectData.length"
         @click="useDirect(selectData)"
       >
         协议直采

+ 38 - 14
src/views/purchase/task/modify-buyer/index.vue

@@ -6,6 +6,7 @@ export default {
   data() {
     return {
       size: "mini",
+      title: "转 派",
       visible: false,
       loading: false,
       params: { id: "", buyer: "", buyerName: "" },
@@ -29,9 +30,10 @@ export default {
     //
     async submit(prop) {
       try {
+        // try
         this.loading = true;
         const { id, buyer, buyerName } = prop;
-        const { code, msg } = await MODEIFYBUYER([
+        const { msg, code } = await MODEIFYBUYER([
           {
             id,
             buyer,
@@ -41,13 +43,12 @@ export default {
         if (code === 200) {
           this.hide();
           this.$emit("success");
-          
-        } else {
-          this.$notify.warning({ title: msg });
+          this.$notify.success({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // loading
         this.loading = false;
       }
     },
@@ -59,7 +60,36 @@ export default {
 </script>
 
 <template>
-  <el-dialog width="25%" :visible.sync="visible" title="转派" @close="hide">
+  <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="loading"
+          circle
+          icon="el-icon-check"
+          @click="submit(params)"
+        >
+        </el-button>
+      </span>
+    </div>
     <el-alert
       title="转派后,采购任务将会从您的采购任务清单中删除,转移到转派目标人员的已受理采购任务清单中,您确定要转派吗?"
       type="info"
@@ -77,20 +107,14 @@ export default {
       <el-form-item prop="" label="">
         <dr-popover-select
           v-model="params.buyerName"
+          :source.sync="params"
+          :data-mapping="{ buyer: 'code', buyerName: 'name' }"
           title="转派人员"
           type="CONTACTS_PARAM"
-          :data-mapping="{ buyer: 'code', buyerName: 'name' }"
-          :source.sync="params"
         >
         </dr-popover-select>
       </el-form-item>
     </el-form>
-    <span slot="footer">
-      <el-button :size="size" @click="visible = false">取 消</el-button>
-      <el-button :size="size" type="primary" @click="submit(params)"
-        >确 定</el-button
-      >
-    </span>
   </el-dialog>
 </template>