瀏覽代碼

Merge branch 'purchaseDev' into 'dev'

Purchase dev20231205

See merge request new-business/drp-web!602
李园 1 年之前
父節點
當前提交
92cd763265

+ 220 - 198
src/views/purchase/apply/index.vue

@@ -1,96 +1,101 @@
 <script>
-  import {dicts} from "./dicts";
-  import useColumns from "./columns";
-  import {LIST, mbDownload, failDownload,oaBack} from "@/api/business/purchase/apply";
-  // 导入的token
-  import {getToken} from "@/utils/auth";
+import { dicts } from "./dicts";
+import useColumns from "./columns";
+import {
+  LIST,
+  mbDownload,
+  failDownload,
+  oaBack,
+} from "@/api/business/purchase/apply";
+// 导入的token
+import { getToken } from "@/utils/auth";
 
-  export default {
-    name: "PuchaseApply",
-    dicts: dicts,
-    components: {
-      SeeButton: () => import("./see/index.vue"),
-      AddButton: () => import("./add/index.vue"),
-      CopyButton: () => import("./copy/index.vue"),
-      EditButton: () => import("./edit/index.vue"),
-      DeleButton: () => import("./delete/index.vue"),
-      SubmButton: () => import("./submit/index.vue"),
-      ElSuperTable: () => import("@/components/super-table/index.vue"),
-      ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
-      ElSuperSearch: () => import("@/components/super-search/index.vue"),
-    },
-    data() {
-      const {TableColumns, SearchColumns} = useColumns();
-      const page = this.$init.page();
-      const params = this.$init.params(SearchColumns);
-      return {
-        // 导入参数
-        upload: {
-          // 是否显示弹出层(导入)
-          open: false,
-          // 弹出层标题(导入)
-          title: "数据导入",
-          // 是否禁用上传
-          isUploading: false,
-          // 是否更新已经存在的用户数据
-          updateSupport: 1,
-          // 设置上传的请求头部
-          headers: {Authorization: "Bearer " + getToken()},
-          // 上传的地址
-          url: process.env.VUE_APP_BASE_API + "/pu/priceApply/import"
-        },
-        size: "mini",
-        loading: false,
-        params: params,
-        page: page,
-        tableData: [],
-        selectData: [],
-        SearchColumns: SearchColumns,
-        TableColumns: TableColumns,
-      };
+export default {
+  name: "PuchaseApply",
+  dicts: dicts,
+  components: {
+    SeeButton: () => import("./see/index.vue"),
+    AddButton: () => import("./add/index.vue"),
+    CopyButton: () => import("./copy/index.vue"),
+    EditButton: () => import("./edit/index.vue"),
+    DeleButton: () => import("./delete/index.vue"),
+    SubmButton: () => import("./submit/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
+  },
+  data() {
+    const { TableColumns, SearchColumns } = useColumns();
+    const page = this.$init.page();
+    const params = this.$init.params(SearchColumns);
+    return {
+      // 导入参数
+      upload: {
+        // 是否显示弹出层(导入)
+        open: false,
+        // 弹出层标题(导入)
+        title: "数据导入",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 1,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/pu/priceApply/import",
+      },
+      size: "mini",
+      loading: false,
+      params: params,
+      page: page,
+      tableData: [],
+      selectData: [],
+      SearchColumns: SearchColumns,
+      TableColumns: TableColumns,
+    };
+  },
+  computed: {
+    tableHeight: {
+      get() {
+        return window.innerHeight - 220;
+      },
+      set() {},
     },
-    computed: {
-      tableHeight:{
-        get(){
-          return window.innerHeight - 220;
-        },
-        set(){},
+  },
+  created() {
+    this.params.priceCode = this.$route.query.billCode;
+    this.useQuery(this.params, this.page);
+  },
+  methods: {
+    //
+    async fetchList(prop, page) {
+      try {
+        this.loading = true;
+        const { pageNum, pageSize } = page;
+        const { code, rows, total } = await LIST(
+          { ...prop },
+          { pageNum, pageSize }
+        );
+        if (code === 200) {
+          this.tableData = rows.map((item, index) => ({
+            ...item,
+            $index: (pageNum - 1) * pageSize + index + 1,
+          }));
+          this.page.total = total;
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
       }
     },
-    created() {
-      this.params.priceCode = this.$route.query.billCode
-      this.useQuery(this.params, this.page);
-    },
-    methods: {
-      //
-      async fetchList(prop, page) {
-        try {
-          this.loading = true;
-          const {pageNum, pageSize} = page;
-          const {code, rows, total} = await LIST(
-            {...prop},
-            {pageNum, pageSize}
-          );
-          if (code === 200) {
-            this.tableData = rows.map((item, index) => ({
-              ...item,
-              $index: (pageNum - 1) * pageSize + index + 1,
-            }));
-            this.page.total = total;
-          }
-        } catch (err) {
-          // catch
-          console.error(err);
-        } finally {
-          // finally
-          this.loading = false;
-        }
-      },
-      // 查 询
-      useQuery(prop, page) {
-        const { billDates } = prop;
-        const [startTime, endTime] = billDates || [];
-        this.fetchList(
+    // 查 询
+    useQuery(prop, page) {
+      const { billDates } = prop;
+      const [startTime, endTime] = billDates || [];
+      this.fetchList(
         {
           ...prop,
           startTime,
@@ -98,119 +103,131 @@
         },
         page
       );
-      },
-      // 重 置
-      useReset() {
-        this.page = this.$init.page();
-        this.params = this.$init.params(this.SearchColumns);
-        this.useQuery(this.params, this.page);
-      },
-      // 选 择
-      useSelect(prop) {
-        this.selectData = prop;
-      },
-      // 明 细
-      async useSee(prop) {
-        const {open} = this.$refs.SeeButton;
-        await open([prop]);
-      },
-      // 下载模板
-      downLoadMb() {
-        this.$modal.loading("正在下载模板,请稍后...");
-        mbDownload().then(res => {
+    },
+    // 重 置
+    useReset() {
+      this.page = this.$init.page();
+      this.params = this.$init.params(this.SearchColumns);
+      this.useQuery(this.params, this.page);
+    },
+    // 选 择
+    useSelect(prop) {
+      this.selectData = prop;
+    },
+    // 明 细
+    async useSee(prop) {
+      const { open } = this.$refs.SeeButton;
+      await open([prop]);
+    },
+    // 下载模板
+    downLoadMb() {
+      this.$modal.loading("正在下载模板,请稍后...");
+      mbDownload()
+        .then((res) => {
           this.$modal.closeLoading();
           const blob = new Blob([res], {
             type: "application/vnd.ms-excel;charset=UTF-8",
-          });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+          }); // 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
           const downloadElement = document.createElement("a"); //创建a标签
           const href = window.URL.createObjectURL(blob); // 创建下载的链接
-          downloadElement.href = href;  //下载地址
-          downloadElement.download = '价格申报单导入模板' + this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
+          downloadElement.href = href; //下载地址
+          downloadElement.download =
+            "价格申报单导入模板" +
+            this.parseTime(new Date().getTime()) +
+            ".xlsx"; // 下载后文件名
           document.body.appendChild(downloadElement);
           downloadElement.click(); // 点击下载
           document.body.removeChild(downloadElement); // 下载完成移除元素
           window.URL.revokeObjectURL(href); // 释放blob对象
-        }).catch(err => {
-          this.$modal.closeLoading();
         })
-      },
-      // 文件上传中处理
-      handleFileUploadProgress(event, file, fileList) {
-        this.upload.isUploading = true;
-        this.$modal.loading("正在导入数据,请稍后...");
-      },
-      // 文件上传成功处理
-      handleFileSuccess(response, file, fileList) {
-        this.$modal.closeLoading();
-        this.upload.open = false;
-        this.upload.isUploading = false;
-        this.$refs.upload.clearFiles();
-        if (response.code == 200) {
-          this.$alert(response.data.msg, "导入结果", {dangerouslyUseHTMLString: true});
-          // 有失败的再次下载下来
-          if (response.data.flag) {
-            this.$modal.loading("正在下载导入失败数据,请稍后...");
-            failDownload({failDatas: response.data.datas}).then(res => {
+        .catch((err) => {
+          this.$modal.closeLoading();
+        });
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+      this.$modal.loading("正在导入数据,请稍后...");
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.$modal.closeLoading();
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      if (response.code == 200) {
+        this.$alert(response.data.msg, "导入结果", {
+          dangerouslyUseHTMLString: true,
+        });
+        // 有失败的再次下载下来
+        if (response.data.flag) {
+          this.$modal.loading("正在下载导入失败数据,请稍后...");
+          failDownload({ failDatas: response.data.datas })
+            .then((res) => {
               this.$modal.closeLoading();
               const blob = new Blob([res], {
                 type: "application/vnd.ms-excel;charset=UTF-8",
-              });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+              }); // 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
               const downloadElement = document.createElement("a"); //创建a标签
               const href = window.URL.createObjectURL(blob); // 创建下载的链接
-              downloadElement.href = href;  //下载地址
-              downloadElement.download = '价格申报单导入失败数据' + this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
+              downloadElement.href = href; //下载地址
+              downloadElement.download =
+                "价格申报单导入失败数据" +
+                this.parseTime(new Date().getTime()) +
+                ".xlsx"; // 下载后文件名
               document.body.appendChild(downloadElement);
               downloadElement.click(); // 点击下载
               document.body.removeChild(downloadElement); // 下载完成移除元素
               window.URL.revokeObjectURL(href); // 释放blob对象
-            }).catch(err => {
-              this.$modal.closeLoading();
             })
-          }
-        }else{
-          this.$notify({
-            message: response.msg,
-            type: response.code == 200 ? 'success' : 'warning'
-          });
+            .catch((err) => {
+              this.$modal.closeLoading();
+            });
         }
-        this.useQuery(this.params, this.page);
-      },
-      errorFile(err) {
-        this.$modal.closeLoading();
-        this.$modal.notifyError("文件已变动,请重新上传");
-      },
-      // 提交上传文件
-      submitFileForm() {
-        this.$refs.upload.submit();
-      },
-      // 导入数据
-      importMb() {
-        this.upload.title = "文件导入"
-        this.upload.open = true
-      },
-      // 收回
-      async reback(row) {
-        console.log('xxxx',this.dict.type)
-        try {
-          const { msg, code } = await oaBack({
-            fdTemplateId: this.dict.type.oa_templete_id.find(item => {
-              return item.label == "价格申报单"
-            }).value,
-            fdId: row.flowId,
-            billCode: row.priceCode,
-            billMaker: row.createBy
-          });
-          if (code === 200) {
-            this.$emit("success");
-            this.$notify.success(msg);
-          }
-        } catch (err) {
-          console.error(err);
-        } finally {
+      } else {
+        this.$notify({
+          message: response.msg,
+          type: response.code == 200 ? "success" : "warning",
+        });
+      }
+      this.useQuery(this.params, this.page);
+    },
+    errorFile(err) {
+      this.$modal.closeLoading();
+      this.$modal.notifyError("文件已变动,请重新上传");
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    // 导入数据
+    importMb() {
+      this.upload.title = "文件导入";
+      this.upload.open = true;
+    },
+    // 收回
+    async reback(row) {
+      console.log("xxxx", this.dict.type);
+      try {
+        const { msg, code } = await oaBack({
+          fdTemplateId: this.dict.type.oa_templete_id.find((item) => {
+            return item.label == "价格申报单";
+          }).value,
+          fdId: row.flowId,
+          billCode: row.priceCode,
+          billMaker: row.createBy,
+        });
+        if (code === 200) {
+          this.$emit("success");
+          this.$notify.success(msg);
         }
-      },
+      } catch (err) {
+        console.error(err);
+      } finally {
+      }
     },
-  };
+  },
+};
 </script>
 
 <template>
@@ -295,14 +312,15 @@
       @row-select="useSelect"
       @pagination="useQuery(params, page)"
     >
-      <ux-table-column
-        fixed="right"
-        title="操作"
-        align="center"
-        width="100"
-        >
+      <ux-table-column fixed="right" title="操作" align="center" width="100">
         <template slot-scope="scope">
-          <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button>
+          <el-button
+            type="text"
+            size="mini"
+            v-if="scope.row.status == '1' && scope.row.flowId"
+            @click="reback(scope.row)"
+            >收回</el-button
+          >
         </template>
       </ux-table-column>
     </el-super-ux-table>
@@ -329,25 +347,29 @@
         <!-- <div class="el-upload__tip" slot="tip">
           <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
         </div> -->
-        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+        <div class="el-upload__tip" style="color: red" slot="tip">
+          提示:仅允许导入“xls”或“xlsx”格式文件!
+        </div>
       </el-upload>
       <div slot="footer">
-        <el-button size="mini" type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button size="mini" type="primary" @click="submitFileForm"
+          >确 定</el-button
+        >
         <el-button size="mini" @click="upload.open = false">取 消</el-button>
       </div>
-    </el-dialog> 
+    </el-dialog>
   </el-card>
 </template>
 <style scoped lang="scss">
-  .el-card {
-    width: calc(100% - 32px);
-    height: calc(100vh - 32px);
-    margin: 16px;
-    padding: 16px;
-    border-radius: 8px;
-  }
+.el-card {
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
+}
 
-  .el-button-group + .el-button-group {
-    margin: 0 0 0 8px;
-  }
+.el-button-group + .el-button-group {
+  margin: 0 0 0 8px;
+}
 </style>

+ 18 - 8
src/views/purchase/apply/see/index.vue

@@ -1,7 +1,7 @@
 <script>
 import useColumns from "./columns";
 import { ITEM, LIST } from "@/api/business/purchase/apply";
-import { toOA } from '@/api/purchase/purchaseDemand.js'
+import { toOA } from "@/api/purchase/purchaseDemand.js";
 
 export default {
   name: "SeeDrawer",
@@ -63,10 +63,16 @@ export default {
         // try
         this.loading = true;
         const { model } = this.$props;
+        const { billDates } = model;
+        const [startTime, endTime] = billDates || [];
+
         const {
           total,
           rows: [{ id }],
-        } = await LIST({ ...model }, { pageNum: prop, pageSize: 1 });
+        } = await LIST(
+          { ...model, startTime, endTime },
+          { pageNum: prop, pageSize: 1 }
+        );
         const { code, data } = await ITEM(id, false);
         if (code === 200) {
           this.params = data;
@@ -91,7 +97,6 @@ export default {
     },
     //
     async hide() {
-      console.log("关闭!!!!!!!", this.$props)
       const {
         TabColumns: [
           {
@@ -104,11 +109,11 @@ export default {
       this.$emit("success");
     },
     async jumpOA() {
-      toOA(this.$store.state.user.name, this.params.flowId).then(res => {
-        if(res.code === 200) {
-          window.open(res.oaUrl)
+      toOA(this.$store.state.user.name, this.params.flowId).then((res) => {
+        if (res.code === 200) {
+          window.open(res.oaUrl);
         }
-      })
+      });
     },
   },
   created() {},
@@ -134,7 +139,12 @@ export default {
     >
       <template slot="title">
         <span>{{ title }}</span>
-        <el-button :size="$attrs.size" :loading="loading" @click="jumpOA" v-if="params.flowId">
+        <el-button
+          :size="$attrs.size"
+          :loading="loading"
+          @click="jumpOA"
+          v-if="params.flowId"
+        >
           流程跳转
         </el-button>
         <el-button :size="$attrs.size" :loading="loading" @click="hide">

+ 9 - 0
src/views/purchase/catalogue/columns.js

@@ -189,6 +189,15 @@ export default function useColumns() {
         valueFormat: "yyyy-MM-dd hh:mm:ss",
       },
     },
+    { 
+      item: { width: 100, key: "customerName", title: "客户" }, 
+      attr: {
+        is: "el-popover-select-v2",
+        referName: "CUSTOMER_PARAM",
+        valueKey: "name",
+        clearable: true,
+      }
+    },
     {
       item: { width: 100, key: "invalid", title: "价格失效日期", span: 8 },
       attr: {

+ 52 - 81
src/views/purchase/workSpace/index.vue

@@ -48,7 +48,6 @@
       </div>
 
       <el-table
-        v-loading="loading"
         :data="tableList"
         fit
         :cell-style="{ borderColor: '#c0c0c0' }"
@@ -95,23 +94,20 @@
         </el-table-column>
       </el-table>
 
-      <el-pagination
-        background
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-        :current-page="queryParams.pageNum"
-        :page-sizes="[10, 20, 50, 100, 200, 500]"
-        :page-size="20"
-        layout="total, sizes, prev, pager, next, jumper"
-        :total="total"
-      >
-      </el-pagination>
+      <pagination
+        :total="page.total"
+        :page.sync="page.pageNum"
+        :limit.sync="page.pageSize"
+        @pagination="getList({ ...page, ...queryParams })"
+        style="height: 32px; padding: 0 !important; flex: 1; overflow-x: auto"
+      />
 
       <el-card class="box-card" style="margin-top: 10px">
         <div slot="header" class="clearfix" style="line-height: 38px">
           <span>单据概述</span>
         </div>
         <el-table
+          v-loading="loading"
           :data="sonTableList"
           fit
           :cell-style="{ borderColor: '#c0c0c0' }"
@@ -160,17 +156,13 @@
           </el-table-column>
         </el-table>
 
-        <el-pagination
-          background
-          @size-change="sonSizeChange"
-          @current-change="sonCurrentChange"
-          :current-page="sonQuery.pageNum"
-          :page-sizes="[10, 20, 50, 100, 200, 500]"
-          :page-size="10"
-          layout="total, sizes, prev, pager, next, jumper"
+        <pagination
           :total="sonTotal"
-        >
-        </el-pagination>
+          :page.sync="sonQuery.pageNum"
+          :limit.sync="sonQuery.pageSize"
+          @pagination="getDetailList(checkRow)"
+          style="height: 32px; padding: 0 !important; flex: 1; overflow-x: auto"
+        />
       </el-card>
     </el-card>
   </div>
@@ -189,12 +181,12 @@ export default {
     ElDictTag: () => import("@/components/DictTag/index.vue"),
   },
   data() {
+    const page = this.$init.page();
     return {
+      page: page,
       queryParams: {
         modelIds: [],
         docSubject: "",
-        pageNum: 1,
-        pageSize: 20,
       },
       loading: false,
       tableList: [],
@@ -216,51 +208,45 @@ export default {
     };
   },
   created() {
-    this.getList(this.queryParams);
+    this.resetList();
   },
   methods: {
-    getList(params) {
-      getWorkSpaceList(params)
-        .then((res) => {
-          if (res.code === 200) {
-            this.tableList = res.rows;
-            this.total = res.total;
-          }
-        })
-        .then(() => {
-          this.loading = false;
-        })
-        .catch((err) => {
-          this.loading = false;
-        });
+    async getList(params) {
+      try {
+        this.$modal.loading("加载中...");
+        let { code, rows, total } = await getWorkSpaceList(params);
+        if (code === 200) {
+          this.tableList = rows;
+          // this.total = res.total;
+          this.page.total = total;
+        }
+      } catch (error) {
+      } finally {
+        this.$modal.closeLoading();
+      }
     },
     searchList() {
-      this.getList(this.queryParams);
+      let { page, queryParams } = this;
+      this.getList({ ...page, ...queryParams });
     },
     resetList() {
       this.queryParams = {
         modelIds: [],
         docSubject: "",
-        pageNum: 1,
-        pageSize: 20,
       };
+      this.page = this.$init.page();
       this.searchList();
     },
     handleSelectionChange(selection) {
-      console.log("选中", selection);
       this.ids = selection;
-      // console.log('选中数组', this.ids.join())
     },
     doubleClick(row) {
-      // this.$refs.tables.toggleRowSelection(row);
       this.rowSelect(row);
     },
     rowSelect(row, column, event) {
-      // console.log('行信息', row)
       // this.recordIndex = this.tableList.findIndex((value, index ,arr) => {
       //   return value.billCode == row.billCode
       // })
-      // console.log('下标:', this.recordIndex)
       // this.check(row)
       // 选择行存储便于子表分页
       this.checkRow = row;
@@ -488,41 +474,26 @@ export default {
           this.sonTableList = [];
         });
     },
-    handleSizeChange(val) {
-      this.queryParams.pageSize = val;
-      this.getList(this.queryParams);
-    },
-    handleCurrentChange(val) {
-      this.queryParams.pageNum = val;
-      this.getList(this.queryParams);
-    },
-    sonSizeChange(val) {
-      this.sonQuery.pageSize = val;
-      this.getDetailList(this.checkRow);
-    },
-    sonCurrentChange(val) {
-      this.sonQuery.pageNum = val;
-      this.getDetailList(this.checkRow);
-    },
+   
     // 获取单据概述列表
-    getDetailList(row) {
-      this.$modal.loading("加载中...");
-      let param = {
-        billCode: row.billCode,
-        type: row.type,
-        ...this.sonQuery,
-      };
-      getWorkDetailList(param)
-        .then((res) => {
-          if (res.code === 200) {
-            this.sonTableList = res.rows;
-            this.sonTotal = res.total;
-            this.$modal.closeLoading();
-          }
-        })
-        .catch((err) => {
-          this.$modal.closeLoading();
-        });
+    async getDetailList(row) {
+      try {
+        this.loading = true;
+        let param = {
+          billCode: row.billCode,
+          type: row.type,
+          ...this.sonQuery,
+        };
+        let { code, rows, total } = await getWorkDetailList(param);
+        if (code === 200) {
+          this.sonTableList = rows;
+          this.sonTotal = total;
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+      
     },
   },
 };