| | |
| | | <!-- 工作日志 --> |
| | | <!-- 走访日志 --> |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel" |
| | | v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" |
| | | @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.article_delete" @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | <!-- <template slot-scope="scope" slot="menu"> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel" |
| | | v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" |
| | | :before-open="beforeOpen" @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.article_delete" @click="handleDelete">删 |
| | | 除 |
| | | </el-button> |
| | | </template> |
| | | <!-- <template slot-scope="scope" slot="menu"> |
| | | <el-button type="text" icon="el-icon-circle-plus-outline" size="small" |
| | | @click="taskApply(scope.row)">任务分发 |
| | | </el-button> |
| | | </template> --> |
| | | </avue-crud> |
| | | <!-- <el-dialog title="任务分发" append-to-body :visible.sync="taskVisible" width="70%" height="60%"> |
| | | </avue-crud> |
| | | <!-- <el-dialog title="任务分发" append-to-body :visible.sync="taskVisible" width="70%" height="60%"> |
| | | <avue-form :option="taskOption" |
| | | v-model="taskForm"> </avue-form> |
| | | </el-dialog> --> |
| | | </basic-container> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs"; |
| | | import { mapGetters } from "vuex"; |
| | | import website from '@/config/website'; |
| | | import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs" |
| | | import { mapGetters } from "vuex" |
| | | import website from '@/config/website' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | taskForm:{}, |
| | | taskOption:{ |
| | | column: [ |
| | | { |
| | | label: '姓名', |
| | | prop: 'name', |
| | | value: 'small' |
| | | } |
| | | ] |
| | | }, |
| | | taskVisible:false, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | datetime: "", |
| | | selectionList: [], |
| | | option: { |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | menuWidth: 280, |
| | | border: true, |
| | | //stripe:true, |
| | | index: true, |
| | | editBtnText:"任务分发", |
| | | editTitle:"任务分发", |
| | | updateBtnText:"确定", |
| | | viewBtn: true, |
| | | selection: true, |
| | | // excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "类型", |
| | | prop: "type", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | dataType: "number", |
| | | type: "select", |
| | | width: 100, |
| | | editDisabled:true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | data () { |
| | | return { |
| | | taskForm: {}, |
| | | taskOption: { |
| | | column: [ |
| | | { |
| | | label: '姓名', |
| | | prop: 'name', |
| | | value: 'small' |
| | | } |
| | | ] |
| | | }, |
| | | search: true, |
| | | span:15, |
| | | row:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "姓名", |
| | | prop: "realName", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | width: 100, |
| | | search: true, |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "手机号", |
| | | prop: "phone", |
| | | span: 12, |
| | | width: 100, |
| | | searchSpan: 4, |
| | | search: true, |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "图片", |
| | | prop: "imageUrls", |
| | | width: 80, |
| | | type: "upload", |
| | | listType: "picture-card", |
| | | dataType: "string", |
| | | multiple: true, |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | propsHttp: { |
| | | res: "data", |
| | | name: 'name', |
| | | url: "link", |
| | | taskVisible: false, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | span: 24, |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "上报事发地址", |
| | | prop: "address", |
| | | overHidden: true, |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | span:24 |
| | | }, |
| | | // { |
| | | // label: "地点", |
| | | // prop: "addressName", |
| | | // overHidden:true |
| | | // }, |
| | | { |
| | | label: "上报时间", |
| | | prop: "createTime", |
| | | width: 160, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | type: "date", |
| | | format: "yyyy-MM-dd HH:mm:ss", |
| | | valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "描述", |
| | | prop: "remark", |
| | | type: "textarea", |
| | | span: 24, |
| | | editDisabled:true, |
| | | labelWidth:110, |
| | | }, |
| | | { |
| | | label: "接收员", |
| | | prop: "userIds", |
| | | type: "tree", |
| | | hide:true, |
| | | labelWidth:110, |
| | | dicUrl:"/api/blade-gridman/gridman/getGridmanList", |
| | | props: { |
| | | label: "gridmanName", |
| | | value: "id", |
| | | datetime: "", |
| | | selectionList: [], |
| | | option: { |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | menuWidth: 280, |
| | | border: true, |
| | | //stripe:true, |
| | | index: true, |
| | | editBtnText: "任务分发", |
| | | editTitle: "任务分发", |
| | | updateBtnText: "确定", |
| | | viewBtn: true, |
| | | selection: true, |
| | | // excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "类型", |
| | | prop: "type", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | dataType: "number", |
| | | type: "select", |
| | | width: 100, |
| | | editDisabled: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | search: true, |
| | | span: 15, |
| | | row: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "姓名", |
| | | prop: "realName", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | width: 100, |
| | | search: true, |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "手机号", |
| | | prop: "phone", |
| | | span: 12, |
| | | width: 100, |
| | | searchSpan: 4, |
| | | search: true, |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "图片", |
| | | prop: "imageUrls", |
| | | width: 80, |
| | | type: "upload", |
| | | listType: "picture-card", |
| | | dataType: "string", |
| | | multiple: true, |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | propsHttp: { |
| | | res: "data", |
| | | name: 'name', |
| | | url: "link", |
| | | }, |
| | | span: 24, |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "上报事发地址", |
| | | prop: "address", |
| | | overHidden: true, |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | span: 24 |
| | | }, |
| | | // { |
| | | // label: "地点", |
| | | // prop: "addressName", |
| | | // overHidden:true |
| | | // }, |
| | | { |
| | | label: "上报时间", |
| | | prop: "createTime", |
| | | width: 160, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | type: "date", |
| | | format: "yyyy-MM-dd HH:mm:ss", |
| | | valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "描述", |
| | | prop: "remark", |
| | | type: "textarea", |
| | | span: 24, |
| | | editDisabled: true, |
| | | labelWidth: 110, |
| | | }, |
| | | { |
| | | label: "接收员", |
| | | prop: "userIds", |
| | | type: "tree", |
| | | hide: true, |
| | | labelWidth: 110, |
| | | dicUrl: "/api/blade-gridman/gridman/getGridmanList", |
| | | props: { |
| | | label: "gridmanName", |
| | | value: "id", |
| | | }, |
| | | } |
| | | ], |
| | | }, |
| | | } |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | watch: { |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.reportForRepairs_add, false), |
| | | viewBtn: this.vaildData(this.permission.reportForRepairs_view, true), |
| | | delBtn: this.vaildData(this.permission.reportForRepairs_delete, false), |
| | | editBtn: this.vaildData(this.permission.reportForRepairs_edit, true), |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 任务派发 |
| | | taskApply(row){ |
| | | var that = this |
| | | this.taskVisible = true |
| | | this.$nextTick(() => { |
| | | }) |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(","); |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/"); |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | loading(); |
| | | data: [], |
| | | } |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(","); |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/"); |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | watch: { |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList () { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.reportForRepairs_add, false), |
| | | viewBtn: this.vaildData(this.permission.reportForRepairs_view, true), |
| | | delBtn: this.vaildData(this.permission.reportForRepairs_delete, false), |
| | | editBtn: this.vaildData(this.permission.reportForRepairs_edit, true), |
| | | } |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | loading(); |
| | | ids () { |
| | | let ids = [] |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 任务派发 |
| | | taskApply (row) { |
| | | var that = this |
| | | this.taskVisible = true |
| | | this.$nextTick(() => { |
| | | }) |
| | | }, |
| | | rowSave (row, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",") |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ) |
| | | }, |
| | | rowUpdate (row, index, done, loading) { |
| | | if (row.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrls.split(",") |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/") |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrls = urls.join(",") |
| | | } |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(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() |
| | | }) |
| | | }, |
| | | beforeOpen (done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getReportForRepairs(this.form.id).then((res) => { |
| | | this.form = res.data.data |
| | | if (this.form.imageUrls) { |
| | | if (this.form.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var names = this.form.imageUrls.split(",") |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | this.form.imageUrls = urls.join(",") |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // con |
| | | done() |
| | | }, |
| | | currentChange (currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | sizeChange (pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | refreshChange () { |
| | | this.onLoad(this.page, this.query) |
| | | }, |
| | | onLoad (page, params = {}) { |
| | | const { dateTime } = this.query |
| | | let values = { |
| | | ...params, |
| | | } |
| | | if (dateTime) { |
| | | values = { |
| | | ...params, |
| | | startTime: dateTime[0], |
| | | endTime: dateTime[1], |
| | | ...this.query, |
| | | } |
| | | values.dateTime = null |
| | | } |
| | | this.loading = true |
| | | getList(page.currentPage, page.pageSize, values).then((res) => { |
| | | const data = res.data.data |
| | | this.page.total = data.total |
| | | this.data = data.records |
| | | this.data.forEach(item => { |
| | | if (item.imageUrls) { |
| | | if (item.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var names = item.imageUrls.split(",") |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | item.imageUrls = urls.join(",") |
| | | } |
| | | } |
| | | }) |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | ); |
| | | }, |
| | | 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(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getReportForRepairs(this.form.id).then((res) => { |
| | | this.form = res.data.data; |
| | | if (this.form.imageUrls) { |
| | | if (this.form.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var names = this.form.imageUrls.split(","); |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | this.form.imageUrls = urls.join(",") |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // con |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | const { dateTime } = this.query; |
| | | let values = { |
| | | ...params, |
| | | }; |
| | | if (dateTime) { |
| | | values = { |
| | | ...params, |
| | | startTime: dateTime[0], |
| | | endTime: dateTime[1], |
| | | ...this.query, |
| | | }; |
| | | values.dateTime = null; |
| | | } |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, values).then((res) => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.data.forEach(item => { |
| | | if (item.imageUrls) { |
| | | if (item.imageUrls.length > 0) { |
| | | var urls = [] |
| | | var names = item.imageUrls.split(","); |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | item.imageUrls = urls.join(",") |
| | | } |
| | | } |
| | | }) |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .avue-upload__icon { |
| | | line-height: 6; |
| | | line-height: 6; |
| | | } |
| | | </style> |