Browse Source

Merge tag 'Hotfix-73' into develop

Finish Hotfix-73
chen 3 năm trước cách đây
mục cha
commit
2bcec7f95a
1 tập tin đã thay đổi với 94 bổ sung5 xóa
  1. 94 5
      src/views/finance/components/receivable_list-add.vue

+ 94 - 5
src/views/finance/components/receivable_list-add.vue

@@ -65,18 +65,35 @@
     </div>
     <span>明细</span>
     <el-divider></el-divider>
+    <!-- 按钮 -->
+    <div class="btn-group clearfix">
+      <div class="fl">
+
+        <el-popconfirm @onConfirm="delSeletFn" title="这是一段内容确定删除吗?">
+          <el-button :disabled="selectList.length < 1" type="danger" size="mini" class="textColor delStyle" icon="el-icon-minus" slot="reference">批量删除</el-button>
+        </el-popconfirm>
+      </div>
+      <div class="fr">
+        <el-button type="primary" size="mini" @click="downLoadFn">模板</el-button>
+        <el-upload class="import-btn" action="" :http-request="handleImport" :file-list="importFileList" :show-file-list="false">
+          <el-button type="primary" size="mini">批量导入</el-button>
+        </el-upload>
+
+      </div>
+    </div>
     <!-- 列表 -->
     <div class="mymain-container">
       <div class="table">
-        <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe :row-class-name="rouClassNameFn" @row-click="onRowClick">
-          <el-table-column align="left" label="序号">
+        <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="selectionChange" :row-class-name="rouClassNameFn" @row-click="onRowClick">
+          <!-- <el-table-column align="left" label="序号">
             <template slot-scope="scope">
               {{ scope.$index + 1 }}
             </template>
-          </el-table-column>
-          <el-table-column align="left" label="*经销商名称" prop="customerName" min-width="160" show-overflow-tooltip>
+          </el-table-column> -->
+          <el-table-column align="center" type="selection" width="51" show-overflow-tooltip></el-table-column>
+          <el-table-column align="left" label="*经销商名称" prop="customerName" min-width="280" show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-select @change="changeCustomerFn($event, scope.$index)" v-model="scope.row.customerId" placeholder="请选择" filterable>
+              <el-select class="selectStyle" @change="changeCustomerFn($event, scope.$index)" v-model="scope.row.customerId" placeholder="请选择" filterable>
                 <el-option v-for="(item, i) in customerList" :key="i" :label="item.name" :value="item.id">
                 </el-option>
               </el-select>
@@ -199,9 +216,11 @@ import {
   getFinanceOtherReceApply,
   getFinanceOtherReceList,
 } from "@/api/finance/receivable_list";
+import { downloadFiles, handleImport } from "@/utils/util";
 export default {
   data() {
     return {
+      importFileList: [],
       messageList: [],
       dialogVisible: false,
       searchForm: {
@@ -227,12 +246,78 @@ export default {
       listLoading: false, // 列表加载loading
       walletList: [], //现金钱包数据
       delIndex: null,
+      selectList: [],
     };
   },
   created() {
     this.getCustomerList();
   },
   methods: {
+    //删除
+    delSeletFn() {
+      // console.log(this.dataList);
+      this.selectList.sort(function (a, b) {
+        return b - a;
+      });
+      // console.log(this.selectList);
+
+      for (let index = 0; index < this.selectList.length; index++) {
+        // console.log(index);
+        this.dataList.splice(this.selectList[index], 1);
+      }
+    },
+    //选择项改变
+    selectionChange(v) {
+      // console.log(v);
+      this.selectList = v.map((v) => v.index);
+      // console.log(this.selectList);
+    },
+    // 导入
+    async handleImport(param) {
+      const file = param.file;
+
+      const formData = new FormData();
+      formData.append("file", file);
+
+      let result = await handleImport("/finance/rece/import/data", formData);
+
+      // console.log(result);
+      this.importFileList = [];
+      if (result.code == 200) {
+        this.$message.success("导入成功");
+        // this.dataList.unshift(result.data);
+        let Arr = result.data.items;
+        for (let v = 0; v < Arr.length; v++) {
+          const res = await getFinanceCustomerList({
+            customerId: Arr[v].customerId,
+            type: "COMMONLY",
+          });
+          this.dataList.push({
+            customerNumber: Arr[v].customerNumber,
+            customerName: Arr[v].customerName,
+            customerId: Arr[v].customerId,
+            projectCode: Arr[v].projectCode,
+            projectName: Arr[v].projectName,
+            departmentId: Arr[v].departmentId,
+            customerWalletId: Arr[v].customerWalletId,
+            invoiceType: Arr[v].invoiceType,
+            incomeDept: Arr[v].incomeDept,
+            totalAmount: Arr[v].totalAmount,
+            taxRate: Arr[v].taxRate,
+            walletId: Arr[v].valletId,
+            walletList: res.data,
+            remark: Arr[v].remark,
+          });
+        }
+      } else {
+        this.$message.error(result.message);
+        // this.$message.error(1231);
+      }
+    },
+    //下载模板
+    async downLoadFn() {
+      downloadFiles("/finance/other/rec/download");
+    },
     //取消
     async dialogVisibleCancel() {
       this.dialogVisible = false;
@@ -392,6 +477,10 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.import-btn {
+  display: inline-block;
+  margin-left: 10px;
+}
 ::v-deep .mountclass {
   input {
     text-align: right;