2 files modified
3 files added
| | |
| | | .DS_Store |
| | | node_modules |
| | | /dist |
| | | zttj-web |
| | | |
| | | /tests/e2e/videos/ |
| | | /tests/e2e/screenshots/ |
| New file |
| | |
| | | import request from '@/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/assessment/assessmentConfig/list', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getDetail = (id) => { |
| | | return request({ |
| | | url: '/assessment/assessmentConfig/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/assessment/assessmentConfig/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/assessment/assessmentConfig/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/assessment/assessmentConfig/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| New file |
| | |
| | | export default { |
| | | height:'auto', |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "主键", |
| | | prop: "id", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "租户ID", |
| | | prop: "tenantId", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "被考核人", |
| | | prop: "userId", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "被考核人名称", |
| | | prop: "userName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "被考核人部门id", |
| | | prop: "deptId", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "被考核人部门名称", |
| | | prop: "deptName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "被考核人职位名称", |
| | | prop: "postName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "考核人", |
| | | prop: "assessorUserId", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "考核人名称", |
| | | prop: "assessorUserName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "考核人部门id", |
| | | prop: "assessorDeptId", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "考核人部门名称", |
| | | prop: "assessorDeptName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "考核人职位名称", |
| | | prop: "assessorPostName", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "权值", |
| | | prop: "weight", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "范围", |
| | | prop: "rangeVal", |
| | | type: "input", |
| | | }, |
| | | { |
| | | label: "创建人", |
| | | prop: "createUser", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "创建部门", |
| | | prop: "createDept", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "创建时间", |
| | | prop: "createTime", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "修改人", |
| | | prop: "updateUser", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "修改时间", |
| | | prop: "updateTime", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "状态", |
| | | prop: "status", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "是否已删除", |
| | | prop: "isDeleted", |
| | | type: "input", |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | hide: true, |
| | | }, |
| | | ] |
| | | } |
| New file |
| | |
| | | <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" |
| | | @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.assessmentConfig_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, getDetail, add, update, remove} from "@/api/assessment/assessmentConfig"; |
| | | import option from "@/option/assessment/assessmentConfig"; |
| | | 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 { |
| | | form: {}, |
| | | query: {}, |
| | | search: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: option, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.validData(this.permission.assessmentConfig_add, false), |
| | | viewBtn: this.validData(this.permission.assessmentConfig_view, false), |
| | | delBtn: this.validData(this.permission.assessmentConfig_delete, false), |
| | | editBtn: this.validData(this.permission.assessmentConfig_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | methods: { |
| | | 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-assessmentConfig/assessmentConfig/export-assessmentConfig?${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(); |
| | | }) |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | 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 => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | <template> |
| | | <basic-container> |
| | | <template v-if="curIndex === 0"> |
| | | <avue-tabs ref="tabs" :option="taskTypeList" @change="tabChange"></avue-tabs> |
| | | <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" @search-reset="searchReset" |
| | | @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
| | | @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template #isAssessmentOk="{ row }"> |
| | | <el-tag :type="setTaskState(row.isAssessmentOk).type" effect="dark">{{ setTaskState(row.isAssessmentOk).text }}</el-tag> |
| | | <basic-container> |
| | | <template v-if="curIndex === 0"> |
| | | <avue-tabs ref="tabs" :option="taskTypeList" @change="tabChange"></avue-tabs> |
| | | <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" @search-reset="searchReset" |
| | | @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
| | | @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template #isAssessmentOk="{ row }"> |
| | | <el-tag :type="setTaskState(row.isAssessmentOk).type" effect="dark"> |
| | | {{ setTaskState(row.isAssessmentOk).text }} |
| | | </el-tag> |
| | | </template> |
| | | <template #menu-left> |
| | | <el-button type="danger" icon="el-icon-delete" plain v-if="permission.assessmentTask_delete" |
| | | @click="handleDelete"> |
| | | 删除 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-upload" |
| | | @click="handleImport" |
| | | >权重导入 |
| | | </el-button> |
| | | <!-- <el-button type="warning" plain icon="el-icon-download" @click="handleExport"> |
| | | 导出 |
| | | </el-button> --> |
| | | </template> |
| | | <template #menu="{ row, index, size }"> |
| | | <el-button type="primary" icon="el-icon-setting" text @click="handleTaskSetting(row)"> |
| | | 考核设置 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-view" text @click="handleAssessorDetails(row)"> |
| | | 考核结果 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-view" text @click="handleAssessorList(row)"> |
| | | 考核详情 |
| | | </el-button> |
| | | <el-button type="success" icon="el-icon-edit" text v-if="row.isAssessmentOk === -1" |
| | | @click="$refs.crud.rowEdit(row,index)"> |
| | | 编辑 |
| | | </el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-view" text @click="handleTaskResult(row)"> |
| | | 考核结果 |
| | | </el-button> --> |
| | | <el-button type="danger" icon="el-icon-delete" text @click="rowDel(row)"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </template> |
| | | <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 v-else-if="curIndex === 1"> |
| | | <assessmentTaskSetting :params="resultParams" @changeIs="changeIs"/> |
| | | </template> |
| | | <template #menu="{ row, index, size }"> |
| | | <el-button type="primary" icon="el-icon-setting" text @click="handleTaskSetting(row)"> |
| | | 考核设置 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-view" text @click="handleAssessorDetails(row)"> |
| | | 考核结果 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-view" text @click="handleAssessorList(row)"> |
| | | 考核详情 |
| | | </el-button> |
| | | <el-button type="success" icon="el-icon-edit" text v-if="row.isAssessmentOk === -1" |
| | | @click="$refs.crud.rowEdit(row,index)"> |
| | | 编辑 |
| | | </el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-view" text @click="handleTaskResult(row)"> |
| | | 考核结果 |
| | | </el-button> --> |
| | | <el-button type="danger" icon="el-icon-delete" text @click="rowDel(row)"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </template> |
| | | <template v-else-if="curIndex === 1"> |
| | | <assessmentTaskSetting :params="resultParams" @changeIs="changeIs"/> |
| | | </template> |
| | | <!-- <template v-else> |
| | | <taskResult :params="resultParams" @changeIs="changeIs" /> |
| | | </template> --> |
| | | <!-- 考核结果详情 --> |
| | | <assessorDetails :params="detailsParams" /> |
| | | <!-- 考核人员详情 --> |
| | | <assessorDialog :params="assessorDialogParams" /> |
| | | </basic-container> |
| | | <!-- <template v-else> |
| | | <taskResult :params="resultParams" @changeIs="changeIs" /> |
| | | </template> --> |
| | | <!-- 考核结果详情 --> |
| | | <assessorDetails :params="detailsParams"/> |
| | | <!-- 考核人员详情 --> |
| | | <assessorDialog :params="assessorDialogParams"/> |
| | | <el-dialog title="权重数据导入" append-to-body v-model="excelBox" width="555px"> |
| | | <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"> |
| | | <template #excelTemplate> |
| | | <el-button type="primary" @click="handleTemplate"> |
| | | 点击下载<i class="el-icon-download el-icon--right"></i> |
| | | </el-button> |
| | | </template> |
| | | </avue-form> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, getDetail, add, update, remove } from "@/api/assessment/assessmentTask"; |
| | | import {getList, getDetail, add, update, remove} from "@/api/assessment/assessmentTask"; |
| | | 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 {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'; |
| | | import taskResult from './components/taskResult.vue' |
| | |
| | | import assessorDialog from "./components/assessorDialog.vue"; |
| | | |
| | | export default { |
| | | components: { |
| | | taskResult, |
| | | addTaskDialog, |
| | | assessmentTaskSetting, |
| | | assessorDetails, |
| | | assessorDialog |
| | | }, |
| | | data() { |
| | | return { |
| | | curIndex: 0, |
| | | form: {}, |
| | | query: {}, |
| | | search: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: option, |
| | | data: [], |
| | | // 考核结果参数 |
| | | resultParams: {}, |
| | | defaultTaskType: 0, |
| | | taskTypeList: { |
| | | column: [ |
| | | { |
| | | label: '个人考核任务', |
| | | prop: 0 |
| | | }, |
| | | { |
| | | label: '部门考核任务', |
| | | prop: 1 |
| | | } |
| | | ] |
| | | }, |
| | | detailsParams: {}, |
| | | assessorDialogParams: {} |
| | | }; |
| | | }, |
| | | watch: { |
| | | defaultTaskType: { |
| | | handler(n) { |
| | | this.query = {} |
| | | this.query['type'] = n |
| | | let params = { |
| | | type: n |
| | | components: { |
| | | taskResult, |
| | | addTaskDialog, |
| | | assessmentTaskSetting, |
| | | assessorDetails, |
| | | assessorDialog |
| | | }, |
| | | data() { |
| | | return { |
| | | curIndex: 0, |
| | | form: {}, |
| | | query: {}, |
| | | search: {}, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: option, |
| | | data: [], |
| | | // 考核结果参数 |
| | | resultParams: {}, |
| | | defaultTaskType: 0, |
| | | taskTypeList: { |
| | | column: [ |
| | | { |
| | | label: '个人考核任务', |
| | | prop: 0 |
| | | }, |
| | | { |
| | | label: '部门考核任务', |
| | | prop: 1 |
| | | } |
| | | ] |
| | | }, |
| | | detailsParams: {}, |
| | | assessorDialogParams: {}, |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: '模板上传', |
| | | prop: 'excelFile', |
| | | type: 'upload', |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data', |
| | | }, |
| | | tip: '请上传 .xls,.xlsx 标准格式文件', |
| | | action: '/assessment/assessmentConfig/import-assessmentConfig', |
| | | }, |
| | | { |
| | | label: '数据覆盖', |
| | | prop: 'isCovered', |
| | | type: 'switch', |
| | | align: 'center', |
| | | width: 80, |
| | | dicData: [ |
| | | { |
| | | label: '否', |
| | | value: 0, |
| | | }, |
| | | { |
| | | label: '是', |
| | | value: 1, |
| | | }, |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择是否覆盖', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '模板下载', |
| | | prop: 'excelTemplate', |
| | | formslot: true, |
| | | span: 24, |
| | | }, |
| | | ], |
| | | }, |
| | | }; |
| | | }, |
| | | watch: { |
| | | 'excelForm.isCovered'() { |
| | | if (this.excelForm.isCovered !== '') { |
| | | const column = this.findObject(this.excelOption.column, 'excelFile'); |
| | | column.action = `/assessment/assessmentConfig/import-assessmentConfig?isCovered=${this.excelForm.isCovered}`; |
| | | } |
| | | }, |
| | | defaultTaskType: { |
| | | handler(n) { |
| | | this.query = {} |
| | | this.query['type'] = n |
| | | let params = { |
| | | type: n |
| | | } |
| | | // 设置默认值 |
| | | const column = this.option.column |
| | | column.some(item => { |
| | | if (item.prop === 'type') { |
| | | item.value = n |
| | | return true |
| | | } |
| | | }) |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | }, |
| | | immediate: true, |
| | | } |
| | | // 设置默认值 |
| | | const column = this.option.column |
| | | column.some(item => { |
| | | if (item.prop === 'type') { |
| | | item.value = n |
| | | return true |
| | | } |
| | | }) |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | }, |
| | | immediate: true, |
| | | } |
| | | }, |
| | | 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(","); |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | type: () => this.defaultTaskType |
| | | } |
| | | }, |
| | | methods: { |
| | | handleTaskSetting(row) { |
| | | this.curIndex = 1; |
| | | this.resultParams = row |
| | | this.resultParams.type = this.defaultTaskType |
| | | }, |
| | | // handleTaskResult(row) { |
| | | // this.curIndex = 2; |
| | | // this.resultParams = row |
| | | // this.resultParams.type = this.defaultTaskType |
| | | // }, |
| | | changeIs(num) { |
| | | this.curIndex = num |
| | | this.$nextTick(() => { |
| | | this.$refs.tabs.active = this.defaultTaskType.toString() |
| | | }) |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | const {startTime, endTime} = row |
| | | const startDate = new Date(startTime).getTime() |
| | | const endDate = new Date(endTime).getTime() |
| | | if (startDate >= endDate) { |
| | | this.$message.warning('结束时间不可小于或等于开始时间') |
| | | loading() |
| | | return |
| | | } |
| | | 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 = `/assessmentTask/assessmentTask/export-assessmentTask?${this.website.tokenHeader}=${getToken()}`; |
| | | const { |
| | | } = this.query; |
| | | let values = { |
| | | ...this.query |
| | | }; |
| | | this.$confirm("是否导出数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | NProgress.start(); |
| | | exportBlob(downloadUrl, values).then(res => { |
| | | downloadXls(res.data, `考核任务表${dateNow()}.xlsx`); |
| | | NProgress.done(); |
| | | }) |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (type === 'add') { |
| | | this.form.assessmentNo = new Date().getFullYear() + '-' + (Number(this.page.total) + 1) |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page, { type: this.defaultTaskType }); |
| | | }, |
| | | searchChange(params, done) { |
| | | params.type = this.defaultTaskType |
| | | 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 = { |
| | | ...this.query, |
| | | ...params |
| | | }; |
| | | |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | tabChange(value) { |
| | | this.defaultTaskType = value.prop |
| | | }, |
| | | setTaskState(state) { |
| | | const status = { |
| | | '-1': { |
| | | text: '未开始', |
| | | type: 'warning' |
| | | 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) |
| | | }; |
| | | }, |
| | | '0': { |
| | | text: '进行中', |
| | | type: '' |
| | | }, |
| | | '1': { |
| | | text: '已完成', |
| | | type: 'success' |
| | | }, |
| | | } |
| | | return status[state] |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | handleAssessorDetails(row) { |
| | | this.detailsParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | provide() { |
| | | return { |
| | | type: () => this.defaultTaskType |
| | | } |
| | | }, |
| | | handleAssessorList(row) { |
| | | this.assessorDialogParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | methods: { |
| | | handleTaskSetting(row) { |
| | | this.curIndex = 1; |
| | | this.resultParams = row |
| | | this.resultParams.type = this.defaultTaskType |
| | | }, |
| | | // handleTaskResult(row) { |
| | | // this.curIndex = 2; |
| | | // this.resultParams = row |
| | | // this.resultParams.type = this.defaultTaskType |
| | | // }, |
| | | changeIs(num) { |
| | | this.curIndex = num |
| | | this.$nextTick(() => { |
| | | this.$refs.tabs.active = this.defaultTaskType.toString() |
| | | }) |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | const {startTime, endTime} = row |
| | | const startDate = new Date(startTime).getTime() |
| | | const endDate = new Date(endTime).getTime() |
| | | if (startDate >= endDate) { |
| | | this.$message.warning('结束时间不可小于或等于开始时间') |
| | | loading() |
| | | return |
| | | } |
| | | 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 = `/assessmentTask/assessmentTask/export-assessmentTask?${this.website.tokenHeader}=${getToken()}`; |
| | | const {} = this.query; |
| | | let values = { |
| | | ...this.query |
| | | }; |
| | | this.$confirm("是否导出数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | NProgress.start(); |
| | | exportBlob(downloadUrl, values).then(res => { |
| | | downloadXls(res.data, `考核任务表${dateNow()}.xlsx`); |
| | | NProgress.done(); |
| | | }) |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (type === 'add') { |
| | | this.form.assessmentNo = new Date().getFullYear() + '-' + (Number(this.page.total) + 1) |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page, {type: this.defaultTaskType}); |
| | | }, |
| | | searchChange(params, done) { |
| | | params.type = this.defaultTaskType |
| | | 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 = { |
| | | ...this.query, |
| | | ...params |
| | | }; |
| | | |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | tabChange(value) { |
| | | this.defaultTaskType = value.prop |
| | | }, |
| | | setTaskState(state) { |
| | | const status = { |
| | | '-1': { |
| | | text: '未开始', |
| | | type: 'warning' |
| | | }, |
| | | '0': { |
| | | text: '进行中', |
| | | type: '' |
| | | }, |
| | | '1': { |
| | | text: '已完成', |
| | | type: 'success' |
| | | }, |
| | | } |
| | | return status[state] |
| | | }, |
| | | handleAssessorDetails(row) { |
| | | this.detailsParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | }, |
| | | handleAssessorList(row) { |
| | | this.assessorDialogParams = { |
| | | visible: true, |
| | | data: row |
| | | } |
| | | }, |
| | | handleImport() { |
| | | this.excelBox = true; |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.excelBox = false; |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | handleTemplate() { |
| | | // 本地资源 |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |