From 153b57170529c558823427c01c79b223428fa79c Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Thu, 6 Jun 2024 12:07:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=E5=85=B3=E8=81=94=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6appId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/booking/item/index.ts | 106 ++++++++ src/api/booking/item/model/index.ts | 32 +++ .../booking/item/components/itemEdit.vue | 199 +++++++++++++++ src/views/booking/item/components/search.vue | 42 +++ src/views/booking/item/index.vue | 240 ++++++++++++++++++ .../booking/school/components/itemType.vue | 67 +++++ .../school/components/merchantEdit.vue | 28 +- src/views/cms/ad/components/ad-edit.vue | 117 ++++----- src/views/cms/ad/components/search.vue | 22 +- src/views/cms/ad/index.vue | 28 +- .../field/components/website-field-edit.vue | 14 +- .../mp-weixin/admin/components/simulator.vue | 4 +- .../cms/mp-weixin/home/components/search.vue | 19 +- .../oa/app/detail/components/app-task.vue | 1 + 14 files changed, 832 insertions(+), 87 deletions(-) create mode 100644 src/api/booking/item/index.ts create mode 100644 src/api/booking/item/model/index.ts create mode 100644 src/views/booking/item/components/itemEdit.vue create mode 100644 src/views/booking/item/components/search.vue create mode 100644 src/views/booking/item/index.vue create mode 100644 src/views/booking/school/components/itemType.vue diff --git a/src/api/booking/item/index.ts b/src/api/booking/item/index.ts new file mode 100644 index 0000000..57173d1 --- /dev/null +++ b/src/api/booking/item/index.ts @@ -0,0 +1,106 @@ +import request from '@/utils/request'; +import type { ApiResult, PageResult } from '@/api'; +import type { Item, ItemParam } from './model'; +import { MODULES_API_URL } from '@/config/setting'; + +/** + * 分页查询项目类型 + */ +export async function pageItem(params: ItemParam) { + const res = await request.get>>( + MODULES_API_URL + '/booking/item/page', + { + params + } + ); + if (res.data.code === 0) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 查询项目类型列表 + */ +export async function listItem(params?: ItemParam) { + const res = await request.get>( + MODULES_API_URL + '/booking/item', + { + params + } + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 添加项目类型 + */ +export async function addItem(data: Item) { + const res = await request.post>( + MODULES_API_URL + '/booking/item', + data + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 修改项目类型 + */ +export async function updateItem(data: Item) { + const res = await request.put>( + MODULES_API_URL + '/booking/item', + data + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 删除项目类型 + */ +export async function removeItem(id?: number) { + const res = await request.delete>( + MODULES_API_URL + '/booking/item/' + id + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 批量删除项目类型 + */ +export async function removeBatchItem(data: (number | undefined)[]) { + const res = await request.delete>( + MODULES_API_URL + '/booking/item/batch', + { + data + } + ); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 根据id查询项目类型 + */ +export async function getItem(id: number) { + const res = await request.get>( + MODULES_API_URL + '/booking/item/' + id + ); + if (res.data.code === 0 && res.data.data) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/src/api/booking/item/model/index.ts b/src/api/booking/item/model/index.ts new file mode 100644 index 0000000..7ebcd69 --- /dev/null +++ b/src/api/booking/item/model/index.ts @@ -0,0 +1,32 @@ +import type { PageParam } from '@/api'; + +/** + * 项目类型 + */ +export interface Item { + // ID + id?: number; + // 项目类型 + name?: string; + // 项目图标 + image?: string; + // 项目备注 + comments?: string; + // 状态 + status?: number; + // 排序号 + sortNumber?: number; + // 租户id + tenantId?: number; + // 创建时间 + createTime?: string; +} + +/** + * 项目类型搜索条件 + */ +export interface ItemParam extends PageParam { + id?: number; + ids?: string; + keywords?: string; +} diff --git a/src/views/booking/item/components/itemEdit.vue b/src/views/booking/item/components/itemEdit.vue new file mode 100644 index 0000000..c73db81 --- /dev/null +++ b/src/views/booking/item/components/itemEdit.vue @@ -0,0 +1,199 @@ + + + + diff --git a/src/views/booking/item/components/search.vue b/src/views/booking/item/components/search.vue new file mode 100644 index 0000000..82fea9d --- /dev/null +++ b/src/views/booking/item/components/search.vue @@ -0,0 +1,42 @@ + + + + diff --git a/src/views/booking/item/index.vue b/src/views/booking/item/index.vue new file mode 100644 index 0000000..e308fd7 --- /dev/null +++ b/src/views/booking/item/index.vue @@ -0,0 +1,240 @@ + + + + + + + diff --git a/src/views/booking/school/components/itemType.vue b/src/views/booking/school/components/itemType.vue new file mode 100644 index 0000000..1854a0a --- /dev/null +++ b/src/views/booking/school/components/itemType.vue @@ -0,0 +1,67 @@ + + + + diff --git a/src/views/booking/school/components/merchantEdit.vue b/src/views/booking/school/components/merchantEdit.vue index 95b85bc..e017a7d 100644 --- a/src/views/booking/school/components/merchantEdit.vue +++ b/src/views/booking/school/components/merchantEdit.vue @@ -60,12 +60,13 @@ /> - + + + + + + + @@ -234,7 +235,7 @@ import { ref, reactive, watch } from 'vue'; import { Form, message } from 'ant-design-vue'; import { assignObject, uuid } from 'ele-admin-pro'; - import { addMerchant, updateMerchant } from '@/api/shop/merchant'; + import { addMerchant, listMerchant, updateMerchant } from "@/api/shop/merchant"; import { Merchant } from '@/api/shop/merchant/model'; import { useThemeStore } from '@/store/modules/theme'; import { storeToRefs } from 'pinia'; @@ -242,10 +243,13 @@ import { FormInstance } from 'ant-design-vue/es/form'; import { FileRecord } from '@/api/system/file/model'; import { MerchantType } from '@/api/shop/merchantType/model'; + import ItemTypeForm from './itemType.vue' import { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types'; import { listRoles } from '@/api/system/role'; import TinymceEditor from '@/components/TinymceEditor/index.vue'; import { uploadOss } from '@/api/system/file'; + import { Item } from "@/api/booking/item/model"; + import { listItem } from "@/api/booking/item"; // 是否是修改 const isUpdate = ref(false); @@ -279,6 +283,7 @@ const content = ref(''); // 是否显示地图选择弹窗 const showMap = ref(false); + const select = ref([]); // 用户信息 const form = reactive({ @@ -524,7 +529,8 @@ ...form, content: content.value, keywords: JSON.stringify(form.keywords), - files: JSON.stringify(files.value) + files: JSON.stringify(files.value), + itemType: select.value?.map((d) => d.id).join(',') }; const saveOrUpdate = isUpdate.value ? updateMerchant : addMerchant; saveOrUpdate(formData) @@ -548,6 +554,7 @@ if (visible) { images.value = []; files.value = []; + select.value = []; content.value = ''; if (props.data) { isUpdate.value = true; @@ -575,6 +582,11 @@ if (props.data.keywords) { form.keywords = JSON.parse(props.data.keywords); } + if (props.data.itemType) { + listItem({ ids: props.data.itemType }).then((list) => { + select.value = list; + }); + } } else { isUpdate.value = false; } diff --git a/src/views/cms/ad/components/ad-edit.vue b/src/views/cms/ad/components/ad-edit.vue index eccd473..f1d2fbf 100644 --- a/src/views/cms/ad/components/ad-edit.vue +++ b/src/views/cms/ad/components/ad-edit.vue @@ -20,18 +20,19 @@ " > - + 图片广告 幻灯片 视频广告 - + + + + + - + - - - ([]); + const pathList = ref([]); // 是否显示最大化切换按钮 const maxable = ref(true); // 表格选中数据 @@ -200,14 +190,6 @@ // 表单验证规则 const rules = reactive({ - name: [ - { - required: true, - type: 'string', - message: '请填写广告位名称', - trigger: 'blur' - } - ], adType: [ { required: true, @@ -222,11 +204,13 @@ type: 'string', message: '请上传图片或视频', trigger: 'blur', - validator: async (_rule: RuleObject, value: string) => { - if (images.value.length == 0) { - return Promise.reject('请上传图片或视频'); - } - return Promise.resolve(); + validator: (_rule: Rule, value: string) => { + return new Promise((resolve, reject) => { + if (images.value.length == 0) { + return reject('请上传图片或视频文件'); + } + return resolve(); + }); } } ] @@ -301,7 +285,9 @@ loading.value = true; const formData = { ...form, - images: JSON.stringify(images.value) + images: JSON.stringify(images.value), + path: + form.adType == '幻灯片' ? JSON.stringify(pathList.value) : form.path }; const saveOrUpdate = isUpdate.value ? updateAd : addAd; saveOrUpdate(formData) @@ -326,6 +312,7 @@ if (props.data) { assignObject(form, props.data); images.value = []; + pathList.value = []; if (props.data.images) { const arr = JSON.parse(props.data.images); arr.map((d) => { @@ -336,6 +323,12 @@ }); }); } + if (props.data.adType == '幻灯片') { + const arr = JSON.parse(props.data.path); + arr.map((d) => { + pathList.value.push(d); + }); + } isUpdate.value = true; } else { images.value = []; diff --git a/src/views/cms/ad/components/search.vue b/src/views/cms/ad/components/search.vue index 82fea9d..0e58daf 100644 --- a/src/views/cms/ad/components/search.vue +++ b/src/views/cms/ad/components/search.vue @@ -7,6 +7,13 @@ 添加 + @@ -14,6 +21,9 @@ import { PlusOutlined } from '@ant-design/icons-vue'; import type { GradeParam } from '@/api/user/grade/model'; import { watch } from 'vue'; + import useSearch from '@/utils/use-search'; + import { UserParam } from '@/api/system/user/model'; + import { AdParam } from '@/api/cms/ad/model'; const props = withDefaults( defineProps<{ @@ -24,7 +34,7 @@ ); const emit = defineEmits<{ - (e: 'search', where?: GradeParam): void; + (e: 'search', where?: AdParam): void; (e: 'add'): void; (e: 'remove'): void; (e: 'batchMove'): void; @@ -35,6 +45,16 @@ emit('add'); }; + // 表单数据 + const { where, resetFields } = useSearch({ + adId: undefined, + keywords: undefined + }); + + const search = () => { + emit('search', where); + }; + watch( () => props.selection, () => {} diff --git a/src/views/cms/ad/index.vue b/src/views/cms/ad/index.vue index 4867d94..9e9d7ff 100644 --- a/src/views/cms/ad/index.vue +++ b/src/views/cms/ad/index.vue @@ -21,6 +21,9 @@ />