Эх сурвалжийг харах

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!138
黄梓星 2 жил өмнө
parent
commit
ce5bbbf794

+ 26 - 2
src/api/business/purchase/catalogue.js

@@ -1,10 +1,18 @@
 import request from "@/utils/request";
 
-export function LIST(params) {
+export function LIST(data, params) {
   return request({
     url: "/pu/price/catalogue/list",
-    method: "GET",
+    method: "POST",
     params: params,
+    data: data,
+  });
+}
+
+export function ITEM(data) {
+  return request({
+    url: `/pu/price/catalogue/${data}`,
+    method: "GET",
   });
 }
 
@@ -16,6 +24,22 @@ export function EDIT(data) {
   });
 }
 
+export function INVALID(data) {
+  return request({
+    url: "/pu/price/catalogue/invalid",
+    method: "POST",
+    data: data,
+  });
+}
+
+export function ENABLE(data) {
+  return request({
+    url: "/pu/price/catalogue/enable",
+    method: "POST",
+    data: data,
+  });
+}
+
 export function EXPORT(data) {
   return request({
     url: "/pu/price/catalogue/export",

+ 8 - 8
src/components/popover-select/components/PSNLICENSE_PARAM.js

@@ -1,18 +1,18 @@
 // 人员证照参照
 export default [
-  {
-    key: "id",
-    title: "ID",
-    type: "Input",
-    search: true,
-  },
   // {
-  //   key: "code",
-  //   title: "编码",
+  //   key: "id",
+  //   title: "ID",
   //   type: "Input",
   //   search: true,
   // },
   {
+    key: "code",
+    title: "编码",
+    type: "Input",
+    search: true,
+  },
+  {
     key: "name",
     title: "名称",
     type: "Input",

+ 2 - 2
src/views/purchase/PurchaseDemandList/reserved.vue

@@ -18,12 +18,12 @@
         </template>
         {{ resData.source }}
       </el-descriptions-item>
-      <el-descriptions-item>
+      <!-- <el-descriptions-item>
         <template slot="label">
           客户
         </template>
         {{ resData.customer }}
-      </el-descriptions-item>
+      </el-descriptions-item> -->
       <el-descriptions-item>
         <template slot="label">
           客户名称

+ 3 - 2
src/views/purchase/apply/add/column.js

@@ -176,14 +176,15 @@ export const TabColumns = [
         width: 200,
         referName: "MATERIAL_PARAM",
         dataMapping: {
-          material: "code",
+          material: "id",
+          materialCode: "code",
           materialName: "name",
           puUnit: "unitIdName",
           specification: "specification",
           manufacturer: "manufacturerIdName",
         },
       },
-      { title: "物料编码", key: "material" },
+      { title: "物料编码", key: "materialCode" },
       {
         title: "生产厂家",
         key: "manufacturer",

+ 3 - 2
src/views/purchase/apply/edit/column.js

@@ -174,14 +174,15 @@ export const TabColumns = [
         width: 200,
         referName: "MATERIAL_PARAM",
         dataMapping: {
-          material: "code",
+          material: "id",
+          materialCode: "code",
           materialName: "name",
           puUnit: "unitIdName",
           specification: "specification",
           manufacturer: "manufacturerIdName",
         },
       },
-      { title: "物料编码", key: "material" },
+      { title: "物料编码", key: "materialCode" },
       {
         title: "生产厂家",
         key: "manufacturer",

+ 1 - 3
src/views/purchase/apply/index.vue

@@ -46,9 +46,7 @@ export default {
         this.loading = true;
         const { pageNum, pageSize } = page;
         const { code, rows, total } = await LIST(
-          {
-            ...prop,
-          },
+          { ...prop },
           { pageNum, pageSize }
         );
         if (code === 200) {

+ 47 - 6
src/views/purchase/catalogue/column.js

@@ -1,4 +1,18 @@
-export const TableColumns = [
+export const FormColumns = [
+  {
+    key: "status",
+    title: "有效状态",
+    inputType: "Select",
+    referName: "is_effective",
+    width: 100,
+  },
+  {
+    key: "enableStatus",
+    title: "启用状态",
+    inputType: "Select",
+    referName: "is_effective",
+    width: 100,
+  },
   {
     key: "puOrgName",
     title: "采购组织",
@@ -39,12 +53,25 @@ export const TableColumns = [
   { key: "buyer", title: "采购员" },
   { key: "buyerName", title: "采购员名称" },
   { key: "source", title: "来源单据编号" },
-  { key: "status", title: "有效状态" },
-  { key: "enableStatus", title: "启用状态" },
   { key: "convertRate", title: "换算率" },
-  { key: "materialStatus", title: "物料启用状态" },
-  { key: "isDistribution", title: "配送价" },
-  { key: "priceType", title: "价格类型" },
+  {
+    key: "materialStatus",
+    title: "物料启用状态",
+    inputType: "Select",
+    referName: "is_effective",
+  },
+  {
+    key: "isDistribution",
+    title: "配送价",
+    inputType: "Select",
+    referName: "is_effective",
+  },
+  {
+    key: "priceType",
+    title: "价格类型",
+    inputType: "Select",
+    referName: "sys_price_type",
+  },
   { key: "demandCode", title: "采购需求单号" },
   { key: "expiryEarly", title: "效期预警" },
   { key: "priority", title: "含税/无税优先" },
@@ -80,4 +107,18 @@ export const SearchColumns = [
   },
   { key: "source", title: "来源单据编号", inputType: "Input" },
   { key: "material", title: "物料编码", inputType: "Input" },
+  {
+    key: "status",
+    title: "有效状态",
+    inputType: "Select",
+    referName: "is_effective",
+  },
+  {
+    key: "enableStatus",
+    title: "启用状态",
+    inputType: "Select",
+    referName: "is_effective",
+  },
 ];
+
+export default { FormColumns, SearchColumns };

+ 0 - 137
src/views/purchase/catalogue/edit/index.vue

@@ -1,137 +0,0 @@
-<script>
-import { TableColumns } from "../column";
-import { EDIT } from "@/api/business/purchase/contract";
-import { initDicts, initRules, initParams } from "@/utils/init";
-
-export default {
-  name: "EditDialog",
-  dicts: initDicts(TableColumns),
-  components: {},
-  data() {
-    return {
-      size: "mini",
-      visible: false,
-      loading: false,
-      columns: TableColumns,
-      rules: initRules(TableColumns),
-      params: initParams(TableColumns),
-    };
-  },
-  computed: {},
-  watch: {},
-  methods: {
-    //
-    open(prop) {
-      this.visible = true;
-      this.fetchItem(prop);
-    },
-    //
-    hide() {
-      this.visible = false;
-      this.params = initParams(this.columns);
-    },
-    //
-    async fetchItem(prop) {
-      try {
-        this.loading = true;
-        this.params = prop;
-      } catch (err) {
-        //
-      } finally {
-        this.loading = false;
-      }
-    },
-    //
-    submit(prop) {
-      this.$refs[prop].validate(async (valid) => {
-        if (valid) {
-          try {
-            const { code, msg } = await EDIT({
-              ...this.params,
-            });
-            if (code === 200) {
-              this.hide();
-              this.$emit("success");
-              
-            } else {
-              this.$notify.warning({ title: msg });
-            }
-          } catch (err) {
-            //
-          } finally {
-            //
-          }
-        } else {
-          return false;
-        }
-      });
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<template>
-  <el-dialog :visible.sync="visible" title="新增" fullscreen @close="hide">
-    <el-form
-      ref="ruleForm"
-      v-loading="loading"
-      :size="size"
-      :rules="rules"
-      :model="params"
-      label-width="auto"
-      label-position="right"
-    >
-      <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
-        <el-col
-          v-for="(column, index) in columns"
-          :key="index"
-          :span="column.span || 8"
-        >
-          <el-form-item :prop="column.key" :label="column.title">
-            <el-input
-              v-if="column.inputType === 'Input'"
-              v-model="params[column.key]"
-              :disabled="column.disabled"
-              :readonly="column.readonly"
-              :clearable="column.clearable"
-              :placeholder="column.placeholder"
-              style="width: 100%"
-            ></el-input>
-            <dr-popover-select
-              v-if="column.inputType === 'PopoverSelect'"
-              v-model="params[column.key]"
-              :source.sync="params"
-              :title="column.title"
-              :type="column.referName"
-              :disabled="column.disabled"
-              :readonly="column.readonly"
-              :clearable="column.clearable"
-              :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
-              style="width: 100%"
-            >
-            </dr-popover-select>
-            <el-switch
-              v-if="column.inputType === 'Switch'"
-              v-model="params[column.key]"
-              active-value="1"
-              inactive-value="0"
-            >
-            </el-switch>
-            <file-upload
-              v-if="column.inputType === 'Upload'"
-              v-model="params[column.key]"
-              :file-type="column.fileType"
-            ></file-upload>
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <div style="text-align: right">
-      <el-button :size="size" @click="hide">取 消</el-button>
-      <el-button :size="size" @click="submit('ruleForm')">新 增</el-button>
-    </div>
-  </el-dialog>
-</template>

+ 45 - 0
src/views/purchase/catalogue/enable/index.vue

@@ -0,0 +1,45 @@
+<script>
+import { ENABLE } from "@/api/business/purchase/catalogue";
+
+export default {
+  name: "EnableDialog",
+  data() {
+    return {};
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open(prop, status) {
+      return this.$confirm("是否启停数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+      })
+        .then(async () => {
+          try {
+            // try
+            const ids = prop.map((item) => item.id);
+            const { msg, code } = await ENABLE({ ids, enableStatus: status });
+            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>

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

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

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

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

+ 32 - 0
src/views/purchase/catalogue/hooks/function.js

@@ -0,0 +1,32 @@
+import { ITEM } from "@/api/business/purchase/catalogue";
+
+export default function useMethods() {
+  const fetchItem = async ({ _this, prop }) => {
+    try {
+      // try
+      _this.loading = true;
+      const { code, data } = await ITEM(prop);
+      if (code === 200) {
+        _this.params = data;
+      }
+    } catch (err) {
+      // catch
+      console.error(err);
+    } finally {
+      // finally
+      _this.loading = false;
+    }
+  };
+  const open = ({ _this }) => {
+    _this.visible = true;
+  };
+  const hide = ({ _this }) => {
+    _this.visible = false;
+  };
+
+  return {
+    open,
+    hide,
+    fetchItem,
+  };
+}

+ 138 - 24
src/views/purchase/catalogue/index.vue

@@ -1,11 +1,14 @@
 <script>
-import { TableColumns, SearchColumns } from "./column";
+import { FormColumns, SearchColumns } from "./column";
 import { LIST } from "@/api/business/purchase/catalogue";
-import { initPage, initParams } from "@/utils/init";
+import { initPage, initDicts, initParams } from "@/utils/init";
 export default {
   name: "PuchaseCatalogue",
+  dicts: [...initDicts(SearchColumns), ...initDicts(FormColumns)],
   components: {
-    EditModel: () => import("./edit/index.vue"),
+    SeeModel: () => import("./see/index.vue"),
+    InvalidModel: () => import("./invalid/index.vue"),
+    EnableModel: () => import("./enable/index.vue"),
   },
   data() {
     return {
@@ -14,25 +17,34 @@ export default {
       searchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableData: [],
-      tableColumns: TableColumns,
+      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 === "2") return false;
+      // other
+      else return true;
+    },
+    //
     async fetchList(prop, page) {
       try {
         this.loading = true;
         const { pageNum, pageSize } = page;
-        const { code, rows, total } = await LIST({
-          pageNum,
-          pageSize,
-          ...prop,
-        });
+        const { code, rows, total } = await LIST(
+          { ...prop },
+          { pageNum, pageSize }
+        );
         if (code === 200) {
           this.tableData = rows;
           this.page.total = total;
@@ -46,6 +58,7 @@ export default {
     },
     // 查 询
     useQuery(prop, page) {
+      this.selectData = [];
       this.fetchList(prop, page);
     },
     // 重 置
@@ -54,12 +67,44 @@ export default {
       this.params = initParams(SearchColumns);
       this.useQuery(this.params, this.page);
     },
-    // 编 辑
-    async useEdit(prop) {
-      return;
-      const { open } = this.$refs.EditModel;
+    // 选 择
+    useSelect(prop) {
+      this.selectData = prop;
+    },
+    // 明 细
+    async useSee(prop) {
+      const { id } = prop;
+      const { open } = this.$refs.SeeModel;
+      await open(id);
+    },
+    // 失 效
+    async useInvalid(prop) {
+      const { open } = this.$refs.InvalidModel;
       await open(prop);
     },
+    hasPowerInvalid(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "2") return false;
+        else return true;
+      } else {
+        return !!prop.length;
+      }
+    },
+    // 启 停
+    async useEnable(prop, status) {
+      const { open } = this.$refs.EnableModel;
+      await open(prop, status);
+    },
+    hasPowerEnable(prop) {
+      if (prop.length === 1) {
+        const [{ status }] = prop;
+        if (status === "2") return false;
+        else return true;
+      } else {
+        return !!prop.length;
+      }
+    },
   },
 };
 </script>
@@ -67,10 +112,23 @@ export default {
 <template>
   <el-card
     v-loading="loading"
-    style="width: calc(100% - 24px); height: 100%; margin: 10px"
+    style="
+      width: calc(100% - 20px);
+      height: 100%;
+      margin: 10px;
+      padding: 0 20px 20px 0;
+    "
     :body-style="{ padding: 0 }"
   >
-    <!-- <see-drawer ref="SeeDrawerFef"></see-drawer> -->
+    <see-model ref="SeeModel"></see-model>
+    <invalid-model
+      ref="InvalidModel"
+      @success="useQuery(params, page)"
+    ></invalid-model>
+    <enable-model
+      ref="EnableModel"
+      @success="useQuery(params, page)"
+    ></enable-model>
     <!-- <add-drawer ref="AddDrawerFef" @close="resetList"></add-drawer> -->
     <!-- <edit-model ref="EditModel" @success="resetList"></edit-model> -->
     <el-form
@@ -96,14 +154,24 @@ export default {
                   style="width: 100%"
                   @keyup.enter.native="useQuery(params, page)"
                 ></el-input>
-                <el-switch
-                  v-if="column.inputType === 'Switch'"
+                <el-select
+                  v-if="column.inputType === 'Select'"
                   v-model="params[column.key]"
-                  active-value="1"
-                  inactive-value="0"
+                  :disabled="column.disabled"
+                  :clearable="column.clearable"
+                  :placeholder="column.placeholder"
+                  style="width: 100%"
+                  @change="useQuery(params, page)"
                   @keyup.enter.native="useQuery(params, page)"
                 >
-                </el-switch>
+                  <el-option
+                    v-for="item in dict.type[column.referName]"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
                 <dr-popover-select
                   v-if="column.inputType === 'PopoverSelect'"
                   v-model="params[column.key]"
@@ -116,6 +184,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>
@@ -130,21 +199,66 @@ export default {
         查 询
       </el-button>
       <el-button :size="size" @click="useReset"> 重 置 </el-button>
+      <el-button
+        v-show="hasPowerInvalid(selectData)"
+        :size="size"
+        @click="useInvalid(selectData)"
+      >
+        失 效
+      </el-button>
+      <el-button
+        v-show="hasPowerEnable(selectData)"
+        :size="size"
+        @click="useEnable(selectData, '0')"
+      >
+        启 用
+      </el-button>
+      <el-button
+        v-show="hasPowerEnable(selectData)"
+        :size="size"
+        @click="useEnable(selectData, '2')"
+      >
+        停 用
+      </el-button>
     </el-row>
     <el-table
-      @row-dblclick="useEdit"
-      :data="tableData"
       :size="size"
+      :data="tableData"
+      highlight-current-row
+      @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"
         :label="column.title"
-        :width="column.width || 180"
-        :show-overflow-tooltip="column.showOverflowTooltip || true"
+        :width="column.width || 200"
+        show-overflow-tooltip
       >
+        <template slot-scope="scope">
+          <dict-tag
+            v-if="column.inputType === 'Select'"
+            :size="size"
+            :value="scope.row[column.key]"
+            :options="dict.type[column.referName]"
+          />
+          <dr-file-preview
+            v-else-if="column.inputType === 'Upload'"
+            v-model="scope.row[column.key]"
+          ></dr-file-preview>
+          <span v-else>{{ scope.row[column.key] }}</span>
+        </template>
       </el-table-column>
     </el-table>
     <pagination

+ 45 - 0
src/views/purchase/catalogue/invalid/index.vue

@@ -0,0 +1,45 @@
+<script>
+import { INVALID } from "@/api/business/purchase/catalogue";
+
+export default {
+  name: "InvalidDialog",
+  data() {
+    return {};
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open(prop) {
+      return this.$confirm("是否失效数据项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "info",
+      })
+        .then(async () => {
+          try {
+            // try
+            const ids = prop.map((item) => item.id);
+            const { msg, code } = await INVALID({ ids });
+            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>

+ 127 - 0
src/views/purchase/catalogue/see/index.vue

@@ -0,0 +1,127 @@
+<script>
+import Column from "../column";
+import useData from "../hooks/data";
+import useDicts from "../hooks/dicts";
+import useMethods from "../hooks/function";
+
+export default {
+  name: "SeeDrawer",
+  dicts: useDicts(Column),
+  data() {
+    return {
+      column: 3,
+      title: "明 细",
+      ...useData(Column),
+    };
+  },
+  computed: {
+    hasPowerEnable: function () {
+      return this.$parent.$parent.hasPowerEnable;
+    },
+    hasPowerInvalid: function () {
+      return this.$parent.$parent.hasPowerInvalid;
+    },
+  },
+  watch: {},
+  methods: {
+    //
+    async open(prop) {
+      const { open, fetchItem } = useMethods();
+      await open({ _this: this });
+      await fetchItem({ _this: this, prop });
+    },
+    //
+    async hide() {
+      const { hide } = useMethods();
+      await hide({ _this: this });
+    },
+    //
+    async useInvalid(prop) {
+      const { useInvalid } = this.$parent.$parent;
+      await useInvalid(prop).then(() => {
+        const [{ id }] = prop;
+        const { fetchItem } = useMethods();
+        fetchItem({ _this: this, prop: id });
+      });
+    },
+    //
+    async useEnable(prop) {
+      const [{ id, enableStatus }] = prop;
+      const { useEnable } = this.$parent.$parent;
+      const status = enableStatus === "2" ? "0" : "2";
+      await useEnable(prop, status).then(() => {
+        const { fetchItem } = useMethods();
+        fetchItem({ _this: this, prop: id });
+      });
+    },
+  },
+  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"
+          circle
+          icon="el-icon-close"
+          @click="hide"
+        ></el-button>
+        <el-tooltip
+          v-if="hasPowerInvalid([params])"
+          effect="dark"
+          content="失 效"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-no-smoking"
+            @click="useInvalid([params])"
+          ></el-button>
+        </el-tooltip>
+        <el-tooltip
+          v-if="hasPowerEnable([params])"
+          effect="dark"
+          :content="params.enableStatus === '2' ? '启 用' : '停 用'"
+          placement="bottom-end"
+        >
+          <el-button
+            :size="size"
+            circle
+            icon="el-icon-turn-off-microphone"
+            @click="useEnable([params])"
+          ></el-button>
+        </el-tooltip>
+      </span>
+    </template>
+    <el-descriptions :size="size" :column="column" border style="margin: 10px">
+      <el-descriptions-item
+        v-if="params[column.key]"
+        v-for="(column, index) in formColumns"
+        :key="index"
+        :label="column.title"
+      >
+        <dict-tag
+          v-if="column.inputType === 'Select'"
+          :size="size"
+          :value="params[column.key]"
+          :options="dict.type[column.referName]"
+        />
+        <span v-else-if="column.inputType === 'Upload'">
+          <dr-file-preview v-model="params[column.key]"></dr-file-preview>
+        </span>
+        <span v-else>{{ params[column.key] }}</span>
+      </el-descriptions-item>
+    </el-descriptions>
+  </el-drawer>
+</template>

+ 29 - 4
src/views/purchase/purchase-order/add/column.js

@@ -191,7 +191,13 @@ export const Columns = [
     width: 200,
   },
   // { key: "isSendSrm", title: "是否同步SRM", inputType: "Checkbox",isShow:true, },
-  { key: "isInvoice", title: "发票标识", inputType: "Checkbox", isShow:true,},
+  { 
+    key: "isInvoice", 
+    title: "发票标识", 
+    inputType: "Checkbox", 
+    isShow:true,
+    disabled:true,
+  },
   { key: "supplierOrderNo", title: "供应商订单号", inputType: "Input",isShow:true, },
   { 
     key: "rebateMoney", 
@@ -277,8 +283,20 @@ export const Columns = [
     }),
     width: 200,
   },
-  { key: "isUrgency", title: "紧急程度", inputType: "Checkbox",isShow:true, },
-  { key: "isSendWms", title: "已同步WMS", inputType: "Checkbox",isShow:true, },
+  { 
+    key: "isUrgency", 
+    title: "紧急程度", 
+    inputType: "Checkbox",
+    isShow:true,
+    disabled:true,
+   },
+  { 
+    key: "isSendWms", 
+    title: "已同步WMS", 
+    inputType: "Checkbox",
+    isShow:true,
+    disabled:true,
+   },
   // { key: "agent", title: "代理人", inputType: "Input", }, // 建议删除
   {
     key: "agentName",
@@ -294,13 +312,20 @@ export const Columns = [
     queryParams: () => ({}),
     width: 200,
   },
-  { key: "isClose", title: "最终关闭", inputType: "Checkbox", isShow:true, },
+  { 
+    key: "isClose", 
+    title: "最终关闭", 
+    inputType: "Checkbox", 
+    isShow:true,
+    disabled:true,
+   },
   {
     key: "closeTime",
     title: "最终关闭日期",
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
     isShow:true,
+    disabled:true,
   },
   { 
     key: "applyPaymentMoney", 

+ 2 - 3
src/views/purchase/purchase-order/add/index.vue

@@ -293,8 +293,7 @@ export default {
       })
     },
     // 主表参照改变之后
-   async handleReferChange(val, source, type){
-     console.log(val,'val-------------------');
+   async handleReferChange(val, type, source){
       // 供应商选择  
       if( type === 'SUPPLIER_PARAM' ){
 
@@ -359,7 +358,7 @@ export default {
 
 
     // 子表参照改变之后
-   async handleTabReferChange(val, source, type) {
+   async handleTabReferChange(val,  type, source) {
 
       // 触发物料参照询价   && source.qty && source.qty != ""
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {

+ 56 - 2
src/views/purchase/purchase-order/edit/index.vue

@@ -230,9 +230,62 @@ export default {
     },
     beforeOpen() {
     },
+
+     // 主表参照改变之后
+   async handleReferChange(val, type, source){
+      // 供应商选择  
+      if( type === 'SUPPLIER_PARAM' ){
+
+        let page = { pageNum: 1 , pageSize: 10 };
+
+        let relevanceRefer = [
+          {
+            // 供应商联系人
+            key:'supplierContacts',
+            params:{
+              type:'SUPPLIERCONTACTS_PARAM',
+              supplierId:val.id,
+            }
+          },
+          {
+            // 供应商业务员
+            key:'supplierPersonal',
+            params:{
+              type:'PSNLICENSE_PARAM',
+              supplierId:val.id,
+              pkOrg: source.puOrg,
+            }
+          }
+        ]
+
+      await  relevanceRefer.forEach(async (refer) =>{
+
+          try {
+
+            const { code, rows} = await orderApi.REFER(
+              {
+                ...refer.params,
+                search: "",
+                isPage: true,
+              }, page );
+
+            if (code === 200) {
+
+              source[refer.key] = rows[0]? rows[0].id :'';
+
+              source[`${refer.key}Name`] = rows[0] ? rows[0].name :'';
+
+            }
+            
+          } catch (error) {}
+          
+        })
+        
+      }
+    },
     // 子表参照改变之后
-    async handleTabReferChange(val, source, type) {
-      
+    async handleTabReferChange(val, type, source) {
+
       // 触发物料参照
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
 
@@ -399,6 +452,7 @@ export default {
                 :data-mapping="column.dataMapping"
                 :disabled="column.disabled" 
                 :query-params="column.queryParams"
+                @change="handleReferChange"
                 ></dr-popover-select>
               <el-input v-if="column.inputType === 'Textarea'" 
                 v-model="params[column.key]" 

+ 140 - 70
src/views/purchase/purchase-order/index.vue

@@ -38,6 +38,10 @@ export default {
         puOrderExecuteList: [],
       },
       checkedList: [],
+      // 子表Select
+      checkedTabList: [],
+      // 主表点击信息
+      primaryResource:{},
     };
   },
   computed: {
@@ -134,6 +138,8 @@ export default {
     // 获取子表信息
     async handleDetailsData(row) {
       try {
+        this.primaryResource = row;
+        this.checkedTabList = [];
         const { code, msg, data } = await orderApi.details(row.id);
         if (code === 200) {
           // 物料信息:puOrderItemList   执行结果:puOrderExecuteList
@@ -186,30 +192,6 @@ export default {
           }
         })
 
-        // this.$confirm('此操作将删除该订单, 是否继续?', '提示', {
-        //   confirmButtonText: '确定',
-        //   cancelButtonText: '取消',
-        //   type: 'warning'
-        // }).then( async() => {
-
-        //   const { id } = row;
-
-        //   const { code } = await orderApi.remove(id);
-          
-        //   if (code === 200) {
-
-        //     this.fetchList(this.params, this.page);
-
-        //   }
-
-        // }).catch(() => {
-
-        //   this.$message({
-        //     type: 'info',
-        //     message: '已取消删除'
-        //   });          
-        // });
-        
       } catch (err) {
         //
       } finally {
@@ -236,11 +218,11 @@ export default {
       } finally {
       }
     },
-    // 判断“退回”按钮
-    judgeIsAllSendBack() {
+    // 判断“整单退回”按钮
+    judgeIsAllReturn() {
       if (this.checkedList.length == 1) {
 
-        // 非手工、状态非审批通过  
+        // 非手工、状态:自由/驳回
         if (this.checkedList[0].source != 3 && (this.checkedList[0].status == 0 || this.checkedList[0].status == 3)) {
 
           return false
@@ -249,8 +231,62 @@ export default {
       return true;
     },
     //  整单退回
-    handleAllSendBack() {
+    handleAllReturn() {
+
+      this.handleReturn(this.checkedList[0].id,[]);
+      // this.$prompt('请输入退回原因', '提示', {
+      //     confirmButtonText: '确定',
+      //     cancelButtonText: '取消',
+      //     inputPattern: /\s*\S+?/,
+      //     inputErrorMessage: '退回原因不能为空'
+      //   }).then(async ({ value }) => {
+
+      //     let data = {
+      //       id: this.checkedList[0].id,
+      //       documentIds: [],
+      //       baskCause: value,
+      //     };
+
+      //     console.log(data);
+
+      //     try {
+
+      //       let { code, msg } = await orderApi.documentsReturn(data);
+
+      //       if (code === 200) {
+
+      //         this.fetchList(this.params, this.page);
+
+      //       }
+      //     } catch (error) {
+      //       console.log(error,'error------------');
+      //     }
+      //   }).catch(() => {   });
+      
+    },
+     // 判断“行退回”按钮
+     judgeIsLineReturn() {
+
+      if (this.checkedTabList.length == 1) {
+
+        // 主信息:非手工、状态:自由/驳回
+        if(this.primaryResource.source != 3 && 
+          (this.primaryResource.status == 0 || this.primaryResource.status == 3) ){
+
+          return false
+        }
 
+      }
+      return true;
+    },
+    // 行退回
+    handleLineReturn(){
+      let ids = this.checkedTabList.map(checked => checked.id);
+      console.log(ids,'行退回ids');
+      this.handleReturn(this.primaryResource.id,ids);
+    },
+    // 退回接口
+    handleReturn(id,documentIds){
       this.$prompt('请输入退回原因', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
@@ -259,8 +295,8 @@ export default {
         }).then(async ({ value }) => {
 
           let data = {
-            id: this.checkedList[0].id,
-            documentIds: [],
+            id,
+            documentIds,
             baskCause: value,
           };
 
@@ -274,12 +310,17 @@ export default {
 
               this.fetchList(this.params, this.page);
 
+              this.checkedList = [];
+              
+              this.checkedTabList = [];
+
+              this.primaryResource = {};
+
             }
           } catch (error) {
             console.log(error,'error------------');
           }
         }).catch(() => {   });
-      
     },
     // 判断是否满足整单关闭
     judgeIsAllClose() {
@@ -341,6 +382,7 @@ export default {
       }
       
     },
+    // 主表Select框
     handleSelect(selection, row) {
 
       this.checkedList = selection;
@@ -348,6 +390,13 @@ export default {
       console.log(this.checkedList, 'this.checkedList');
 
     },
+    // 子表Select框
+    handleTabSelect(selection, row){
+
+      this.checkedTabList = selection;
+
+      console.log(this.checkedTabList, 'this.checkedTabList');
+    },
   }
 };
 </script>
@@ -477,7 +526,7 @@ export default {
         </el-button-group>
 
         <el-button-group style="margin-left: 10px" :key="checkedList.length + 1">
-          <el-button size="mini" @click="handleAllSendBack" :disabled="judgeIsAllSendBack()">整单退回</el-button>
+          <el-button size="mini" @click="handleAllReturn" :disabled="judgeIsAllReturn()">整单退回</el-button>
           <el-button size="mini" @click="handleAllClose" :disabled="judgeIsAllClose()">整单关闭</el-button>
         </el-button-group>
 
@@ -501,7 +550,7 @@ export default {
       height="450"
       style="width: 100%; margin: 20px 0 0 0"
     >
-      <el-table-column type="selection" width="45"></el-table-column>
+      <el-table-column type="selection" width="45" ></el-table-column>
       <el-table-column type="index" width="50" label="序号"></el-table-column>
       <el-table-column 
         v-for="(column, index) in tableColumns" 
@@ -574,43 +623,64 @@ export default {
       :limit.sync="page.pageSize"
       @pagination="fetchList(params, page)"
     />
-
-    <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
-      <el-tab-pane 
-        v-for="(column, index) in tabColumns" 
-        :key="index" 
-        :label="column.title" 
-        :name="column.key"
-      >
-        <el-table :data="tabTableDatas[column.key]" style="width: 100%" highlight-current-row
-          :height="tabTableDatas[column.key].length ? 300 : 100">
-          <el-table-column type="index" width="50" label="序号"></el-table-column>
-          <el-table-column 
-            v-for="(cColumn, cIndex)  in column.tableColumns" 
-            :key="cIndex" 
-            :prop="cColumn.key"
-            :label="cColumn.title" 
-            :width="cColumn.width || 180"
-            :show-overflow-tooltip="cColumn.showOverflowTooltip || true"
+   
+    <div style="position: relative; padding-top: 10px;">
+      <el-row style="position: absolute; top: 30px; right: 20px;z-index: 10;">
+        <el-button 
+          size="mini" 
+          @click="handleLineReturn"
+          :disabled="judgeIsLineReturn()"
+        >行退回</el-button>
+      </el-row>
+      <el-tabs v-model="tabName" @tab-click="handleTabClick" style="width: 100%;padding: 20px 10px">
+       
+        <el-tab-pane 
+          v-for="(column, index) in tabColumns" 
+          :key="index" 
+          :label="column.title" 
+          :name="column.key"
+        >
+          <el-table 
+            :data="tabTableDatas[column.key]" 
+            style="width: 100%" 
+            highlight-current-row
+            :height="tabTableDatas[column.key].length ? 300 : 100"
+            @select="handleTabSelect"
           >
-            <template slot-scope="scope">
-              <dict-tag v-if="cColumn.referName" 
-                size="small" 
-                :value="scope.row[cColumn.key]"
-                :options="dict.type[cColumn.referName]"
-               />
-              <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" 
-                v-model="scope.row[cColumn.key]"
-                disabled
-                true-label="Y" 
-                false-label="N"
-              ></el-checkbox>
-              <span v-else>{{ scope.row[cColumn.key] }}</span>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-tab-pane>
-    </el-tabs>
-
+            <el-table-column
+              v-if=" tabName === 'puOrderItemList'" 
+              type="selection" 
+              width="45"
+            ></el-table-column>
+            <el-table-column type="index" width="50" label="序号"></el-table-column>
+            <el-table-column 
+              v-for="(cColumn, cIndex)  in column.tableColumns" 
+              :key="cIndex" 
+              :prop="cColumn.key"
+              :label="cColumn.title" 
+              :width="cColumn.width || 180"
+              :show-overflow-tooltip="cColumn.showOverflowTooltip || true"
+            >
+              <template slot-scope="scope">
+                <dict-tag v-if="cColumn.referName" 
+                  size="small" 
+                  :value="scope.row[cColumn.key]"
+                  :options="dict.type[cColumn.referName]"
+                 />
+                <el-checkbox v-else-if="cColumn.inputType === 'Checkbox'" 
+                  v-model="scope.row[cColumn.key]"
+                  disabled
+                  true-label="Y" 
+                  false-label="N"
+                ></el-checkbox>
+                <span v-else>{{ scope.row[cColumn.key] }}</span>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
+        
+      </el-tabs>
+      
+    </div>
   </el-card>
 </template>

+ 6 - 1
src/views/purchase/task/first-direct/column.js

@@ -11,7 +11,12 @@ export const TableColumns = [
     inputType: "Select",
     referName: "sys_price_type",
   },
-  { key: "isDistribution", title: "配送价" },
+  {
+    key: "isDistribution",
+    title: "配送价",
+    inputType: "Select",
+    referName: "sys_yes_no",
+  },
   { key: "effectiveDate", title: "价格生效日期" },
   { key: "endDate", title: "价格失效日期" },
   { key: "tax", title: "税率" },

+ 9 - 3
src/views/purchase/task/first-direct/index.vue

@@ -36,7 +36,7 @@ export default {
         this.loading = true;
         const { code, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
-          prop = data;
+          this.data = data;
           return true;
         } else {
           return false;
@@ -144,8 +144,8 @@ export default {
               :size="size"
               :min="cItem.min(item)"
               :max="cItem.max(item)"
-              :controls-position="cItem.controlsPosition"
               :placeholder="cItem.placeholder"
+              :controls-position="cItem.controlsPosition"
               style="width: 90%"
             ></el-input-number>
             <el-date-picker
@@ -154,8 +154,8 @@ export default {
               :size="size"
               :type="cItem.type"
               :placeholder="cItem.placeholder"
-              :picker-options="cItem.pickerOptions"
               :value-format="cItem.valueFormat"
+              :picker-options="cItem.pickerOptions"
               style="width: 90%"
             ></el-date-picker>
             <el-input
@@ -166,6 +166,12 @@ export default {
               type="textarea"
               style="width: 90%"
             ></el-input>
+            <dict-tag
+              v-else-if="cItem.inputType === 'Select'"
+              :size="size"
+              :value="scope.row[cItem.key]"
+              :options="dict.type[cItem.referName]"
+            />
             <span v-else>{{ scope.row[cItem.key] }}</span>
           </template>
         </el-table-column>

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

@@ -38,9 +38,6 @@ export default {
       if (status === "1") {
         // 已执行协议直采
         return false;
-      } else if (status === "3") {
-        // 已退回
-        return false;
       } else {
         return true;
       }

+ 1 - 1
vue.config.js

@@ -32,7 +32,7 @@ module.exports = {
   devServer: {
     host: "0.0.0.0",
     port: port,
-    open: true,
+    open: false,
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {