瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

qinbai 3 年之前
父節點
當前提交
2a052d7e21

+ 9 - 1
src/api/basicData/message.js

@@ -1,6 +1,6 @@
 import request from '@/router/axios';
 
-// 发送消息
+// 发送消息(单人)
 export function sendMessage(data) {
   return request({
     url: '/api/blade-client/message/save',
@@ -8,3 +8,11 @@ export function sendMessage(data) {
     data: data
   })
 }
+// 发送消息(多人)
+export function sendManyMessage(data) {
+  return request({
+    url: '/api/blade-client/message/batchSave',
+    method: 'post',
+    data: data
+  })
+}

+ 12 - 1
src/api/salaryManagement/primarySchool.js

@@ -17,6 +17,17 @@ export function detail(id) {
     method: 'get'
   })
 }
+export function itemDetail(current, size, params) {
+  return request({
+    url: '/api/blade-school/salaryitem/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size
+    }
+  })
+}
 //修改和新增
 export function submit(data) {
   return request({
@@ -44,4 +55,4 @@ export function delItem(data) {
       ids: data
     }
   })
-}
+}

+ 2 - 2
src/components/messageSend/main.vue

@@ -41,7 +41,7 @@
 
 <script>
 import { getList } from "@/api/system/user";
-import { sendMessage } from "@/api/basicData/message"
+import { sendMessage,sendManyMessage } from "@/api/basicData/message"
 
 export default {
   name: "main",
@@ -81,7 +81,7 @@ export default {
             ...this.form,
             messageType: 1
           }
-          sendMessage(data).then(res => {
+          sendManyMessage(data).then(res => {
             this.$message.success('发送成功')
             this.closeDialog()
           })

+ 285 - 112
src/views/salaryManagement/primarySchool/detailsPage.vue

@@ -20,108 +20,136 @@
       </el-button>
     </div>
     <div class="customer-main">
-       <containerTitle title="基础资料"></containerTitle>
-    <basic-container>
-      <avue-form class="trading-form" ref="form" v-model="form" :option="option" />
-    </basic-container>
-    <containerTitle title="基础明细"></containerTitle>
-    <basic-container>
-      <avue-crud
-        ref="crud"
-        :option="optionList"
-        :data="dataList"
-        :search.sync="search"
-        @search-change="searchChange"
-        @saveColumn="saveColumn"
-        :cell-style="cellStyle"
-        :header-cell-class-name="headerCellClassName"
-      >
-        <template slot="menuLeft">
-          <el-button
-            type="primary"
-            @click="dataList.push({ $cellEdit: true })"
-            size="small"
-            :disabled="detailData.status == 1"
-            >新增</el-button
-          >
-          <el-button
-            type="primary"
-            size="small"
-            icon="el-icon-bottom"
-            @click="importExcel()"
-            :disabled="detailData.status == 1"
-            >导入
-          </el-button>
-          <el-button
-            type="primary"
-            size="small"
-            icon="el-icon-bottom"
-            @click.stop="openExport()"
-            >导出
-          </el-button>
-        </template>
-        <template slot-scope="{ row, index }" slot="menu">
-          <el-button
-            type="text"
-            size="small"
-            @click.stop="rowCell(row)"
-            :disabled="detailData.status == 1"
-          >
-            编辑
-          </el-button>
-          <el-button
-            type="text"
-            size="small"
-            @click.stop="rowDel(row, index)"
-            :disabled="detailData.status == 1"
-          >
-            删除
-          </el-button>
-        </template>
-      </avue-crud>
-      <el-dialog
-        title="导入教职工资料"
-        append-to-body
-        :visible.sync="excelBox"
-        width="555px"
-        v-dialog-drag
-      >
+      <containerTitle title="基础资料"></containerTitle>
+      <basic-container>
         <avue-form
-          :option="excelOption"
-          v-model="excelForm"
-          table-loading="excelLoading"
-          :upload-after="uploadAfter"
+          class="trading-form"
+          ref="form"
+          v-model="form"
+          :option="option"
+        />
+      </basic-container>
+      <containerTitle title="基础明细"></containerTitle>
+      <basic-container>
+        <avue-crud
+          ref="crud"
+          :option="optionList"
+          :data="dataList"
+          :page.sync="page"
+          :search.sync="search"
+          :table-loading="loading"
+          @current-change="currentChange"
+          @size-change="sizeChange"
+          @search-change="searchChange"
+          @saveColumn="saveColumn"
+          :cell-style="cellStyle"
+          :header-cell-class-name="headerCellClassName"
         >
-          <template slot="excelTemplate">
-            <el-button type="primary" @click="derivation">
-              点击下载<i class="el-icon-download el-icon--right"></i>
+          <template slot="menuLeft">
+            <el-button
+              type="primary"
+              @click="dataList.push({ $cellEdit: true })"
+              size="small"
+              :disabled="detailData.status == 1"
+              >新增</el-button
+            >
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-bottom"
+              @click="importExcel()"
+              :disabled="detailData.status == 1"
+              >导入
+            </el-button>
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-bottom"
+              @click.stop="openExport()"
+              >导出
+            </el-button>
+          </template>
+          <template slot-scope="{ row, index }" slot="menu">
+            <el-button
+              type="text"
+              size="small"
+              @click.stop="rowCell(row)"
+              :disabled="detailData.status == 1"
+            >
+              {{ row.$cellEdit ? "保存" : "编辑" }}
+            </el-button>
+            <el-button
+              type="text"
+              size="small"
+              @click.stop="rowDel(row, index)"
+              :disabled="detailData.status == 1"
+            >
+              删除
             </el-button>
           </template>
-        </avue-form>
-        <p style="text-align: center;color: #DC0505">
-          温馨提示 第一次导入时请先下载模板
-        </p>
-      </el-dialog>
-    </basic-container>
+        </avue-crud>
+        <el-dialog
+          title="导入教职工资料"
+          append-to-body
+          :visible.sync="excelBox"
+          width="555px"
+          v-dialog-drag
+        >
+          <avue-form
+            :option="excelOption"
+            v-model="excelForm"
+            table-loading="excelLoading"
+            :upload-after="uploadAfter"
+          >
+            <template slot="excelTemplate">
+              <el-button type="primary" @click="derivation">
+                点击下载<i class="el-icon-download el-icon--right"></i>
+              </el-button>
+            </template>
+          </avue-form>
+          <p style="text-align: center;color: #DC0505">
+            温馨提示 第一次导入时请先下载模板
+          </p>
+        </el-dialog>
+      </basic-container>
     </div>
   </div>
 </template>
 
 <script>
 import { getToken } from "@/util/auth";
-import { detail, submit, delItem } from "@/api/salaryManagement/primarySchool";
+import {
+  detail,
+  submit,
+  delItem,
+  itemDetail
+} from "@/api/salaryManagement/primarySchool";
 export default {
   name: "detailsPage",
   data() {
     return {
       excelBox: false,
+      loading: false,
       xcelLoading: false,
-      excelForm: {},
+      excelForm: {
+        type: "1"
+      },
       excelOption: {
         submitBtn: false,
         emptyBtn: false,
         column: [
           {
+            label: "导入类型",
+            prop: "type",
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=import_type",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            span: 12
+          },
+          {
             label: "模板下载",
             prop: "excelTemplate",
             formslot: true,
@@ -138,13 +166,19 @@ export default {
               res: "data"
             },
             tip: "请上传 .xls,.xlsx 标准格式文件",
-            action: "/api/blade-school/salaryitem/import"
+            action: "/api/blade-school/salaryitem/import",
+            disabled: false
           }
         ]
       },
       form: {},
       dataList: [],
-      allDataList: [],
+      page: {
+        pageSize: 20,
+        currentPage: 1,
+        total: 0,
+        pageSizes: [10, 20, 30, 40, 50, 100]
+      },
       drawer: false,
       tableHeight: 0,
       option: {
@@ -940,7 +974,8 @@ export default {
             cell: true
           }
         ]
-      }
+      },
+      exportUrl: "/api/blade-school/salaryitem/export/template"
     };
   },
   props: {
@@ -954,9 +989,9 @@ export default {
     }
     if (this.detailData.status == 1) {
       this.option.disabled = true;
-      this.findObject(this.optionList.column, "cname").search=true
+      this.findObject(this.optionList.column, "cname").search = true;
     }
-    this.optionList.height = window.innerHeight - 380;
+    this.optionList.height = window.innerHeight - 400;
   },
   methods: {
     cellStyle() {
@@ -984,22 +1019,44 @@ export default {
       }
     },
     getDetail(id) {
-      detail(id)
+      detail(id).then(res => {
+        this.form = res.data.data;
+        this.getItemDetail();
+      });
+    },
+    getItemDetail() {
+      const data = {
+        pid: this.form.id,
+        ...this.search
+      };
+      this.loading = true;
+      itemDetail(this.page.currentPage, this.page.pageSize, data)
         .then(res => {
-          this.form = res.data.data;
-          this.dataList = res.data.data.salaryItemList;
-          if (this.detailData.status == 1) {
-            this.allDataList = res.data.data.salaryItemList;
-          }
+          this.dataList = res.data.data.records;
+          this.page.total = res.data.data.total;
         })
         .finally(() => {
-          // this.loading = false;
-          // this.showBut = true;
-          // this.pageLoading = false;
+          this.loading = false;
         });
     },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
+        if (!row.cname) {
+          return this.$message.error("请完善姓名");
+        }
+        if (!row.idNumber) {
+          return this.$message.error("请完善身份证号");
+        }
+        // if (!row.rankStandard) {
+        //   return this.$message.error("请完善职级标准");
+        // }
+        const arr = [];
+        arr.push(row);
+        submit({ ...this.form, salaryItemList: arr }).then(res => {
+          this.$message.success("保存成功");
+          this.form = res.data.data;
+          this.getItemDetail();
+        });
         this.$set(row, "$cellEdit", false);
       } else {
         this.$set(row, "$cellEdit", true);
@@ -1017,7 +1074,7 @@ export default {
               type: "success",
               message: "删除成功!"
             });
-            this.dataList.splice(index, 1);
+            this.getItemDetail();
           });
         } else {
           this.$message({
@@ -1029,13 +1086,18 @@ export default {
       });
     },
     searchChange(params, done) {
-      if (params.cname) {
-        this.dataList = this.allDataList.filter(e => e.cname == params.cname);
-      } else {
-        this.dataList = this.allDataList;
-      }
+      this.getItemDetail();
       done();
     },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getItemDetail();
+    },
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
+      this.getItemDetail();
+    },
     uploadAfter(res, done, loading, column) {
       this.excelBox = false;
       this.$message.success("导入成功!");
@@ -1066,23 +1128,25 @@ export default {
               );
             }
           }
-          submit({ ...this.form, salaryItemList: this.dataList })
-            .then(res => {
-              this.$message.success("保存成功");
-              this.form = res.data.data;
-              this.dataList = res.data.data.salaryItemList;
-            })
-            .finally(() => {});
+          submit({ ...this.form, salaryItemList: this.dataList }).then(res => {
+            this.$message.success("保存成功");
+            this.form = res.data.data;
+            this.getItemDetail();
+          });
         } else {
           return false;
         }
       });
     },
     derivation() {
+      if (!this.excelForm.type) {
+        return this.$message.error("请选择导入类型");
+      }
+      if (!this.exportUrl) {
+        return this.$message.error("暂无模板文件");
+      }
       window.open(
-        `/api/blade-school/salaryitem/export/template?${
-          this.website.tokenHeader
-        }=${getToken()}`
+        `${this.exportUrl}?${this.website.tokenHeader}=${getToken()}`
       );
     },
     openExport() {
@@ -1188,6 +1252,115 @@ export default {
     backToList() {
       this.$emit("goBack");
     }
+  },
+  watch: {
+    "excelForm.type": function(val) {
+      if (val) {
+        switch (val) {
+          case "1":
+            this.exportUrl = "/api/blade-school/salaryitem/export/template";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "2":
+            this.exportUrl = "/api/blade-school/salaryitem/export/employ";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/employ";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "5":
+            this.exportUrl =
+              "/api/blade-school/salaryitem/export/teacherSubsidy";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/teacherSubsidy";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "6":
+            this.exportUrl = "/api/blade-school/salaryitem/export/position";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/position";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "9":
+            this.exportUrl = "/api/blade-school/salaryitem/export/overtime";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/overtime";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "10":
+            this.exportUrl = "/api/blade-school/salaryitem/export/weChat";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/weChat";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "11":
+            this.exportUrl = "/api/blade-school/salaryitem/export/power";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/power";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "12":
+            this.exportUrl = "/api/blade-school/salaryitem/export/phoneFine";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/phoneFine";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "13":
+            this.exportUrl =
+              "/api/blade-school/salaryitem/export/sanitationFee";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/sanitationFee";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          case "17":
+            this.exportUrl =
+              "/api/blade-school/salaryitem/export/attendanceExcel";
+            this.findObject(this.excelOption.column, "excelFile").action =
+              "/api/blade-school/salaryitem/import/attendanceExcel";
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = false;
+            break;
+          default:
+            this.findObject(
+              this.excelOption.column,
+              "excelFile"
+            ).disabled = true;
+            this.exportUrl = "";
+        }
+      } else {
+        this.findObject(this.excelOption.column, "excelFile").disabled = true;
+      }
+    }
   }
 };
 </script>
@@ -1205,4 +1378,4 @@ export default {
 ::v-deep .el-form-item__error {
   display: none !important;
 }
-</style>
+</style>

+ 1 - 1
src/views/salaryManagement/primarySchool/index.vue

@@ -59,7 +59,7 @@ export default {
       detailData: {},
       page: {
         pageSize: 10,
-        pagerCount: 1
+        currentPage: 1
       },
       option: {
         searchShow: true,