| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | 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"> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList" |
| | | :before-open="beforeOpen" v-model="form" 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 slot="menuLeft"> |
| | | <el-button |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | v-if="permission.policeman_delete" |
| | | @click="handleDelete">删 除 |
| | | <el-button size="small" icon="el-icon-delete" plain v-if="permission.policeman_delete" @click="handleDelete">删 除 |
| | | </el-button> |
| | | <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="数据导入" append-to-body :visible.sync="excelBox" width="555px"> |
| | | <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"> |
| | | <template slot="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 {getPage, getDetail, add, update, remove} from "@/api/policeman/policeman"; |
| | | import {mapGetters} from "vuex"; |
| | | import { getPage, getDetail, add, update, remove } from "@/api/policeman/policeman"; |
| | | import { mapGetters } from "vuex"; |
| | | import { exportBlob } from "@/api/common"; |
| | | import { downloadXls } from "@/util/util"; |
| | | import { getToken } from "@/util/auth"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | height:'auto', |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "警员名称", |
| | | prop: "name", |
| | | search: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入警员名称", |
| | | trigger: "blur" |
| | | }] |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | excelBox: false, |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: '模板上传', |
| | | prop: 'excelFile', |
| | | type: 'upload', |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | { |
| | | label: "警员编号", |
| | | prop: "serialNumber", |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "contact", |
| | | }, |
| | | { |
| | | label: "所属单位", |
| | | prop: "deptId", |
| | | type: "tree", |
| | | dicUrl: "api/blade-system/dept/lazy-list", |
| | | props:{ |
| | | label:'deptName', |
| | | value:'id', |
| | | children:'children' |
| | | tip: '请上传 .xls,.xlsx 标准格式文件', |
| | | action: "/api/policeman/policeman/import-policeman" |
| | | }, |
| | | { |
| | | label: "数据覆盖", |
| | | prop: "isCovered", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 80, |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | search: true, |
| | | searchSpan:4, |
| | | rules: [{ |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择所属单位", |
| | | message: "请选择是否覆盖", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: '模板下载', |
| | | prop: 'excelTemplate', |
| | | formslot: true, |
| | | span: 24, |
| | | } |
| | | ] |
| | | }, |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | selection: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "警员名称", |
| | | prop: "name", |
| | | search: true, |
| | | searchSpan: 4, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入警员名称", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | { |
| | | label: "警员编号", |
| | | prop: "serialNumber", |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "contact", |
| | | }, |
| | | { |
| | | label: "单位编号", |
| | | prop: "deptCode", |
| | | search: true, |
| | | searchSpan: 4, |
| | | }, |
| | | { |
| | | label: "单位名称", |
| | | prop: "deptName", |
| | | search: true, |
| | | searchSpan: 4, |
| | | }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userInfo", "permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.policeman_add, false), |
| | | viewBtn: this.vaildData(this.permission.policeman_view, false), |
| | | delBtn: this.vaildData(this.permission.policeman_delete, false), |
| | | editBtn: this.vaildData(this.permission.policeman_edit, false) |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userInfo","permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.policeman_add, false), |
| | | viewBtn: this.vaildData(this.permission.policeman_view, false), |
| | | delBtn: this.vaildData(this.permission.policeman_delete, false), |
| | | editBtn: this.vaildData(this.permission.policeman_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | watch: { |
| | | 'excelForm.isCovered'() { |
| | | if (this.excelForm.isCovered !== '') { |
| | | const column = this.findObject(this.excelOption.column, "excelFile"); |
| | | column.action = `/api/policeman/policeman/import-policeman?isCovered=${this.excelForm.isCovered}`; |
| | | } |
| | | }, |
| | | 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(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | 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; |
| | | |
| | | if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator"){ |
| | | params["jurisdiction"] = this.userInfo.dept_id; |
| | | } |
| | | |
| | | getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }, 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(); |
| | | }); |
| | | }, |
| | | 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; |
| | | |
| | | if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator") { |
| | | params["jurisdiction"] = this.userInfo.dept_id; |
| | | } |
| | | |
| | | getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | //下面为导入操作 |
| | | handleImport() { |
| | | this.excelBox = true; |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.excelBox = false; |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | handleTemplate() { |
| | | exportBlob(`/api/policeman/policeman/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => { |
| | | downloadXls(res.data, "警员信息数据模板.xlsx"); |
| | | }) |
| | | }, |
| | | } |
| | | |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | | <style></style> |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | 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"> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList" |
| | | :before-open="beforeOpen" v-model="form" 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 slot="menuLeft"> |
| | | <el-button |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | v-if="permission.scheduling_delete" |
| | | @click="handleDelete">删 除 |
| | | <el-button size="small" icon="el-icon-delete" plain v-if="permission.scheduling_delete" @click="handleDelete">删 除 |
| | | </el-button> |
| | | <el-button type="success" size="small" plain icon="el-icon-upload2" @click="handleImport">导入 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="数据导入" append-to-body :visible.sync="excelBox" width="555px"> |
| | | <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"> |
| | | <template slot="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, getPliceman} from "@/api/scheduling/scheduling"; |
| | | import {mapGetters} from "vuex"; |
| | | import { getList, getDetail, add, update, remove, getPliceman } from "@/api/scheduling/scheduling"; |
| | | import { mapGetters } from "vuex"; |
| | | import { exportBlob } from "@/api/common"; |
| | | import { downloadXls } from "@/util/util"; |
| | | import { getToken } from "@/util/auth"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "值班员", |
| | | prop: "person", |
| | | search:true, |
| | | type: "select", |
| | | dicUrl: "/api/policeman/policeman/all", |
| | | props: { |
| | | label: "name", |
| | | value: "id" |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | excelBox: false, |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: '模板上传', |
| | | prop: 'excelFile', |
| | | type: 'upload', |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | tip: '请上传 .xls,.xlsx 标准格式文件', |
| | | action: "/api/scheduling/scheduling/import-scheduling" |
| | | }, |
| | | { |
| | | label: "数据覆盖", |
| | | prop: "isCovered", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 80, |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "contact", |
| | | }, |
| | | { |
| | | label: "值班岗位", |
| | | prop: "station", |
| | | row: true, |
| | | span: 24 |
| | | }, |
| | | { |
| | | label: "值班时间", |
| | | prop: "startTime", |
| | | type: "datetime", |
| | | defaultTime: '00:00:00', |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | rules: [{ |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择值班时间", |
| | | message: "请选择是否覆盖", |
| | | trigger: "blur" |
| | | }], |
| | | }, |
| | | { |
| | | label: "带班领导", |
| | | prop: "leads", |
| | | type: "select", |
| | | dicUrl: "/api/policeman/policeman/all", |
| | | props: { |
| | | label: "name", |
| | | value: "id" |
| | | } |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "leadContact", |
| | | }, |
| | | ] |
| | | }, |
| | | data: [], |
| | | policemanList: [] |
| | | ] |
| | | }, |
| | | { |
| | | label: '模板下载', |
| | | prop: 'excelTemplate', |
| | | formslot: true, |
| | | span: 24, |
| | | } |
| | | ] |
| | | }, |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | selection: true, |
| | | excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "值班单位", |
| | | prop: "dept", |
| | | row: true, |
| | | span: 24 |
| | | }, |
| | | { |
| | | label: "值班日期", |
| | | prop: "day", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择值班日期", |
| | | trigger: "blur" |
| | | }], |
| | | }, |
| | | { |
| | | label: "值班员", |
| | | prop: "person", |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "contact", |
| | | }, |
| | | { |
| | | label: "值班类型", |
| | | prop: "type", |
| | | }, |
| | | { |
| | | label: "带班领导", |
| | | prop: "leads", |
| | | type: "select", |
| | | dicUrl: "/api/policeman/policeman/all", |
| | | props: { |
| | | label: "name", |
| | | value: "id" |
| | | } |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "leadContact", |
| | | }, |
| | | |
| | | ] |
| | | }, |
| | | data: [], |
| | | policemanList: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.scheduling_add, false), |
| | | viewBtn: this.vaildData(this.permission.scheduling_view, false), |
| | | delBtn: this.vaildData(this.permission.scheduling_delete, false), |
| | | editBtn: this.vaildData(this.permission.scheduling_edit, false) |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.scheduling_add, false), |
| | | viewBtn: this.vaildData(this.permission.scheduling_view, false), |
| | | delBtn: this.vaildData(this.permission.scheduling_delete, false), |
| | | editBtn: this.vaildData(this.permission.scheduling_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | watch: { |
| | | 'form.person': { |
| | | handler(res) { |
| | | this.policemanList.forEach(e => { |
| | | if (res == e.id) { |
| | | this.form.contact = e.contact |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | 'form.leads': { |
| | | handler(res) { |
| | | this.policemanList.forEach(e => { |
| | | if (res == e.id) { |
| | | this.form.leadContact = e.contact |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getPolicemanAll(); |
| | | }, |
| | | 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(); |
| | | }); |
| | | }, |
| | | 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; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | getPolicemanAll() { |
| | | getPliceman().then(res => { |
| | | this.policemanList = res.data.data |
| | | const securityIdColumn = this.findObject(this.option.column, "person") |
| | | securityIdColumn.dicData = this.policemanList |
| | | const securityIdColumns = this.findObject(this.option.column, "leads") |
| | | securityIdColumns.dicData = this.policemanList |
| | | }) |
| | | } |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }; |
| | | }, |
| | | watch: { |
| | | 'form.person': { |
| | | handler(res) { |
| | | this.policemanList.forEach(e => { |
| | | if (res == e.id) { |
| | | this.form.contact = e.contact |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | 'form.leads': { |
| | | handler(res) { |
| | | this.policemanList.forEach(e => { |
| | | if (res == e.id) { |
| | | this.form.leadContact = e.contact |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | 'excelForm.isCovered'() { |
| | | if (this.excelForm.isCovered !== '') { |
| | | const column = this.findObject(this.excelOption.column, "excelFile"); |
| | | column.action = `/api/scheduling/scheduling/import-scheduling?isCovered=${this.excelForm.isCovered}`; |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getPolicemanAll(); |
| | | }, |
| | | 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(); |
| | | }); |
| | | }, |
| | | 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; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | getPolicemanAll() { |
| | | getPliceman().then(res => { |
| | | this.policemanList = res.data.data |
| | | const securityIdColumn = this.findObject(this.option.column, "person") |
| | | securityIdColumn.dicData = this.policemanList |
| | | const securityIdColumns = this.findObject(this.option.column, "leads") |
| | | securityIdColumns.dicData = this.policemanList |
| | | }) |
| | | }, |
| | | //下面为导入操作 |
| | | handleImport() { |
| | | this.excelBox = true; |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.excelBox = false; |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | handleTemplate() { |
| | | exportBlob(`/api/scheduling/scheduling/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => { |
| | | downloadXls(res.data, "值班信息数据模板.xlsx"); |
| | | }) |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | | <style></style> |
| | |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="用户数据导入" |
| | | <el-dialog title="数据导入" |
| | | append-to-body |
| | | :visible.sync="excelBox" |
| | | width="555px"> |