Bladeren bron

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!228
黄梓星 1 jaar geleden
bovenliggende
commit
f942b6c76e

+ 18 - 27
src/components/super-search/index.vue

@@ -90,33 +90,22 @@
           </el-col>
         </el-row>
       </el-col>
-      <el-col :span="3">
-        <el-button
-          :size="$attrs.size"
-          plain
-          type="primary"
-          @click="$emit('submit')"
-        >
+      <el-col :span="3" style="text-align: right">
+        <el-button :size="$attrs.size" type="primary" @click="$emit('submit')">
           查 询
         </el-button>
-        <el-button
-          :size="$attrs.size"
-          plain
-          type="info"
-          @click="$emit('reset')"
-        >
+        <el-button :size="$attrs.size" @click="$emit('reset')">
           重 置
         </el-button>
-        <el-button
-          :size="$attrs.size"
-          plain
-          type="info"
-          @click="visible = !visible"
-        >
-          {{ visible ? "收 起" : "展 开" }}
-        </el-button>
       </el-col>
     </el-row>
+    <el-divider>
+      <i
+        :class="visible ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
+        style="cursor: pointer"
+        @click="visible = !visible"
+      ></i>
+    </el-divider>
   </el-form>
 </template>
 
@@ -162,13 +151,15 @@ export default {
     },
     showColumns: {
       get() {
-        const { columns, visible } = this;
-        if (visible) {
-          return columns;
-        } else {
-          return columns.filter((item, index) => index < 4);
-        }
+        return this.visible ? this.columns : this.columns.slice(0, 4);
+      },
+      set() {},
+    },
+    hideColumns: {
+      get() {
+        return this.columns.slice(4);
       },
+      set() {},
     },
   },
   watch: {},

+ 56 - 5
src/components/super-table/index.vue

@@ -5,8 +5,6 @@
     v-on="$listeners"
     :data="innerValue"
     border
-    stripe
-    highlight-current-row
     class="el-super-table"
   >
     <slot></slot>
@@ -15,6 +13,7 @@
       :key="index"
       :prop="item.key"
       :label="item.title"
+      :fixed="item.fixed"
       :width="item.width || 225"
       show-overflow-tooltip
     >
@@ -46,8 +45,59 @@
         }}</component>
       </template>
     </el-table-column>
+    <el-table-column width="50" fixed="right" align="center">
+      <template slot="header" slot-scope="scope">
+        <i
+          class="el-icon-setting"
+          style="cursor: pointer"
+          @click="drawer = true"
+        ></i>
+        <el-drawer
+          size="25%"
+          title="操作列"
+          append-to-body
+          :visible.sync="drawer"
+        >
+          <el-row :gutter="20" style="margin: 0">
+            <el-draggable v-model="columns" :group="{ item: 'key' }">
+              <el-col
+                v-for="({ item }, index) in columns"
+                :key="index"
+                :span="24"
+                style="
+                  display: flex;
+                  justify-content: space-between;
+                  padding: 15px 20px;
+                "
+              >
+                <span style="cursor: move">
+                  <i class="el-icon-rank"></i>
+                  {{ item.title }}
+                </span>
+                <div>
+                  <el-radio-group
+                    v-model="item.hidden"
+                    :size="$attrs.size"
+                    style="margin: 0 15px 0 0"
+                  >
+                    <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-button :label="false">不</el-radio-button>
+                    <el-radio-button label="left">左</el-radio-button>
+                    <el-radio-button label="right">右</el-radio-button>
+                  </el-radio-group>
+                </div>
+              </el-col>
+            </el-draggable>
+          </el-row>
+        </el-drawer>
+      </template>
+      <slot name="operation" :scope="scope"></slot>
+      <template slot-scope="scope"> </template>
+    </el-table-column>
   </el-table>
-  <!-- <el-empty v-else :image-size="200"></el-empty> -->
 </template>
 
 <script>
@@ -69,11 +119,12 @@ export default {
   },
   components: {
     ElDictTag: () => import("@/components/DictTag/index.vue"),
+    ElDraggable: () => import("@/components/draggable/index.vue"),
     ElFilePreview: () => import("@/components/file-preview/index.vue"),
     ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
   },
   data() {
-    return {};
+    return { drawer: false };
   },
   computed: {
     innerValue: {
@@ -86,7 +137,7 @@ export default {
     },
     showColumns: {
       get() {
-        return this.columns.filter(({ attr }) => attr.isHidden);
+        return this.columns.filter(({ item }) => item.hidden);
       },
     },
   },

+ 0 - 46
src/views/purchase/task/close/index.vue

@@ -1,46 +0,0 @@
-<script>
-import { SHUTDOWN } from "@/api/business/purchase/task";
-export default {
-  name: "DeleteDialog",
-  data() {
-    return {};
-  },
-  computed: {},
-  watch: {},
-  methods: {
-    //
-    open(prop) {
-      return new Promise((resolve, reject) => {
-        this.$confirm("是否关闭数据项?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async () => {
-            try {
-              this.loading = true;
-              const { demandItemId } = prop;
-              const { msg, code } = await SHUTDOWN(demandItemId);
-              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));
-      });
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<template></template>

+ 33 - 29
src/views/purchase/task/column.js

@@ -1,79 +1,83 @@
 export const TableColumns = [
-  { item: { key: "code", title: "订单生成单号" }, attr: { isHidden: true } },
+  { item: { key: "code", title: "订单生成单号" }, attr: {} },
   {
     item: { key: "status", title: "状态" },
     attr: {
       is: "el-dict-tag",
       dictName: "purchase_task_status",
-      isHidden: true,
     },
   },
-  { item: { key: "demandCode", title: "需求单号" }, attr: { isHidden: true } },
-  { item: { key: "materialName", title: "物料" }, attr: { isHidden: true } },
+  { item: { key: "demandCode", title: "需求单号" }, attr: {} },
+  { item: { key: "materialName", title: "物料" }, attr: {} },
   {
     item: { key: "materialCode", title: "物料编码" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "materialDesc", title: "物料描述" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "manufacturerName", title: "生产厂家" },
-    attr: { isHidden: true },
+    attr: {},
   },
-  { item: { key: "puQty", title: "采购数量" }, attr: { isHidden: true } },
+  { item: { key: "puQty", title: "采购数量" }, attr: {} },
   {
     item: { key: "executeQty", title: "已执行数量" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "residueQty", title: "未执行数量" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "priceType", title: "价格类型" },
-    attr: { is: "el-dict-tag", dictName: "sys_price_type", isHidden: true },
+    attr: { is: "el-dict-tag", dictName: "sys_price_type" },
   },
-  { item: { key: "puUnitName", title: "采购单位" }, attr: { isHidden: true } },
-  { item: { key: "buyerName", title: "采购员" }, attr: { isHidden: true } },
+  { item: { key: "puUnitName", title: "采购单位" }, attr: {} },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
   {
     item: { key: "supplierName", title: "建议供应商" },
-    attr: { isHidden: true },
+    attr: {},
   },
-  { item: { key: "puOrgName", title: "采购组织" }, attr: { isHidden: true } },
-  { item: { key: "currencyName", title: "币种" }, attr: { isHidden: true } },
-  { item: { key: "source", title: "需求来源" }, attr: { isHidden: true } },
+  { item: { key: "puOrgName", title: "采购组织" }, attr: {} },
+  { item: { key: "currencyName", title: "币种" }, attr: {} },
+  { item: { key: "source", title: "需求来源" }, attr: {} },
   {
     item: { key: "customerName", title: "收货客户" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "assignSupplierName", title: "指定供应商" },
-    attr: { isHidden: true },
+    attr: {},
   },
-  { item: { key: "demandDate", title: "需求时间" }, attr: { isHidden: true } },
-  { item: { key: "projectName", title: "项目名称" }, attr: { isHidden: true } },
+  { item: { key: "demandDate", title: "需求时间" }, attr: {} },
+  { item: { key: "projectName", title: "项目名称" }, attr: {} },
   {
     item: { key: "demandPersonalName", title: "需求人" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "demandOrgName", title: "需求组织" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "demandDeptName", title: "需求部门" },
-    attr: { isHidden: true },
+    attr: {},
   },
   {
     item: { key: "isBack", title: "是否退回" },
-    attr: { is: "el-dict-tag", dictName: "sys_yes_no", isHidden: true },
+    attr: { is: "el-dict-tag", dictName: "sys_yes_no" },
   },
-  { item: { key: "baskCause", title: "退回原因" }, attr: { isHidden: true } },
-  { item: { key: "backDate", title: "退回日期" }, attr: { isHidden: true } },
-  { item: { key: "unitName", title: "单位" }, attr: { isHidden: true } },
-];
+  { item: { key: "baskCause", title: "退回原因" }, attr: {} },
+  { item: { key: "backDate", title: "退回日期" }, attr: {} },
+  { item: { key: "unitName", title: "单位" }, attr: {} },
+].map(({ item, attr }) => ({
+  attr,
+  item: { ...item, hidden: true, fixed: false },
+}));
+
+console.log("t", TableColumns);
 
 export const SearchColumns = [
   {

+ 91 - 0
src/views/purchase/task/dao-chu/index.vue

@@ -0,0 +1,91 @@
+<script>
+export default {
+  name: "ExportDialog",
+  props: {
+    data: {
+      type: [Object],
+      require: true,
+    },
+    page: {
+      type: [Object],
+      require: true,
+    },
+  },
+  data() {
+    return {
+      title: "导 出",
+      visible: false,
+      loading: false,
+    };
+  },
+  computed: {},
+  watch: {},
+  methods: {
+    //
+    open() {
+      this.visible = true;
+    },
+    //
+    hide() {
+      this.visible = false;
+    },
+    //
+    async submit(prop, page) {
+      try {
+        // try
+        this.loading = true;
+        const { pageNum, pageSize } = page;
+        await this.download(
+          "pu/order/generate/export",
+          { ...prop, pageNum, pageSize },
+          `task_${new Date().getTime()}.xlsx`
+        );
+        await this.hide();
+      } catch (err) {
+        // catch
+      } finally {
+        // loading
+        this.loading = false;
+      }
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-button v-bind="$attrs" v-on="$listeners" @click="open">
+    {{ title }}
+    <el-dialog
+      :title="title"
+      :visible.sync="visible"
+      width="25%"
+      append-to-body
+      @close="hide"
+    >
+      <div slot="footer" class="dialog-footer">
+        <el-button
+          :size="$attrs.size"
+          :loading="loading"
+          @click="visible = false"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="submit(params, page)"
+          >确 认</el-button
+        >
+      </div>
+      <el-alert
+        title="是否确认导出所有数据项?"
+        type="info"
+        show-icon
+        :closable="false"
+      >
+      </el-alert>
+    </el-dialog>
+  </el-button>
+</template>

+ 0 - 53
src/views/purchase/task/documents-return/index.vue

@@ -1,53 +0,0 @@
-<script>
-import { DOCUMENTSRETURN } from "@/api/business/purchase/task";
-export default {
-  name: "DocumentsReturnDialog",
-  components: {},
-  data() {
-    return {};
-  },
-  computed: {},
-  watch: {},
-  methods: {
-    //
-    open(prop) {
-      return new Promise((resolve, reject) => {
-        this.$prompt("请填写退单原因", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "info",
-        })
-          .then(async ({ value: baskCause }) => {
-            try {
-              this.loading = true;
-              const documentIds = prop.map((item) => item.id);
-              const { msg, code } = await DOCUMENTSRETURN({
-                baskCause,
-                documentIds,
-              });
-              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));
-      });
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-
-<template></template>
-
-<style scoped></style>

+ 0 - 35
src/views/purchase/task/export/index.vue

@@ -1,35 +0,0 @@
-<script>
-export default {
-  name: "ExportDialog",
-  data() {
-    return {};
-  },
-  computed: {},
-  watch: {},
-  methods: {
-    //
-    open(prop, page) {
-      this.$confirm("是否确认导出所有数据项?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "info",
-      })
-        .then(() => {
-          const { pageNum, pageSize } = page;
-          this.download(
-            "pu/order/generate/export",
-            { ...prop, pageNum, pageSize },
-            `task_${new Date().getTime()}.xlsx`
-          );
-        })
-        .catch((err) => {
-          console.error(err);
-        });
-    },
-  },
-  created() {},
-  mounted() {},
-  destroyed() {},
-};
-</script>
-<template></template>

+ 0 - 208
src/views/purchase/task/first-direct/index.vue

@@ -1,208 +0,0 @@
-<script>
-import { TableColumns } from "./column";
-import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
-export default {
-  name: "FirstDirectPurchaseDrawer",
-  components: {
-    ElDictTag: () => import("@/components/DictTag/index.vue"),
-    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
-  },
-  data() {
-    return {
-      size: "mini",
-      title: "协议直采",
-      width: "100%",
-      column: 3,
-      visible: false,
-      loading: false,
-      tableColumns: TableColumns,
-      data: [],
-    };
-  },
-  computed: {
-    $dicts: {
-      get: function () {
-        return this.$parent.$parent.$dicts;
-      },
-    },
-  },
-  watch: {},
-  methods: {
-    //
-    async open(prop) {
-      this.visible = await this.fetchItem(prop);
-    },
-    //
-    hide() {
-      this.visible = false;
-    },
-    //
-    async fetchItem(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { code, data } = await FIRSTDIRECT(prop);
-        if (code === 200) {
-          this.data = data.map((item) => ({
-            ...item,
-            orderPriceVos: item.orderPriceVos.map((cItem) => ({
-              ...item,
-              ...cItem,
-            })),
-          }));
-          console.log("this.data", this.data);
-          return true;
-        } else {
-          return false;
-        }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
-    },
-    //
-    async submit(prop) {
-      const params = prop
-        .map((item) => ({
-          ...item,
-          orderPriceVos: item.orderPriceVos.filter(
-            (citem) => citem.purchaseQuantity
-          ),
-        }))
-        .filter((item) => item.orderPriceVos.length);
-      try {
-        // try
-        const { msg, code } = await ADD(params);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success({ title: msg, duration: 3000 });
-        }
-      } catch (err) {
-        // catch
-      } finally {
-        // finally
-      }
-    },
-  },
-  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-check"
-          @click="submit(data)"
-        >
-        </el-button>
-        <el-button
-          :size="size"
-          circle
-          type="danger"
-          icon="el-icon-close"
-          @click="visible = false"
-        ></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>
-          <span style="margin-right: 10px">{{ item.materialName }}</span>
-          <span style="color: tomato">{{ item.puQty }}</span>
-          (<span style="color: tomato">{{
-            item.puQty - (item.executeQty || 0)
-          }}</span
-          >)
-          <span> {{ item.puUnitName }}</span>
-        </template>
-        <el-descriptions-item label="需求组织">
-          {{ item.demandOrgName }}
-        </el-descriptions-item>
-        <el-descriptions-item label="采购组织">
-          {{ item.puOrgName }}
-        </el-descriptions-item>
-        <el-descriptions-item label="需求时间">
-          {{ item.demandDate }}
-        </el-descriptions-item>
-      </el-descriptions>
-      <el-table
-        v-loading="loading"
-        :size="size"
-        :data="item.orderPriceVos"
-        style="width: 100%"
-      >
-        <el-table-column
-          v-for="(cItem, cIndex) in tableColumns"
-          :key="cIndex"
-          :prop="cItem.item.key"
-          :label="cItem.item.title"
-          :fixed="cItem.item.fixed"
-          :width="cItem.item.width || 250"
-          show-overflow-tooltip
-        >
-          <template slot-scope="scope">
-            <el-input-number
-              v-if="cItem.attr.component === 'el-input-number'"
-              v-model="scope.row[cItem.item.key]"
-              :size="size"
-              :min="cItem.attr.min(item)"
-              :max="cItem.attr.max(item)"
-              :controls-position="cItem.attr.controlsPosition"
-              style="width: 90%"
-            ></el-input-number>
-            <el-date-picker
-              v-else-if="cItem.attr.component === 'el-date-picker'"
-              v-model="scope.row[cItem.item.key]"
-              :size="size"
-              :type="cItem.attr.type"
-              :value-format="cItem.attr.valueFormat"
-              :picker-options="cItem.attr.pickerOptions"
-              style="width: 90%"
-            ></el-date-picker>
-            <el-input
-              v-else-if="cItem.attr.component === 'el-input'"
-              v-model="scope.row[cItem.item.key]"
-              :size="size"
-              autosize
-              type="textarea"
-              style="width: 90%"
-            ></el-input>
-            <el-computed-input-v2
-              v-else-if="cItem.attr.component === 'el-computed-input-v2'"
-              v-on="cItem.listeners"
-              v-model="scope.row[cItem.item.key]"
-              :source="scope.row"
-              :formatter="cItem.attr.formatter"
-              style="width: 100%"
-            ></el-computed-input-v2>
-            <el-dict-tag
-              v-else-if="cItem.attr.component === 'el-dict-tag'"
-              :size="size"
-              :value="scope.row[cItem.item.key]"
-              :options="$dicts[cItem.attr.dictName]"
-            />
-            <span v-else>{{ scope.row[cItem.item.key] }}</span>
-          </template>
-        </el-table-column>
-      </el-table>
-    </div>
-  </el-drawer>
-</template>
-
-<style scoped></style>

+ 37 - 111
src/views/purchase/task/index.vue

@@ -7,14 +7,12 @@ export default {
   name: "PuchaseTask",
   dicts: [...initDicts([...TableColumns, ...SearchColumns])],
   components: {
-    SeeModel: () => import("./see/index.vue"),
-    CloseModel: () => import("./close/index.vue"),
-    ExportModel: () => import("./export/index.vue"),
-    ShiftModel: () => import("./modify-buyer/index.vue"),
-    DirectModel: () => import("./first-direct/index.vue"),
-    ReturnModel: () => import("./documents-return/index.vue"),
-    ElHideTableColumnButton: () =>
-      import("@/components/hide-table-column/index.vue"),
+    // CloseModel: () => import("./close/index.vue"),
+    DcButton: () => import("./dao-chu/index.vue"),
+    MxButton: () => import("./ming-xi/index.vue"),
+    ZpButton: () => import("./zhuan-pai/index.vue"),
+    ThxqButton: () => import("./tui-hui-xu-qiu/index.vue"),
+    XyzcButton: () => import("./xie-yi-zhi-cai/index.vue"),
     ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
@@ -39,7 +37,6 @@ export default {
   },
   watch: {},
   created() {
-    this.params.status = "0";
     this.useQuery(this.params, this.page);
   },
   methods: {
@@ -105,52 +102,14 @@ export default {
     useSelect(prop) {
       this.selectData = prop;
     },
-    // 行 关
-    async useClose(prop) {
-      const { open } = this.$refs.CloseModel;
-      await open(prop);
-    },
-    // 退 回
-    async useReturn(prop) {
-      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;
-      const { open } = this.$refs.SeeModel;
-      await open(id);
-    },
-    // 直 采
-    async useDirect(prop) {
-      console.log(this);
-      const { open } = this.$refs.DirectModel;
+      const { open } = this.$refs.mingxi;
       await open(prop);
     },
-    hasPowerDirect(prop) {
-      if (prop.length === 1) {
-        const [{ status }] = prop;
-        if (status === "1") return false;
-        else return true;
-      } else {
-        return !!prop.length;
-      }
-    },
     // 导 出
     async useExport(prop, page) {
-      const { open } = this.$refs.ExportModel;
+      const { open } = this.$refs.daochu;
       await open(prop, page);
     },
   },
@@ -167,36 +126,40 @@ export default {
       @reset="useReset"
       @submit="useQuery(params, page)"
     ></el-super-search>
-    <div style="padding: 0 20px; display: flex; justify-content: space-between">
-      <div>
-        <el-button
+    <div style="padding: 0 20px; text-align: right">
+      <el-button-group style="margin: 0 10px 0 0">
+        <thxq-button
           :size="size"
-          :disabled="!hasPowerShift(selectData)"
-          @click="useShift(selectData[0])"
-        >
-          转 派
-        </el-button>
-        <el-button
-          v-show="hasPowerReturn(selectData)"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></thxq-button>
+        <xyzc-button
           :size="size"
-          @click="useReturn(selectData)"
-        >
-          退回需求
-        </el-button>
-        <el-button
-          v-show="hasPowerDirect(selectData)"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
+        ></xyzc-button>
+      </el-button-group>
+      <el-button-group>
+        <zp-button
           :size="size"
-          @click="useDirect(selectData)"
+          :select-data="selectData"
+          @success="useQuery(params, page)"
         >
-          协议直采
-        </el-button>
-      </div>
-      <div>
-        <el-hide-table-column-button
-          v-model="TableColumns"
+        </zp-button>
+        <mx-button
+          v-show="false"
+          :size="size"
+          :select-data="selectData"
+          ref="mingxi"
+          @success="useQuery(params, page)"
+        ></mx-button>
+        <dc-button
           :size="size"
-        ></el-hide-table-column-button>
-      </div>
+          :page="page"
+          :data="params"
+          @success="useQuery(params, page)"
+        ></dc-button>
+      </el-button-group>
     </div>
     <el-super-table
       v-model="tableData"
@@ -221,24 +184,6 @@ export default {
       :limit.sync="page.pageSize"
       @pagination="useQuery(params, page)"
     />
-    <see-model ref="SeeModel"></see-model>
-    <export-model ref="ExportModel"></export-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-card>
 </template>
 <style scoped lang="scss">
@@ -247,24 +192,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>

+ 102 - 0
src/views/purchase/task/ming-xi/index.vue

@@ -0,0 +1,102 @@
+<script>
+import { TableColumns } from "../column";
+import { initDicts } from "@/utils/init.js";
+import { ITEM } from "@/api/business/purchase/task";
+export default {
+  name: "SeeDrawer",
+  dicts: [...initDicts(TableColumns)],
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {},
+  data() {
+    return {
+      title: "明 细",
+      width: "25%",
+      column: 1,
+      visible: false,
+      loading: false,
+      columns: TableColumns,
+      params: {},
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        return this.selectData.length !== 1;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    // 查 询
+    async fetchItem(prop) {
+      try {
+        this.loading = true;
+        const { code, data } = await ITEM(prop);
+        if (code === 200) {
+          this.params = data;
+          return true;
+        } else {
+          return false;
+        }
+      } catch (err) {
+        // catch
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+    //
+    async open(prop) {
+      const { id } = prop;
+      this.visible = await this.fetchItem(id);
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open(selectData[0])"
+  >
+    {{ title }}
+    <el-drawer
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+    >
+      <el-descriptions
+        :size="$attrs.size"
+        :column="column"
+        border
+        style="margin: 10px"
+      >
+        <el-descriptions-item
+          v-if="params[column.item.key]"
+          v-for="(column, index) in columns"
+          :key="index"
+          :label="column.item.title"
+        >
+          <dict-tag
+            v-if="column.attr.dictName"
+            :size="$attrs.size"
+            :value="params[column.item.key]"
+            :options="dict.type[column.attr.dictName]"
+          />
+          <span v-else>{{ params[column.item.key] }}</span>
+        </el-descriptions-item>
+      </el-descriptions>
+    </el-drawer>
+  </el-button>
+</template>

+ 0 - 125
src/views/purchase/task/modify-buyer/index.vue

@@ -1,125 +0,0 @@
-<script>
-import { MODEIFYBUYER } from "@/api/business/purchase/task";
-export default {
-  name: "ModifyBuyerDialog",
-  components: {
-    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
-  },
-  data() {
-    return {
-      size: "mini",
-      title: "转 派",
-      visible: false,
-      loading: false,
-      params: { id: "", buyer: "", buyerName: "" },
-    };
-  },
-  computed: {},
-  watch: {},
-  methods: {
-    //
-    open(prop) {
-      this.visible = true;
-      this.params.id = prop;
-    },
-    //
-    hide() {
-      this.visible = false;
-      this.params.id = "";
-      this.params.buyer = "";
-      this.params.buyerName = "";
-    },
-    //
-    async submit(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { id, buyer, buyerName } = prop;
-        const { msg, code } = await MODEIFYBUYER([
-          {
-            id,
-            buyer,
-            buyerName,
-          },
-        ]);
-        if (code === 200) {
-          this.hide();
-          this.$emit("success");
-          this.$notify.success({ title: msg });
-        }
-      } catch (err) {
-        // catch
-      } 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-check"
-          @click="submit(params)"
-        >
-        </el-button>
-        <el-button
-          :size="size"
-          :disabled="loading"
-          circle
-          type="danger"
-          icon="el-icon-close"
-          @click="visible = false"
-        >
-        </el-button>
-      </span>
-    </div>
-    <el-alert
-      title="转派后,采购任务将会从您的采购任务清单中删除,转移到转派目标人员的已受理采购任务清单中,您确定要转派吗?"
-      type="info"
-      show-icon
-      :closable="false"
-      style="margin-bottom: 10px"
-    >
-    </el-alert>
-    <el-form
-      :size="size"
-      :model="params"
-      label-width="0px"
-      label-position="right"
-      style="padding: 0"
-    >
-      <el-form-item prop="" label="">
-        <el-popover-select-v2
-          v-model="params.buyerName"
-          :source.sync="params"
-          :data-mapping="{ buyer: 'code', buyerName: 'name' }"
-          valueKey="name"
-          referName="CONTACTS_PARAM"
-        >
-        </el-popover-select-v2>
-      </el-form-item>
-    </el-form>
-  </el-dialog>
-</template>
-
-<style scoped></style>

+ 0 - 92
src/views/purchase/task/see/index.vue

@@ -1,92 +0,0 @@
-<script>
-import { TableColumns } from "../column";
-import { ITEM } from "@/api/business/purchase/task";
-export default {
-  name: "SeeDialog",
-  components: {},
-  data() {
-    return {
-      size: "mini",
-      title: "明细",
-      width: "100%",
-      column: 3,
-      visible: false,
-      loading: false,
-      columns: TableColumns,
-      params: {},
-    };
-  },
-  computed: {
-    $dicts: {
-      get: function () {
-        return this.$parent.$parent.$dicts;
-      },
-    },
-  },
-  watch: {},
-  methods: {
-    // 查 询
-    async fetchItem(prop) {
-      try {
-        this.loading = true;
-        const { code, data } = await ITEM(prop);
-        if (code === 200) {
-          this.params = data;
-          return true;
-        } else {
-          return false;
-        }
-      } catch (err) {
-        // catch
-      } finally {
-        // finally
-        this.loading = false;
-      }
-    },
-    //
-    async open(prop) {
-      this.visible = await this.fetchItem(prop);
-    },
-  },
-  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
-          type="danger"
-          icon="el-icon-close"
-          @click="visible = false"
-        ></el-button>
-      </span>
-    </template>
-    <el-descriptions :size="size" :column="column" border style="margin: 10px">
-      <el-descriptions-item
-        v-if="params[column.item.key]"
-        v-for="(column, index) in columns"
-        :key="index"
-        :label="column.item.title"
-      >
-        <dict-tag
-          v-if="column.attr.dictName"
-          :size="size"
-          :value="params[column.item.key]"
-          :options="$dicts[column.attr.dictName]"
-        />
-        <span v-else>{{ params[column.item.key] }}</span>
-      </el-descriptions-item>
-    </el-descriptions>
-  </el-drawer>
-</template>

+ 124 - 0
src/views/purchase/task/tui-hui-xu-qiu/index.vue

@@ -0,0 +1,124 @@
+<script>
+import { DOCUMENTSRETURN } from "@/api/business/purchase/task";
+export default {
+  name: "DocumentsReturnDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {},
+  data() {
+    return {
+      title: "退回需求",
+      visible: false,
+      loading: false,
+      params: { baskCause: "" },
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        return !this.selectData.length;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    //
+    open() {
+      this.visible = true;
+    },
+    //
+    hide() {
+      this.visible = false;
+      this.params.baskCause = "";
+    },
+    //
+    async submit(prop) {
+      try {
+        // try
+        this.loading = true;
+        const {
+          params: { baskCause },
+        } = this;
+        const documentIds = prop.map((item) => item.id);
+        const { msg, code } = await DOCUMENTSRETURN({
+          baskCause,
+          documentIds,
+        });
+        if (code === 200) {
+          this.hide();
+          this.$emit("success");
+          this.$notify.success({ title: msg });
+        }
+      } catch (err) {
+        // catch
+      } finally {
+        // loading
+        this.loading = false;
+      }
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
+<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" class="dialog-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-form
+        :size="$attrs.size"
+        :model="params"
+        label-width="0px"
+        label-position="right"
+        style="padding: 0"
+      >
+        <el-form-item prop="" label="">
+          <el-input v-model="params.baskCause"> </el-input>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </el-button>
+</template>
+
+<style scoped></style>

+ 7 - 7
src/views/purchase/task/first-direct/column.js → src/views/purchase/task/xie-yi-zhi-cai/column.js

@@ -15,7 +15,7 @@ export const TableColumns = [
   },
   {
     item: { key: "priceType", title: "价格类型" },
-    attr: { component: "el-dict-tag", dictName: "sys_price_type" },
+    attr: { is: "el-dict-tag", dictName: "sys_price_type" },
   },
   {
     item: { key: "effectiveDate", title: "价格生效日期" },
@@ -28,7 +28,7 @@ export const TableColumns = [
   {
     item: { key: "tax", title: "税率 (%)" },
     attr: {
-      component: "el-computed-input-v2",
+      is: "el-computed-input-v2",
       formatter: (prop) => {
         return (prop.tax * 1).toFixed(CONFIG.precision);
       },
@@ -37,7 +37,7 @@ export const TableColumns = [
   {
     item: { key: "taxFreePrice", title: "无税单价" },
     attr: {
-      component: "el-computed-input-v2",
+      is: "el-computed-input-v2",
       formatter: (prop = 0) => {
         return (prop.tax * 1).toFixed(CONFIG.precision);
       },
@@ -46,7 +46,7 @@ export const TableColumns = [
   {
     item: { key: "taxPrice", title: "主含税单价" },
     attr: {
-      component: "el-computed-input-v2",
+      is: "el-computed-input-v2",
       formatter: (prop = 0) => {
         return (prop.tax * 1).toFixed(CONFIG.precision);
       },
@@ -55,7 +55,7 @@ export const TableColumns = [
   {
     item: { key: "purchaseQuantity", title: "本次采购数量" },
     attr: {
-      component: "el-input-number",
+      is: "el-input-number",
       min: () => 0,
       max: (prop) => {
         const { puQty = 0, executeQty = 0 } = prop;
@@ -67,7 +67,7 @@ export const TableColumns = [
   {
     item: { key: "arrivalDatePlan", title: "计划到货日期" },
     attr: {
-      component: "el-date-picker",
+      is: "el-date-picker",
       valueFormat: "yyyy-MM-dd",
       pickerOptions: {
         disabledDate(time) {
@@ -79,7 +79,7 @@ export const TableColumns = [
   {
     item: { key: "note", title: "备注" },
     attr: {
-      component: "el-input",
+      is: "el-input",
       autosize: true,
       type: "textarea",
     },

+ 219 - 0
src/views/purchase/task/xie-yi-zhi-cai/index.vue

@@ -0,0 +1,219 @@
+<script>
+import { TableColumns } from "./column";
+import { initDicts } from "@/utils/init.js";
+import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
+export default {
+  name: "FirstDirectPurchaseDrawer",
+  dicts: [...initDicts(TableColumns)],
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElDictTag: () => import("@/components/DictTag/index.vue"),
+    ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
+  },
+  data() {
+    return {
+      title: "协议直采",
+      width: "50%",
+      column: 1,
+      visible: false,
+      loading: false,
+      tableColumns: TableColumns,
+      data: [],
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        return !this.selectData.length;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    //
+    async open(prop) {
+      this.visible = await this.fetchItem(prop);
+    },
+    //
+    hide() {
+      this.visible = false;
+    },
+    //
+    async fetchItem(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { code, data } = await FIRSTDIRECT(prop);
+        if (code === 200) {
+          this.data = data.map((item) => ({
+            ...item,
+            orderPriceVos: item.orderPriceVos.map((cItem) => ({
+              ...item,
+              ...cItem,
+            })),
+          }));
+          return true;
+        } else {
+          return false;
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+    //
+    async submit(prop) {
+      const params = prop
+        .map((item) => ({
+          ...item,
+          orderPriceVos: item.orderPriceVos.filter(
+            (citem) => citem.purchaseQuantity
+          ),
+        }))
+        .filter((item) => item.orderPriceVos.length);
+      try {
+        // try
+        const { msg, code } = await ADD(params);
+        if (code === 200) {
+          this.hide();
+          this.$emit("success");
+          this.$notify.success({ title: msg, duration: 3000 });
+        }
+      } catch (err) {
+        // catch
+      } finally {
+        // finally
+      }
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open(selectData)"
+  >
+    {{ title }}
+    <el-drawer
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+    >
+      <div v-for="(item, index) in data" :key="index" style="margin: 10px">
+        <el-descriptions :size="$attrs.size" :column="column" border>
+          <template #title>
+            <span style="margin-right: 10px">{{ item.materialName }}</span>
+            <span style="color: tomato">{{ item.puQty }}</span>
+            (<span style="color: tomato">{{
+              item.puQty - (item.executeQty || 0)
+            }}</span
+            >)
+            <span> {{ item.puUnitName }}</span>
+          </template>
+          <el-descriptions-item label="需求组织">
+            {{ item.demandOrgName }}
+          </el-descriptions-item>
+          <el-descriptions-item label="采购组织">
+            {{ item.puOrgName }}
+          </el-descriptions-item>
+          <el-descriptions-item label="需求时间">
+            {{ item.demandDate }}
+          </el-descriptions-item>
+        </el-descriptions>
+        <el-table
+          v-loading="loading"
+          :size="$attrs.size"
+          :data="item.orderPriceVos"
+          style="width: 100%"
+        >
+          <el-table-column
+            v-for="(cItem, cIndex) in tableColumns"
+            :key="cIndex"
+            :prop="cItem.item.key"
+            :label="cItem.item.title"
+            :fixed="cItem.item.fixed"
+            :width="cItem.item.width || 250"
+            show-overflow-tooltip
+          >
+            <template slot-scope="scope">
+              <el-input-number
+                v-if="cItem.attr.is === 'el-input-number'"
+                v-model="scope.row[cItem.item.key]"
+                :size="$attrs.size"
+                :min="cItem.attr.min(item)"
+                :max="cItem.attr.max(item)"
+                :controls-position="cItem.attr.controlsPosition"
+                style="width: 90%"
+              ></el-input-number>
+              <el-date-picker
+                v-else-if="cItem.attr.is === 'el-date-picker'"
+                v-model="scope.row[cItem.item.key]"
+                :size="$attrs.size"
+                :type="cItem.attr.type"
+                :value-format="cItem.attr.valueFormat"
+                :picker-options="cItem.attr.pickerOptions"
+                style="width: 90%"
+              ></el-date-picker>
+              <el-input
+                v-else-if="cItem.attr.is === 'el-input'"
+                v-model="scope.row[cItem.item.key]"
+                :size="$attrs.size"
+                autosize
+                type="textarea"
+                style="width: 90%"
+              ></el-input>
+              <el-computed-input-v2
+                v-else-if="cItem.attr.is === 'el-computed-input-v2'"
+                v-on="cItem.listeners"
+                v-model="scope.row[cItem.item.key]"
+                :source="scope.row"
+                :formatter="cItem.attr.formatter"
+                style="width: 100%"
+              ></el-computed-input-v2>
+              <el-dict-tag
+                v-else-if="cItem.attr.is === 'el-dict-tag'"
+                :size="$attrs.size"
+                :value="scope.row[cItem.item.key]"
+                :options="dict.type[cItem.attr.dictName]"
+              />
+              <span v-else>{{ scope.row[cItem.item.key] }}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <div style="text-align: right; margin: 20px 20px 0">
+        <el-button
+          :size="$attrs.size"
+          :loading="loading"
+          @click="visible = false"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="submit(data)"
+          >确 认</el-button
+        >
+      </div>
+    </el-drawer>
+  </el-button>
+</template>
+
+<style scoped></style>

+ 136 - 0
src/views/purchase/task/zhuan-pai/index.vue

@@ -0,0 +1,136 @@
+<script>
+import { MODEIFYBUYER } from "@/api/business/purchase/task";
+export default {
+  name: "ModifyBuyerDialog",
+  props: {
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
+  data() {
+    return {
+      title: "转 派",
+      visible: false,
+      loading: false,
+      params: { id: "", buyer: "", buyerName: "" },
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        return this.selectData.length !== 1;
+      },
+      set() {},
+    },
+  },
+  watch: {},
+  methods: {
+    //
+    open(prop) {
+      this.visible = true;
+      this.params.id = prop;
+    },
+    //
+    hide() {
+      this.visible = false;
+      this.params.id = "";
+      this.params.buyer = "";
+      this.params.buyerName = "";
+    },
+    //
+    async submit(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { id, buyer, buyerName } = prop;
+        const { msg, code } = await MODEIFYBUYER([
+          {
+            id,
+            buyer,
+            buyerName,
+          },
+        ]);
+        if (code === 200) {
+          this.hide();
+          this.$emit("success");
+          this.$notify.success({ title: msg });
+        }
+      } catch (err) {
+        // catch
+      } finally {
+        // loading
+        this.loading = false;
+      }
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="open(selectData[0])"
+  >
+    {{ title }}
+    <el-dialog
+      :title="title"
+      :visible.sync="visible"
+      width="25%"
+      append-to-body
+      @close="hide"
+    >
+      <div slot="footer" class="dialog-footer">
+        <el-button
+          :size="$attrs.size"
+          :loading="loading"
+          @click="visible = false"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="submit(params)"
+          >确 认</el-button
+        >
+      </div>
+      <el-alert
+        title="转派后,采购任务将会从您的采购任务清单中删除,转移到转派目标人员的已受理采购任务清单中,您确定要转派吗?"
+        type="info"
+        show-icon
+        :closable="false"
+        style="margin-bottom: 10px"
+      >
+      </el-alert>
+      <el-form
+        :size="$attrs.size"
+        :model="params"
+        label-width="0px"
+        label-position="right"
+        style="padding: 0"
+      >
+        <el-form-item prop="" label="">
+          <el-popover-select-v2
+            v-model="params.buyerName"
+            :source.sync="params"
+            :data-mapping="{ buyer: 'code', buyerName: 'name' }"
+            valueKey="name"
+            referName="CONTACTS_PARAM"
+          >
+          </el-popover-select-v2>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </el-button>
+</template>
+
+<style scoped></style>