|
|
@@ -1,24 +1,11 @@
|
|
|
<template>
|
|
|
<basic-container>
|
|
|
<avue-crud
|
|
|
- :option="technicianRosterOption"
|
|
|
- :table-loading="loading"
|
|
|
- :data="dataList"
|
|
|
- :page="page"
|
|
|
- ref="crud"
|
|
|
+ v-bind="bindVal"
|
|
|
+ v-on="onEvent"
|
|
|
v-model="form"
|
|
|
- :permission="permissionList"
|
|
|
+ :page.sync="page"
|
|
|
:before-open="handleBeforeOpen"
|
|
|
- @row-del="rowDel"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @row-save="rowSave"
|
|
|
- @search-change="searchChange"
|
|
|
- @search-reset="searchReset"
|
|
|
- @selection-change="selectionChange"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @on-load="onLoad"
|
|
|
>
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
|
@@ -57,7 +44,7 @@
|
|
|
读取上个月人员名单
|
|
|
</el-button>
|
|
|
<div>
|
|
|
- <year-month-select v-model="yearAndMonth"></year-month-select>
|
|
|
+ <year-month-select v-model="params.yearAndMonth"></year-month-select>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -79,10 +66,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getList, add, update, remove } from "@/api/technicianRoster";
|
|
|
import {exportBlob} from "@/api/common";
|
|
|
-import technicianRosterOption from "@/option/user/technicianRoster";
|
|
|
-import { mapGetters } from "vuex";
|
|
|
import YearMonthSelect from "@/components/year-month-select";
|
|
|
import moment from "moment";
|
|
|
import NProgress from 'nprogress';
|
|
|
@@ -92,34 +76,23 @@ import {downloadXls} from "@/util/util";
|
|
|
import {dateNow} from "@/util/date";
|
|
|
|
|
|
|
|
|
-export default {
|
|
|
+export default window.$crudCommon({
|
|
|
components: {
|
|
|
YearMonthSelect,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- form: {},
|
|
|
- selectionList: [],
|
|
|
- query: {},
|
|
|
- yearAndMonth: moment(new Date()).format('YYYY-MM'),
|
|
|
- loading: true,
|
|
|
- page: {
|
|
|
- pageSize: 10,
|
|
|
- pageSizes: [10, 30, 50, 100, 200],
|
|
|
- currentPage: 1,
|
|
|
- total: 0,
|
|
|
+ params: {
|
|
|
+ yearAndMonth: moment(new Date()).format('YYYY-MM'),
|
|
|
},
|
|
|
- dataList: [],
|
|
|
- technicianRosterOption,
|
|
|
-
|
|
|
excelBox: false,
|
|
|
excelForm: {},
|
|
|
|
|
|
- isSelAnnual: false,
|
|
|
+ isSelAnnual: false, // 是否选择全年
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- yearAndMonth(newVal) {
|
|
|
+ 'params.yearAndMonth'(newVal) {
|
|
|
if (newVal.indexOf("-") > -1) {
|
|
|
// 是否勾选未全年
|
|
|
this.isSelAnnual = false;
|
|
|
@@ -127,7 +100,7 @@ export default {
|
|
|
this.isSelAnnual = true;
|
|
|
}
|
|
|
this.page.currentPage = 1;
|
|
|
- this.onLoad(this.page);
|
|
|
+ this.getList(this.page);
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -139,19 +112,12 @@ export default {
|
|
|
// viewBtn: false,
|
|
|
// };
|
|
|
// },
|
|
|
- ids() {
|
|
|
- let ids = [];
|
|
|
- this.selectionList.forEach((ele) => {
|
|
|
- ids.push(ele.id);
|
|
|
- });
|
|
|
- return ids.join(",");
|
|
|
- },
|
|
|
excelOption() {
|
|
|
return {
|
|
|
submitBtn: false,
|
|
|
emptyBtn: false,
|
|
|
column: [
|
|
|
- {
|
|
|
+ {
|
|
|
label: '上传月份',
|
|
|
props: 'yearAndMonth',
|
|
|
type: 'input',
|
|
|
@@ -193,129 +159,6 @@ export default {
|
|
|
}
|
|
|
done();
|
|
|
},
|
|
|
- rowSave(row, done, loading) {
|
|
|
- const form = {
|
|
|
- ...row,
|
|
|
- };
|
|
|
- add(form).then(
|
|
|
- () => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- done();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- loading();
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
- rowUpdate(row, index, done, loading) {
|
|
|
- update(row).then(
|
|
|
- () => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- this.onLoad(this.page);
|
|
|
- done();
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- loading();
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
- rowDel(row) {
|
|
|
- this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return remove(row.id);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- searchReset() {
|
|
|
- this.query = {};
|
|
|
- this.onLoad(this.page);
|
|
|
- },
|
|
|
- searchChange(params, done) {
|
|
|
- this.query = params;
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoad(this.page, params);
|
|
|
- done();
|
|
|
- },
|
|
|
- selectionChange(list) {
|
|
|
- this.selectionList = list;
|
|
|
- },
|
|
|
- selectionClear() {
|
|
|
- this.selectionList = [];
|
|
|
- this.$refs.crud.toggleSelection();
|
|
|
- },
|
|
|
- handleDelete() {
|
|
|
- if (this.selectionList.length === 0) {
|
|
|
- this.$message.warning("请选择至少一条数据");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return remove(this.ids);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!",
|
|
|
- });
|
|
|
- this.$refs.crud.toggleSelection();
|
|
|
- });
|
|
|
- },
|
|
|
- currentChange(currentPage) {
|
|
|
- this.page.currentPage = currentPage;
|
|
|
- },
|
|
|
- sizeChange(pageSize) {
|
|
|
- this.page.pageSize = pageSize;
|
|
|
- },
|
|
|
- refreshChange() {
|
|
|
- this.onLoad(this.page, this.query);
|
|
|
- },
|
|
|
- onLoad(page, params = {}) {
|
|
|
- this.loading = true;
|
|
|
- let queryParams = Object.assign(params, this.query, { yearAndMonth: this.yearAndMonth });
|
|
|
- getList(
|
|
|
- page.currentPage,
|
|
|
- page.pageSize,
|
|
|
- queryParams
|
|
|
- ).then((res) => {
|
|
|
- if (!res.data) {
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- const data = res.data.data;
|
|
|
- this.page.total = data.total;
|
|
|
- this.dataList = data.records.map(item => {
|
|
|
- if (item.gender) {
|
|
|
- item.gender = String(item.gender);
|
|
|
- }
|
|
|
- return item;
|
|
|
- });
|
|
|
- this.loading = false;
|
|
|
- this.selectionClear();
|
|
|
- });
|
|
|
- },
|
|
|
handleImport() {
|
|
|
if (this.isSelAnnual) {
|
|
|
this.$message.warning("请选择月份");
|
|
|
@@ -352,5 +195,8 @@ export default {
|
|
|
this.$message.warning("功能建设中...");
|
|
|
},
|
|
|
},
|
|
|
-};
|
|
|
+}, {
|
|
|
+ // 模块路径
|
|
|
+ name: 'technicianRoster'
|
|
|
+});
|
|
|
</script>
|