1 files modified
2 files added
| New file |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/blade-taskReportForRepairs/taskReportForRepairs/page', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/blade-taskReportForRepairs/taskReportForRepairs/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/blade-taskReportForRepairs/taskReportForRepairs/save', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/blade-taskReportForRepairs/taskReportForRepairs/update', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const getReportForRepairs = (id) => { |
| | | return request({ |
| | | url: '/api/blade-taskReportForRepairs/taskReportForRepairs/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | |
| | | component: "AvueUeditor", |
| | | labelWidth: 120, |
| | | options: { |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | action: "/api/blade-resource/oss/endpoint/put-file-attach", |
| | | props: { |
| | | res: "data", |
| | | url: "link", |
| New file |
| | |
| | | <!-- 工作日志 --> |
| | | <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> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs"; |
| | | import { mapGetters } from "vuex"; |
| | | import website from '@/config/website'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | 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: 350, |
| | | border: false, |
| | | //stripe:true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "类型", |
| | | prop: "type", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | dataType: "number", |
| | | type:"select", |
| | | width:100, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "姓名", |
| | | prop: "realName", |
| | | span: 12, |
| | | searchSpan: 4, |
| | | width:100, |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "手机号", |
| | | prop: "phone", |
| | | span: 12, |
| | | width:100, |
| | | searchSpan: 4, |
| | | search: true, |
| | | }, |
| | | { |
| | | 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, |
| | | }, |
| | | { |
| | | 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", |
| | | }, |
| | | { |
| | | label: "备注", |
| | | prop: "remark", |
| | | type:"textarea", |
| | | hide:true, |
| | | span: 24, |
| | | } |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | watch: { |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.reportForRepairs_add, true), |
| | | viewBtn: this.vaildData(this.permission.reportForRepairs_view, true), |
| | | delBtn: this.vaildData(this.permission.reportForRepairs_delete, true), |
| | | editBtn: this.vaildData(this.permission.reportForRepairs_edit, true), |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | }, |
| | | methods: { |
| | | 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(); |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | .avue-upload__icon { |
| | | line-height: 6; |
| | | } |
| | | </style> |