| | |
| | | <!-- 走访日志 --> |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form" |
| | | :permission="permissionList" @search-change="searchChange" @search-reset="searchReset" |
| | | @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
| | | @refresh-change="refreshChange" @on-load="onLoad"> |
| | | </avue-crud> |
| | | </basic-container> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form" |
| | | :permission="permissionList" @search-change="searchChange" @row-save="rowSave" @row-update="rowUpdate" |
| | | @row-del="rowDel" :before-open="beforeOpen" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template slot-scope="scope" slot="menu"> |
| | | <el-button type="text" icon="el-icon-circle-plus-outline" size="small" @click="manageMember(scope.row)">业委会成员 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | |
| | | <el-dialog title="业委会成员" append-to-body :visible.sync="memberFlag" width="70%" height="60%"> |
| | | <ownersMemberManager ref="ownersMemberManager" /> |
| | | </el-dialog> |
| | | |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList } from "@/api/owners_committee" |
| | | import { mapGetters } from "vuex" |
| | | import website from '@/config/website' |
| | | import { |
| | | getList, |
| | | add, |
| | | update, |
| | | remove, |
| | | getDetatil |
| | | } from "@/api/owners_committee" |
| | | import { |
| | | mapGetters |
| | | } from "vuex" |
| | | import website from '@/config/website' |
| | | import func from "@/util/func"; |
| | | import ownersMemberManager from "./components/ownersMemberManager" |
| | | |
| | | export default { |
| | | data () { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | export default { |
| | | components: { |
| | | ownersMemberManager |
| | | }, |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | datetime: "", |
| | | selectionList: [], |
| | | memberFlag: false, |
| | | option: { |
| | | // menu: false, |
| | | // addBtn: false, |
| | | border: true, |
| | | index: false, |
| | | selection: false, |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | //stripe:true, |
| | | viewBtn: true, |
| | | excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [{ |
| | | label: "业委会名称", |
| | | prop: "name", |
| | | search: true, |
| | | searchLabelWidth: 136, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入业委会名称", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, |
| | | datetime: "", |
| | | selectionList: [], |
| | | option: { |
| | | menu: false, |
| | | addBtn: false, |
| | | border: true, |
| | | index: false, |
| | | selection: false, |
| | | height: "auto", |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | //stripe:true, |
| | | viewBtn: true, |
| | | excelBtn: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "业委会名称", |
| | | labelWidth: 116, |
| | | prop: "name", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "小区名称", |
| | | prop: "areaName", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "开始时间", |
| | | prop: "startTime", |
| | | type: "date", |
| | | format: "yyyy-MM-dd HH:mm:ss", |
| | | valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入走访时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "总人数", |
| | | prop: "peopleTotal", |
| | | }, |
| | | { |
| | | label: "手机号", |
| | | prop: "mobile", |
| | | }, |
| | | { |
| | | label: "地址", |
| | | prop: "location", |
| | | }, |
| | | { |
| | | label: "经度", |
| | | prop: "longitude", |
| | | }, |
| | | { |
| | | label: "纬度", |
| | | prop: "latitude", |
| | | }, |
| | | { |
| | | label: "图片", |
| | | prop: "imageUrl", |
| | | type: "upload", |
| | | labelWidth: 120, |
| | | width: 80, |
| | | listType: "picture-img", |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | propsHttp: { |
| | | res: "data", |
| | | name: 'name', |
| | | url: "link", |
| | | }, |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "小区", |
| | | prop: "areaId", |
| | | searchSpan: 5, |
| | | type: 'tree', |
| | | dicUrl: `/api/blade-district/district/getDistrictTree`, |
| | | props: { |
| | | label: "name", |
| | | value: "id" |
| | | }, |
| | | defaultExpandedKeys: ["361102003"], |
| | | cascader: ['principalId'], |
| | | span: 12, |
| | | labelWidth: 120, |
| | | width: 220, |
| | | overHidden: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择小区", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, |
| | | { |
| | | label: "开始时间", |
| | | prop: "startTime", |
| | | type: "date", |
| | | format: "yyyy-MM-dd HH:mm:ss", |
| | | valueFormat: "yyyy-MM-dd HH:mm:ss", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入走访时间", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, |
| | | { |
| | | label: "总人数", |
| | | prop: "peopleTotal", |
| | | display: false, |
| | | }, |
| | | { |
| | | label: "业委会负责人", |
| | | prop: "principalId", |
| | | span: 12, |
| | | labelWidth: 120, |
| | | type: "tree", |
| | | remote: true, |
| | | props: { |
| | | label: 'name', |
| | | value: 'id' |
| | | }, |
| | | hide: true, |
| | | dicUrl: `/api/blade-system/user/searchUserByDistrictId?districtId={{key}}`, |
| | | defaultExpandedKeys: [], |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择业委会负责人", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, { |
| | | label: "负责人名称", |
| | | prop: "principalName", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入负责人名称", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, |
| | | { |
| | | label: "负责人手机号", |
| | | prop: "mobile", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入负责人手机号", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, |
| | | { |
| | | label: "地址", |
| | | prop: "location", |
| | | }, |
| | | { |
| | | label: "经度", |
| | | prop: "longitude", |
| | | }, |
| | | { |
| | | label: "纬度", |
| | | prop: "latitude", |
| | | }, |
| | | { |
| | | label: "图片", |
| | | prop: "imageUrl", |
| | | type: "upload", |
| | | labelWidth: 120, |
| | | width: 80, |
| | | listType: "picture-img", |
| | | action: "/api/blade-resource/oss/endpoint/put-file", |
| | | propsHttp: { |
| | | res: "data", |
| | | name: 'name', |
| | | url: "link", |
| | | }, |
| | | viewDisplay: false, |
| | | span: 24, |
| | | }, { |
| | | label: "简介", |
| | | prop: "profile", |
| | | // labelWidth: 140, |
| | | viewDisplay: false, |
| | | type: "textarea" |
| | | }, |
| | | |
| | | ], |
| | | }, |
| | | data: [], |
| | | } |
| | | ], |
| | | }, |
| | | data: [], |
| | | } |
| | | }, |
| | | watch: { |
| | | }, |
| | | watch: {}, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList () { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.gridWorkLog_add, true), |
| | | viewBtn: this.vaildData(this.permission.gridWorkLog_view, true), |
| | | delBtn: this.vaildData(this.permission.gridWorkLog_delete, true), |
| | | editBtn: this.vaildData(this.permission.gridWorkLog_edit, true), |
| | | } |
| | | }, |
| | | ids () { |
| | | let ids = [] |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | }, |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.gridWorkLog_add, true), |
| | | viewBtn: this.vaildData(this.permission.gridWorkLog_view, true), |
| | | delBtn: this.vaildData(this.permission.gridWorkLog_delete, true), |
| | | editBtn: this.vaildData(this.permission.gridWorkLog_edit, true), |
| | | } |
| | | }, |
| | | ids() { |
| | | let ids = [] |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | }, |
| | | }, |
| | | methods: { |
| | | 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.map(item => { |
| | | if (item.imageUrl && item.imageUrl.length > 0) { |
| | | var urls = [] |
| | | var names = item.imageUrl.split(",") |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | item.imageUrl = urls.join(",") |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | manageMember(row) { |
| | | this.memberFlag = true |
| | | var that = this |
| | | this.$nextTick(() => { |
| | | that.$refs.ownersMemberManager.init(row) |
| | | }) |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | row.imageUrl = func.join(row.imageUrl) |
| | | if (row.imageUrl.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrl.split(","); |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/"); |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrl = urls.join(",") |
| | | } |
| | | row.propertyFlag = 1 |
| | | 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.imageUrl.length > 0) { |
| | | var urls = [] |
| | | var split = row.imageUrl.split(","); |
| | | split.forEach(url => { |
| | | var names = url.split("jczz/"); |
| | | urls.push(names[1]) |
| | | }) |
| | | row.imageUrl = 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: "操作成功!", |
| | | }); |
| | | }); |
| | | }, |
| | | // 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)) { |
| | | getDetatil(this.form.id).then((res) => { |
| | | this.form = res.data.data; |
| | | this.form.propertyFlag = 1; |
| | | if (this.form.constructionSchemeUrls.length > 0) { |
| | | var urls = [] |
| | | var names = this.form.constructionSchemeUrls.split(","); |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | this.form.constructionSchemeUrls = urls.join(",") |
| | | const column = this.findObject(this.option.column, "principalId"); |
| | | let arr = [] |
| | | arr.push(this.form.areaId) |
| | | column.defaultExpandedKeys = arr; |
| | | } |
| | | }); |
| | | } |
| | | // con |
| | | 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.map(item => { |
| | | if (item.imageUrl && item.imageUrl.length > 0) { |
| | | var urls = [] |
| | | var names = item.imageUrl.split(",") |
| | | names.forEach(name => { |
| | | urls.push(website.minioUrl + name) |
| | | }) |
| | | item.imageUrl = urls.join(",") |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .avue-upload__icon { |
| | | .avue-upload__icon { |
| | | line-height: 6; |
| | | } |
| | | </style> |
| | | } |
| | | </style> |