Просмотр исходного кода

fix:角色批量操作及费用校验增加总计及筛选

刘恒 2 лет назад
Родитель
Сommit
d9f5adaaaa

+ 32 - 30
src/components/table/StandardTable.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="standard-table">
-    <div class="alert">
+    <!-- <div class="alert">
       <a-alert type="info" :show-icon="true" v-if="selectedRows">
         <div class="message" slot="message">
           已选择&nbsp;<a>{{ selectedRows.length }}</a
@@ -15,7 +15,7 @@
           </template>
         </div>
       </a-alert>
-    </div>
+    </div> -->
     <a-table
       :bordered="bordered"
       :loading="loading"
@@ -26,7 +26,7 @@
       :expandedRowKeys="expandedRowKeys"
       :expandedRowRender="expandedRowRender"
       @change="onChange"
-      :rowSelection="
+      :row-selection="
         selectedRows
           ? { selectedRowKeys: selectedRowKeys, onChange: updateSelect }
           : undefined
@@ -95,6 +95,7 @@ export default {
     return {
       needTotalList: [],
       selectRow: -1,
+      selectedRowKeys: [],
     };
   },
   methods: {
@@ -117,8 +118,9 @@ export default {
 
     updateSelect(selectedRowKeys, selectedRows) {
       // console.log(selectedRowKeys, selectedRows);
+      this.selectedRowKeys = selectedRowKeys;
       this.$emit("update:selectedRows", selectedRows);
-      this.$emit("selectedRowChange", selectedRowKeys, selectedRows);
+      this.$emit("selectedRowChange", selectedRows);
     },
     initTotalList(columns) {
       const totalList = columns
@@ -143,34 +145,34 @@ export default {
     this.needTotalList = this.initTotalList(this.columns);
   },
   watch: {
-    selectedRows(selectedRows) {
-      this.needTotalList = this.needTotalList.map((item) => {
-        return {
-          ...item,
-          total: selectedRows.reduce((sum, val) => {
-            let v;
-            try {
-              v = val[item.dataIndex]
-                ? val[item.dataIndex]
-                : eval(`val.${item.dataIndex}`);
-            } catch (_) {
-              v = val[item.dataIndex];
-            }
-            v = !isNaN(parseFloat(v)) ? parseFloat(v) : 0;
-            return sum + v;
-          }, 0),
-        };
-      });
-    },
+    // selectedRows(selectedRows) {
+    //   this.needTotalList = this.needTotalList.map((item) => {
+    //     return {
+    //       ...item,
+    //       total: selectedRows.reduce((sum, val) => {
+    //         let v;
+    //         try {
+    //           v = val[item.dataIndex]
+    //             ? val[item.dataIndex]
+    //             : eval(`val.${item.dataIndex}`);
+    //         } catch (_) {
+    //           v = val[item.dataIndex];
+    //         }
+    //         v = !isNaN(parseFloat(v)) ? parseFloat(v) : 0;
+    //         return sum + v;
+    //       }, 0),
+    //     };
+    //   });
+    // },
   },
   computed: {
-    selectedRowKeys() {
-      return this.selectedRows.map((record) => {
-        return typeof this.rowKey === "function"
-          ? this.rowKey(record)
-          : record[this.rowKey];
-      });
-    },
+    // selectedRowKeys() {
+    //   return this.selectedRows.map((record) => {
+    //     return typeof this.rowKey === "function"
+    //       ? this.rowKey(record)
+    //       : record[this.rowKey];
+    //   });
+    // },
   },
 };
 </script>

+ 22 - 24
src/pages/financial/verification.vue

@@ -51,6 +51,7 @@
         </div>
       </div>
       <div>选择投保险种:</div>
+
       <a-radio-group
         default-value="0"
         button-style="solid"
@@ -67,13 +68,13 @@
         <a-form-item label="保险公司" :labelCol="{ span: 8 }" :colon="false">
           <a-select
             placeholder="请选择"
-            v-model="formState.leaderId"
+            v-model="formState.companyId"
             allowClear
             show-search
             :filter-option="filterOption"
           >
             <a-select-option
-              v-for="item in manageList"
+              v-for="item in companyList"
               :key="item.id"
               :value="item.id"
             >
@@ -88,9 +89,6 @@
             allowClear
           ></a-input>
         </a-form-item>
-
-        <a-form-item label="审核时间" :labelCol="{ span: 5 }" :colon="false">
-        </a-form-item>
       </a-form>
     </div>
     <standard-table
@@ -165,20 +163,17 @@ export default {
   data() {
     return {
       formState: {
-        whole: "",
-        cityId: "",
-        countyId: "",
-        houseId: "",
-        provinceId: "",
         days: undefined,
         time: [moment().format("YYYY-MM-DD"), moment().format("YYYY-MM-DD")],
         riskCode: "",
         endDate: moment().format("YYYY-MM-DD"),
         beginDate: moment().format("YYYY-MM-DD"),
+        reviewer: undefined,
+        companyId: undefined,
       },
       backLinePersonnel: {},
       columns: columns,
-      companyList: [],
+
       tableList: [],
       pagination: {
         current: 1,
@@ -197,6 +192,7 @@ export default {
       areaList: [],
       storeList: [],
       totalObj: {},
+      companyList: [],
     };
   },
   watch: {
@@ -209,25 +205,26 @@ export default {
   },
   mounted() {
     this.getVerification();
+    this.$API.financial.getCompany().then((res) => {
+      console.log(res);
+      if (res.data.code === 200) {
+        this.companyList = [...res.data.data];
+      }
+    });
     // setTimeout(() => {
     // }, 1000);
   },
   methods: {
+    filterOption(input, option) {
+      return (
+        option.componentOptions.children[0].text
+          .toLowerCase()
+          .indexOf(input.toLowerCase()) >= 0
+      );
+    },
     handleFinish() {
       //
     },
-    wholeHandleChange() {
-      this.getProvinceList(this.formState.whole);
-    },
-    provinceHandleChange() {
-      this.getCityList(this.formState.provinceId);
-    },
-    cityHandleChange() {
-      this.getAreaList(this.formState.cityId);
-    },
-    countyHandleChange() {
-      this.getStoreList(this.formState.countyId);
-    },
 
     async getVerification() {
       this.loading = true;
@@ -331,7 +328,8 @@ export default {
     .ant-form {
       display: flex;
       > .ant-form-item {
-        flex: 1;
+        flex: none;
+        width: 300px;
         /deep/.ant-form-item-control-wrapper {
           width: 100%;
         }

+ 57 - 1
src/pages/sys/role.vue

@@ -11,7 +11,7 @@
         <a-button type="primary" @click="search">查询</a-button>
         <a-button type="primary" @click="addRole">新增</a-button>
       </div>
-      <div>
+      <div style="margin-top: 10px">
         <standard-table
           bordered
           :columns="columns"
@@ -20,6 +20,8 @@
           @change="onChange"
           :loading="loading"
           @onClickRow="onClickRow"
+          :selectedRows="checkTable"
+          @selectedRowChange="selectedRowChange"
         >
           <div slot="operation" slot-scope="text">
             <a-button @click.stop="edit(text)" style="margin-right: 10px"
@@ -48,16 +50,31 @@
       </div>
       <div class="role-head">
         <a-checkbox
+          v-if="checkTable.length < 1"
           @change="handleCheckAll"
           v-model="checkAll"
           :disabled="!tableItem.id"
         >
           全选
         </a-checkbox>
+        <a-checkbox
+          v-if="checkTable.length > 1"
+          @change="handleCheckAll"
+          v-model="checkAll"
+          :disabled="checkTable.length < 1"
+        >
+          全选
+        </a-checkbox>
         <a-button @click="reset" :disabled="!tableItem.id">重置</a-button>
         <a-button type="primary" @click="submit" :disabled="!tableItem.id"
           >提交</a-button
         >
+        <a-button
+          type="primary"
+          :disabled="checkTable.length < 1"
+          @click="batchOperation"
+          >批量操作</a-button
+        >
       </div>
     </div>
     <a-modal
@@ -174,6 +191,7 @@ export default {
       checkAll: false,
       resetForm: {},
       expandedKeys: [],
+      checkTable: [],
     };
   },
   created() {
@@ -183,6 +201,40 @@ export default {
   },
   mounted() {},
   methods: {
+    //批量功能操作
+    batchOperation() {
+      // this.treeDisabled = false;
+      this.$API.sysManage
+        .saveBatchRoleMenus({
+          roleIdIds: this.checkTable,
+          menuIds: this.checkedKeys,
+          sysType: 2,
+        })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.$message.success(res.data.msg);
+            this.expandedKeys = [];
+            this.checkTable = [];
+            // this.$refs.menuTree.setCheckedNodes(allMenus);
+          } else {
+            this.$message.error(res.data.msg);
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    //表格选择
+    selectedRowChange(val) {
+      this.checkTable = val.map((v) => {
+        return v.id;
+      });
+      if (val.length > 0) {
+        this.treeDisabled = false;
+      } else {
+        this.treeDisabled = true;
+      }
+    },
     edit(item) {
       this.dataForm = { ...item.record };
 
@@ -391,6 +443,10 @@ export default {
   > div {
     flex: 1;
   }
+  .role-manage-aside {
+    flex: none;
+    width: 60% !important;
+  }
 
   .role-head {
     display: flex;

+ 7 - 1
src/services/financial.js

@@ -23,6 +23,11 @@ export async function getCarList(data) {
 export async function getCostCenterTotal(data) {
     return request("/taskStatistics/costCenterTotal", METHOD.POST, data)
 }
+//保险公司筛选框
+export async function getCompany(data) {
+    return request("/esmInsCompany/gainTopList?type=1", METHOD.GET, data)
+}
+
 
 
 
@@ -31,5 +36,6 @@ export default {
     getReceivablesList,
     getMonthReceivablesList,
     getCarList,
-    getCostCenterTotal
+    getCostCenterTotal,
+    getCompany
 }

+ 8 - 1
src/services/sysManage.js

@@ -101,6 +101,12 @@ export async function getAgentOrChannel(data) {
 }
 
 
+//批量给角色添加功能权限
+export async function saveBatchRoleMenus(data) {
+    return request("/kztRole/saveBatchRoleMenus", METHOD.POST, data)
+}
+
+
 
 
 
@@ -129,7 +135,8 @@ export default {
     getUserList,
     UserSetDeptAuth,
     getUserItem,
-    getAgentOrChannel
+    getAgentOrChannel,
+    saveBatchRoleMenus
 
 
 }