From 626af15b65701197a33ad0d1384bae8d56c169ce Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 09 Jan 2024 18:17:22 +0800
Subject: [PATCH] 内容管理字段补充,服务管理页面展示调整
---
src/views/property/convenienceHotline.vue | 530 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 276 insertions(+), 254 deletions(-)
diff --git a/src/views/property/convenienceHotline.vue b/src/views/property/convenienceHotline.vue
index 2103701..f241403 100644
--- a/src/views/property/convenienceHotline.vue
+++ b/src/views/property/convenienceHotline.vue
@@ -1,280 +1,302 @@
<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.district_delete" @click="handleDelete">删 除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
+ <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.district_delete"
+ @click="handleDelete">删 除
+ </el-button>
+ </template>
+ </avue-crud>
+ </basic-container>
</template>
<script>
- import {
+import {
getList,
remove,
update,
add,
getDetail
- } from "@/api/convenienceHotline/convenienceHotline"
- import {
+} from "@/api/convenienceHotline/convenienceHotline"
+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: 280,
- border: true,
- //stripe:true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- column: [{
- label: "名称",
- prop: "name",
- searchSpan: 4,
- search: true,
- width: 260,
- rules: [{
- required: true,
- message: "请输入名称",
- trigger: "blur",
- }, ],
+} from "vuex"
+import website from '@/config/website'
+export default {
+ data () {
+ //手机号格式校验
+ let validatorPhone = function (rule, value, callback) {
+ if (value) {
+ if (!/^1[3456789]\d{9}$/.test(value)) {
+ callback(new Error('手机号格式有误!'))
+ } else {
+ callback()
+ }
+ }
+ callback()
+ }
+
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
},
- {
- label: "电话",
- prop: "telephone",
- span: 24,
- rules: [{
- required: true,
- message: "请输入电话",
- trigger: "blur",
- }, ],
+ datetime: "",
+ selectionList: [],
+ option: {
+ labelWidth: 66,
+ searchLabelWidth: 66,
+ searchShow: true,
+ searchMenuSpan: 3,
+ menuWidth: 210,
+
+ height: "auto",
+ calcHeight: 54,
+ dialogWidth: 950,
+ tip: false,
+ border: true,
+ //stripe:true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ dialogClickModal: false,
+ column: [{
+ label: "名称",
+ prop: "name",
+ searchSpan: 4,
+ search: true,
+ width: 260,
+ rules: [{
+ required: true,
+ message: "请输入名称",
+ trigger: "blur",
+ },],
+ },
+ {
+ width: 120,
+ label: "联系方式",
+ prop: "telephone",
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请输入联系方式",
+ trigger: "blur",
+ },
+ {
+ validator: validatorPhone,
+ trigger: 'blur'
+ }],
+ },
+ {
+ label: "备注",
+ prop: "remark",
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请输入备注",
+ trigger: "blur",
+ },],
+ },
+ ],
},
- {
- label: "备注",
- prop: "remark",
- span: 24,
- rules: [{
- required: true,
- message: "请输入备注",
- trigger: "blur",
- }, ],
- },
- ],
- },
- data: [],
- }
+ data: [],
+ }
},
watch: {},
computed: {
- ...mapGetters(["permission", "userInfo"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.district_add, true),
- viewBtn: this.vaildData(this.permission.district_view, true),
- delBtn: this.vaildData(this.permission.district_delete, true),
- editBtn: this.vaildData(this.permission.district_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.district_add, true),
+ viewBtn: this.vaildData(this.permission.district_view, true),
+ delBtn: this.vaildData(this.permission.district_delete, true),
+ editBtn: this.vaildData(this.permission.district_edit, true),
+ }
+ },
+ ids () {
+ let ids = []
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id)
+ })
+ return ids.join(",")
+ },
},
methods: {
- rowSave(row, done, loading) {
- if (row.picUrl.length > 0) {
- var urls = []
- var split = row.picUrl.split(",")
- split.forEach(url => {
- var names = url.split("jczz/")
- urls.push(names[1])
- })
- row.picUrl = urls.join(",")
- }
- row.userid = this.userInfo.user_id
- add(row).then(
- () => {
- this.onLoad(this.page)
- this.$message({
- type: "success",
- message: "操作成功!",
- })
- done()
- },
- (error) => {
- window.console.log(error)
- loading()
- }
- )
- },
- rowUpdate(row, index, done, loading) {
- 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)) {
- getDetail(this.form.id).then((res) => {
- this.form = res.data.data
- if (this.form.picUrl.length > 0) {
- var urls = []
- var names = this.form.picUrl.split(",")
- names.forEach(name => {
- urls.push(website.minioUrl + name)
- })
- this.form.picUrl = 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.picUrl) {
- if (item.picUrl.length > 0) {
+ rowSave (row, done, loading) {
+ if (row.picUrl.length > 0) {
var urls = []
- var names = item.picUrl.split(",")
- names.forEach(name => {
- urls.push(website.minioUrl + name)
+ var split = row.picUrl.split(",")
+ split.forEach(url => {
+ var names = url.split("jczz/")
+ urls.push(names[1])
})
- item.picUrl = urls.join(",")
- }
+ row.picUrl = urls.join(",")
}
- })
- this.loading = false
- this.selectionClear()
- })
- }
+ row.userid = this.userInfo.user_id
+ add(row).then(
+ () => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ })
+ done()
+ },
+ (error) => {
+ window.console.log(error)
+ loading()
+ }
+ )
+ },
+ rowUpdate (row, index, done, loading) {
+ 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)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data
+ if (this.form.picUrl.length > 0) {
+ var urls = []
+ var names = this.form.picUrl.split(",")
+ names.forEach(name => {
+ urls.push(website.minioUrl + name)
+ })
+ this.form.picUrl = 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.picUrl) {
+ if (item.picUrl.length > 0) {
+ var urls = []
+ var names = item.picUrl.split(",")
+ names.forEach(name => {
+ urls.push(website.minioUrl + name)
+ })
+ item.picUrl = urls.join(",")
+ }
+ }
+ })
+ this.loading = false
+ this.selectionClear()
+ })
+ }
}
- }
+}
</script>
<style>
- .avue-upload__icon {
+.avue-upload__icon {
line-height: 6;
- }
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3