| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" v-model:search="search" v-model:page="page" v-model="form" :table-loading="loading" |
| | | :data="data" :permission="permissionList" :before-open="beforeOpen" ref="crud" @row-update="rowUpdate" |
| | | @row-save="rowSave" @row-del="rowDel" @search-change="searchChange"> |
| | | :data="data" :permission="permissionList" ref="crud" @row-update="rowUpdate" @row-save="rowSave" |
| | | @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template #menu-left> |
| | | <el-button type="danger" icon="el-icon-delete" plain v-if="permission.assessmentTask_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | <el-button type="warning" plain icon="el-icon-download" @click="handleExport">导 出 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | import { getList, add, update, remove } from "@/api/system/user.js"; |
| | | import option from "@/option/assessmentTask/assessmentTask"; |
| | | import { mapGetters } from "vuex"; |
| | | import { exportBlob } from "@/api/common"; |
| | | import { getToken } from '@/utils/auth'; |
| | | import { downloadXls } from "@/utils/util"; |
| | | import { dateNow } from "@/utils/date"; |
| | | import NProgress from 'nprogress'; |
| | | import 'nprogress/nprogress.css'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: option, |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: false, |
| | | delBtn: true, |
| | | editBtn: true, |
| | | addBtn: true, |
| | | selection: true, |
| | | dialogClickModal: false, |
| | | labelWidth: 120, |
| | | column: [ |
| | | { |
| | | label: "工号", |
| | | prop: "postId", |
| | | type: "input", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "姓名", |
| | | prop: "name", |
| | | type: "input", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "部门", |
| | | prop: "deptName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "职务", |
| | | prop: "postName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "人员类型", |
| | | type: "input" |
| | | }, |
| | | { |
| | | label: "合伙类型", |
| | | type: "input" |
| | | }, |
| | | { |
| | | label: '企点(数值)', |
| | | type: 'input', |
| | | }, |
| | | // { |
| | | // label: "创建人", |
| | | // prop: "createUser", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "创建部门", |
| | | // prop: "createDept", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "创建时间", |
| | | // prop: "createTime", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "修改人", |
| | | // prop: "updateUser", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "修改时间", |
| | | // prop: "updateTime", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "状态", |
| | | // prop: "status", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | // { |
| | | // label: "是否已删除", |
| | | // prop: "isDeleted", |
| | | // type: "input", |
| | | // hide: true, |
| | | // }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.validData(this.permission.assessmentTask_add, false), |
| | | viewBtn: this.validData(this.permission.assessmentTask_view, false), |
| | | delBtn: this.validData(this.permission.assessmentTask_delete, false), |
| | | editBtn: this.validData(this.permission.assessmentTask_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | methods: { |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | loading(); |
| | | window.console.log(error); |
| | | }); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | loading(); |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | | 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(); |
| | | }); |
| | | }, |
| | | handleExport() { |
| | | let downloadUrl = `/blade-system/user/export-user?${this.website.tokenHeader}=${getToken()}`; |
| | | const { |
| | | } = this.query; |
| | | let values = { |
| | | }; |
| | | this.$confirm("是否导出数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | NProgress.start(); |
| | | exportBlob(downloadUrl, values).then(res => { |
| | | downloadXls(res.data, `考核任务表${dateNow()}.xlsx`); |
| | | NProgress.done(); |
| | | }) |
| | | }); |
| | | }, |
| | | 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(); |
| | | }, |
| | | 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; |
| | | |
| | | const { |
| | | } = this.query; |
| | | |
| | | let values = { |
| | | }; |
| | | |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | console.log(res.data.data.records); |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style></style> |
| | | |
| | | <style></style> |