generated from Leo_Ding/web-template
开发
This commit is contained in:
parent
69a80a2e2f
commit
7beb9fd909
12
package-lock.json
generated
12
package-lock.json
generated
@ -8,6 +8,7 @@
|
|||||||
"name": "JinShan-Admin",
|
"name": "JinShan-Admin",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||||
"@ant-design/colors": "^7.0.0",
|
"@ant-design/colors": "^7.0.0",
|
||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
"@icon-park/vue-next": "^1.4.2",
|
"@icon-park/vue-next": "^1.4.2",
|
||||||
@ -242,6 +243,12 @@
|
|||||||
"@algolia/requester-common": "4.19.1"
|
"@algolia/requester-common": "4.19.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@amap/amap-jsapi-loader": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@ant-design/colors": {
|
"node_modules/@ant-design/colors": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.0.0.tgz",
|
||||||
@ -5514,6 +5521,11 @@
|
|||||||
"@algolia/requester-common": "4.19.1"
|
"@algolia/requester-common": "4.19.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@amap/amap-jsapi-loader": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw=="
|
||||||
|
},
|
||||||
"@ant-design/colors": {
|
"@ant-design/colors": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.0.0.tgz",
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
"src/**/*.{js,vue}": "eslint --ext .js,.vue .eslintignore --no-cache --fix"
|
"src/**/*.{js,vue}": "eslint --ext .js,.vue .eslintignore --no-cache --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||||
"@ant-design/colors": "^7.0.0",
|
"@ant-design/colors": "^7.0.0",
|
||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
"@icon-park/vue-next": "^1.4.2",
|
"@icon-park/vue-next": "^1.4.2",
|
||||||
|
|||||||
14
src/apis/modules/customer.js
Normal file
14
src/apis/modules/customer.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/customers', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/customers/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/customers', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/customers/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/customers/${id}`)
|
||||||
14
src/apis/modules/mettingRoom.js
Normal file
14
src/apis/modules/mettingRoom.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/metting-rooms', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/metting-rooms/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/metting-rooms', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/metting-rooms/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/metting-rooms/${id}`)
|
||||||
14
src/apis/modules/mettingYuYue.js
Normal file
14
src/apis/modules/mettingYuYue.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/metting-room-orders', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/metting-room-orders/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/metting-room-orders', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/metting-room-orders/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/metting-room-orders/${id}`)
|
||||||
14
src/apis/modules/mutualComment.js
Normal file
14
src/apis/modules/mutualComment.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('api/v1/mutualComment', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`api/v1/mutualComment/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('api/v1/mutualComment', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`api/v1/mutualComment/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`api/v1/mutualComment/${id}`)
|
||||||
16
src/apis/modules/nbdMutuaAid.js
Normal file
16
src/apis/modules/nbdMutuaAid.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/reciprocities', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/reciprocities/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/reciprocities', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/reciprocities/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/reciprocities/${id}`)
|
||||||
|
// 获取评论历史
|
||||||
|
export const getList = (id) => request.basic.get(`/api/v1/reciprocity-histories/${id}`)
|
||||||
14
src/apis/modules/orderList.js
Normal file
14
src/apis/modules/orderList.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/work-orders', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/work-orders/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/work-orders', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/work-orders/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/work-orders/${id}`)
|
||||||
14
src/apis/modules/orderType.js
Normal file
14
src/apis/modules/orderType.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/work-order-types', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/work-order-types/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/work-order-types', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/work-order-types/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/work-order-types/${id}`)
|
||||||
14
src/apis/modules/serverList.js
Normal file
14
src/apis/modules/serverList.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/surrounding-services', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/surrounding-services/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/surrounding-services', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/surrounding-services/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/surrounding-services/${id}`)
|
||||||
14
src/apis/modules/serverType.js
Normal file
14
src/apis/modules/serverType.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/surrounding-service-types', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/surrounding-service-types/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/surrounding-service-types', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/surrounding-service-types/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/surrounding-service-types/${id}`)
|
||||||
@ -1,8 +1,8 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 4966438 */
|
font-family: "iconfont"; /* Project id 4966438 */
|
||||||
src: url('iconfont.woff2?t=1751607897346') format('woff2'),
|
src: url('iconfont.woff2?t=1752057370159') format('woff2'),
|
||||||
url('iconfont.woff?t=1751607897346') format('woff'),
|
url('iconfont.woff?t=1752057370159') format('woff'),
|
||||||
url('iconfont.ttf?t=1751607897346') format('truetype');
|
url('iconfont.ttf?t=1752057370159') format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
@ -13,6 +13,38 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-cooperation:before {
|
||||||
|
content: "\e611";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-huiyishi:before {
|
||||||
|
content: "\e614";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-gongdan:before {
|
||||||
|
content: "\ec37";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-zhoubian:before {
|
||||||
|
content: "\e739";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-lishi:before {
|
||||||
|
content: "\e60e";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-xiangqing:before {
|
||||||
|
content: "\e63c";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-kaishi-yuan:before {
|
||||||
|
content: "\e64b";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-shenhe:before {
|
||||||
|
content: "\f195";
|
||||||
|
}
|
||||||
|
|
||||||
.icon-huodongliebiao-copy:before {
|
.icon-huodongliebiao-copy:before {
|
||||||
content: "\e600";
|
content: "\e600";
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -5,6 +5,62 @@
|
|||||||
"css_prefix_text": "icon-",
|
"css_prefix_text": "icon-",
|
||||||
"description": "",
|
"description": "",
|
||||||
"glyphs": [
|
"glyphs": [
|
||||||
|
{
|
||||||
|
"icon_id": "551475",
|
||||||
|
"name": "同行互助",
|
||||||
|
"font_class": "cooperation",
|
||||||
|
"unicode": "e611",
|
||||||
|
"unicode_decimal": 58897
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "4942645",
|
||||||
|
"name": "会议室",
|
||||||
|
"font_class": "huiyishi",
|
||||||
|
"unicode": "e614",
|
||||||
|
"unicode_decimal": 58900
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "5769243",
|
||||||
|
"name": "工单",
|
||||||
|
"font_class": "gongdan",
|
||||||
|
"unicode": "ec37",
|
||||||
|
"unicode_decimal": 60471
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "14145077",
|
||||||
|
"name": "周边",
|
||||||
|
"font_class": "zhoubian",
|
||||||
|
"unicode": "e739",
|
||||||
|
"unicode_decimal": 59193
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "10933913",
|
||||||
|
"name": "历史",
|
||||||
|
"font_class": "lishi",
|
||||||
|
"unicode": "e60e",
|
||||||
|
"unicode_decimal": 58894
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24848552",
|
||||||
|
"name": "详情",
|
||||||
|
"font_class": "xiangqing",
|
||||||
|
"unicode": "e63c",
|
||||||
|
"unicode_decimal": 58940
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "34273005",
|
||||||
|
"name": "开始-圆",
|
||||||
|
"font_class": "kaishi-yuan",
|
||||||
|
"unicode": "e64b",
|
||||||
|
"unicode_decimal": 58955
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "19738994",
|
||||||
|
"name": "审核",
|
||||||
|
"font_class": "shenhe",
|
||||||
|
"unicode": "f195",
|
||||||
|
"unicode_decimal": 61845
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "29742036",
|
"icon_id": "29742036",
|
||||||
"name": "活动列表",
|
"name": "活动列表",
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
262
src/components/GxMap/index.vue
Normal file
262
src/components/GxMap/index.vue
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
<template>
|
||||||
|
<div class="map-container">
|
||||||
|
<!-- 地图容器 -->
|
||||||
|
<a-form-item :label="'输入地址'">
|
||||||
|
<a-input-search v-model:value="searchValue" placeholder="输入需要查找的地址" enter-button @search="searchLocation" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'搜索结果'">
|
||||||
|
<a-select ref="select" v-model:value="selectValue" style="width: 100%" @focus="focus" @change="handleChange" >
|
||||||
|
<a-select-option v-for="item in searchList" :value="item.id">{{ item.name }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
<div id="map" ref="mapContainer" style="height: calc(100% - 100px);"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, onUnmounted,defineEmits } from 'vue'
|
||||||
|
import AMapLoader from '@amap/amap-jsapi-loader'
|
||||||
|
defineOptions({
|
||||||
|
name: 'GxMap',
|
||||||
|
})
|
||||||
|
// 地图实例引用
|
||||||
|
const map = ref(null)
|
||||||
|
const mapContainer = ref(null)
|
||||||
|
const searchValue = ref('')
|
||||||
|
const searchResult = ref(null);
|
||||||
|
const markers = ref([]);
|
||||||
|
const locationMode = ref()
|
||||||
|
const locationData = ref({});
|
||||||
|
const infoWindow = ref(null);
|
||||||
|
const geocoder = ref(null);
|
||||||
|
const selectValue = ref('')
|
||||||
|
const searchList = ref([])
|
||||||
|
|
||||||
|
const emit = defineEmits(['handleGetLng']) //
|
||||||
|
onMounted(() => {
|
||||||
|
initMap()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (map.value) {
|
||||||
|
map.value.destroy()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const initMap = async () => {
|
||||||
|
try {
|
||||||
|
// 安全密钥配置(必须放在插件初始化前!)
|
||||||
|
window._AMapSecurityConfig = {
|
||||||
|
securityJsCode: 'df197447a4adc77f0cb376a44462272c' // 替换为你的jscode
|
||||||
|
};
|
||||||
|
// 加载地图 SDK
|
||||||
|
const AMap = await AMapLoader.load({
|
||||||
|
key: "38b334d84b1f89aa39d4efae76f0b341", // 替换你的高德Key
|
||||||
|
version: "2.0", // SDK 版本
|
||||||
|
plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.Geocoder'] // 需要加载的插件
|
||||||
|
})
|
||||||
|
|
||||||
|
// 初始化地图
|
||||||
|
map.value = new AMap.Map(mapContainer.value, {
|
||||||
|
zoom: 13, // 缩放级别
|
||||||
|
center: [120.894522,31.981269], // 中心点坐标(北京)
|
||||||
|
viewMode: "3D" // 使用3D视图
|
||||||
|
})
|
||||||
|
|
||||||
|
// 添加控件
|
||||||
|
map.value.addControl(new AMap.ToolBar())
|
||||||
|
map.value.addControl(new AMap.Scale())
|
||||||
|
// 初始化地理编码器
|
||||||
|
geocoder.value = new AMap.Geocoder({
|
||||||
|
city: "全国"
|
||||||
|
});
|
||||||
|
// 添加标记点
|
||||||
|
const marker = new AMap.Marker({
|
||||||
|
position: [120.894522,31.981269],
|
||||||
|
title: "南通市人民政府"
|
||||||
|
})
|
||||||
|
|
||||||
|
map.value.add(marker)
|
||||||
|
// 添加地图点击事件
|
||||||
|
map.value.on('click', handleMapClick);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("地图加载失败:", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理地图点击事件
|
||||||
|
const handleMapClick = (e) => {
|
||||||
|
// 清除之前的标记
|
||||||
|
clearMarkers();
|
||||||
|
|
||||||
|
// 获取点击位置的经纬度
|
||||||
|
const lng = e.lnglat.getLng();
|
||||||
|
const lat = e.lnglat.getLat();
|
||||||
|
|
||||||
|
// 设置定位模式
|
||||||
|
locationMode.value = "点击定位";
|
||||||
|
|
||||||
|
// 存储坐标
|
||||||
|
locationData.value = {
|
||||||
|
lng: lng,
|
||||||
|
lat: lat,
|
||||||
|
name: "点击位置",
|
||||||
|
address: "正在获取地址..."
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建标记
|
||||||
|
const marker = new AMap.Marker({
|
||||||
|
position: [lng, lat],
|
||||||
|
title: "点击位置"
|
||||||
|
});
|
||||||
|
|
||||||
|
map.value.add(marker);
|
||||||
|
markers.value.push(marker);
|
||||||
|
|
||||||
|
// 设置地图中心
|
||||||
|
map.value.setCenter([lng, lat]);
|
||||||
|
|
||||||
|
// 使用逆地理编码获取地址信息
|
||||||
|
geocoder.value.getAddress([lng, lat], (status, result) => {
|
||||||
|
if (status === 'complete' && result.regeocode) {
|
||||||
|
const address = result.regeocode.formattedAddress;
|
||||||
|
locationData.value.address = address;
|
||||||
|
|
||||||
|
// 添加信息窗口
|
||||||
|
infoWindow.value = new AMap.InfoWindow({
|
||||||
|
content: `<div style="padding:10px;min-width:200px;">
|
||||||
|
<div style="font-weight:bold;margin-bottom:5px;">点击位置</div>
|
||||||
|
<div>${address}</div>
|
||||||
|
<div style="margin-top:8px;color:#666;">
|
||||||
|
<div>经度: ${lng.toFixed(6)}</div>
|
||||||
|
<div>纬度: ${lat.toFixed(6)}</div>
|
||||||
|
</div>
|
||||||
|
</div>`,
|
||||||
|
offset: new AMap.Pixel(0, -35)
|
||||||
|
});
|
||||||
|
const obj={address:address,lng:lng,lat:lat}
|
||||||
|
|
||||||
|
infoWindow.value.open(map.value, [lng, lat]);
|
||||||
|
emit('handleGetLng', obj)
|
||||||
|
} else {
|
||||||
|
locationData.value.address = "无法获取地址信息";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 搜索地点
|
||||||
|
const searchLocation = () => {
|
||||||
|
if (!searchValue.value.trim()) {
|
||||||
|
alert('请输入搜索关键词');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除之前的标记
|
||||||
|
clearMarkers();
|
||||||
|
|
||||||
|
// 使用高德地图的搜索插件
|
||||||
|
AMap.plugin('AMap.PlaceSearch', () => {
|
||||||
|
const placeSearch = new AMap.PlaceSearch({
|
||||||
|
pageSize: 10,
|
||||||
|
pageIndex: 1,
|
||||||
|
city: '全国'
|
||||||
|
});
|
||||||
|
|
||||||
|
placeSearch.search(searchValue.value, (status, result) => {
|
||||||
|
if (status === 'complete' && result.poiList.pois.length) {
|
||||||
|
searchList.value = result.poiList.pois.map(item => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
address: item.address,
|
||||||
|
location: {
|
||||||
|
lng: item.location.lng,
|
||||||
|
lat: item.location.lat
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(searchList.value)
|
||||||
|
const poi = result.poiList.pois[0];
|
||||||
|
|
||||||
|
// 存储搜索结果
|
||||||
|
searchResult.value = {
|
||||||
|
id: poi.id,
|
||||||
|
name: poi.name,
|
||||||
|
address: poi.address,
|
||||||
|
location: {
|
||||||
|
lng: poi.location.lng,
|
||||||
|
lat: poi.location.lat
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建标记
|
||||||
|
const marker = new AMap.Marker({
|
||||||
|
position: [poi.location.lng, poi.location.lat],
|
||||||
|
title: poi.name
|
||||||
|
});
|
||||||
|
|
||||||
|
map.value.add(marker);
|
||||||
|
markers.value.push(marker);
|
||||||
|
|
||||||
|
// 设置地图中心
|
||||||
|
map.value.setCenter([poi.location.lng, poi.location.lat]);
|
||||||
|
|
||||||
|
// 添加信息窗口
|
||||||
|
const infoWindow = new AMap.InfoWindow({
|
||||||
|
content: `<div style="padding:5px;min-width:150px;">
|
||||||
|
<div style="font-weight:bold;">${poi.name}</div>
|
||||||
|
<div>${poi.address}</div>
|
||||||
|
<div>经度: ${poi.location.lng.toFixed(6)}</div>
|
||||||
|
<div>纬度: ${poi.location.lat.toFixed(6)}</div>
|
||||||
|
</div>`,
|
||||||
|
offset: new AMap.Pixel(0, -30)
|
||||||
|
});
|
||||||
|
|
||||||
|
infoWindow.open(map.value, marker.getPosition());
|
||||||
|
|
||||||
|
// 点击标记打开信息窗口
|
||||||
|
marker.on('click', () => {
|
||||||
|
infoWindow.open(map.value, marker.getPosition());
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
alert('未找到相关地点,请尝试其他关键词');
|
||||||
|
searchResult.value = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 清除所有标记
|
||||||
|
const clearMarkers = () => {
|
||||||
|
markers.value.forEach(marker => {
|
||||||
|
map.value.remove(marker);
|
||||||
|
});
|
||||||
|
markers.value = [];
|
||||||
|
searchResult.value = null;
|
||||||
|
};
|
||||||
|
const handleChange=(e)=>{
|
||||||
|
const item = searchList.value.find(item=>item.id===e)
|
||||||
|
const obj={
|
||||||
|
lng:item.location.lng,
|
||||||
|
lat:item.location.lat,
|
||||||
|
addres:item.address
|
||||||
|
}
|
||||||
|
emit('handleGetLng', obj)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.map-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
background-color: #eee;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
0
src/components/comment/index.vue
Normal file
0
src/components/comment/index.vue
Normal file
@ -20,6 +20,7 @@ import UploadInput from './Upload/UploadInput.vue'
|
|||||||
import Scrollbar from './Scrollbar/Scrollbar.vue'
|
import Scrollbar from './Scrollbar/Scrollbar.vue'
|
||||||
import Cascader from './Cascader/Cascader.vue'
|
import Cascader from './Cascader/Cascader.vue'
|
||||||
import GxUpload from './GxUpload/index.vue'
|
import GxUpload from './GxUpload/index.vue'
|
||||||
|
import GxMap from './GxMap/index.vue'
|
||||||
import { setupLoadingDirective } from './Loading/directive'
|
import { setupLoadingDirective } from './Loading/directive'
|
||||||
|
|
||||||
const componentList = [
|
const componentList = [
|
||||||
@ -42,7 +43,8 @@ const componentList = [
|
|||||||
UploadInput,
|
UploadInput,
|
||||||
Scrollbar,
|
Scrollbar,
|
||||||
Cascader,
|
Cascader,
|
||||||
GxUpload
|
GxUpload,
|
||||||
|
GxMap
|
||||||
]
|
]
|
||||||
|
|
||||||
export const loading = Loading
|
export const loading = Loading
|
||||||
|
|||||||
@ -1,15 +1,57 @@
|
|||||||
import {EnumManager} from './enums'
|
import {EnumManager} from './enums'
|
||||||
|
|
||||||
const activatyStatus = new EnumManager([
|
const activatyStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '待开始', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 3, name: '进行中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
{ value: 4, name: '已结束', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
//工单
|
||||||
|
const orderStatus = new EnumManager([
|
||||||
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
{ value: 2, name: '进行中', color: '#52c41a' }, // 绿色(进行中)
|
{ value: 2, name: '进行中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
{ value: 3, name: '已完成', color: '#1890ff' }, // 蓝色(完成色)
|
{ value: 3, name: '已完成', color: '#1890ff' }, // 蓝色(完成色)
|
||||||
{ value: 4, name: '已过期', color: '#bfbfbf' }, // 灰色(失效色)
|
{ value: 97, name: '已过期', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
{ value: 5, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
{ value: 98, name: '已撤销', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
//公告状态
|
||||||
|
const announcementStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '进行中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
{ value:98, name: '停用', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
])
|
])
|
||||||
|
|
||||||
const enumsStatus = new EnumManager([
|
const enumsStatus = new EnumManager([
|
||||||
{ value: 0, name: '启用', color: '#52c41a' }, // 绿色(启用)
|
{ value: 1, name: '启用', color: '#52c41a' }, // 绿色(启用)
|
||||||
{ value: 1, name: '停用', color: '#ff4d4f' } // 红色(停用)
|
{ value: 2, name: '停用', color: '#ff4d4f' } // 红色(停用)
|
||||||
])
|
])
|
||||||
export {activatyStatus,enumsStatus}
|
//互助状态
|
||||||
|
const nbdMutualStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '进行中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
{ value: 3, name: '已完成', color: '#1890ff' }, // 蓝色(完成色)
|
||||||
|
{ value: 98, name: '已撤销', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
//工单类型状态
|
||||||
|
const workTypeStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '启用中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
{ value: 98, name: '禁用', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
//会议室类型状态
|
||||||
|
const mettingStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '启用中', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
{ value: 98, name: '禁用', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
//用户类型状态
|
||||||
|
const userStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '启用', color: '#52c41a' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '禁用', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
export {activatyStatus,enumsStatus,orderStatus,announcementStatus,nbdMutualStatus,workTypeStatus,mettingStatus,userStatus}
|
||||||
@ -32,8 +32,21 @@ export default {
|
|||||||
account: '个人页',
|
account: '个人页',
|
||||||
'account.trigger': '触发报错',
|
'account.trigger': '触发报错',
|
||||||
'account.logout': '退出登录',
|
'account.logout': '退出登录',
|
||||||
homebanner:'首页轮播图',
|
homebanner: '首页轮播图',
|
||||||
neighborhood:'邻里圈轮播图',
|
neighborhood: '邻里圈轮播图',
|
||||||
announcementList:'社区公告',
|
announcementList: '社区公告',
|
||||||
activity:'活动列表'
|
activity: '活动列表',
|
||||||
|
nbdMutualAid: '邻里互助',
|
||||||
|
nbdMutual: '邻里互助',
|
||||||
|
mutualComment: '评论列表',
|
||||||
|
workOrder: '工单管理',
|
||||||
|
orderList: '工单列表',
|
||||||
|
orderType: '工单类型',
|
||||||
|
server:'周边服务',
|
||||||
|
serverList: '门店列表',
|
||||||
|
serverType: '门店分类',
|
||||||
|
mettingMgt:'会议室管理',
|
||||||
|
mettingRoom:'会议室列表',
|
||||||
|
mettingYuYue:'预约记录',
|
||||||
|
customer:'用户管理'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ export default {
|
|||||||
// role
|
// role
|
||||||
'pages.system.role.add': '添加角色',
|
'pages.system.role.add': '添加角色',
|
||||||
'pages.system.role.edit': '编辑角色',
|
'pages.system.role.edit': '编辑角色',
|
||||||
'pages.system.role.delTip': '确定删除该角色吗?',
|
'pages.system.role.delTip': '确定删除该项吗?',
|
||||||
'pages.system.role.form.code': '编码',
|
'pages.system.role.form.code': '编码',
|
||||||
'pages.system.role.form.code.placeholder': '请输入编码',
|
'pages.system.role.form.code.placeholder': '请输入编码',
|
||||||
'pages.system.role.form.code.required': '编码是必填项!',
|
'pages.system.role.form.code.required': '编码是必填项!',
|
||||||
@ -78,7 +78,7 @@ export default {
|
|||||||
// user
|
// user
|
||||||
'pages.system.user.add': '添加用户',
|
'pages.system.user.add': '添加用户',
|
||||||
'pages.system.user.edit': '编辑用户',
|
'pages.system.user.edit': '编辑用户',
|
||||||
'pages.system.user.delTip': '确定删除该用户吗?',
|
'pages.system.user.delTip': '确定删除该项吗?',
|
||||||
'pages.system.user.form.username': '用户名',
|
'pages.system.user.form.username': '用户名',
|
||||||
'pages.system.user.form.username.placeholder': '请输入用户名',
|
'pages.system.user.form.username.placeholder': '请输入用户名',
|
||||||
'pages.system.user.form.username.required': '用户名是必填项!',
|
'pages.system.user.form.username.required': '用户名是必填项!',
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { TableOutlined,HomeOutlined } from '@ant-design/icons-vue'
|
import { TableOutlined, HomeOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -49,4 +49,168 @@ export default [
|
|||||||
permission: '*',
|
permission: '*',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'nbdMutual',
|
||||||
|
name: 'nbdMutual',
|
||||||
|
component: 'RouteViewLayout',
|
||||||
|
meta: {
|
||||||
|
icon: 'icon-cooperation',
|
||||||
|
title: '邻里互助',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'nbdMutual/nbdMutualAid',
|
||||||
|
name: 'nbdMutualAid',
|
||||||
|
component: 'pages/nbdMutual/nbdMutualAid/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '邻里互助',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// path: 'nbdMutual/mutualComment',
|
||||||
|
// name: 'mutualComment',
|
||||||
|
// component: 'pages/nbdMutual/mutualComment/index.vue',
|
||||||
|
// meta: {
|
||||||
|
// icon: 'icon-huodongliebiao-copy',
|
||||||
|
// title: '求助评论',
|
||||||
|
// isMenu: true,
|
||||||
|
// keepAlive: true,
|
||||||
|
// permission: '*',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'workOrder',
|
||||||
|
name: 'workOrder',
|
||||||
|
component: 'RouteViewLayout',
|
||||||
|
meta: {
|
||||||
|
icon: 'icon-gongdan',
|
||||||
|
title: '工单列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'workOrder/orderType',
|
||||||
|
name: 'orderType',
|
||||||
|
component: 'pages/workOrder/orderType/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '功能类型',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'workOrder/orderList',
|
||||||
|
name: 'orderList',
|
||||||
|
component: 'pages/workOrder/orderList/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '工单列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'server',
|
||||||
|
name: 'server',
|
||||||
|
component: 'RouteViewLayout',
|
||||||
|
meta: {
|
||||||
|
icon: 'icon-zhoubian',
|
||||||
|
title: '周边服务',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'server/serverType',
|
||||||
|
name: 'serverType',
|
||||||
|
component: 'pages/server/serverType/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '门店类型',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'server/serverList',
|
||||||
|
name: 'serverList',
|
||||||
|
component: 'pages/server/serverList/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '门店列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'mettingMgt',
|
||||||
|
name: 'mettingMgt',
|
||||||
|
component: 'RouteViewLayout',
|
||||||
|
meta: {
|
||||||
|
icon: 'icon-zhoubian',
|
||||||
|
title: '会议室管理',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'mettingMgt/mettingRoom',
|
||||||
|
name: 'mettingRoom',
|
||||||
|
component: 'pages/mettingMgt/mettingList/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '会议室',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'mettingMgt/mettingYuYue',
|
||||||
|
name: 'mettingYuYue',
|
||||||
|
component: 'pages/mettingMgt/mettingYuYue/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: '',
|
||||||
|
title: '会议室预约',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'customer/index',
|
||||||
|
name: 'customer',
|
||||||
|
component: 'pages/user/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: HomeOutlined,
|
||||||
|
title: '用户管理',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel" :ok-button-props="{ disabled: formData.status!==2 }">
|
||||||
<a-spin :spinning="spining">
|
<a-spin :spinning="spining">
|
||||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
<a-card class="mb-8-2">
|
<a-card class="mb-8-2">
|
||||||
@ -12,18 +12,18 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'活动内容'" name="activityContent">
|
<a-form-item :label="'活动内容'" name="content">
|
||||||
<x-editor v-model="formData.activityContent"></x-editor>
|
<x-editor v-model="formData.content"></x-editor>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'活动时间'" name="activityTime">
|
<a-form-item :label="'活动时间'" name="openAt">
|
||||||
<a-input v-model:value="formData.activityTime" placeholder="请输入活动时间" />
|
<a-input v-model:value="formData.openAt" placeholder="请输入活动时间" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'状态'" name="status">
|
<a-form-item :label="'状态'" name="status">
|
||||||
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
<a-radio-group v-model:value="formData.status" :options="activatyStatus.getAll()" disabled></a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@ -33,8 +33,8 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item :label="'背景图片'" name="backImg">
|
<a-form-item :label="'背景图片'" name="images">
|
||||||
<gx-upload v-model="formData.backImg" accept-types=".jpg,.png,.webp"
|
<gx-upload v-model="formData.images" accept-types=".jpg,.png,.webp"
|
||||||
:fileNumber="1" />
|
:fileNumber="1" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@ -56,7 +56,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import GxUpload from '@/components/GxUpload/index.vue'
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
import { spliceUrl } from "@/utils/util"
|
import { spliceUrl } from "@/utils/util"
|
||||||
import { enumsStatus } from '@/enums/index'
|
import { activatyStatus } from '@/enums/index'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -67,9 +67,9 @@ const okText = ref(t('button.confirm'))
|
|||||||
const fileList = ref([])
|
const fileList = ref([])
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
title: [{ required: true, message: '请输入活动名称' }],
|
title: [{ required: true, message: '请输入活动名称' }],
|
||||||
activityTime: [{ required: true, message: '请输入活动时间' }],
|
openAt: [{ required: true, message: '请输入活动时间' }],
|
||||||
cover: [{required: false, message: '请上传图片', trigger: 'change'}],
|
cover: [{required: false, message: '请上传图片', trigger: 'change'}],
|
||||||
backImg: [{ required: false, message: '请上传图片', trigger: 'change' }],
|
images: [{ required: false, message: '请上传图片', trigger: 'change' }],
|
||||||
activityContent:[{ required: true, message: '请输入活动内容' }]
|
activityContent:[{ required: true, message: '请输入活动内容' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ function handleCreate() {
|
|||||||
title: '新增活动',
|
title: '新增活动',
|
||||||
})
|
})
|
||||||
// initData()
|
// initData()
|
||||||
formData.value.status = 'enabled'
|
formData.value.status = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,12 +106,15 @@ async function handleEdit(record = {}) {
|
|||||||
}
|
}
|
||||||
hideSpining()
|
hideSpining()
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.startAt = dayjs(data.startAt)
|
|
||||||
formData.value.endAt = dayjs(data.endAt)
|
|
||||||
formData.value.endSignupAt = dayjs(data.endSignupAt)
|
|
||||||
|
|
||||||
if (data.images && data.images.length > 0) {
|
if (data.images && data.images.length > 0) {
|
||||||
formData.value.fileList = data.images.map(item => config('http.apiBasic') + item)
|
formData.value.images = data.images.map(item => config('http.apiBasic') + item)
|
||||||
|
}else{
|
||||||
|
formData.value.images=[]
|
||||||
|
}
|
||||||
|
if(data.cover){
|
||||||
|
formData.value.cover=[config('http.apiBasic')+data.cover]
|
||||||
|
}else{
|
||||||
|
formData.value.cover=[]
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error({ content: error.message })
|
message.error({ content: error.message })
|
||||||
@ -132,7 +135,7 @@ function handleOk() {
|
|||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
cover: formData.value.cover?spliceUrl(formData.value.cover[0]):'',
|
cover: formData.value.cover?spliceUrl(formData.value.cover[0]):'',
|
||||||
backImg: formData.value.backImg ? formData.value.backImg.map(item => spliceUrl(item)) : ''
|
images: formData.value.images ? formData.value.images.map(item => spliceUrl(item)) : []
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
|
|||||||
@ -45,26 +45,44 @@
|
|||||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
|
|
||||||
<template v-if="column.dataIndex === 'cover'">
|
<template v-if="column.dataIndex === 'cover'">
|
||||||
<img :src="config('http.apiConfig')+record.cover" alt="" srcset="">
|
<a-image :width="60"
|
||||||
|
:src="record.cover ? config('http.apiBasic') + record.cover : errImg" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'content'">
|
<template v-if="column.dataIndex === 'content'">
|
||||||
<span style="cursor: pointer;color:#1677ff;" @click="content = record.content || ''; type = 2; open = true" type="link">点击查看</span>
|
<span style="cursor: pointer;color:#1677ff;"
|
||||||
|
@click="content = record.content || ''; type = 2; open = true" type="link">点击查看</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'status' === column.dataIndex">
|
||||||
<a-tag :color="enumsStatus.getColor(record.status)">{{enumsStatus.getName(record.status)}}</a-tag>
|
<a-tag :color="activatyStatus.getColor(record.status)">{{
|
||||||
|
activatyStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '审核' }}</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="startHandleEdit(record)" v-if="record.status === 2">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '开始活动' }}</template>
|
||||||
|
<i class='iconfont icon-kaishi-yuan' style='font-size:14px;color:#52c41a'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||||
<edit-outlined /> </a-tooltip></x-action-button>
|
<edit-outlined />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
<x-action-button @click="handleDelete(record)">
|
<x-action-button @click="handleDelete(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -72,19 +90,31 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-modal v-model:open="open" :title="type === 1 ? '活动图片' : '活动详情'" @ok="open = false">
|
<a-modal v-model:open="open" :title="type === 1 ? '活动图片' : '活动详情'" @ok="open = false">
|
||||||
<template v-if="type === 1">
|
<a-card class="mb-8-2">
|
||||||
<a-image v-if="imgList.length > 0" :width="200" v-for="item of imgList"
|
<template v-if="type === 1">
|
||||||
:src="config('http.apiBasic') + item" />
|
<a-image v-if="imgList.length > 0" :width="200" v-for="item of imgList"
|
||||||
<span v-else>
|
:src="config('http.apiBasic') + item" />
|
||||||
暂无图片
|
<span v-else>
|
||||||
</span>
|
暂无图片
|
||||||
</template>
|
</span>
|
||||||
<template v-else>
|
</template>
|
||||||
<span>{{ content }}</span>
|
<template v-else>
|
||||||
</template>
|
<p v-html="content"></p>
|
||||||
|
</template>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<a-modal :open="modal.open" :title="'审核'" :width="640" :confirm-loading="modal.confirmLoading" title="审核"
|
||||||
|
ok-text="确认" cancel-text="取消" @ok="handleAuditEdit" @cancel="hideModal()">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '不通过' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -95,11 +125,12 @@ import apis from '@/apis'
|
|||||||
import { formatUtcDateTime } from '@/utils/util'
|
import { formatUtcDateTime } from '@/utils/util'
|
||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { usePagination } from '@/hooks'
|
import { usePagination,useModal } from '@/hooks'
|
||||||
import EditDialog from './components/EditDialog.vue'
|
import EditDialog from './components/EditDialog.vue'
|
||||||
import { PlusOutlined, EditOutlined, DeleteOutlined, QrcodeOutlined } from '@ant-design/icons-vue'
|
import { PlusOutlined, EditOutlined, DeleteOutlined, QrcodeOutlined } from '@ant-design/icons-vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { enumsStatus } from '@/enums/index.js'
|
import { activatyStatus } from '@/enums/index.js'
|
||||||
|
import errImg from '@/assets/blankSpace.png'
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'activity',
|
name: 'activity',
|
||||||
})
|
})
|
||||||
@ -109,17 +140,20 @@ const imgList = ref([])
|
|||||||
const type = ref(1)
|
const type = ref(1)
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '活动标题', dataIndex: 'title'},
|
|
||||||
{ title: '活动时间', dataIndex: 'activityTime',align: 'center' },
|
|
||||||
{ title: '活动内容', dataIndex: 'activityContent',align: 'center' },
|
|
||||||
{ title: '活动封面', dataIndex: 'cover', align: 'center', width: 100 },
|
{ title: '活动封面', dataIndex: 'cover', align: 'center', width: 100 },
|
||||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
|
{ title: '活动标题', dataIndex: 'title' },
|
||||||
|
{ title: '活动时间', dataIndex: 'openAt', align: 'center' },
|
||||||
|
{ title: '活动内容', dataIndex: 'content', align: 'center', width: 100 },
|
||||||
|
{ title: '状态', dataIndex: 'status', align: 'center', width: 100 },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 140, align: 'center' },
|
||||||
]
|
]
|
||||||
|
const { modal, showModal, hideModal, showLoading:auditShowLoading, hideLoading:auditHideLoading } = useModal()
|
||||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =usePagination()
|
||||||
usePagination()
|
|
||||||
|
|
||||||
const editDialogRef = ref()
|
const editDialogRef = ref()
|
||||||
|
const currentForm=ref({})
|
||||||
|
const auditStatus=ref(2)
|
||||||
|
const remark=ref('')
|
||||||
getPageList()
|
getPageList()
|
||||||
/**
|
/**
|
||||||
* 获取表格数据
|
* 获取表格数据
|
||||||
@ -147,7 +181,51 @@ async function getPageList() {
|
|||||||
hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
showModal()
|
||||||
|
}
|
||||||
|
const startHandleEdit=async (obj)=>{
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...obj,
|
||||||
|
status: 3,
|
||||||
|
}
|
||||||
|
const result = await apis.activity.updateItem(obj.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
getPageList()
|
||||||
|
message.success('活动已成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
auditShowLoading()
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
console.log(params);
|
||||||
|
const result = await apis.activity.updateItem(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
auditHideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
getPageList()
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
auditHideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel" :ok-button-props="{ disabled: formData.status!==1 }">
|
||||||
<a-spin :spinning="spining">
|
<a-spin :spinning="spining">
|
||||||
<a-form ref="formRef" :model="formData" :rules="formRules" :label-col="{ style: { width: '90px' } }">
|
<a-form ref="formRef" :model="formData" :rules="formRules" :label-col="{ style: { width: '90px' } }">
|
||||||
<a-card class="mb-8-2">
|
<a-card class="mb-8-2">
|
||||||
@ -16,24 +16,29 @@
|
|||||||
style="width: 100%;" />
|
style="width: 100%;" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item label="排序" name="sequence">
|
<a-form-item label="排序" name="sequence">
|
||||||
<a-input-number v-model:value="formData.sequence" style="width: 100%;" />
|
<a-input-number v-model:value="formData.sequence" style="width: 100%;" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'状态'" name="status">
|
<a-form-item :label="'状态'" name="status">
|
||||||
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
<a-radio-group v-model:value="formData.status" :options="announcementStatus.getAll()" disabled></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'公告简介'" name="desc">
|
||||||
|
<a-textarea v-model:value="formData.desc" ></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'公告内容'" name="desc">
|
<a-form-item :label="'公告内容'" name="content">
|
||||||
<x-editor v-model="formData.desc" :uploadHandler="uploadHandler" :height="350"></x-editor>
|
<x-editor v-model="formData.content" :uploadHandler="uploadHandler" :height="350"></x-editor>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'公告封面'" name="img">
|
<a-form-item :label="'公告封面'" name="cover">
|
||||||
<gx-upload v-model="formData.img" :fileNumber="1"></gx-upload>
|
<gx-upload v-model="formData.cover" :fileNumber="1"></gx-upload>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@ -52,7 +57,7 @@ import { useForm, useModal, useSpining } from '@/hooks'
|
|||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { enumsStatus } from '@/enums/index'
|
import { announcementStatus } from '@/enums/index'
|
||||||
import {spliceUrl} from '@/utils/util'
|
import {spliceUrl} from '@/utils/util'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
@ -65,11 +70,12 @@ const roles = ref([])
|
|||||||
const { spining, showSpining, hideSpining } = useSpining()
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
formRules.value = {
|
formRules.value = {
|
||||||
title: { required: true, message: '请输入标题' },
|
title: { required: true, message: '请输入标题' },
|
||||||
desc: { required: true, message: '请输入内容' },
|
desc: { required: true, message: '请输入简介' },
|
||||||
|
content: { required: true, message: '请输入内容' },
|
||||||
sequence: { required: true, message: '请选择排序' },
|
sequence: { required: true, message: '请选择排序' },
|
||||||
status: { required: true, message: '请选择是否启用' },
|
status: { required: true, message: '请选择是否启用' },
|
||||||
createdAt: { required: true, message: '请选择创建时间' },
|
createdAt: { required: true, message: '请选择创建时间' },
|
||||||
img:{required: false, message: '请上传封面'}
|
cover:{required: false, message: '请上传封面'}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +86,7 @@ function handleCreate() {
|
|||||||
type: 'create',
|
type: 'create',
|
||||||
title: '新增',
|
title: '新增',
|
||||||
})
|
})
|
||||||
formData.value.status = 0
|
formData.value.status = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +104,7 @@ async function handleEdit(record = {}) {
|
|||||||
hideSpining()
|
hideSpining()
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.createdAt = dayjs(data.createdAt)
|
formData.value.createdAt = dayjs(data.createdAt)
|
||||||
formData.value.img=formData.value.img?[config('http.apiBasic')+formData.value.img]:[]
|
formData.value.cover=formData.value.cover?[config('http.apiBasic')+formData.value.cover]:[]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(error.message)
|
message.error(error.message)
|
||||||
}
|
}
|
||||||
@ -109,7 +115,6 @@ async function handleEdit(record = {}) {
|
|||||||
* 确定
|
* 确定
|
||||||
*/
|
*/
|
||||||
function handleOk() {
|
function handleOk() {
|
||||||
console.log(formData.value)
|
|
||||||
formRef.value
|
formRef.value
|
||||||
.validateFields()
|
.validateFields()
|
||||||
.then(async (values) => {
|
.then(async (values) => {
|
||||||
@ -118,7 +123,7 @@ function handleOk() {
|
|||||||
showLoading()
|
showLoading()
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
img:formData.value.img?spliceUrl(formData.value.img[0]):''
|
cover:formData.value.cover?spliceUrl(formData.value.cover[0]):''
|
||||||
}
|
}
|
||||||
console.log(params);
|
console.log(params);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,10 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item :label="'状态'" name="status">
|
<a-form-item :label="'状态'" name="status">
|
||||||
<a-input :placeholder="'请输入状态'" v-model:value="searchFormData.status"></a-input>
|
<a-select v-model:value="searchFormData.status" allowClear>
|
||||||
|
<a-select-option v-for="item of announcementStatus.getAll()" :value="item.value">{{
|
||||||
|
item.label }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col class="align-right" v-bind="colSpan">
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
@ -39,11 +42,14 @@
|
|||||||
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered="true"
|
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered="true"
|
||||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if=" column.dataIndex === 'img'">
|
<template v-if="column.dataIndex === 'cover'">
|
||||||
<a-image :width="60" :src="record.img?config('http.apiBasic')+record.img:errImg" />
|
<a-image :width="60"
|
||||||
|
:src="record.cover ? config('http.apiBasic') + record.cover : errImg" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'status' === column.dataIndex">
|
||||||
<a-tag :color="enumsStatus.getColor(record.status)">{{ enumsStatus.getName(record.status) }}</a-tag>
|
<a-tag :color="announcementStatus.getColor(record.status)">{{
|
||||||
|
announcementStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'createdAt' === column.dataIndex">
|
<template v-if="'createdAt' === column.dataIndex">
|
||||||
{{ dayjs(record.createdAt).format('YYYY-MM-DD') }}
|
{{ dayjs(record.createdAt).format('YYYY-MM-DD') }}
|
||||||
@ -52,6 +58,12 @@
|
|||||||
<p v-html="record.desc"></p>
|
<p v-html="record.desc"></p>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '审核' }}</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
<x-action-button @click="$refs.addDialogRef.handleEdit(record)">
|
<x-action-button @click="$refs.addDialogRef.handleEdit(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ '编辑公告' }}</template>
|
<template #title> {{ '编辑公告' }}</template>
|
||||||
@ -70,7 +82,18 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
<a-modal :open="modal.open" :title="'审核'" :width="640" :confirm-loading="modal.confirmLoading" title="审核"
|
||||||
|
ok-text="确认" cancel-text="取消" @ok="handleAuditEdit" @cancel="hideModal()">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '不通过' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
<add-dialog ref="addDialogRef" @ok="onOk"></add-dialog>
|
<add-dialog ref="addDialogRef" @ok="onOk"></add-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -79,10 +102,11 @@ import { message, Modal } from 'ant-design-vue'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import apis from '@/apis'
|
import apis from '@/apis'
|
||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import { enumsStatus } from '@/enums/index.js'
|
import { announcementStatus } from '@/enums/index.js'
|
||||||
import { usePagination } from '@/hooks'
|
import { usePagination,useModal } from '@/hooks'
|
||||||
import AddDialog from './components/AddDialog.vue'
|
import AddDialog from './components/AddDialog.vue'
|
||||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import errImg from '@/assets/blankSpace.png'
|
import errImg from '@/assets/blankSpace.png'
|
||||||
@ -92,20 +116,21 @@ defineOptions({
|
|||||||
})
|
})
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '封面', dataIndex: 'img', key: 'img',with:60,align:'center'},
|
{ title: '封面', dataIndex: 'cover', key: 'cover', with: 60, align: 'center' },
|
||||||
{ title: '标题', dataIndex: 'title', key: 'title', ellipsis: true },
|
{ title: '标题', dataIndex: 'title', key: 'title', ellipsis: true },
|
||||||
{ title: '内容', dataIndex: 'desc', ellipsis: true },
|
{ title: '简介', dataIndex: 'desc', ellipsis: true },
|
||||||
{ title: '排序', dataIndex: 'sequence', width: 80, align: 'center' },
|
{ title: '排序', dataIndex: 'sequence', width: 80, align: 'center' },
|
||||||
{ title: '状态', key: 'status', dataIndex: 'status', width: 120, align: 'center' },
|
{ title: '状态', key: 'status', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
{ title: '创建时间', dataIndex: 'createdAt', width: 200, align: 'center' },
|
{ title: '创建时间', dataIndex: 'createdAt', width: 200, align: 'center' },
|
||||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 140, align: 'center' },
|
||||||
]
|
]
|
||||||
|
const { modal, showModal, hideModal, showLoading:auditShowLoading, hideLoading:auditHideLoading } = useModal()
|
||||||
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } = usePagination()
|
||||||
usePagination()
|
|
||||||
// const { resetForm } = useForm()
|
// const { resetForm } = useForm()
|
||||||
const addDialogRef = ref()
|
const addDialogRef = ref()
|
||||||
|
const currentForm=ref({})
|
||||||
|
const auditStatus=ref(2)
|
||||||
|
const remark=ref('')
|
||||||
getPageList()
|
getPageList()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,7 +188,33 @@ function handleRemove({ id }) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
showModal()
|
||||||
|
}
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
auditShowLoading()
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
console.log(params);
|
||||||
|
const result = await apis.announcement.updateNotices(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
auditHideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
getPageList()
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
auditHideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -16,11 +16,11 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'状态'" name="status">
|
|
||||||
<a-form-item :label="'状态'" name="status">
|
<a-form-item :label="'状态'" name="status">
|
||||||
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'图片'" name="img">
|
<a-form-item :label="'图片'" name="img">
|
||||||
@ -45,6 +45,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt'
|
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt'
|
||||||
import {spliceUrl} from '@/utils/util'
|
import {spliceUrl} from '@/utils/util'
|
||||||
|
import { enumsStatus } from '@/enums/index.js'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -72,7 +73,7 @@ function handleCreate() {
|
|||||||
// 80对应about
|
// 80对应about
|
||||||
title: '添加',
|
title: '添加',
|
||||||
})
|
})
|
||||||
formData.value.status = 0
|
formData.value.status = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +107,7 @@ function handleOk() {
|
|||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
img: spliceUrl(formData.value?.img[0]),
|
img: spliceUrl(formData.value?.img[0]),
|
||||||
type: 'homeBanner' ,
|
scene: 1 ,
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<x-search-bar class="mb-8-2">
|
<!-- <x-search-bar class="mb-8-2">
|
||||||
<template #default="{ gutter, colSpan }">
|
<template #default="{ gutter, colSpan }">
|
||||||
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
||||||
<a-row :gutter="gutter">
|
<a-row :gutter="gutter">
|
||||||
@ -11,9 +11,8 @@
|
|||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="状态" name="status">
|
<a-form-item label="状态" name="status">
|
||||||
<a-select v-model:value="searchFormData.status" allowClear>
|
<a-select v-model:value="searchFormData.status" allowClear>
|
||||||
<a-select-option value="">全部</a-select-option>
|
<a-select-option v-for="item of enumsStatus.getAll()" :value="item.value">{{ item.label
|
||||||
<a-select-option value="enabled">启用</a-select-option>
|
}}</a-select-option>
|
||||||
<a-select-option value="disabled">停用</a-select-option>
|
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@ -28,7 +27,7 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
</x-search-bar>
|
</x-search-bar> -->
|
||||||
<a-row :gutter="8" :wrap="false">
|
<a-row :gutter="8" :wrap="false">
|
||||||
<a-col flex="auto">
|
<a-col flex="auto">
|
||||||
<a-card type="flex">
|
<a-card type="flex">
|
||||||
@ -41,14 +40,15 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</x-action-bar>
|
</x-action-bar>
|
||||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'img' === column.dataIndex">
|
<template v-if="'img' === column.dataIndex">
|
||||||
<a-image :width="60" :src="record.img?config('http.apiBasic')+record.img:errImg" />
|
<a-image :width="60" :src="record.img ? config('http.apiBasic') + record.img : errImg" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'status' === column.dataIndex">
|
||||||
<a-tag :color="enumsStatus.getColor(record.status)">{{ enumsStatus.getName(record.status) }}</a-tag>
|
<a-tag :color="enumsStatus.getColor(record.status)">{{ enumsStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
@ -111,8 +111,8 @@ async function getPageList() {
|
|||||||
const { success, data, total } = await apis.imgmgt
|
const { success, data, total } = await apis.imgmgt
|
||||||
.getDataList({
|
.getDataList({
|
||||||
pageSize,
|
pageSize,
|
||||||
current:current,
|
current: current,
|
||||||
type: 'homeBanner',
|
scene: 1,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
174
src/views/pages/mettingMgt/mettingList/components/EditDialog.vue
Normal file
174
src/views/pages/mettingMgt/mettingList/components/EditDialog.vue
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'会议室名称'" name="title">
|
||||||
|
<a-input :placeholder="'请输入会议室名称'" v-model:value="formData.title"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'会议室人数'" name="maxNum">
|
||||||
|
<a-input-number :placeholder="'请输入排序'" v-model:value="formData.maxNum"
|
||||||
|
style="width: 100%;">
|
||||||
|
<template #addonAfter>
|
||||||
|
人间
|
||||||
|
</template>
|
||||||
|
</a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'会议室描述'" name="content">
|
||||||
|
<x-editor v-model="formData.content"></x-editor>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'会议室图片'" name="imgs">
|
||||||
|
<gx-upload v-model="formData.imgs" accept-types=".jpg,.png,.webp" :fileNumber="10" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status" :options="mettingStatus.getAll()"
|
||||||
|
disabled></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { mettingStatus } from '@/enums/index.js'
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import { status } from 'nprogress'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const treeData = ref([])
|
||||||
|
formRules.value = {
|
||||||
|
title: { required: true, message: '请输入会议室名称' },
|
||||||
|
maxNum: { required: true, message: '请输入人数' },
|
||||||
|
content: { required: true, message: '请输入会议室描述' },
|
||||||
|
status: { required: true, message: '请选择状态', trigger: 'change' },
|
||||||
|
imgs: { required: true, message: '请选择状态', trigger: 'change' }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '新增',
|
||||||
|
})
|
||||||
|
formData.value.status = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑',
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
showSpining()
|
||||||
|
const { data, success } = await apis.mettingRoom.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hideSpining()
|
||||||
|
formData.value = { ...data }
|
||||||
|
formData.value.imgs=data.imgs.length>0?data.imgs.map(item=>config('http.apiBasic')+item):[]
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
status:1,
|
||||||
|
imgs:formData.value.imgs.length>0?formData.value.imgs.map(item=>spliceUrl(item)):[]
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.mettingRoom.createMenu(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.mettingRoom.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
182
src/views/pages/mettingMgt/mettingList/index.vue
Normal file
182
src/views/pages/mettingMgt/mettingList/index.vue
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
新增会议室
|
||||||
|
</a-button>
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="workTypeStatus.getColor(record.status)">{{
|
||||||
|
workTypeStatus.getName(record.status) }}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'content'===column.dataIndex">
|
||||||
|
<a-button type="link" @click="content=record.content;contentView=true">点击查看</a-button>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)" >
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>编辑</template>
|
||||||
|
<edit-outlined />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>审核</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal :open="open" :title="'审核'" :width="640" title="审核" ok-text="确认" cancel-text="取消" @ok="handleAuditEdit"
|
||||||
|
@cancel="open = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '不通过' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<a-modal :open="contentView" :title="'描述'" :width="640" ok-text="确认" cancel-text="取消" @ok="contentView=false"
|
||||||
|
@cancel="contentView = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<p v-html="content"></p>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { workTypeStatus } from '@/enums/index.js'
|
||||||
|
defineOptions({
|
||||||
|
name: 'mettingRoom',
|
||||||
|
})
|
||||||
|
const currentForm = ref({})
|
||||||
|
const open = ref(false)
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const remark = ref('')
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const content=ref('')
|
||||||
|
const contentView=ref(false)
|
||||||
|
const columns = [
|
||||||
|
{ title: '会议室名称', dataIndex: 'title' },
|
||||||
|
{ title: '会议室描述', dataIndex: 'content',align:'center' },
|
||||||
|
{ title: '会议室人数', dataIndex: 'maxNum' },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||||
|
usePagination()
|
||||||
|
|
||||||
|
const editDialogRef = ref()
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.mettingRoom
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
open.value = true
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.mettingRoom.updateMenu(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
getPageList()
|
||||||
|
open.value = false
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'用户名'" name="customerName">
|
||||||
|
<a-input :placeholder="'请输入用户名'" v-model:value="formData.customerName"
|
||||||
|
></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工单分类'" name="label">
|
||||||
|
<a-input :placeholder="'请输入工单分类'" v-model:value="formData.label" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工单内容'" name="content">
|
||||||
|
<a-textarea :placeholder="'请输入工单内容'" v-model:value="formData.content"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 5 }" ></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工作地点'" name="address">
|
||||||
|
<a-input :placeholder="'请输入工作地点'" v-model:value="formData.address" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'创建时间'" name="createAt">
|
||||||
|
<a-input :placeholder="'请输入创建时间'" v-model:value="formData.createAt" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'上门时间'" name="startAt">
|
||||||
|
<a-input :placeholder="'请输入上门时间'" v-model:value="formData.startAt" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import { readonly } from 'vue'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const treeData = ref([])
|
||||||
|
const status=ref(2)
|
||||||
|
const remark=ref('')
|
||||||
|
formRules.value = {
|
||||||
|
label: { required: true, message: '请输入产品类别名称' },
|
||||||
|
sequence: { required: true, message: '请输入排序' }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '产品分类',
|
||||||
|
})
|
||||||
|
// 初始化所有字段
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑分类',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
status:status.value,
|
||||||
|
remark:status.remark
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.orderList.createProductsItem(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.orderList.updateItem(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
182
src/views/pages/mettingMgt/mettingYuYue/index.vue
Normal file
182
src/views/pages/mettingMgt/mettingYuYue/index.vue
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'startAt' === column.dataIndex">
|
||||||
|
<span>{{ dayjs(record.startAt).format('YYYY-MM-DD HH:mm:ss') + ' - ' +
|
||||||
|
dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>审核</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal :open="open" :title="'审核'" :width="640" title="审核" ok-text="确认" cancel-text="取消" @ok="handleAuditEdit"
|
||||||
|
@cancel="open = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '驳回' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { orderStatus } from '@/enums/index.js'
|
||||||
|
import { status } from 'nprogress'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
defineOptions({
|
||||||
|
name: 'mettingYuYue',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '用户', dataIndex: 'concatName' },
|
||||||
|
{ title: '手机号', dataIndex: 'concatPhone' },
|
||||||
|
{ title: '会议室', dataIndex: 'roomName' },
|
||||||
|
{ title: '时间段', dataIndex: 'startAt', width: 300, align: 'center' },
|
||||||
|
{ title: '备注', dataIndex: 'remark' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||||
|
const remark = ref('')
|
||||||
|
const currentInfo = ref({})
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const editDialogRef = ref()
|
||||||
|
const open = ref(false)
|
||||||
|
const imgOpen = ref(false)
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.mettingYuYue
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (obj = {}, type) => {
|
||||||
|
currentInfo.value = obj
|
||||||
|
if (type === 'audit') {
|
||||||
|
open.value = true
|
||||||
|
} else {
|
||||||
|
imgOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleClick = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentInfo.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.mettingYuYue.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
message.success('已审核')
|
||||||
|
open.value = false
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.mettingRoom.updateMenu(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
getPageList()
|
||||||
|
open.value = false
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'审核结果'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status"
|
||||||
|
:options="[{ label: '通过', value: 2 }, { label: '拒绝', value: 5 }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'备注'" name="remark">
|
||||||
|
<a-input v-model:value="formData.remark"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
formRules.value = {
|
||||||
|
status: { required: true, message: '请选择审核状态', trigger: 'change' },
|
||||||
|
remark: [{ required: true, message: '请输入备注', trigger: 'remark' }],
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({type: 'edit',title: '审核'})
|
||||||
|
formData.value.id=record.id
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
id: formData.value.id,
|
||||||
|
status: formData.value.status,
|
||||||
|
remark: formData.value.remark
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.nbdMutualAid.createMenu(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.nbdMutualAid.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -1,20 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<x-search-bar class="mb-8-2">
|
<x-search-bar class="mb-8-2">
|
||||||
<template #default="{ gutter, colSpan }">
|
<template #default="{ gutter, colSpan }">
|
||||||
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
<a-form :model="searchFormData" layout="inline">
|
||||||
<a-row :gutter="gutter">
|
<a-row :gutter="gutter">
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="名称" name="name">
|
<a-form-item label="用户名称:" name="userName">
|
||||||
<a-input placeholder="请输入图片名称" v-model:value="searchFormData.name"></a-input>
|
<a-input placeholder="请输入用户名称" v-model:value="searchFormData.userName"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="状态" name="status">
|
<a-form-item label="评论人名称:" name="commentUser">
|
||||||
<a-select v-model:value="searchFormData.status" allowClear>
|
<a-input placeholder="请输入评论人名称" v-model:value="searchFormData.commentUser"></a-input>
|
||||||
<a-select-option value="">全部</a-select-option>
|
|
||||||
<a-select-option value="enabled">启用</a-select-option>
|
|
||||||
<a-select-option value="disabled">停用</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col class="align-right" v-bind="colSpan">
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
@ -32,33 +28,22 @@
|
|||||||
<a-row :gutter="8" :wrap="false">
|
<a-row :gutter="8" :wrap="false">
|
||||||
<a-col flex="auto">
|
<a-col flex="auto">
|
||||||
<a-card type="flex">
|
<a-card type="flex">
|
||||||
<x-action-bar class="mb-8-2">
|
|
||||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
|
||||||
<template #icon>
|
|
||||||
<plus-outlined></plus-outlined>
|
|
||||||
</template>
|
|
||||||
新增
|
|
||||||
</a-button>
|
|
||||||
</x-action-bar>
|
|
||||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'img' === column.dataIndex">
|
|
||||||
<a-image :width="60" :src="record.img?config('http.apiBasic')+record.img:errImg" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'status' === column.dataIndex">
|
||||||
<a-tag :color="enumsStatus.getColor(record.status)">{{ enumsStatus.getName(record.status) }}</a-tag>
|
<a-tag :color="activatyStatus.getColor(record.status)">{{activatyStatus.getName(record.status)}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'pushAt' === column.dataIndex">
|
||||||
|
<span>{{ dayjs(record.pushAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
|
||||||
<a-tooltip>
|
|
||||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
|
||||||
<edit-outlined /> </a-tooltip></x-action-button>
|
|
||||||
<x-action-button @click="handleDelete(record)">
|
<x-action-button @click="handleDelete(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -73,26 +58,24 @@
|
|||||||
import { message, Modal } from 'ant-design-vue'
|
import { message, Modal } from 'ant-design-vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import apis from '@/apis'
|
import apis from '@/apis'
|
||||||
import { formatUtcDateTime } from '@/utils/util'
|
|
||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import { statusUserTypeEnum } from '@/enums/system'
|
|
||||||
import { usePagination } from '@/hooks'
|
import { usePagination } from '@/hooks'
|
||||||
import errImg from '@/assets/blankSpace.png'
|
import errImg from '@/assets/blankSpace.png'
|
||||||
import EditDialog from './components/EditDialog.vue'
|
import EditDialog from './components/EditDialog.vue'
|
||||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { delMenu, getDataList } from '@/apis/modules/imgmgt'
|
import { activatyStatus } from '@/enums/index.js'
|
||||||
import { enumsStatus } from '@/enums/index.js'
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'nbdMa',
|
name: 'mutualComment',
|
||||||
})
|
})
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '图片', dataIndex: 'img', width: 100, align: 'center' },
|
{ title: '评论人名称', dataIndex: 'commentUser', key: 'commentUser' },
|
||||||
{ title: '名称', dataIndex: 'title', key: 'name' },
|
{ title: '评论内容', dataIndex: 'commentContent' },
|
||||||
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
{ title: '发布时间', dataIndex: 'pushAt', width: 120, align: 'center' },
|
||||||
{ title: '顺序', dataIndex: 'sequence', width: 100, align: 'center' },
|
{ title: '被评论人', dataIndex: 'userName', align: 'center' },
|
||||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
{ title: '被评论帖子', dataIndex: 'title', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||||
@ -108,11 +91,10 @@ async function getPageList() {
|
|||||||
try {
|
try {
|
||||||
showLoading()
|
showLoading()
|
||||||
const { pageSize, current } = paginationState
|
const { pageSize, current } = paginationState
|
||||||
const { success, data, total } = await apis.imgmgt
|
const { success, data, total } = await apis.mutualComment
|
||||||
.getDataList({
|
.getDataList({
|
||||||
pageSize,
|
pageSize,
|
||||||
current:current,
|
current: current,
|
||||||
type: 'neighborhoodBanner',
|
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@ -141,7 +123,7 @@ function handleDelete({ id }) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
; (async () => {
|
; (async () => {
|
||||||
try {
|
try {
|
||||||
const { success } = await apis.imgmgt.delMenu(id).catch(() => {
|
const { success } = await apis.mutualComment.delMenu(id).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
if (config('http.code.success') === success) {
|
if (config('http.code.success') === success) {
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
// CommentItem.js
|
||||||
|
import { h } from 'vue'
|
||||||
|
|
||||||
|
export const CommentItem = {
|
||||||
|
name: 'CommentItem',
|
||||||
|
props: {
|
||||||
|
comment: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
// 可选:添加深度限制防止无限递归
|
||||||
|
depth: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
// 日期格式化函数
|
||||||
|
const formatDate = (dateString) => {
|
||||||
|
return new Date(dateString).toLocaleString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回渲染函数
|
||||||
|
return () => {
|
||||||
|
const { comment, depth } = props
|
||||||
|
// 创建子评论元素(递归部分)
|
||||||
|
let childComments = null
|
||||||
|
if (comment.children?.length && depth < 10) {
|
||||||
|
// 限制最大深度为10层
|
||||||
|
childComments = h(
|
||||||
|
'div',
|
||||||
|
{ class: 'replies' },
|
||||||
|
comment.children.map((child) =>
|
||||||
|
h(CommentItem, {
|
||||||
|
comment: child,
|
||||||
|
key: child.id,
|
||||||
|
depth: depth + 1, // 传递增加后的深度
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建主组件结构
|
||||||
|
return h('div', { class: 'comment' }, [
|
||||||
|
// 评论头部
|
||||||
|
h('div', { class: 'comment-header' }, [
|
||||||
|
h('span', { class: 'username' }, comment.pusherName),
|
||||||
|
h('span', { class: 'time' }, formatDate(comment.createdAt)),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// 评论内容
|
||||||
|
h('div', { class: 'comment-content' }, comment.content),
|
||||||
|
|
||||||
|
// 子评论容器
|
||||||
|
childComments,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
160
src/views/pages/nbdMutual/nbdMutualAid/components/EditDialog.vue
Normal file
160
src/views/pages/nbdMutual/nbdMutualAid/components/EditDialog.vue
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleCancel" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'用户名称'" name="customerName">
|
||||||
|
<a-input v-model:value="formData.customerName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'求助标题'" name="title">
|
||||||
|
<a-input v-model:value="formData.title"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'创建时间'" name="createdAt">
|
||||||
|
<a-date-picker v-model:value="formData.createdAt" style="width: 100%;"></a-date-picker>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status"
|
||||||
|
:options="nbdMutualStatus.getAll()" disabled></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'内容'" name="content">
|
||||||
|
<a-textarea v-model:value="formData.content"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'备注'" name="remark">
|
||||||
|
<a-input v-model:value="formData.remark"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'图片'" name="images">
|
||||||
|
<a-image :width="200" v-for="item in formData.images" :src="config('http.apiBasic')+item" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { nbdMutualStatus } from '@/enums/index.js'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
formRules.value = {
|
||||||
|
// customerName: { required: true, message: '', trigger: 'change' },
|
||||||
|
// status: { required: true, message: '请选择审核状态', trigger: 'change' },
|
||||||
|
// remark: [{ required: true, message: '请输入备注', trigger: 'remark' }],
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑',
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
showSpining()
|
||||||
|
const { data, success } = await apis.nbdMutuaAid.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hideSpining()
|
||||||
|
formData.value = { ...data }
|
||||||
|
formData.value.createdAt=dayjs(data.createdAt)
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
id: formData.value.id,
|
||||||
|
status: formData.value.status,
|
||||||
|
remark: formData.value.remark
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.nbdMutualAid.createMenu(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.nbdMutualAid.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
307
src/views/pages/nbdMutual/nbdMutualAid/index.vue
Normal file
307
src/views/pages/nbdMutual/nbdMutualAid/index.vue
Normal file
@ -0,0 +1,307 @@
|
|||||||
|
<template>
|
||||||
|
<x-search-bar class="mb-8-2">
|
||||||
|
<template #default="{ gutter, colSpan }">
|
||||||
|
<a-form :model="searchFormData" layout="inline">
|
||||||
|
<a-row :gutter="gutter">
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item label="用户名称:" name="userName">
|
||||||
|
<a-input placeholder="请输入用户名称" v-model:value="searchFormData.userName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-select v-model:value="searchFormData.status" allowClear>
|
||||||
|
<a-select-option v-for="item of nbdMutualStatus.getAll()" :value="item.value">{{
|
||||||
|
item.label }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
|
{{ $t('button.search') }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</x-search-bar>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'avator' === column.dataIndex">
|
||||||
|
<a-image :width="60"
|
||||||
|
:src="record.avator ? config('http.apiBasic') + record.avator : errImg" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="nbdMutualStatus.getColor(record.status)">{{
|
||||||
|
nbdMutualStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'createdAt' === column.dataIndex">
|
||||||
|
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="'title' === column.dataIndex">
|
||||||
|
<a-tooltip :title="record.title">
|
||||||
|
<span>{{ record.title }}</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<template v-if="'content' === column.dataIndex">
|
||||||
|
<a-tooltip :title="record.content">
|
||||||
|
<span>{{ record.content }}</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<template v-if="'remark' === column.dataIndex">
|
||||||
|
<a-tooltip :title="record.remark">
|
||||||
|
<span>{{ record.remark }}</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record, 'audit')" v-if="record.status === 1">
|
||||||
|
<a-tooltip :title="'审核'">
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
|
<a-tooltip :title="'详情'">
|
||||||
|
<i class="iconfont icon-xiangqing" style='font-size:16px;'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(record)">
|
||||||
|
<a-tooltip :title="'评论列表'">
|
||||||
|
<i class="iconfont icon-lishi" style='font-size:16px;color:#666666'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal v-model:open="open" :title="'审核'" @ok="handleClick">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item label="审核" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus">
|
||||||
|
<a-radio :value="2">通过</a-radio>
|
||||||
|
<a-radio :value="99">不通过</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="备注" name="">
|
||||||
|
<a-textarea :placeholder="'请输入审核备注'" v-model:value="remark"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 5 }"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<a-modal v-model:open="historyOpen" :title="'历史记录'" @ok="historyOpen = false">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<p>{{ nbdMutualAidInfo.content }}</p>
|
||||||
|
<div v-if="nbdMutualAidInfo.histories.length > 0">
|
||||||
|
<comment-item v-for="comment in nbdMutualAidInfo.histories" :key="comment.id" :comment="comment" />
|
||||||
|
</div>
|
||||||
|
<span v-else>暂无记录...</span>
|
||||||
|
</a-card>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination, useSpining } from '@/hooks'
|
||||||
|
import { CommentItem } from './components/CommentItem.js';
|
||||||
|
import errImg from '@/assets/blankSpace.png'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { nbdMutualStatus } from '@/enums/index.js'
|
||||||
|
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
defineOptions({
|
||||||
|
name: 'nbdMutuaAid',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '用户名称', dataIndex: 'customerName', key: 'customerName', width: 120 },
|
||||||
|
{ title: '求助标题', dataIndex: 'title', width: 120, align: 'center', ellipsis: true },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: '创建时间', dataIndex: 'createdAt', width: 160, align: 'center' },
|
||||||
|
{ title: '内容', dataIndex: 'content', align: 'center', ellipsis: true },
|
||||||
|
{ title: '备注', dataIndex: 'remark', align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 140, align: 'center' },
|
||||||
|
]
|
||||||
|
const historyList = ref([])
|
||||||
|
const historyOpen = ref(false)
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const open = ref(false)
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const remark = ref('')
|
||||||
|
const editDialogRef = ref()
|
||||||
|
const currentInfo = ref({})
|
||||||
|
const nbdMutualAidInfo = ref({})
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.nbdMutuaAid
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
//筛选type的值80对应about
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (obj = {}, type) => {
|
||||||
|
currentInfo.value = obj
|
||||||
|
if (type === 'audit') {
|
||||||
|
open.value = true
|
||||||
|
} else {
|
||||||
|
// imgOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleClick = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentInfo.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.nbdMutuaAid.updateMenu(currentInfo.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
message.success('已审核')
|
||||||
|
open.value = false
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 评论列表
|
||||||
|
*/
|
||||||
|
const handleDelete = async ({ id }) => {
|
||||||
|
try {
|
||||||
|
historyOpen.value = true
|
||||||
|
showSpining()
|
||||||
|
const { success, data } = await apis.nbdMutuaAid.getList(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
nbdMutualAidInfo.value = { ...data }
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideSpining()
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
/* 全局评论样式 */
|
||||||
|
.comment {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
color: #888;
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-content {
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.replies {
|
||||||
|
margin-top: 15px;
|
||||||
|
margin-left: 30px;
|
||||||
|
padding-left: 15px;
|
||||||
|
border-left: 2px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,163 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
|
||||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
|
||||||
<a-spin :spinning="spining">
|
|
||||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
|
||||||
<a-card class="mb-8-2">
|
|
||||||
<a-row :gutter="12">
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'名称'" name="title">
|
|
||||||
<a-input :placeholder="'请输入名称'" v-model:value="formData.title"></a-input>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'顺序'" name="sequence">
|
|
||||||
<a-input-number :placeholder="'请输入顺序'" v-model:value="formData.sequence" style="width: 100%;"></a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'状态'" name="status">
|
|
||||||
<a-form-item :label="'状态'" name="status">
|
|
||||||
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'图片'" name="img">
|
|
||||||
<gx-upload v-model="formData.img" :fileNumber="1" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-card>
|
|
||||||
</a-form>
|
|
||||||
</a-spin>
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { cloneDeep } from 'lodash-es'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { config } from '@/config'
|
|
||||||
import apis from '@/apis'
|
|
||||||
import { useForm, useModal, useSpining } from '@/hooks'
|
|
||||||
import { message } from 'ant-design-vue'
|
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt'
|
|
||||||
import {spliceUrl} from '@/utils/util'
|
|
||||||
const emit = defineEmits(['ok'])
|
|
||||||
const { t } = useI18n() // 解构出t方法
|
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
|
||||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
|
||||||
const { spining, showSpining, hideSpining } = useSpining()
|
|
||||||
const cancelText = ref(t('button.cancel'))
|
|
||||||
const okText = ref(t('button.confirm'))
|
|
||||||
const rolesValue = ref([])
|
|
||||||
const roles = ref([])
|
|
||||||
const img = ref('')
|
|
||||||
|
|
||||||
formRules.value = {
|
|
||||||
title: { required: true, message: '请输入名称' },
|
|
||||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
|
||||||
sequence: [{ required: true, message: '请选择顺序', trigger: 'change' }],
|
|
||||||
img: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新建
|
|
||||||
*/
|
|
||||||
function handleCreate() {
|
|
||||||
showModal({
|
|
||||||
type: 'create',
|
|
||||||
// 80对应about
|
|
||||||
title: '添加',
|
|
||||||
})
|
|
||||||
formData.value.status = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
*/
|
|
||||||
async function handleEdit(record = {}) {
|
|
||||||
showModal({
|
|
||||||
type: 'edit',
|
|
||||||
title: t('pages.system.user.edit'),
|
|
||||||
})
|
|
||||||
showSpining()
|
|
||||||
const { data, success } = await apis.imgmgt.getMenu(record.id).catch()
|
|
||||||
if (!success) {
|
|
||||||
hideModal()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
hideSpining()
|
|
||||||
formData.value = { ...data }
|
|
||||||
formData.value.img=[config('http.apiBasic')+data.img]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确定
|
|
||||||
*/
|
|
||||||
function handleOk() {
|
|
||||||
if (!formData.value.img) return message.error('请上传图片');
|
|
||||||
formRef.value.validateFields().then(async (values) => {
|
|
||||||
console.log(values)
|
|
||||||
try {
|
|
||||||
showLoading()
|
|
||||||
const params = {
|
|
||||||
...values,
|
|
||||||
img: spliceUrl(formData.value?.img[0]),
|
|
||||||
type: 'neighborhoodBanner' ,
|
|
||||||
}
|
|
||||||
let result = null
|
|
||||||
switch (modal.value.type) {
|
|
||||||
case 'create':
|
|
||||||
result = await apis.imgmgt.createMenu(params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case 'edit':
|
|
||||||
// result = await apis.imgmgt.updateMenu(formData.value.id, params).catch(() => {
|
|
||||||
result = await apis.imgmgt.updateMenu(formData.value.id, params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
hideLoading()
|
|
||||||
if (config('http.code.success') === result?.success) {
|
|
||||||
hideModal()
|
|
||||||
emit('ok')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
hideLoading()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.log(e)
|
|
||||||
hideLoading()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消
|
|
||||||
*/
|
|
||||||
function handleCancel() {
|
|
||||||
formData.value.img=['']
|
|
||||||
hideModal()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭后
|
|
||||||
*/
|
|
||||||
function onAfterClose() {
|
|
||||||
resetForm()
|
|
||||||
hideLoading()
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
handleCreate,
|
|
||||||
handleEdit,
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@ -1,35 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
<a-spin :spinning="spining">
|
<a-spin :spinning="spining">
|
||||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
<a-card class="mb-8-2">
|
<a-card class="mb-8-2">
|
||||||
<a-row :gutter="12">
|
<a-row :gutter="12">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item :label="'名称'" name="title">
|
<a-form-item :label="'名称'" name="title">
|
||||||
<a-input :placeholder="'请输入名称'" v-model:value="formData.title"></a-input>
|
<a-input :placeholder="'请输入名称'" v-model:value="formData.title"></a-input>
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'顺序'" name="sequence">
|
|
||||||
<a-input-number :placeholder="'请输入顺序'" v-model:value="formData.sequence" style="width: 100%;"></a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item :label="'状态'" name="status">
|
|
||||||
<a-form-item :label="'状态'" name="status">
|
|
||||||
<a-radio-group v-model:value="formData.status" :options="enumsStatus.getAll()"></a-radio-group>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form-item>
|
</a-col>
|
||||||
</a-col>
|
<a-col :span="24">
|
||||||
<a-col :span="24">
|
<a-form-item :label="'顺序'" name="sequence">
|
||||||
<a-form-item :label="'图片'" name="img">
|
<a-input-number :placeholder="'请输入顺序'" v-model:value="formData.sequence"
|
||||||
<gx-upload v-model="formData.img" :fileNumber="1" />
|
style="width: 100%;"></a-input-number>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
<a-col :span="24">
|
||||||
</a-card>
|
<a-form-item :label="'状态'" name="status">
|
||||||
</a-form>
|
<a-radio-group v-model:value="formData.status"
|
||||||
|
:options="enumsStatus.getAll()"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'图片'" name="img">
|
||||||
|
<gx-upload v-model="formData.img" :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
@ -43,8 +43,8 @@ import { useForm, useModal, useSpining } from '@/hooks'
|
|||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { createMenu, getMenu, updateMenu } from '@/apis/modules/imgmgt'
|
import { enumsStatus } from '@/enums/index.js'
|
||||||
import {spliceUrl} from '@/utils/util'
|
import { spliceUrl } from '@/utils/util'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -72,7 +72,7 @@ function handleCreate() {
|
|||||||
// 80对应about
|
// 80对应about
|
||||||
title: '添加',
|
title: '添加',
|
||||||
})
|
})
|
||||||
formData.value.status = 0
|
formData.value.status = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +91,7 @@ async function handleEdit(record = {}) {
|
|||||||
}
|
}
|
||||||
hideSpining()
|
hideSpining()
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.img=[config('http.apiBasic')+data.img]
|
formData.value.img = [config('http.apiBasic') + data.img]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +106,7 @@ function handleOk() {
|
|||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
img: spliceUrl(formData.value?.img[0]),
|
img: spliceUrl(formData.value?.img[0]),
|
||||||
type: 'neighborhoodBanner' ,
|
scene: 2,
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
@ -142,7 +142,7 @@ function handleOk() {
|
|||||||
* 取消
|
* 取消
|
||||||
*/
|
*/
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
formData.value.img=['']
|
formData.value.img = ['']
|
||||||
hideModal()
|
hideModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<x-search-bar class="mb-8-2">
|
<!-- <x-search-bar class="mb-8-2">
|
||||||
<template #default="{ gutter, colSpan }">
|
<template #default="{ gutter, colSpan }">
|
||||||
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
<a-form :label-col="{ style: { width: '40px' } }" :model="searchFormData" layout="inline">
|
||||||
<a-row :gutter="gutter">
|
<a-row :gutter="gutter">
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="名称" name="name">
|
<a-form-item label="名称" name="title">
|
||||||
<a-input placeholder="请输入图片名称" v-model:value="searchFormData.name"></a-input>
|
<a-input placeholder="请输入图片名称" v-model:value="searchFormData.title"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col v-bind="colSpan">
|
<a-col v-bind="colSpan">
|
||||||
<a-form-item label="状态" name="status">
|
<a-form-item label="状态" name="status">
|
||||||
<a-select v-model:value="searchFormData.status" allowClear>
|
<a-select v-model:value="searchFormData.status" allowClear>
|
||||||
<a-select-option value="">全部</a-select-option>
|
<a-select-option v-for="item of enumsStatus.getAll()" :value="item.value">{{ item.label }}</a-select-option>
|
||||||
<a-select-option value="enabled">启用</a-select-option>
|
|
||||||
<a-select-option value="disabled">停用</a-select-option>
|
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@ -28,7 +26,7 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
</x-search-bar>
|
</x-search-bar> -->
|
||||||
<a-row :gutter="8" :wrap="false">
|
<a-row :gutter="8" :wrap="false">
|
||||||
<a-col flex="auto">
|
<a-col flex="auto">
|
||||||
<a-card type="flex">
|
<a-card type="flex">
|
||||||
@ -112,7 +110,7 @@ async function getPageList() {
|
|||||||
.getDataList({
|
.getDataList({
|
||||||
pageSize,
|
pageSize,
|
||||||
current:current,
|
current:current,
|
||||||
type: 'neighborhoodBanner',
|
scene: 2,
|
||||||
...searchFormData.value,
|
...searchFormData.value,
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
245
src/views/pages/server/serverList/components/EditDialog.vue
Normal file
245
src/views/pages/server/serverList/components/EditDialog.vue
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-tabs v-model:activeKey="activeKey">
|
||||||
|
<a-tab-pane key="1" tab="基本信息">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品分类'" name="typeId">
|
||||||
|
<a-select ref="select" v-model:value="formData.typeId" style="width: 100%">
|
||||||
|
<a-select-option v-for="item in typeList" :value="item.value">{{
|
||||||
|
item.label }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品排序'" name="sequence">
|
||||||
|
<a-input-number :placeholder="'请输入排序'" v-model:value="formData.sequence"
|
||||||
|
style="width: 100%;"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'门店名称'" name="storeName">
|
||||||
|
<a-input :placeholder="'请输入门店名称'" v-model:value="formData.storeName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'营业时间'" name="openAt">
|
||||||
|
<a-input :placeholder="'请输入营业时间'" v-model:value="formData.openAt"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'标签'" name="labels">
|
||||||
|
<a-select v-model:value="formData.labels" mode="tags" style="width: 100%"
|
||||||
|
placeholder="输入标签然后回车"></a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status"
|
||||||
|
:options="enumsStatus.getAll()"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'店铺描述'" name="content">
|
||||||
|
<a-textarea :placeholder="'请输入店铺描述'" v-model:value="content"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 5 }"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item :label="'店铺封面'" name="storeCover">
|
||||||
|
<gx-upload v-model="formData.storeCover" accept-types=".jpg,.png,.webp"
|
||||||
|
:fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item :label="'详情图片'" name="img">
|
||||||
|
<gx-upload v-model="formData.img" accept-types=".jpg,.png,.webp"
|
||||||
|
:fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-tab-pane>
|
||||||
|
<a-tab-pane key="2" tab="位置信息">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item :label="'经度'" name="longitude">
|
||||||
|
<a-input :placeholder="'请输入经度'" v-model:value="formData.longitude"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item :label="'纬度'" name="latitude">
|
||||||
|
<a-input :placeholder="'请输入纬度'" v-model:value="formData.latitude"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'详细地址'" name="storeAddress">
|
||||||
|
<a-input :placeholder="'请输入详细地址'"
|
||||||
|
v-model:value="formData.storeAddress"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<gx-map @handleGetLng="handleGetLng" />
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { enumsStatus } from '@/enums/index.js'
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import { init } from 'echarts'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const typeList = ref([])
|
||||||
|
const searchValue = ref('')
|
||||||
|
const activeKey = ref('1')
|
||||||
|
formRules.value = {
|
||||||
|
typeId: [{ required: true, message: '请选择产品类别名称', trigger: 'change' }],
|
||||||
|
sequence: { required: true, message: '请输入排序' },
|
||||||
|
storeName: { required: true, message: '请输入门店名称' },
|
||||||
|
openAt: { required: true, message: '请输入营业时间' },
|
||||||
|
longitude: { required: true, message: '请输入经度' },
|
||||||
|
latitude: { required: true, message: '请输入纬度' },
|
||||||
|
storeAddress: { required: true, message: '请输入门店地址' },
|
||||||
|
status:{required: true, message: '请选择状态', trigger: 'change'}
|
||||||
|
}
|
||||||
|
const initData = async () => {
|
||||||
|
try {
|
||||||
|
showSpining()
|
||||||
|
const { data, success } = await apis.serverType.getDataList({ pageSize: 99, current: 1 })
|
||||||
|
if (success) {
|
||||||
|
typeList.value = data.map(item => ({ value: item.id, label: item.label }))
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '新增',
|
||||||
|
})
|
||||||
|
initData()
|
||||||
|
formData.value.status = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑',
|
||||||
|
})
|
||||||
|
const { data, success } = await apis.serverList.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.value = { ...data }
|
||||||
|
formData.value.storeCover=data.storeCover?[config('http.apiBasic')+data.storeCover]:''
|
||||||
|
formData.value.img=data.img?[config('http.apiBasic')+data.img]:''
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
console.log(formData.value)
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
storeCover: formData.value.storeCover ? spliceUrl(formData.value.storeCover[0]) : '',
|
||||||
|
img: formData.value.img ? spliceUrl(formData.value.img[0]) : '',
|
||||||
|
latitude: parseFloat(formData.value.latitude),
|
||||||
|
longitude: parseFloat(formData.value.longitude)
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.serverList.createMenu(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.serverList.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleGetLng = (obj = {}) => {
|
||||||
|
formData.value.longitude = obj.lng
|
||||||
|
formData.value.latitude = obj.lat
|
||||||
|
formData.value.storeAddress = obj.address
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
159
src/views/pages/server/serverList/index.vue
Normal file
159
src/views/pages/server/serverList/index.vue
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
新增门店
|
||||||
|
</a-button>
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="enumsStatus.getColor(record.status)">{{ enumsStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>编辑</template>
|
||||||
|
<edit-outlined /> </a-tooltip></x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>撤销</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { enumsStatus } from '@/enums/index.js'
|
||||||
|
defineOptions({
|
||||||
|
name: 'serverList',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '所属分类', dataIndex: 'label' },
|
||||||
|
{ title: '门店名称', dataIndex: 'storeName', ellipsis: true },
|
||||||
|
// { title: '门店封面', dataIndex: 'storeCover' },
|
||||||
|
{ title: '经度', dataIndex: 'longitude' },
|
||||||
|
{ title: '纬度', dataIndex: 'latitude' },
|
||||||
|
{ title: '详细地址', dataIndex: 'storeAddress', ellipsis: true },
|
||||||
|
{ title: '营业时间', dataIndex: 'openAt' },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||||
|
usePagination()
|
||||||
|
|
||||||
|
const editDialogRef = ref()
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.serverList
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function handleDelete(value) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确定撤销该工单吗',
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.serverList.delMenu(value).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
143
src/views/pages/server/serverType/components/EditDialog.vue
Normal file
143
src/views/pages/server/serverType/components/EditDialog.vue
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品分类'" name="label">
|
||||||
|
<a-input :placeholder="'请输入产品分类名称'" v-model:value="formData.label"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品排序'" name="sequence">
|
||||||
|
<a-input-number :placeholder="'请输入排序'"
|
||||||
|
v-model:value="formData.sequence" style="width: 100%;"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<!-- <a-col :span="24">
|
||||||
|
<a-form-item :label="'图标'" name="iconUrl">
|
||||||
|
<gx-upload v-model="formData.iconUrl" accept-types=".jpg,.png,.webp" :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col> -->
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import Http from 'xy-http'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const treeData = ref([])
|
||||||
|
formRules.value = {
|
||||||
|
label: { required: true, message: '请输入产品类别名称' },
|
||||||
|
sequence: { required: true, message: '请输入排序' },
|
||||||
|
iconUrl:{required: true, message: '请上传图标', trigger: 'change'}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({type: 'create',title: '产品分类'})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({type: 'edit',title: '编辑分类'})
|
||||||
|
const { data, success } = await apis.serverType.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.value = { ...data }
|
||||||
|
formData.value.iconUrl=[config('http.apiBasic')+data.iconUrl]
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
iconUrl:formData.value.iconUrl?spliceUrl(formData.value.iconUrl[0]):''
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.serverType.createMenu(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.serverType.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
160
src/views/pages/server/serverType/index.vue
Normal file
160
src/views/pages/server/serverType/index.vue
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
新增分类
|
||||||
|
</a-button>
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'iconUrl'===column.dataIndex">
|
||||||
|
<a-image :width="60" :src="record.iconUrl?config('http.apiBasic')+record.iconUrl:errImg" />
|
||||||
|
</template>
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="orderStatus.getColor(record.status)">{{ orderStatus.getName(record.status)}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>编辑分类</template>
|
||||||
|
<edit-outlined /> </a-tooltip></x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { orderStatus } from '@/enums/index.js'
|
||||||
|
import errImg from '@/assets/blankSpace.png'
|
||||||
|
defineOptions({
|
||||||
|
name: 'serverType',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '分类名称', dataIndex: 'label' },
|
||||||
|
// { title: '图标', dataIndex: 'iconUrl' },
|
||||||
|
{ title: '分类排序', dataIndex: 'sequence' },
|
||||||
|
// { title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||||
|
usePagination()
|
||||||
|
|
||||||
|
const editDialogRef = ref()
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.serverType
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function handleDelete(value) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确定删除该分类吗',
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.serverType.delMenu(value).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
232
src/views/pages/user/index.vue
Normal file
232
src/views/pages/user/index.vue
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
<template>
|
||||||
|
<!-- <x-search-bar class="mb-8-2">
|
||||||
|
<template #default="{ gutter, colSpan }">
|
||||||
|
<a-form :model="searchFormData" layout="inline">
|
||||||
|
<a-row :gutter="gutter">
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item label="登录账号" name="username">
|
||||||
|
<a-input placeholder="请输入登录账号" v-model:value="searchFormData.username"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item label="用户名称" name="name">
|
||||||
|
<a-input placeholder="请输入用户名称" v-model:value="searchFormData.name"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-select v-model:value="searchFormData.status" allowClear>
|
||||||
|
<a-select-option v-for="item of userStatus.getAll()" :value="item.value">{{
|
||||||
|
item.label }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
|
{{ $t('button.search') }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</x-search-bar> -->
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<a-table :columns="columns" :data-source="listData" :loading="loading" bordered="true"
|
||||||
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.dataIndex === 'avatar'">
|
||||||
|
<a-image :width="45" :src="record.avatar ? config('http.apiBasic') + record.avatar : errImg" />
|
||||||
|
</template>
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="userStatus.getColor(record.status)">{{
|
||||||
|
userStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'createdAt' === column.dataIndex">
|
||||||
|
{{ dayjs(record.createdAt).format('YYYY-MM-DD') }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '编辑' }}</template>
|
||||||
|
<edit-outlined />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal :open="modal.open" :title="'编辑'" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
ok-text="确认" cancel-text="取消" @ok="handleAuditEdit" @cancel="hideModal()">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'编辑'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="userStatus.getAll()"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<!-- <a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item> -->
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<add-dialog ref="addDialogRef" @ok="onOk"></add-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { userStatus } from '@/enums/index.js'
|
||||||
|
import { usePagination,useModal } from '@/hooks'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import errImg from '@/assets/blankSpace.png'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'systemRole',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '头像', dataIndex: 'avatar', key: 'avatar', with: 50, align: 'center' },
|
||||||
|
{ title: '用户名', dataIndex: 'name', key: 'name'},
|
||||||
|
{ title: '手机号', dataIndex: 'phone'},
|
||||||
|
{ title: '简介', dataIndex: 'introduce',align: 'center' },
|
||||||
|
{ title: '状态', key: 'status', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: '创建时间', dataIndex: 'createdAt', width: 200, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 140, align: 'center' },
|
||||||
|
]
|
||||||
|
const { modal, showModal, hideModal, showLoading:auditShowLoading, hideLoading:auditHideLoading } = useModal()
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } = usePagination()
|
||||||
|
// const { resetForm } = useForm()
|
||||||
|
const addDialogRef = ref()
|
||||||
|
const currentForm=ref({})
|
||||||
|
const auditStatus=ref(2)
|
||||||
|
const remark=ref('')
|
||||||
|
getPageList()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公公告列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.customer
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
*/
|
||||||
|
function handleRemove({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('pages.system.role.delTip'),
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.customer.delNotices(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
auditStatus.value=params.status
|
||||||
|
showModal()
|
||||||
|
}
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
auditShowLoading()
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
}
|
||||||
|
console.log(params);
|
||||||
|
const result = await apis.customer.updateMenu(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
auditHideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
getPageList()
|
||||||
|
message.success('编辑成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
auditHideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
163
src/views/pages/workOrder/orderList/components/EditDialog.vue
Normal file
163
src/views/pages/workOrder/orderList/components/EditDialog.vue
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'用户名'" name="customerName">
|
||||||
|
<a-input :placeholder="'请输入用户名'" v-model:value="formData.customerName"
|
||||||
|
></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工单分类'" name="label">
|
||||||
|
<a-input :placeholder="'请输入工单分类'" v-model:value="formData.label" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工单内容'" name="content">
|
||||||
|
<a-textarea :placeholder="'请输入工单内容'" v-model:value="formData.content"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 5 }" ></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'工作地点'" name="address">
|
||||||
|
<a-input :placeholder="'请输入工作地点'" v-model:value="formData.address" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'创建时间'" name="createAt">
|
||||||
|
<a-input :placeholder="'请输入创建时间'" v-model:value="formData.createAt" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'上门时间'" name="startAt">
|
||||||
|
<a-input :placeholder="'请输入上门时间'" v-model:value="formData.startAt" ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import { readonly } from 'vue'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const treeData = ref([])
|
||||||
|
const status=ref(2)
|
||||||
|
const remark=ref('')
|
||||||
|
formRules.value = {
|
||||||
|
label: { required: true, message: '请输入产品类别名称' },
|
||||||
|
sequence: { required: true, message: '请输入排序' }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '产品分类',
|
||||||
|
})
|
||||||
|
// 初始化所有字段
|
||||||
|
initData()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑分类',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
status:status.value,
|
||||||
|
remark:status.remark
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.orderList.createProductsItem(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.orderList.updateItem(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
230
src/views/pages/workOrder/orderList/index.vue
Normal file
230
src/views/pages/workOrder/orderList/index.vue
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'url' === column.dataIndex">
|
||||||
|
<a-button type="link" @click="auditHandleEdit(record, 'img')">点击查看</a-button>
|
||||||
|
</template>
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="orderStatus.getColor(record.status)">{{
|
||||||
|
orderStatus.getName(record.status) }}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="auditHandleEdit(record, 'audit')" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '审核' }}</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(record)" v-if="record.status!==98">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>撤销</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal v-model:open="open" :title="'审核'" @ok="handleClick">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
|
||||||
|
<a-form-item label="审核" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus">
|
||||||
|
<a-radio :value="2">通过</a-radio>
|
||||||
|
<a-radio :value="99">不通过</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="备注" name="">
|
||||||
|
<a-textarea :placeholder="'请输入审核备注'" v-model:value="remark"
|
||||||
|
:auto-size="{ minRows: 2, maxRows: 5 }"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<a-modal v-model:open="imgOpen" :title="'图片/视频'" @ok="imgOpen = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'图片'" name="images">
|
||||||
|
<template v-if="currentInfo.images && currentInfo.images.length > 0">
|
||||||
|
<a-image-preview-group>
|
||||||
|
<a-image v-for="item in currentInfo.images" :width="200"
|
||||||
|
:src="config('http.apiBasic') + item" />
|
||||||
|
</a-image-preview-group>
|
||||||
|
</template>
|
||||||
|
<template v-else>暂无</template>
|
||||||
|
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="视频" name="video">
|
||||||
|
<template v-if="currentInfo.videos && currentInfo.videos.length > 0">
|
||||||
|
<video width="320" height="240" controls>
|
||||||
|
<source v-for="item in currentInfo.videos" :src="config('http.apiBasic') + item">
|
||||||
|
</video>
|
||||||
|
</template>
|
||||||
|
<template>暂无</template>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { orderStatus } from '@/enums/index.js'
|
||||||
|
import { status } from 'nprogress'
|
||||||
|
defineOptions({
|
||||||
|
name: 'orderList',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '用户名称', dataIndex: 'customerName' },
|
||||||
|
{ title: '工单分类', dataIndex: 'label' },
|
||||||
|
{ title: '工单标题', dataIndex: 'title', ellipsis: true },
|
||||||
|
{ title: '工单内容', dataIndex: 'content', ellipsis: true },
|
||||||
|
{ title: '图片/视频', dataIndex: 'url', width: 120,align:'center' },
|
||||||
|
{ title: '工作地点', dataIndex: 'address', ellipsis: true },
|
||||||
|
{ title: '创建时间', dataIndex: 'createAt' },
|
||||||
|
{ title: '上门时间', dataIndex: 'startAt' },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||||
|
const remark = ref('')
|
||||||
|
const currentInfo = ref({})
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const editDialogRef = ref()
|
||||||
|
const open = ref(false)
|
||||||
|
const imgOpen=ref(false)
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.orderList
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (obj = {}, type) => {
|
||||||
|
currentInfo.value = obj
|
||||||
|
if (type === 'audit') {
|
||||||
|
open.value = true
|
||||||
|
} else {
|
||||||
|
imgOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleClick = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentInfo.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.orderList.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
message.success('已审核')
|
||||||
|
open.value=false
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function handleDelete(value) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确定撤销该工单吗',
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const params={
|
||||||
|
...value,
|
||||||
|
status:98
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
const { success } = await apis.orderList.updateMenu(value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success('撤销成功')
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
153
src/views/pages/workOrder/orderType/components/EditDialog.vue
Normal file
153
src/views/pages/workOrder/orderType/components/EditDialog.vue
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品分类'" name="label">
|
||||||
|
<a-input :placeholder="'请输入产品分类名称'" v-model:value="formData.label"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'产品排序'" name="sequence">
|
||||||
|
<a-input-number :placeholder="'请输入排序'" v-model:value="formData.sequence"
|
||||||
|
style="width: 100%;"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status" :options="workTypeStatus.getAll()" disabled></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref, onBeforeMount } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { workTypeStatus } from '@/enums/index.js'
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
const areaFormRef = ref()
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const treeData = ref([])
|
||||||
|
formRules.value = {
|
||||||
|
label: { required: true, message: '请输入产品类别名称' },
|
||||||
|
sequence: { required: true, message: '请输入排序' },
|
||||||
|
status: { required: true, message: '请选择状态', trigger: 'change' }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: '新增分类',
|
||||||
|
})
|
||||||
|
formData.value.status=1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: '编辑分类',
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
showSpining()
|
||||||
|
const { data, success } = await apis.orderType.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hideSpining()
|
||||||
|
formData.value = { ...data }
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideSpining()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.orderType.createMenu(params).catch((error) => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.orderType.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error(error)
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error({ content: error.message })
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
170
src/views/pages/workOrder/orderType/index.vue
Normal file
170
src/views/pages/workOrder/orderType/index.vue
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
新增分类
|
||||||
|
</a-button>
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="workTypeStatus.getColor(record.status)">{{
|
||||||
|
workTypeStatus.getName(record.status) }}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>编辑分类</template>
|
||||||
|
<edit-outlined />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title>审核</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-modal :open="open" :title="'审核'" :width="640" title="审核" ok-text="确认" cancel-text="取消" @ok="handleAuditEdit"
|
||||||
|
@cancel="open = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '不通过' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { workTypeStatus } from '@/enums/index.js'
|
||||||
|
defineOptions({
|
||||||
|
name: 'orderType',
|
||||||
|
})
|
||||||
|
const currentForm = ref({})
|
||||||
|
const open = ref(false)
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const remark = ref('')
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '分类名称', dataIndex: 'label' },
|
||||||
|
{ title: '分类排序', dataIndex: 'sequence' },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||||
|
]
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||||
|
usePagination()
|
||||||
|
|
||||||
|
const editDialogRef = ref()
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.orderType
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
listData.value = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
key: item.value
|
||||||
|
}))
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
open.value = true
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.orderType.updateMenu(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
getPageList()
|
||||||
|
open.value = false
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -239,7 +239,6 @@ function handleDelete({ id }) {
|
|||||||
* 编辑完成
|
* 编辑完成
|
||||||
*/
|
*/
|
||||||
async function onOk() {
|
async function onOk() {
|
||||||
message.success(t('component.message.success.delete'))
|
|
||||||
await getMenuList()
|
await getMenuList()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -138,6 +138,11 @@
|
|||||||
"@algolia/logger-common" "4.19.1"
|
"@algolia/logger-common" "4.19.1"
|
||||||
"@algolia/requester-common" "4.19.1"
|
"@algolia/requester-common" "4.19.1"
|
||||||
|
|
||||||
|
"@amap/amap-jsapi-loader@^1.0.1":
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz"
|
||||||
|
integrity sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==
|
||||||
|
|
||||||
"@ant-design/colors@^6.0.0":
|
"@ant-design/colors@^6.0.0":
|
||||||
version "6.0.0"
|
version "6.0.0"
|
||||||
resolved "https://registry.npmmirror.com/@ant-design/colors/-/colors-6.0.0.tgz"
|
resolved "https://registry.npmmirror.com/@ant-design/colors/-/colors-6.0.0.tgz"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user