基础数据-班次管理-新增排序/权限

dev-scheduling
ysn 1 month ago
parent 76e4015fda
commit e5ea0f67bf
  1. 131
      src/views/basicData/shiftManagement.vue

@ -17,13 +17,16 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
@sort-change="sortChange"
:permission="permissionList"
> >
</avue-crud> </avue-crud>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import {getList,addShift,updateShift} from "@/api/basicData/shiftManagement" import { getList, addShift, updateShift } from '@/api/basicData/shiftManagement';
import { mapGetters } from 'vuex';
export default { export default {
data() { data() {
return { return {
@ -39,8 +42,8 @@ export default {
excelBox: false, excelBox: false,
option: { option: {
tip: false, tip: false,
height: "auto", height: 'auto',
rowKey: "csId", rowKey: 'csId',
calcHeight: 32, calcHeight: 32,
simplePage: false, simplePage: false,
searchShow: true, searchShow: true,
@ -53,9 +56,9 @@ export default {
selection: false, selection: false,
viewBtn: false, viewBtn: false,
delBtn: false, delBtn: false,
editBtnText: "修改", editBtnText: '修改',
editBtnIcon: " ", editBtnIcon: ' ',
viewBtnText: "详情", viewBtnText: '详情',
labelWidth: 120, labelWidth: 120,
menuWidth: 120, menuWidth: 120,
dialogWidth: 300, dialogWidth: 300,
@ -65,22 +68,22 @@ export default {
searchShowBtn: false, searchShowBtn: false,
excelBtn: true, excelBtn: true,
showOverflowTooltip: true, showOverflowTooltip: true,
searchLabelPosition: "left", searchLabelPosition: 'left',
searchGutter: 24, searchGutter: 24,
searchSpan: 6, searchSpan: 6,
menuAlign: "center", menuAlign: 'center',
gridBtn: false, gridBtn: false,
searchMenuPosition: "right", searchMenuPosition: 'right',
searchLabelWidth:'auto', searchLabelWidth: 'auto',
addBtnIcon: " ", addBtnIcon: ' ',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
align: "center", align: 'center',
column: [ column: [
{ {
label: "班次", label: '班次',
prop: "name", prop: 'name',
search: true, search: true,
sortable: true, sortable: true,
filter: true, filter: true,
@ -90,8 +93,8 @@ export default {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入班次", message: '请输入班次',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
@ -102,21 +105,21 @@ export default {
emptyBtn: false, emptyBtn: false,
column: [ column: [
{ {
label: "模板上传", label: '模板上传',
prop: "excelFile", prop: 'excelFile',
type: "upload", type: 'upload',
drag: true, drag: true,
loadText: "模板上传中,请稍等", loadText: '模板上传中,请稍等',
span: 24, span: 24,
propsHttp: { propsHttp: {
res: "data", res: 'data',
}, },
tip: "请上传 .xls,.xlsx 标准格式文件", tip: '请上传 .xls,.xlsx 标准格式文件',
action: "/blade-system/user/import-user", action: '/blade-system/user/import-user',
}, },
{ {
label: "模板下载", label: '模板下载',
prop: "excelTemplate", prop: 'excelTemplate',
formslot: true, formslot: true,
span: 24, span: 24,
}, },
@ -125,7 +128,15 @@ export default {
selectionList: [], selectionList: [],
}; };
}, },
mounted() {}, computed: {
...mapGetters(['permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.shiftManagement_add, false),
editBtn: this.validData(this.permission.shiftManagement_edit, false),
};
},
},
methods: { methods: {
handleImport() { handleImport() {
this.excelBox = true; this.excelBox = true;
@ -139,22 +150,22 @@ export default {
this.$refs.crud.toggleSelection(); this.$refs.crud.toggleSelection();
}, },
rowUpdate(row, index, done, loading) { rowUpdate(row, index, done, loading) {
updateShift(row).then(res =>{ updateShift(row).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success("修改成功") this.$message.success('修改成功');
this.onLoad() this.onLoad();
done() done();
} }
}) });
}, },
rowSave(row, done, loading) { rowSave(row, done, loading) {
addShift(row).then(res =>{ addShift(row).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success("新增成功") this.$message.success('新增成功');
this.onLoad() this.onLoad();
done() done();
} }
}) });
// done(); // done();
}, },
searchReset() { searchReset() {
@ -168,10 +179,10 @@ export default {
done(); done();
}, },
rowDel(row, index, done) { rowDel(row, index, done) {
this.$confirm("确定将选择数据删除?", { this.$confirm('确定将选择数据删除?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => {}); }).then(() => {});
}, },
currentChange(currentPage) { currentChange(currentPage) {
@ -183,17 +194,31 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
//
sortChange({ prop, order }) {
if (!prop) {
//
this.query.orderByField = undefined;
this.query.isAsc = undefined;
} else {
const orderByField = prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase();
this.query.orderByField = orderByField;
this.query.isAsc = order === 'ascending' ? true : false;
}
//
this.onLoad();
},
onLoad() { onLoad() {
this.loading = true; this.loading = true;
getList({ getList({
current:1, current: 1,
size:10, size: 10,
...this.query ...this.query,
}).then(res =>{ }).then(res => {
this.data = res.data.data.records this.data = res.data.data.records;
this.page.total = res.data.data.total this.page.total = res.data.data.total;
this.loading = false this.loading = false;
}) });
}, },
}, },
}; };

Loading…
Cancel
Save