002201 2 年之前
父节点
当前提交
1b3b4ea7fc

+ 66 - 0
src/components/file-tag/index.vue

@@ -0,0 +1,66 @@
+<template>
+  <div class="file-tag">
+    <el-popconfirm
+      v-for="item in newValue"
+      :key="item.url"
+      confirm-button-text="好的"
+      cancel-button-text="不用了"
+      :title="`下载${item.name}`"
+      style="display: block"
+      @confirm="
+        download(
+          '/pu/contract/download/resource',
+          { resource: item.url },
+          item.name
+        )
+      "
+    >
+      <el-button :size="size" type="text" slot="reference">
+        {{ item.name }}
+      </el-button>
+    </el-popconfirm>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "FileTag",
+  props: {
+    // v-model
+    value: {
+      type: String,
+      require: true,
+    },
+    // 组件大小
+    size: {
+      type: String,
+      dafault: () => {
+        return "mini";
+      },
+    },
+  },
+  data() {
+    return {};
+  },
+  computed: {
+    newValue() {
+      const { value } = this.$props;
+      return this.setFileList(value);
+    },
+  },
+  watch: {},
+  methods: {
+    //
+    setFileList(prop) {
+      return prop.split(";").map((file) => {
+        const { url, name } = JSON.parse(file);
+        return { url: url, name: name };
+      });
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<style scoped></style>

+ 6 - 3
src/main.js

@@ -48,11 +48,13 @@ import VueMeta from "vue-meta";
 // 字典数据组件
 import DictData from "@/components/DictData";
 //
-import PopoverSelect from "@/components/popover-select/index.vue";
+import PopoverSelect from "@/components/popover-select";
 //
-import PopoverTreeSelect from "@/components/popover-tree-select/index.vue";
+import PopoverTreeSelect from "@/components/popover-tree-select";
 //
-import ComputedInput from "@/components/computed-input/index.vue";
+import ComputedInput from "@/components/computed-input";
+// 附件标签组件
+import FileTag from "@/components/file-tag";
 
 // 全局方法挂载
 Vue.prototype.getDicts = getDicts;
@@ -76,6 +78,7 @@ Vue.component("ImagePreview", ImagePreview);
 Vue.component("DrPopoverSelect", PopoverSelect);
 Vue.component("DrPopoverTreeSelect", PopoverTreeSelect);
 Vue.component("DrComputedInput", ComputedInput);
+Vue.component("DrFileTag", FileTag);
 
 Vue.use(directive);
 Vue.use(plugins);

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

@@ -128,7 +128,7 @@ export default {
     <el-form
       :size="size"
       :model="params"
-      label-width="75px"
+      label-width="auto"
       label-position="right"
       style="padding: 20px 20px 0"
       @submit.native.prevent

+ 26 - 36
src/views/purchase/contract/see/index.vue

@@ -16,6 +16,9 @@ export default {
   data() {
     return {
       size: "mini",
+      title: "明细",
+      width: "100%",
+      column: 3,
       visible: false,
       loading: false,
       columns: Columns,
@@ -35,41 +38,35 @@ export default {
   watch: {},
   methods: {
     //
+    setFileList(prop) {
+      return prop.split(";").map((file) => ({
+        url: file,
+        name: file.split("/")[file.split("/").length - 1],
+      }));
+    },
+    //
     open(prop) {
       this.visible = true;
       this.fetchItem(prop);
     },
-    //
-    hide() {
-      this.visible = false;
-      this.params = initParams(Columns);
-      this.tabName = this.tabColumns[0].key;
-    },
-    //
+    // 查 询
     async fetchItem(prop) {
       try {
         this.loading = true;
         const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
-
           this.tabName = this.tabColumns[0].key;
         } else {
           this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
-    //
-    setFileList(prop) {
-      return prop.split(",").map((file) => ({
-        url: file,
-        name: file.split("/")[file.split("/").length - 1],
-      }));
-    },
   },
   created() {},
   mounted() {},
@@ -77,14 +74,15 @@ export default {
 };
 </script>
 <template>
-  <el-dialog :visible.sync="visible" title="明细" fullscreen @close="hide">
-    <el-descriptions :column="4" border>
+  <el-drawer :visible.sync="visible" :size="width" :title="title">
+    <el-descriptions border :size="size" :column="column" style="margin: 10px">
       <el-descriptions-item
         v-if="params[column.key]"
         v-for="(column, index) in columns"
         :key="index"
         :label="column.title"
-        :labelStyle="{ width: '100px' }"
+        :labelStyle="{ width: '150px' }"
+        :contentStyle="{ width: 'auto' }"
       >
         <dict-tag
           v-if="column.inputType === 'Select'"
@@ -93,25 +91,17 @@ export default {
           :options="dict.type[column.referName]"
         />
         <span v-else-if="column.inputType === 'Upload'">
-          <el-button
-            v-for="file in setFileList(params[column.key])"
-            :key="file.url"
-            type="text"
-            @click.stop="
-              download(
-                '/pu/contract/download/resource',
-                { resource: file.url },
-                file.name
-              )
-            "
-          >
-            {{ file.name }}
-          </el-button>
+          <dr-file-tag v-model="params[column.key]"></dr-file-tag>
         </span>
         <span v-else>{{ params[column.key] }}</span>
       </el-descriptions-item>
     </el-descriptions>
-    <el-tabs v-model="tabName" tab-position="top" style="width: 100%">
+    <el-tabs
+      v-model="tabName"
+      :size="size"
+      tab-position="top"
+      style="margin: 10px"
+    >
       <el-tab-pane
         v-for="(column, index) in tabColumns"
         :key="index"
@@ -119,7 +109,7 @@ export default {
         :label="column.title"
         lazy
       >
-        <el-table :data="params[column.key]" style="width: 100%">
+        <el-table :size="size" :data="params[column.key]">
           <el-table-column
             v-for="(cColumn, cIndex) in column.tableColumns"
             :key="cIndex"
@@ -140,5 +130,5 @@ export default {
         </el-table>
       </el-tab-pane>
     </el-tabs>
-  </el-dialog>
+  </el-drawer>
 </template>

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

@@ -109,6 +109,8 @@ export const SearchColumns = [
     title: "状态",
     inputType: "Select",
     referName: "purchase_task_status",
+    value: "0",
+    clearable: true,
   },
   {
     key: "date",
@@ -138,6 +140,7 @@ export const SearchColumns = [
     title: "需求来源",
     inputType: "Input",
     placeholder: "请输入来源单据号,多个用,分隔",
+    span: 12,
   },
 ];
 

+ 7 - 8
src/views/purchase/task/first-direct/index.vue

@@ -8,6 +8,9 @@ export default {
   data() {
     return {
       size: "mini",
+      title: "首次协议直采",
+      width: "100%",
+      column: 3,
       visible: false,
       loading: false,
       tableColumns: initColumns(TableColumns),
@@ -76,13 +79,9 @@ export default {
 </script>
 
 <template>
-  <el-dialog :visible.sync="visible" width="75%" title="首次协议直采">
-    <div
-      v-for="(item, index) in data"
-      :key="index"
-      style="width: 100%; margin: 0 0 20px 0"
-    >
-      <el-descriptions border size="mini" :column="4">
+  <el-drawer :visible.sync="visible" :size="width" :title="title">
+    <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>
@@ -151,7 +150,7 @@ export default {
         <el-button :size="size" @click="submit">提 交</el-button>
       </div>
     </div>
-  </el-dialog>
+  </el-drawer>
 </template>
 
 <style scoped></style>

+ 11 - 11
src/views/purchase/task/index.vue

@@ -1,7 +1,6 @@
-el-col
 <script>
-import { TableColumns, SearchColumns } from "./column";
 import { LIST } from "@/api/business/purchase/task";
+import { TableColumns, SearchColumns } from "./column";
 import { initPage, initDicts, initParams } from "@/utils/init";
 export default {
   name: "PuchaseTask",
@@ -32,11 +31,11 @@ export default {
     this.useQuery(this.params, this.page);
   },
   methods: {
-    // selectable
-    selectable(row) {
+    //
+    setSelectable(row) {
       const { status } = row;
-      if (status === "1") return false;
-      else if (status === "3") return false;
+      if (status === "1") return true;
+      else if (status === "3") return true;
       else return true;
     },
     //
@@ -60,17 +59,18 @@ export default {
       const { pageNum, pageSize } = page;
       const {
         date: [startDate, endDate],
-        documentsCodes,
+        documentsCodes: code,
       } = prop;
+      const documentsCodes = code
+        ? code.replace(/\s*/g, "").replaceAll(",", ",")
+        : undefined;
       await this.fetchList(
         {
           ...prop,
           endDate,
           startDate,
+          documentsCodes,
           date: undefined,
-          documentsCodes: documentsCodes
-            ? documentsCodes.replace(/\s*/g, "").replaceAll(",", ",")
-            : undefined,
         },
         { pageNum, pageSize, isAsc: "desc", orderByColumn: "updateTime" }
       );
@@ -279,7 +279,7 @@ export default {
         width="55"
         align="center"
         type="selection"
-        :selectable="selectable"
+        :selectable="setSelectable"
       >
       </el-table-column>
       <el-table-column

+ 10 - 12
src/views/purchase/task/see/index.vue

@@ -2,7 +2,6 @@
 import { TableColumns as Columns } from "../column";
 import { ITEM } from "@/api/business/purchase/task";
 import { initDicts, initParams } from "@/utils/init";
-console.log("initDicts(Columns)", initDicts(Columns));
 export default {
   name: "SeeDialog",
   dicts: initDicts(Columns),
@@ -10,6 +9,9 @@ export default {
   data() {
     return {
       size: "mini",
+      title: "明细",
+      width: "100%",
+      column: 3,
       visible: false,
       loading: false,
       columns: Columns,
@@ -24,24 +26,20 @@ export default {
       this.visible = true;
       this.fetchItem(prop);
     },
-    //
-    hide() {
-      this.visible = false;
-    },
-    // 查询详细
+    // 查 询
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code,data } = await ITEM(prop);
+        const { code, data } = await ITEM(prop);
         if (code === 200) {
           this.params = data;
-          
         } else {
           this.$notify.warning({ title: msg });
         }
       } catch (err) {
-        //
+        // catch
       } finally {
+        // finally
         this.loading = false;
       }
     },
@@ -52,8 +50,8 @@ export default {
 };
 </script>
 <template>
-  <el-dialog :visible.sync="visible" title="明细">
-    <el-descriptions :column="2" border>
+  <el-drawer :visible.sync="visible" :size="width" :title="title">
+    <el-descriptions :size="size" :column="column" border style="margin: 10px">
       <el-descriptions-item
         v-if="params[column.key]"
         v-for="(column, index) in columns"
@@ -69,5 +67,5 @@ export default {
         <span v-else>{{ params[column.key] }}</span>
       </el-descriptions-item>
     </el-descriptions>
-  </el-dialog>
+  </el-drawer>
 </template>