楼盘列表

This commit is contained in:
Leo_Ding 2025-06-26 17:04:17 +08:00
parent 8b77e6a688
commit 65230a42e4
17 changed files with 765 additions and 769 deletions

14
src/apis/modules/house.js Normal file
View File

@ -0,0 +1,14 @@
/**
* 区域模块接口
*/
import request from '@/utils/request'
// 获取项目列表
export const getProjectList = (params) => request.basic.get('/api/v1/houses', params)
// 获取单挑数据
export const getItem = (id) => request.basic.get(`/api/v1/houses/${id}`)
// 添加条目
export const createProject = (params) => request.basic.post('/api/v1/houses', params)
// 更新role
export const updateItem = (id, params) => request.basic.put(`/api/v1/houses/${id}`, params)
// 删除数据
export const delItem = (id) => request.basic.delete(`/api/v1/houses/${id}`)

BIN
src/assets/upload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -2,13 +2,14 @@
<div class="clearfix">
<a-upload list-type="picture-card" :multiple="multiple" v-model:file-list="fileList" @preview="handlePreview"
@change="handleChange" :customRequest="handleCustomRequest" :beforeUpload="beforeUpload">
<div v-if="fileList.length < fileNumber">
<div v-if="fileList.length < fileNumber" >
<plus-outlined />
<div class="ant-upload-text">上传</div>
</div>
</a-upload>
<a-modal :open="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
<img alt="example" v-if="fileType==='img'" style="width: 100%" :src="previewImage" />
<video v-if="fileType==='video'" :src="previewImage" controls autoplay loop muted ></video>
</a-modal>
</div>
</template>
@ -20,6 +21,11 @@ import { UploadOutlined } from '@ant-design/icons-vue';
import { message } from 'ant-design-vue';
import { config } from '@/config'
import apis from '@/apis'
defineOptions({
name: 'GxUpload',
})
const fileType=ref('img')
const previewVisible = ref(false)
const previewImage = ref('')
const props = defineProps({
@ -31,7 +37,15 @@ const props = defineProps({
listType: { type: String, default: 'text' },
disabled: { type: Boolean, default: false },
uploadText: { type: String },
fileNumber: { type: Number, default: 6 }
fileNumber: { type: Number, default: 6 },
width: {
type: Number,
default: 120,
},
height: {
type: Number,
default: 120,
},
});
const emit = defineEmits(['update:modelValue', 'uploadSuccess', 'uploadError']);
@ -49,18 +63,18 @@ onMounted(() => {
});
//
const beforeUpload = (file) => {
const isValidType = props.acceptTypes === '*' ||
props.acceptTypes.split(',').some(type => file.name.endsWith(type.replace('*', '')));
const isValidSize = file.size / 1024 / 1024 < props.maxSize;
// const isValidType = props.acceptTypes === '*' ||
// props.acceptTypes.split(',').some(type => file.name.endsWith(type.replace('*', '')));
// const isValidSize = file.size / 1024 / 1024 < props.maxSize;
if (!isValidType) {
message.error(`仅支持 ${props.acceptTypes} 格式文件`);
return false;
}
if (!isValidSize) {
message.error(`文件大小不能超过 ${props.maxSize}MB`);
return false;
}
// if (!isValidType) {
// message.error(` ${props.acceptTypes} `);
// return false;
// }
// if (!isValidSize) {
// message.error(` ${props.maxSize}MB`);
// return false;
// }
return true;
};
const handleCancel = () => {
@ -75,10 +89,17 @@ const getBase64 = (file) => {
});
}
const handlePreview = async (file) => {
console.log(file.name)
const list=['.avi','.mp4','.mov','.wmv','.mkv','.m4v']
const fileSuffix=file.name.substring(file.name.lastIndexOf('.'))
if(list.includes(fileSuffix)){
fileType.value='video'
}
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj)
}
previewImage.value = file.url || file.preview;
console.log(previewImage.value)
previewVisible.value = true;
};

View File

@ -19,6 +19,7 @@ import UploadImage from './Upload/UploadImage.vue'
import UploadInput from './Upload/UploadInput.vue'
import Scrollbar from './Scrollbar/Scrollbar.vue'
import Cascader from './Cascader/Cascader.vue'
import GxUpload from './GxUpload/index.vue'
import { setupLoadingDirective } from './Loading/directive'
const componentList = [
@ -41,6 +42,7 @@ const componentList = [
UploadInput,
Scrollbar,
Cascader,
GxUpload
]
export const loading = Loading

View File

@ -47,9 +47,9 @@ export default {
equityGoods: '权益商品',
regional: '区域模块',
regionalList: '区域列表 ',
projectList: '项目列表',
projectList: '案场列表',
hoseBookList: '房刊列表',
houseList: '房源列表',
houseList: '楼盘列表',
announcement: '消息公告',
announcementList: '公告列表',
bannberTypeList: '轮播图分类列表',
@ -65,5 +65,5 @@ export default {
erCodeList: '二维码列表',
order:"权益订单",
points:'积分列表',
activity:'案场活动'
activity:'活动列表'
}

View File

@ -7,7 +7,7 @@ export default [
component: 'activity/index.vue',
meta: {
icon: CoffeeOutlined,
title: '案场活动',
title: '活动列表',
isMenu: true,
keepAlive: true,
permission: '*',

View File

@ -30,7 +30,7 @@ export default [
name: 'projectList',
component: 'regional/projectList/index.vue',
meta: {
title: '项目列表',
title: '案场列表',
isMenu: true,
keepAlive: true,
permission: '*',
@ -52,7 +52,7 @@ export default [
name: 'houseList',
component: 'regional/houseList/index.vue',
meta: {
title: '房源列表',
title: '楼盘列表',
isMenu: true,
keepAlive: true,
permission: '*',

View File

@ -328,3 +328,9 @@ export const myTrim = (str, char, type = 'right') => {
}
return str.replace(/^\s+|\s+$/g, '')
}
/**截取图片路径域名部分 */
export const spliceUrl=(fullUrl)=>{
if(!fullUrl) return null
const pathOnly = fullUrl.replace(/^https?:\/\/[^\/]+/, '');
return pathOnly
}

View File

@ -74,11 +74,7 @@
<a-tooltip>
<template #title> {{ $t('pages.system.user.edit') }}</template>
<edit-outlined /> </a-tooltip></x-action-button>
<x-action-button @click="createQrcode(record)">
<a-tooltip>
<template #title>二维码</template>
<QrcodeOutlined />
</a-tooltip></x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
@ -102,11 +98,7 @@
</template>
</a-modal>
<a-modal v-model:open="qropen" :title="'生成二维码'" @ok="qropen = false" :footer="null">
<a-card class="mb-8-2" style="display: flex;align-items: center;flex-direction: column;justify-content: center;">
<x-qrCode :value="qrValue" :icon="qrlogo" :iconBackgroundColor="'#ffffff'" :size="180"></x-qrCode>
</a-card>
</a-modal>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
</template>
@ -122,7 +114,7 @@ import { customersEnum, areaEnum } from "@/enums/useEnum"
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined, QrcodeOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import qrlogo from '@/assets/qrlogo.png'
defineOptions({
name: 'activity',
})
@ -130,9 +122,7 @@ const { t } = useI18n() // 解构出t方法
const open = ref(false)
const imgList = ref([])
const type = ref(1)
const content = ref('')
const qrValue = ref('')
const qropen = ref(false)
const columns = [
{ title: '活动标题', dataIndex: 'title', width: 200 },
{ title: '活动时间', dataIndex: 'startAt', width: 300, align: 'center' },
@ -209,10 +199,7 @@ function handleDelete({ id }) {
},
})
}
const createQrcode = (params) => {
qrValue.value = 'ceshi'
qropen.value = true
}
/**
* 分页
*/

View File

@ -1,169 +0,0 @@
<template>
<a-card
:body-style="{ height: 'calc(100% - 56px - 47px)', padding: 0 }"
:style="{
position: 'sticky',
top: appStore.mainOffsetTop,
height: appStore.mainHeight,
}">
<template #title>
<a-input-search placeholder="搜索部门"></a-input-search>
</template>
<x-scrollbar class="pa-8-2">
<a-spin :spinning="loading">
<a-tree
block-node
:selected-keys="selectedKeys"
:tree-data="listData"
:field-names="{ key: 'id', children: 'children' }"
@select="onSelect">
<template #title="{ title }">
<span class="ant-tree-title__name">{{ title }}</span>
<span class="ant-tree-title__actions">
<a-dropdown
:trigger="['click']"
@click.stop>
<x-action-button>
<more-outlined></more-outlined>
</x-action-button>
<template #overlay>
<a-menu>
<a-menu-item @click="$refs.editDepartmentDialogRef.handleEdit()">
添加子部门
</a-menu-item>
<a-menu-item @click="$refs.editDepartmentDialogRef.handleEdit()">
编辑
</a-menu-item>
<a-menu-item @click="handleDelete">删除</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
</template>
</a-tree>
<empty
v-if="!listData.length"
:image="Empty.PRESENTED_IMAGE_SIMPLE"></empty>
</a-spin>
</x-scrollbar>
<template #actions>
<span @click="$refs.editDepartmentDialogRef.handleCreate()">
<plus-outlined></plus-outlined>
新建部门
</span>
</template>
</a-card>
<edit-department-dialog
ref="editDepartmentDialogRef"
@ok="onOk"></edit-department-dialog>
</template>
<script setup>
import { useAppStore } from '@/store'
import { ref, watch } from 'vue'
import { usePagination } from '@/hooks'
import apis from '@/apis'
import { Empty, Modal, message } from 'ant-design-vue'
import { config } from '@/config'
import { head, get, find } from 'lodash-es'
import { MoreOutlined, PlusOutlined } from '@ant-design/icons-vue'
import EditDepartmentDialog from './EditDepartmentDialog.vue'
const props = defineProps({
value: {
type: String,
default: '',
},
})
const emit = defineEmits(['change', 'update:value'])
const appStore = useAppStore()
const { listData, loading, showLoading, hideLoading } = usePagination()
const editDepartmentDialogRef = ref()
const selectedKeys = ref([props.value])
watch(
() => props.value,
(val) => {
if (val === selectedKeys.value?.[0]) return
selectedKeys.value = [val]
}
)
getList()
/**
* 获取列表
* @returns {Promise<void>}
*/
async function getList() {
try {
showLoading()
const { code, data } = await apis.common.getPageList().catch(() => {
throw new Error()
})
hideLoading()
if (config('http.code.success') === code) {
const { records } = data
listData.value = records
if (listData.value.length) {
selectedKeys.value = [get(head(listData.value), 'id')]
trigger()
}
}
} catch (error) {
hideLoading()
}
}
/**
* 删除
*/
function handleDelete({ id }) {
Modal.confirm({
title: '删除提示',
content: '确认删除?',
okText: '确认',
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
try {
const { code } = await apis.common.del(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === code) {
resolve()
message.success('删除成功')
await getList()
}
} catch (error) {
reject()
}
})()
})
},
})
}
function onSelect(keys) {
if (!keys.length) return
selectedKeys.value = keys
trigger()
}
async function onOk() {
await getList()
}
function trigger() {
const value = head(selectedKeys.value)
const record = find(listData.value, { id: value })
emit('update:value', value)
emit('change', record)
}
</script>
<style lang="less" scoped></style>

View File

@ -1,131 +0,0 @@
<template>
<a-modal
:open="modal.open"
:title="modal.title"
:width="480"
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
:cancel-text="cancelText"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '90px' } }">
<a-form-item
label="部门名称"
name="name">
<a-input v-model:value="formData.name"></a-input>
</a-form-item>
<a-form-item
label="上级部门"
name="parent_id">
<a-tree-select v-model:value="formData.parent_id"></a-tree-select>
</a-form-item>
<a-form-item
label="部门负责人"
name="name">
<a-input v-model:value="formData.name"></a-input>
</a-form-item>
</a-form>
</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 } from '@/hooks'
const emit = defineEmits(['ok'])
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '新建部门',
})
}
/**
* 编辑
*/
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑部门',
})
formRecord.value = record
formData.value = cloneDeep(record)
}
/**
* 确定
*/
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.common.create(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.common.update(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
cancelText.value = '取消'
hideLoading()
}
defineExpose({
handleCreate,
handleEdit,
})
</script>
<style lang="less" scoped></style>

View File

@ -1,155 +1,68 @@
<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-form
ref="formRef"
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '90px' } }">
<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="12">
<a-form-item
:label="$t('pages.system.user.form.username')"
name="username">
<a-input
:placeholder="$t('pages.system.user.form.username.placeholder')"
v-model:value="formData.username"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.password')"
name="password">
<a-input-password
v-model:value="formData.password"
:placeholder="$t('pages.system.user.form.password.placeholder')" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.name')"
name="name">
<a-input
:placeholder="$t('pages.system.user.form.name.placeholder')"
v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.roles')"
name="roles">
<a-select
v-model:value="formData.roles"
mode="multiple"
style="width: 100%"
:placeholder="$t('pages.system.user.form.roles.placeholder')"
:options="roles"
@change="handleChange"></a-select>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.phone')"
type="tel"
name="phone">
<a-input
:placeholder="$t('pages.system.user.form.phone.placeholder')"
type="tel"
v-model:value="formData.phone"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
:label="$t('pages.system.user.form.email')"
type="email"
name="email">
<a-input
:placeholder="$t('pages.system.user.form.email.placeholder')"
type="email"
v-model:value="formData.email"></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="24">
<a-form-item
:label="$t('pages.system.user.form.remark')"
name="remark">
<a-textarea
:placeholder="$t('pages.system.user.form.remark.placeholder')"
v-model:value="formData.remark"></a-textarea>
<a-form-item :label="'案场名称'" name="name">
<a-input :placeholder="'请输入案场名称'" v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="12">
<a-col :span="24">
<a-form-item
:label="$t('pages.system.user.form.status')"
name="status">
<a-radio-group
v-model:value="formData.status"
:options="[
{ label: $t('pages.system.user.form.status.activated'), value: 'activated' },
{ label: $t('pages.system.user.form.status.freezed'), value: 'freezed' },
<a-form-item :label="'状态'" name="status">
<a-radio-group v-model:value="formData.status" :options="[
{ label: '启用', value: 'enabled' },
{ label: '停用', value: 'disabled' },
]"></a-radio-group>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'图片'">
<gx-upload v-model="formData.fileList" accept-types=".jpg,.png,.webp" :fileNumber="1"
@uploadSuccess="uploadSuccess" />
</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 { ref, onBeforeMount } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useForm, useModal, useSpining } from '@/hooks'
import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import GxUpload from '@/components/GxUpload/index.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 rolesValue = ref([])
const roles = ref([])
const ceshi = ref('1222')
const areaList = ref([])
const childOpen = ref(false)
const fileList = ref([])
const formArea = ref({ name: '', status: 'enabled' })
formRules.value = {
name: { required: true, message: t('pages.system.user.form.username.placeholder') },
username: { required: true, message: t('pages.system.user.form.code.placeholder') },
status: { required: true, message: t('pages.system.user.form.status') },
roles: [{ required: true, message: t('pages.system.user.form.roles.placeholder'), trigger: 'change' }],
name: { required: true, message: '请输入案场名称' },
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
}
/**
* 请求角色
*/
getRole()
/**
* select 选择框
*/
const handleChange = (value) => {
rolesValue.value = value
}
/**
* 新建
@ -157,74 +70,64 @@ const handleChange = (value) => {
function handleCreate() {
showModal({
type: 'create',
title: t('pages.system.user.add'),
title: '新增案场',
})
// initData()
formData.value.status = 'enabled'
}
async function getRole() {
const { success, data } = await apis.role.getRoleList().catch(() => {
throw new Error()
})
if (!success) {
return message.error('当前角色信息错误')
}
let roleArr = []
if (data.length) {
data.forEach((item) => {
roleArr.push({
label: item.name,
value: item.id,
})
})
}
roles.value = roleArr
}
/**
* 编辑
*/
async function handleEdit(record = {}) {
showModal({
type: 'edit',
title: t('pages.system.user.edit'),
title: '编辑案场',
})
const { data, success } = await apis.users.getUsers(record.id).catch()
try {
showSpining()
const { data, success } = await apis.project.getItem(record.id).catch()
if (!success) {
hideModal()
return
}
let roles = []
if (data.roles) {
roles = formatArr(data.roles, 'edit')
hideSpining()
formData.value = { ...data }
if(data.img){
formData.value.fileList = [config('http.apiBasic')+data.img]
}
} catch (error) {
message.error({ content: error.message })
hideSpining()
}
data.roles = roles
formRecord.value = data
formData.value = cloneDeep(data)
}
const uploadSuccess = (data) => {
fileList.value.push(data)
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
if (fileList.value.length === 0) return message.error('请上传图片')
formRef.value.validateFields().then(async (values) => {
try {
showLoading()
const params = {
...values,
roles: formatArr(rolesValue.value),
name: formData.value.name,
status: formData.value.status,
img: fileList.value[0]
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.users.createUsers(params).catch(() => {
throw new Error()
result = await apis.project.createProject(params).catch((error) => {
throw new Error(error)
})
break
case 'edit':
result = await apis.users.updateUsers(formData.value.id, params).catch(() => {
throw new Error()
result = await apis.project.updateItem(formData.value.id, params).catch(() => {
throw new Error(error)
})
break
}
@ -234,40 +137,15 @@ function handleOk() {
emit('ok')
}
} catch (error) {
message.error({ content: error.message })
hideLoading()
}
})
.catch(() => {
.catch((e) => {
hideLoading()
})
}
/**
* 对权限组 过数据格式
*/
function formatArr(data, type = '') {
const rolesArr = []
data.forEach((item) => {
roles.value.forEach((r) => {
if (type === 'edit') {
if (item.role_id === r.value) {
rolesArr.push({
value: item.role_id,
label: r.label,
})
return
}
} else if (r.value === item) {
rolesArr.push({
role_id: item,
role_name: r.label,
})
return
}
})
})
return rolesArr
}
/**
* 取消

View File

@ -1,44 +1,27 @@
<template>
<x-search-bar class="mb-8-2">
<!-- <x-search-bar class="mb-8-2">
<template #default="{ gutter, colSpan }">
<a-form
:label-col="{ style: { width: '100px' } }"
:model="searchFormData"
layout="inline">
<a-form :model="searchFormData" layout="inline">
<a-row :gutter="gutter">
<a-col v-bind="colSpan">
<a-form-item
:label="$t('pages.system.role.form.name')"
name="name">
<a-input
:placeholder="$t('pages.system.role.form.code.placeholder')"
v-model:value="searchFormData.name"></a-input>
<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 name="code">
<template #label>
{{ $t('pages.system.role.form.code') }}
<a-tooltip :title="$t('pages.system.role.form.code')">
<question-circle-outlined class="ml-4-1 color-placeholder" />
</a-tooltip>
</template>
<a-input
:placeholder="$t('pages.system.role.form.code.placeholder')"
v-model:value="searchFormData.code"></a-input>
<a-form-item label="状态" name="status">
<a-select v-model:value="searchFormData.status" allowClear>
<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-col>
<a-col
class="align-right"
v-bind="colSpan">
<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">
<a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }}
</a-button>
</a-space>
@ -46,73 +29,56 @@
</a-row>
</a-form>
</template>
</x-search-bar>
<a-row
:gutter="8"
:wrap="false">
</x-search-bar> -->
<a-row :gutter="8" :wrap="false">
<a-col flex="auto">
<a-card type="flex">
<x-action-bar class="mb-8-2">
<a-button
v-action="'add'"
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
<template #icon>
<plus-outlined></plus-outlined>
</template>
{{ $t('pages.system.role.add') }}
新增案场
</a-button>
</x-action-bar>
<a-table
:columns="columns"
:data-source="listData"
:loading="loading"
:pagination="paginationState"
:scroll="{ x: 1000 }"
@change="onTableChange">
<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="'statusType' === column.key">
<!--状态-->
<a-tag
v-if="statusTypeEnum.is('enabled', record.status)"
color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
<!--状态-->
<a-tag
v-if="statusTypeEnum.is('disabled', record.status)"
color="processing">
{{ statusTypeEnum.getDesc(record.status) }}
</a-tag>
</template>
<template v-if="'createAt' === column.key">
{{ formatUtcDateTime(record.created_at) }}
<template v-if="column.dataIndex === 'img'">
<a-image :width="60" :src="config('http.apiBasic')+record.img || $imageErr.imgErr" />
</template>
<template v-if="'status' === column.dataIndex">
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
</template>
<template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.role.edit') }}</template>
<edit-outlined />
</a-tooltip>
</x-action-button>
<x-action-button @click="handleRemove(record)">
<template #title> {{ $t('pages.system.user.edit') }}</template>
<edit-outlined /> </a-tooltip></x-action-button>
<x-action-button @click="createQrcode(record)">
<a-tooltip>
<template #title> {{ $t('pages.system.delete') }}</template>
<delete-outlined style="color: #ff4d4f" />
</a-tooltip>
</x-action-button>
<template #title>二维码</template>
<QrcodeOutlined />
</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>
<a-modal v-model:open="qropen" :title="'生成二维码'" @ok="qropen = false" :footer="null">
<a-card class="mb-8-2"
style="display: flex;align-items: center;flex-direction: column;justify-content: center;">
<x-qrCode :value="qrValue" :icon="qrlogo" :iconBackgroundColor="'#ffffff'" :size="180"></x-qrCode>
</a-card>
</a-modal>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
</template>
<script setup>
@ -121,42 +87,41 @@ import { ref } from 'vue'
import apis from '@/apis'
import { formatUtcDateTime } from '@/utils/util'
import { config } from '@/config'
import { statusTypeEnum } from '@/enums/system'
import { usePagination, useForm } from '@/hooks'
import { statusUserTypeEnum } from '@/enums/system'
import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { PlusOutlined, EditOutlined, DeleteOutlined,QrcodeOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import qrlogo from '@/assets/qrlogo.png'
const content = ref('')
const qrValue = ref('')
const qropen = ref(false)
defineOptions({
name: 'systemRole',
name: 'projectList',
})
const { t } = useI18n() // t
const columns = [
{ title: t('pages.system.role.form.code'), dataIndex: 'code', width: 240 },
{ title: t('pages.system.role.form.name'), dataIndex: 'name' },
{ title: t('pages.system.role.form.status'), dataIndex: 'status', key: 'statusType', width: 80 },
{ title: t('pages.system.role.form.sequence'), dataIndex: 'sequence', width: 100 },
{ title: t('pages.system.role.form.created_at'), key: 'createAt', fixed: 'right', width: 120 },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
{ title: '图片', dataIndex: 'img', width: 120,align:'center'},
{ title: '项目名称', dataIndex: 'name', key: 'title' },
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100,align:'center' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
]
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
usePagination()
const { resetForm } = useForm()
const editDialogRef = ref()
getPageList()
/**
* 获取用户列
* 获取格数据
* @returns {Promise<void>}
*/
async function getPageList() {
try {
showLoading()
const { pageSize, current } = paginationState
const { success, data, total } = await apis.role
.getRoleList({
const { success, data, total } = await apis.project
.getProjectList({
pageSize,
page: current,
...searchFormData.value,
@ -175,18 +140,18 @@ async function getPageList() {
}
/**
*
*
*/
function handleRemove({ id }) {
function handleDelete({ id }) {
Modal.confirm({
title: t('pages.system.role.delTip'),
title: t('pages.system.user.delTip'),
content: t('button.confirm'),
okText: t('button.confirm'),
onOk: () => {
return new Promise((resolve, reject) => {
;(async () => {
; (async () => {
try {
const { success } = await apis.role.delRole(id).catch(() => {
const { success } = await apis.project.delItem(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
@ -212,6 +177,13 @@ function onTableChange({ current, pageSize }) {
getPageList()
}
/**
* 搜索
*/
function handleSearch() {
resetPagination()
getPageList()
}
/**
* 重置
*/
@ -220,16 +192,22 @@ function handleResetSearch() {
resetPagination()
getPageList()
}
/**
* 搜索
*/
function handleSearch() {
resetForm()
resetPagination()
getPageList()
const createQrcode = (params) => {
const {name,areaId,id}=params
const item={ title:name,
typer:'activity',
pathUrl:'/pages/sceneDetail/index.vue',
areaId,
relationId:id,
kvalue1:'',
kvalue2:'',
kvalue3:'',
kvalue4:'',
kvalue5:'',}
qrValue.value = JSON.stringify(item)
console.log(qrValue.value)
qropen.value = true
}
/**
* 编辑完成
*/

View File

@ -1,70 +1,329 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
<a-modal :open="modal.open" :title="modal.title" :width="800" :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-col :span="12">
<a-form-item :label="'楼盘名称'" name="name">
<a-input :placeholder="'请输入楼盘名称'" v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-col :span="12">
<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="area">
<a-select ref="select" v-model:value="formData.areaId">
<a-select-option value="1">南通</a-select-option>
<a-select-option value="2">盐城</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'项目标签'" name="labels">
<div v-for="(item, index) in formData.labels" :key="index"
style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px">
<a-input :placeholder="'请输入标签'" :value="item"
@change="(e) => updateLabel(index, e.target.value)">
</a-input>
<div style="width: 50px;display: flex;justify-content: flex-end;align-items: center;">
<a-button v-if="index === formData.labels.length - 1" type="primary"
:icon="h(PlusOutlined)" @click="addLabel" />
<a-button v-else danger :icon="h(MinusOutlined)" @click="removeLabel(index)" />
</div>
</div>
<a-col :span="12">
<a-form-item :label="'主力户型'" name="masterType">
<a-input :placeholder="'请输入主力户型'" v-model:value="formData.masterType"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'经度'" name="longitude">
<a-form-item :label="'开盘时间'" name="openAt">
<a-input :placeholder="'请输入开盘时间'" v-model:value="formData.openAt"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘均价'" name="price">
<a-input-number :placeholder="'请输入均价'" v-model:value="formData.price"
style="width:100%"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘类型'" name="type">
<a-input :placeholder="'请输入楼盘类型'" v-model:value="formData.type"
style="width:100%"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'待售状态'" name="status">
<a-input :placeholder="'请输入待售状态'" v-model:value="formData.status"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'所属区域'" name="areaId">
<a-select ref="select" v-model:value="formData.areaId">
<a-select-option v-for="item in areaEnum.getAll()" :value="item.value">{{
item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘特点'" name="title">
<a-input :placeholder="'请输入楼盘特点'" v-model:value="formData.title"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘经度'" name="longitude">
<a-input-number :placeholder="'请输入经度'" style="width: 100%;" :precision="2"
v-model:value="formData.longitude"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'纬度'" name="latitude">
<a-form-item :label="'楼盘纬度'" name="latitude">
<a-input-number :placeholder="'请输入纬度'" style="width: 100%;" :precision="2"
v-model:value="formData.latitude"></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="[
{ label: '启用', value: 'enabled' },
{ label: '停用', value: 'disabled' },
]"></a-radio-group>
<a-col :span="12">
<a-form-item :label="'展厅地址'" name="showAddress">
<a-input :placeholder="'请输入展厅地址'"
v-model:value="formData.showAddress"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'项目图片'">
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp" :fileNumber="20"
@uploadSuccess="uploadSuccess" />
<a-form-item :label="'楼盘标签'" name="labels">
<div
style="display: flex;justify-content: space-around;gap:5px 20px;flex-wrap: wrap;">
<div v-for="(item, index) in formData.labels" :key="index"
style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;flex: 1; min-width: calc(50% - 10px);">
<a-input :placeholder="'请输入标签'" :value="item"
@change="(e) => updateLabel(index, e.target.value)">
</a-input>
<div
style="width: 50px;display: flex;justify-content: flex-end;align-items: center;">
<a-button v-if="index === formData.labels.length - 1" type="primary"
:icon="h(PlusOutlined)" @click="addLabel" />
<a-button v-else danger :icon="h(MinusOutlined)"
@click="removeLabel(index)" />
</div>
</div>
</div>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘图片'">
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp"
:fileNumber="20" @uploadSuccess="uploadSuccess" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'楼盘视频'">
<gx-upload v-model="formData.videos" accept-types=".avi,.mp4,.mov,.wmv,.mkv,.m4v"
:fileNumber="20" />
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="2" tab="户型信息">
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
<a-button type="primary" @click="addLayout">
<template #icon>
<PlusOutlined />
</template>
户型
</a-button>
</div>
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
v-for="(child, index) of formData.layOuts" :key="index">
<a-col :span="24">
<a-form-item :label="'标题'" name="title">
<a-input :placeholder="'请输入标题'" v-model:value="child.title"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'单价'">
<a-input :placeholder="'请输入单价'" v-model:value="child.price"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'朝向'" name="direction">
<a-input :placeholder="'请输入朝向'" v-model:value="child.direction"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'面积'" name="area">
<a-input :placeholder="'请输入建筑面积'" v-model:value="child.area"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'图片'">
<gx-upload v-model="child.layImgList" accept-types=".jpg,.png,.webp"
:fileNumber="1" @uploadSuccess="uploadSuccess" />
</a-form-item>
</a-col>
<template #actions>
<a-button type="text" @click="delLayOut(index)"> </a-button>
</template>
</a-card>
</div>
</a-tab-pane>
<a-tab-pane key="3" tab="楼盘周边">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item :label="'公交'" name="busNum">
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.busNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'医院'" name="hospitalNum">
<a-input-number :placeholder="'请输入医院个数'" v-model:value="formData.hospitalNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'生活'" name="lifeNum">
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.lifeNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'地铁'" name="metroNum">
<a-input-number :placeholder="'请输入地铁个数'" v-model:value="formData.metroNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'学校'" name="schoolNum">
<a-input-number :placeholder="'请输入学校个数'" v-model:value="formData.schoolNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="4" tab="楼盘顾问">
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
<a-button type="primary" @click="addLayout">
<template #icon>
<PlusOutlined />
</template>
顾问
</a-button>
</div>
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
v-for="(child, index) of formData.advisers" :key="index">
<a-col :span="24">
<a-form-item :label="'姓名'" name="adviserName">
<a-input :placeholder="'请输入顾问姓名'"
v-model:value="child.adviserName"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'手机号'">
<a-input :placeholder="'请输入手机号'"
v-model:value="child.adviserPhone"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'头像'">
<gx-upload v-model="child.adviserImg" accept-types=".jpg,.png,.webp"
:fileNumber="1" />
</a-form-item>
</a-col>
<template #actions>
<a-button type="text" @click="delLayOut(index)"> </a-button>
</template>
</a-card>
</div>
</a-tab-pane>
<a-tab-pane key="5" tab="销售信息">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item :label="'楼盘状态'" name="louPanStatus">
<a-input :placeholder="'请输入楼盘状态'"
v-model:value="formData.louPanStatus"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'产权年限'" name="duration">
<a-input :placeholder="'请输入产权年限'" v-model:value="formData.duration"
style="width: 100%;"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'在售户型'" name="salesType">
<a-input :placeholder="'请输入在售户型'" v-model:value="formData.salesType"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'售楼地址'" name="salesAddress">
<a-input :placeholder="'请输入售楼地址'"
v-model:value="formData.salesAddress"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'售楼电话'" name="salesPhone">
<a-input :placeholder="'请输入售楼电话'" v-model:value="formData.salesPhone"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="6" tab="小区概况">
<a-row :gutter="12">
<a-col :span="12">
<a-form-item :label="'车位数量'" name="packingNum">
<a-input-number :placeholder="'请输入车位数量'" v-model:value="formData.packingNum"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'总户数'" name="roomNUM">
<a-input-number :placeholder="'请输入总户数'" v-model:value="formData.roomNUM"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'绿地率'" name="greeningRate">
<a-input :placeholder="'请输入绿地率'"
v-model:value="formData.greeningRate"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'R19009容积率'" name="r19009Ratio">
<a-input :placeholder="'请输入R19009容积率'"
v-model:value="formData.r19009Ratio"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'R19010容积率'" name="r19009Ratio">
<a-input :placeholder="'请输入R19010容积率'"
v-model:value="formData.r19010Ratio"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'R19011容积率'" name="r19011Ratio">
<a-input :placeholder="'请输入R19011容积率'"
v-model:value="formData.r19011Ratio"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'物业类型'" name="propertyType">
<a-input :placeholder="'请输入物业类型'"
v-model:value="formData.propertyType"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'物业公司'" name="propertyName">
<a-input :placeholder="'请输入物业公司'"
v-model:value="formData.propertyName"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item :label="'物业费用'" name="propertyPrice">
<a-input :placeholder="'请输入物业费用'"
v-model:value="formData.propertyPrice"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</a-card>
</a-form>
</a-spin>
@ -78,7 +337,10 @@ import apis from '@/apis'
import { useForm, useModal, useSpining } from '@/hooks'
import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n'
import { PlusOutlined, MinusOutlined } from '@ant-design/icons-vue';
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
import dayjs from 'dayjs'
import { customersEnum, areaEnum } from "@/enums/useEnum"
import {spliceUrl} from "@/utils/util.js"
const emit = defineEmits(['ok'])
const { t } = useI18n() // t
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
@ -86,12 +348,15 @@ 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 layImgList = []
const activeKey = ref('1')
formRules.value = {
name: { required: true, message: '请输入区域名称' },
lon: { required: true, message: '请输入经度' },
lat: { required: true, message: '请输入纬度' },
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
name: { required: true, message: '请输入楼盘名称' },
address: { required: true, message: '请输入楼盘地址' },
masterType: { required: true, message: '请输入主力户型' },
openAt: { required: true, message: '请输入开盘时间' },
price: { required: true, message: '请输入楼盘均价' },
status: [{ required: true, message: '请输入状态' }],
}
/**
@ -100,11 +365,21 @@ formRules.value = {
function handleCreate() {
showModal({
type: 'create',
title: '新增区域',
title: '新增楼盘',
})
// initData()
formData.value.labels=['']
formData.value.status = 'enabled'
formData.value.labels = ['', '']
formData.value.areaId = 1
formData.value.layOuts = [
{ area: '', price: '', direction: '', title: '', layImgList: [] },
{ area: '', price: '', direction: '', title: '', layImgList: [] },
{ area: '', price: '', direction: '', title: '', layImgList: [] },
]
formData.value.advisers = [
{ adviserName: '', adviserPhone: '', adviserImg: [] },
{ adviserName: '', adviserPhone: '', adviserImg: [] },
{ adviserName: '', adviserPhone: '', adviserImg: [] },
]
}
/**
@ -113,17 +388,62 @@ function handleCreate() {
async function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑区域',
title: '编辑楼盘',
})
try {
showSpining()
const { data, success } = await apis.area.getItem(record.id).catch()
const { data, success } = await apis.house.getItem(record.id).catch()
if (!success) {
hideModal()
return
}
hideSpining()
formData.value = { ...data }
formData.value = {
id:data.id,
address: data.address,
areaId: data.areaId,//
imgList: data.images?data.images.map(item => config('http.apiBasic') + item):[],
labels: data.labels,
latitude: data.latitude,
longitude: data.longitude,
masterType: data.masterType,
name: data.name,
openAt: data.openAt,
price: data.price,
status: data.status,
title: data.title,
videos: data.videos? data.videos.map(item => config('http.apiBasic') + item):[],
advisers: data.advisers?data.advisers.map(item=>({adviserName:item.name,adviserPhone:item.phone,adviserImg:item.avatar?[config('http.apiBasic')+item.avatar]:[]})):[{ adviserName: '', adviserPhone: '', adviserImg: [] },
{ adviserName: '', adviserPhone: '', adviserImg: [] },
{ adviserName: '', adviserPhone: '', adviserImg: [] },],
address: data.detail.basicInfo.address,
houseArea: data.detail.basicInfo.area,
buildingarea: data.detail.basicInfo.buildingarea,
showAddress: data.detail.basicInfo.showAddress,
type: data.detail.basicInfo.type,
louPanStatus: data.detail.salesInfo.status,
duration: data.detail.salesInfo.duration,
salesType: data.detail.salesInfo.salesType,
salesPhone: data.detail.salesInfo.salesPhone,
salesAddress:data.detail.salesInfo.salesAddress,
greeningRate: data.detail.communityInfo.greeningRate,
packingNum: data.detail.communityInfo.packingNum,
propertyName: data.detail.communityInfo.propertyName,
propertyPrice: data.detail.communityInfo.propertyPrice,
propertyType: data.detail.communityInfo.propertyType,
r19009Ratio: data.detail.communityInfo.r19009Ratio,
r19010Ratio: data.detail.communityInfo.r19010Ratio,
r19011Ratio: data.detail.communityInfo.r19011Ratio,
roomNUM: data.detail.communityInfo.roomNUM,
layOuts: data.layOuts ? data.layOuts.map(item => ({ area: item.area, direction: item.direction, layImgList: item.img?[config('http.apiBasic') + item.img]:[], price: item.price, title: item.title })):[{ area: '', price: '', direction: '', title: '', layImgList: [] },
{ area: '', price: '', direction: '', title: '', layImgList: [] },
{ area: '', price: '', direction: '', title: '', layImgList: [] },],
busNum: data.surroundings&&data.surroundings.busNum,
hospitalNum: data.surroundings&&data.surroundings.hospitalNum,
lifeNum: data.surroundings&&data.surroundings.lifeNum,
metroNum: data.surroundings&&data.surroundings.metroNum,
schoolNum: data.surroundings&&data.surroundings.schoolNum,
}
} catch (error) {
message.error({ content: error.message })
hideSpining()
@ -138,17 +458,71 @@ function handleOk() {
try {
showLoading()
const params = {
...values
address: formData.value.address,
areaId: formData.value.areaId,//
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0]),
images: formData.value.imgList && formData.value.imgList.map(item=>spliceUrl(item)),
labels: formData.value.labels,
latitude: formData.value.latitude,
longitude: formData.value.longitude,
masterType: formData.value.masterType,
name: formData.value.name,
openAt: formData.value.openAt,
price: formData.value.price.toString(),
status: formData.value.status,
title: formData.value.title,
videos: formData.value.videos&&formData.value.videos.map(item=>spliceUrl(item)),
advisers: formData.value.advisers&&formData.value.advisers.map(item=>({name:item.adviserName,phone:item.adviserPhone,avatar:item.adviserImg[0]&&spliceUrl(item.adviserImg[0])})),
detail: {
basicInfo: {
address: formData.value.address,//
area: formData.value.houseArea,//
buildingarea: formData.value.buildingarea,//
masterType: formData.value.masterType,//
status: formData.value.status,//
showAddress: formData.value.showAddress,//
type: formData.value.type,//
},
salesInfo: {
status: formData.value.louPanStatus,//
duration: formData.value.duration,//
salesType: formData.value.salesType,//
salesAddress: formData.value.salesAddress,//
salesPhone: formData.value.salesPhone//
},
communityInfo: {
greeningRate: formData.value.greeningRate,
packingNum: formData.value.packingNum.toString(),
propertyName: formData.value.propertyName.toString(),
propertyPrice: formData.value.propertyPrice,
propertyType: formData.value.propertyType,
r19009Ratio: formData.value.r19009Ratio,
r19010Ratio: formData.value.r19010Ratio,
r19011Ratio: formData.value.r19011Ratio,
roomNUM: formData.value.roomNUM.toString(),
}
},
layOuts: formData.value.layOuts && formData.value.layOuts.map(item => ({ area: item.area, direction: item.direction, img: item.layImgList[0]&&spliceUrl(item.layImgList[0]), price: item.price, title: item.title })),
surroundings: {
busNum: formData.value.busNum,
hospitalNum: formData.value.hospitalNum,
lifeNum: formData.value.lifeNum,
metroNum: formData.value.metroNum,
schoolNum: formData.value.metroNum,
}
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.area.createProject(params).catch((error) => {
result = await apis.house.createProject(params).catch((error) => {
console.log(error.message)
throw new Error(error)
})
break
case 'edit':
result = await apis.area.updateItem(formData.value.id, params).catch(() => {
result = await apis.house.updateItem(formData.value.id, params).catch(() => {
console.log(error.message)
throw new Error(error)
})
break
@ -200,6 +574,15 @@ defineExpose({
handleCreate,
handleEdit,
})
//
const addLayout = () => {
const params = { imgs: [], area: '', price: '', direction: '', title: '' }
formData.value.layOuts.push(params)
}
//
const delLayOut = (index) => {
formData.value.layOuts.splice(index, 1)
}
</script>
<style lang="less" scoped></style>

View File

@ -29,7 +29,7 @@
</a-row>
</a-form>
</template>
</x-search-bar> -->
</x-search-bar> -->
<a-row :gutter="8" :wrap="false">
<a-col flex="auto">
<a-card type="flex">
@ -38,25 +38,23 @@
<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" :scroll="{ x: 1000 }" @change="onTableChange">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'img'">
<a-image :width="60" :src="config('http.apiBasic')+record.img || $imageErr.imgErr" />
</template>
<template v-if="'status' === column.dataIndex">
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
<template v-if="column.dataIndex === 'price'">
<span>{{ record.price+'(元/平)' }}</span>
</template>
<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)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
@ -80,15 +78,18 @@ import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
defineOptions({
name: 'houseList',
})
const { t } = useI18n() // t
const columns = [
{ title: '区域名称', dataIndex: 'name'},
{ title: '经度', dataIndex: 'lon',width:100,align:'center'},
{ title: '纬度', dataIndex: 'lat',width:100,align:'center'},
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100,align:'center' },
{ title: '楼盘名称', dataIndex: 'name' },
{ title: '主力户型', dataIndex: 'masterType', width: 120, align: 'center' },
{ title: '开盘时间', dataIndex: 'openAt', width: 100, align: 'center' },
{ title: '楼盘地址', dataIndex: 'address', align: 'center',ellipsis: true, },
{ title: '楼盘均价', dataIndex: 'price', align: 'center', width: 110 },
{ title: '待售状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
]
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
@ -102,7 +103,7 @@ async function getPageList() {
try {
showLoading()
const { pageSize, current } = paginationState
const { success, data, total } = await apis.area
const { success, data, total } = await apis.house
.getProjectList({
pageSize,
page: current,
@ -133,7 +134,7 @@ function handleDelete({ id }) {
return new Promise((resolve, reject) => {
; (async () => {
try {
const { success } = await apis.area.delItem(id).catch(() => {
const { success } = await apis.house.delItem(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
@ -181,6 +182,7 @@ async function onOk() {
message.success(t('component.message.success.delete'))
await getPageList()
}
</script>
<style lang="less" scoped></style>

View File

@ -6,8 +6,8 @@
<a-card class="mb-8-2">
<a-row :gutter="12">
<a-col :span="24">
<a-form-item :label="'项目名称'" name="name">
<a-input :placeholder="'请输入项目名称'" v-model:value="formData.name"></a-input>
<a-form-item :label="'案场名称'" name="name">
<a-input :placeholder="'请输入案场名称'" v-model:value="formData.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
@ -58,14 +58,10 @@ const childOpen = ref(false)
const fileList = ref([])
const formArea = ref({ name: '', status: 'enabled' })
formRules.value = {
title: { required: true, message: '请输入项目名称' },
name: { required: true, message: '请输入案场名称' },
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
}
const areaFormRules = {
name: [{ required: true, message: '请输入基地名称' }],
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
// fileList: [{ required: true, message: '', trigger: 'change' }],
}
/**
@ -74,7 +70,7 @@ const areaFormRules = {
function handleCreate() {
showModal({
type: 'create',
title: '新增项目',
title: '新增案场',
})
// initData()
formData.value.status = 'enabled'
@ -86,7 +82,7 @@ function handleCreate() {
async function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑项目',
title: '编辑案场',
})
try {
showSpining()

View File

@ -38,7 +38,7 @@
<template #icon>
<plus-outlined></plus-outlined>
</template>
新增项目
新增案场
</a-button>
</x-action-bar>
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
@ -57,6 +57,11 @@
<a-tooltip>
<template #title> {{ $t('pages.system.user.edit') }}</template>
<edit-outlined /> </a-tooltip></x-action-button>
<x-action-button @click="createQrcode(record)">
<a-tooltip>
<template #title>二维码</template>
<QrcodeOutlined />
</a-tooltip></x-action-button>
<x-action-button @click="handleDelete(record)">
<a-tooltip>
<template #title>{{ $t('pages.system.delete') }}</template>
@ -67,7 +72,12 @@
</a-card>
</a-col>
</a-row>
<a-modal v-model:open="qropen" :title="'生成二维码'" @ok="qropen = false" :footer="null">
<a-card class="mb-8-2"
style="display: flex;align-items: center;flex-direction: column;justify-content: center;">
<x-qrCode :value="qrValue" :icon="qrlogo" :iconBackgroundColor="'#ffffff'" :size="180"></x-qrCode>
</a-card>
</a-modal>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
</template>
@ -79,10 +89,13 @@ import { formatUtcDateTime } from '@/utils/util'
import { config } from '@/config'
import { statusUserTypeEnum } from '@/enums/system'
import { usePagination } from '@/hooks'
import EditDialog from './components/EditDialog.vue'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { PlusOutlined, EditOutlined, DeleteOutlined,QrcodeOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import qrlogo from '@/assets/qrlogo.png'
const content = ref('')
const qrValue = ref('')
const qropen = ref(false)
defineOptions({
name: 'projectList',
})
@ -91,7 +104,7 @@ const columns = [
{ title: '图片', dataIndex: 'img', width: 120,align:'center'},
{ title: '项目名称', dataIndex: 'name', key: 'title' },
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100,align:'center' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
]
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
@ -179,6 +192,22 @@ function handleResetSearch() {
resetPagination()
getPageList()
}
const createQrcode = (params) => {
const {name,areaId,id}=params
const item={ title:name,
typer:'activity',
pathUrl:'/pages/sceneDetail/index.vue',
areaId,
relationId:id,
kvalue1:'',
kvalue2:'',
kvalue3:'',
kvalue4:'',
kvalue5:'',}
qrValue.value = JSON.stringify(item)
console.log(qrValue.value)
qropen.value = true
}
/**
* 编辑完成
*/