修复:项目管理的关联工单列表增加查询条件appId
This commit is contained in:
106
src/api/booking/item/index.ts
Normal file
106
src/api/booking/item/index.ts
Normal file
@@ -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<ApiResult<PageResult<Item>>>(
|
||||||
|
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<ApiResult<Item[]>>(
|
||||||
|
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<ApiResult<unknown>>(
|
||||||
|
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<ApiResult<unknown>>(
|
||||||
|
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<ApiResult<unknown>>(
|
||||||
|
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<ApiResult<unknown>>(
|
||||||
|
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<ApiResult<Item>>(
|
||||||
|
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));
|
||||||
|
}
|
||||||
32
src/api/booking/item/model/index.ts
Normal file
32
src/api/booking/item/model/index.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
199
src/views/booking/item/components/itemEdit.vue
Normal file
199
src/views/booking/item/components/itemEdit.vue
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑项目类型' : '添加项目类型'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="项目类型" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入项目类型"
|
||||||
|
v-model:value="form.name"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="项目备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="项目图标" name="image">
|
||||||
|
<SelectFile
|
||||||
|
:placeholder="`请选择图标`"
|
||||||
|
:limit="1"
|
||||||
|
:data="images"
|
||||||
|
@done="chooseImage"
|
||||||
|
@del="onDeleteItem"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="排序号" name="sortNumber">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
|
v-model:value="form.sortNumber"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addItem, updateItem } from '@/api/booking/item';
|
||||||
|
import { Item } from '@/api/booking/item/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: Item | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
const form = reactive<Item>({
|
||||||
|
id: undefined,
|
||||||
|
name: '',
|
||||||
|
image: '',
|
||||||
|
comments: '',
|
||||||
|
status: 0,
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive({
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请填写名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.thumbnail;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDeleteItem = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields } = useForm(form, rules);
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateItem : addItem;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
42
src/views/booking/item/components/search.vue
Normal file
42
src/views/booking/item/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
240
src/views/booking/item/index.vue
Normal file
240
src/views/booking/item/index.vue
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="itemId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'name'">
|
||||||
|
<a-avatar :src="record.image" :width="50" />
|
||||||
|
{{ record.name }}
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ItemEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { toDateString } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import ItemEdit from './components/itemEdit.vue';
|
||||||
|
import { pageItem, removeItem, removeBatchItem } from '@/api/booking/item';
|
||||||
|
import type { Item, ItemParam } from '@/api/booking/item/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<Item[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<Item | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pageItem({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '项目类型',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '备注',
|
||||||
|
// dataIndex: 'comments',
|
||||||
|
// key: 'comments',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '状态',
|
||||||
|
// dataIndex: 'status',
|
||||||
|
// key: 'status',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '排序号',
|
||||||
|
dataIndex: 'sortNumber',
|
||||||
|
key: 'sortNumber',
|
||||||
|
align: 'center',
|
||||||
|
width: 180,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '创建时间',
|
||||||
|
// dataIndex: 'createTime',
|
||||||
|
// key: 'createTime',
|
||||||
|
// align: 'center',
|
||||||
|
// sorter: true,
|
||||||
|
// ellipsis: true,
|
||||||
|
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ItemParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: Item) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: Item) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeItem(row.id)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchItem(selection.value.map((d) => d.id))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: Item) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'Item'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
67
src/views/booking/school/components/itemType.vue
Normal file
67
src/views/booking/school/components/itemType.vue
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<!-- 角色选择下拉框 -->
|
||||||
|
<template>
|
||||||
|
<a-select
|
||||||
|
mode="multiple"
|
||||||
|
allow-clear
|
||||||
|
:value="ids"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
@update:value="updateValue"
|
||||||
|
@blur="onBlur"
|
||||||
|
>
|
||||||
|
<a-select-option v-for="item in data" :key="item.id" :value="item.id">
|
||||||
|
{{ item.name }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import { Item } from '@/api/booking/item/model';
|
||||||
|
import { listItem } from '@/api/booking/item';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:value', value: Item[]): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的商户
|
||||||
|
value?: Item[];
|
||||||
|
//
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择场馆'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 选中的id
|
||||||
|
const ids = computed(() => props.value?.map((d) => d.id as number));
|
||||||
|
|
||||||
|
// 数据列表
|
||||||
|
const data = ref<Item[]>([]);
|
||||||
|
|
||||||
|
/* 更新选中数据 */
|
||||||
|
const updateValue = (value: number[]) => {
|
||||||
|
emit(
|
||||||
|
'update:value',
|
||||||
|
value.map((v) => ({ id: v }))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 获取数据 */
|
||||||
|
listItem({})
|
||||||
|
.then((list) => {
|
||||||
|
data.value = list;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 失去焦点 */
|
||||||
|
const onBlur = () => {
|
||||||
|
emit('blur');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -60,12 +60,13 @@
|
|||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="项目类型" name="itemType">
|
<a-form-item label="项目类型" name="itemType">
|
||||||
<DictSelect
|
<ItemTypeForm v-model:value="select" />
|
||||||
dict-code="ItemType"
|
<!-- <DictSelect-->
|
||||||
:placeholder="`请选择项目类型`"
|
<!-- dict-code="ItemType"-->
|
||||||
style="width: 120px"
|
<!-- :placeholder="`请选择项目类型`"-->
|
||||||
v-model:value="form.itemType"
|
<!-- style="width: 120px"-->
|
||||||
/>
|
<!-- v-model:value="form.itemType"-->
|
||||||
|
<!-- />-->
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="营业时间" name="businessTime">
|
<a-form-item label="营业时间" name="businessTime">
|
||||||
<!-- <a-time-picker-->
|
<!-- <a-time-picker-->
|
||||||
@@ -234,7 +235,7 @@
|
|||||||
import { ref, reactive, watch } from 'vue';
|
import { ref, reactive, watch } from 'vue';
|
||||||
import { Form, message } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject, uuid } from 'ele-admin-pro';
|
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 { Merchant } from '@/api/shop/merchant/model';
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -242,10 +243,13 @@
|
|||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
import { MerchantType } from '@/api/shop/merchantType/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 { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types';
|
||||||
import { listRoles } from '@/api/system/role';
|
import { listRoles } from '@/api/system/role';
|
||||||
import TinymceEditor from '@/components/TinymceEditor/index.vue';
|
import TinymceEditor from '@/components/TinymceEditor/index.vue';
|
||||||
import { uploadOss } from '@/api/system/file';
|
import { uploadOss } from '@/api/system/file';
|
||||||
|
import { Item } from "@/api/booking/item/model";
|
||||||
|
import { listItem } from "@/api/booking/item";
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
@@ -279,6 +283,7 @@
|
|||||||
const content = ref<any>('');
|
const content = ref<any>('');
|
||||||
// 是否显示地图选择弹窗
|
// 是否显示地图选择弹窗
|
||||||
const showMap = ref(false);
|
const showMap = ref(false);
|
||||||
|
const select = ref<Item[]>([]);
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const form = reactive<Merchant>({
|
const form = reactive<Merchant>({
|
||||||
@@ -524,7 +529,8 @@
|
|||||||
...form,
|
...form,
|
||||||
content: content.value,
|
content: content.value,
|
||||||
keywords: JSON.stringify(form.keywords),
|
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;
|
const saveOrUpdate = isUpdate.value ? updateMerchant : addMerchant;
|
||||||
saveOrUpdate(formData)
|
saveOrUpdate(formData)
|
||||||
@@ -548,6 +554,7 @@
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
images.value = [];
|
images.value = [];
|
||||||
files.value = [];
|
files.value = [];
|
||||||
|
select.value = [];
|
||||||
content.value = '';
|
content.value = '';
|
||||||
if (props.data) {
|
if (props.data) {
|
||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
@@ -575,6 +582,11 @@
|
|||||||
if (props.data.keywords) {
|
if (props.data.keywords) {
|
||||||
form.keywords = JSON.parse(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 {
|
} else {
|
||||||
isUpdate.value = false;
|
isUpdate.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,19 @@
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<a-form-item label="广告位类型" name="adType">
|
<a-form-item label="广告位类型" name="adType">
|
||||||
<a-select ref="select" v-model:value="form.adType" style="width: 120px">
|
<a-select
|
||||||
|
ref="select"
|
||||||
|
:disabled="isUpdate"
|
||||||
|
v-model:value="form.adType"
|
||||||
|
style="width: 120px"
|
||||||
|
>
|
||||||
<a-select-option value="图片广告">图片广告</a-select-option>
|
<a-select-option value="图片广告">图片广告</a-select-option>
|
||||||
<a-select-option value="幻灯片">幻灯片</a-select-option>
|
<a-select-option value="幻灯片">幻灯片</a-select-option>
|
||||||
<a-select-option value="视频广告">视频广告</a-select-option>
|
<a-select-option value="视频广告">视频广告</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<template v-if="form.adType == '幻灯片'">
|
<template v-if="form.adType == '幻灯片'">
|
||||||
<a-form-item
|
<a-form-item label="广告图片" name="images">
|
||||||
label="广告图片"
|
|
||||||
name="images"
|
|
||||||
extra="请上传广告图片,最多可上传9张图"
|
|
||||||
>
|
|
||||||
<SelectFile
|
<SelectFile
|
||||||
:placeholder="`请选择图片`"
|
:placeholder="`请选择图片`"
|
||||||
:limit="9"
|
:limit="9"
|
||||||
@@ -39,35 +40,16 @@
|
|||||||
@done="chooseFile"
|
@done="chooseFile"
|
||||||
@del="onDeleteItem"
|
@del="onDeleteItem"
|
||||||
/>
|
/>
|
||||||
<!-- <ele-image-upload-->
|
|
||||||
<!-- v-model:value="images"-->
|
|
||||||
<!-- :limit="9"-->
|
|
||||||
<!-- :drag="true"-->
|
|
||||||
<!-- :accept="'image/png,image/jpeg'"-->
|
|
||||||
<!-- :item-style="{ maxWidth: '160px', maxHeight: '160px' }"-->
|
|
||||||
<!-- :upload-handler="uploadHandler"-->
|
|
||||||
<!-- @upload="onUpload"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="form.adType == '图片广告'">
|
<template v-if="form.adType == '图片广告'">
|
||||||
<a-form-item label="广告图片" name="images" extra="请上传广告图片">
|
<a-form-item label="广告图片" name="images">
|
||||||
<SelectFile
|
<SelectFile
|
||||||
:placeholder="`请选择图片`"
|
|
||||||
:limit="1"
|
:limit="1"
|
||||||
:data="images"
|
:data="images"
|
||||||
@done="chooseFile"
|
@done="chooseFile"
|
||||||
@del="onDeleteItem"
|
@del="onDeleteItem"
|
||||||
/>
|
/>
|
||||||
<!-- <ele-image-upload-->
|
|
||||||
<!-- v-model:value="images"-->
|
|
||||||
<!-- :limit="1"-->
|
|
||||||
<!-- :accept="'image/png,image/jpeg'"-->
|
|
||||||
<!-- :drag="true"-->
|
|
||||||
<!-- :item-style="{ maxWidth: '160px', maxHeight: '160px' }"-->
|
|
||||||
<!-- :upload-handler="uploadHandler"-->
|
|
||||||
<!-- @upload="onUpload"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="form.adType == '视频广告'">
|
<template v-if="form.adType == '视频广告'">
|
||||||
@@ -83,40 +65,43 @@
|
|||||||
@done="chooseFile"
|
@done="chooseFile"
|
||||||
@del="onDeleteItem"
|
@del="onDeleteItem"
|
||||||
/>
|
/>
|
||||||
<!-- <ele-image-upload-->
|
|
||||||
<!-- v-model:value="images"-->
|
|
||||||
<!-- :limit="1"-->
|
|
||||||
<!-- :accept="'video/mp4'"-->
|
|
||||||
<!-- :drag="true"-->
|
|
||||||
<!-- :item-style="{ maxWidth: '160px', maxHeight: '160px' }"-->
|
|
||||||
<!-- :upload-handler="uploadHandler"-->
|
|
||||||
<!-- @upload="onUpload"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<a-form-item label="广告位名称" name="name">
|
<a-form-item label="路由/链接地址" name="path">
|
||||||
|
<template v-if="form.adType == '幻灯片' && images.length > 0">
|
||||||
|
<template v-for="(item, index) in images" :key="index">
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
:maxlength="100"
|
:maxlength="100"
|
||||||
placeholder="请输入广告位名称"
|
:placeholder="`请输入地址${index + 1}`"
|
||||||
v-model:value="form.name"
|
v-model:value="pathList[index]"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</template>
|
||||||
<a-form-item label="广告位描述" name="comments">
|
</template>
|
||||||
<a-textarea
|
<template v-else>
|
||||||
:rows="4"
|
|
||||||
:maxlength="200"
|
|
||||||
placeholder="请输入广告位描述"
|
|
||||||
v-model:value="form.comments"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="路由/链接地址" name="path">
|
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
:maxlength="100"
|
:maxlength="100"
|
||||||
placeholder="请输入路由/链接地址"
|
placeholder="请输入路由/链接地址"
|
||||||
v-model:value="form.path"
|
v-model:value="form.path"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="标题" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
:maxlength="100"
|
||||||
|
placeholder="请输入广告标题"
|
||||||
|
v-model:value="form.name"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="广告描述" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入广告描述"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="排序号" name="sortNumber">
|
<a-form-item label="排序号" name="sortNumber">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
@@ -145,10 +130,14 @@
|
|||||||
import { Ad } from '@/api/cms/ad/model';
|
import { Ad } from '@/api/cms/ad/model';
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { FormInstance, RuleObject } from 'ant-design-vue/es/form';
|
import { FormInstance, type Rule, RuleObject } from 'ant-design-vue/es/form';
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
import { uploadFile } from '@/api/system/file';
|
import { uploadFile } from '@/api/system/file';
|
||||||
import { FileRecord } from '@/api/system/file/model';
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
import { checkExistence } from '@/api/system/company';
|
||||||
|
import image from '@/views/cms/photo/image.vue';
|
||||||
|
import defaultResult from 'ant-design-vue/es/_util/isMobile';
|
||||||
|
import any = defaultResult.any;
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
@@ -173,6 +162,7 @@
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
// 已上传数据
|
// 已上传数据
|
||||||
const images = ref<ItemType[]>([]);
|
const images = ref<ItemType[]>([]);
|
||||||
|
const pathList = ref<any[]>([]);
|
||||||
// 是否显示最大化切换按钮
|
// 是否显示最大化切换按钮
|
||||||
const maxable = ref(true);
|
const maxable = ref(true);
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
@@ -200,14 +190,6 @@
|
|||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
name: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
message: '请填写广告位名称',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
adType: [
|
adType: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -222,11 +204,13 @@
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
message: '请上传图片或视频',
|
message: '请上传图片或视频',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
validator: async (_rule: RuleObject, value: string) => {
|
validator: (_rule: Rule, value: string) => {
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
if (images.value.length == 0) {
|
if (images.value.length == 0) {
|
||||||
return Promise.reject('请上传图片或视频');
|
return reject('请上传图片或视频文件');
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -301,7 +285,9 @@
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
const formData = {
|
const formData = {
|
||||||
...form,
|
...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;
|
const saveOrUpdate = isUpdate.value ? updateAd : addAd;
|
||||||
saveOrUpdate(formData)
|
saveOrUpdate(formData)
|
||||||
@@ -326,6 +312,7 @@
|
|||||||
if (props.data) {
|
if (props.data) {
|
||||||
assignObject(form, props.data);
|
assignObject(form, props.data);
|
||||||
images.value = [];
|
images.value = [];
|
||||||
|
pathList.value = [];
|
||||||
if (props.data.images) {
|
if (props.data.images) {
|
||||||
const arr = JSON.parse(props.data.images);
|
const arr = JSON.parse(props.data.images);
|
||||||
arr.map((d) => {
|
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;
|
isUpdate.value = true;
|
||||||
} else {
|
} else {
|
||||||
images.value = [];
|
images.value = [];
|
||||||
|
|||||||
@@ -7,6 +7,13 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>添加</span>
|
<span>添加</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-input-search
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入关键词"
|
||||||
|
v-model:value="where.keywords"
|
||||||
|
@pressEnter="search"
|
||||||
|
@search="search"
|
||||||
|
/>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -14,6 +21,9 @@
|
|||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import type { GradeParam } from '@/api/user/grade/model';
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
import { watch } from 'vue';
|
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(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -24,7 +34,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'search', where?: GradeParam): void;
|
(e: 'search', where?: AdParam): void;
|
||||||
(e: 'add'): void;
|
(e: 'add'): void;
|
||||||
(e: 'remove'): void;
|
(e: 'remove'): void;
|
||||||
(e: 'batchMove'): void;
|
(e: 'batchMove'): void;
|
||||||
@@ -35,6 +45,16 @@
|
|||||||
emit('add');
|
emit('add');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const { where, resetFields } = useSearch<AdParam>({
|
||||||
|
adId: undefined,
|
||||||
|
keywords: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
const search = () => {
|
||||||
|
emit('search', where);
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.selection,
|
() => props.selection,
|
||||||
() => {}
|
() => {}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'adType'">
|
||||||
|
<a-tag>{{ record.adType }}</a-tag>
|
||||||
|
</template>
|
||||||
<template v-if="column.key === 'images'">
|
<template v-if="column.key === 'images'">
|
||||||
<template
|
<template
|
||||||
v-for="(item, index) in JSON.parse(record.images)"
|
v-for="(item, index) in JSON.parse(record.images)"
|
||||||
@@ -115,21 +118,34 @@
|
|||||||
{
|
{
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'adType',
|
dataIndex: 'adType',
|
||||||
key: 'adType'
|
key: 'adType',
|
||||||
},
|
width: 120,
|
||||||
{
|
|
||||||
title: '广告位名称',
|
|
||||||
dataIndex: 'name'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '广告图片',
|
title: '广告图片',
|
||||||
dataIndex: 'images',
|
dataIndex: 'images',
|
||||||
key: 'images'
|
key: 'images'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '跳转路径',
|
||||||
|
dataIndex: 'path',
|
||||||
|
key: 'path',
|
||||||
|
width: 280,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '描述',
|
||||||
|
dataIndex: 'comments',
|
||||||
|
key: 'path',
|
||||||
|
width: 280,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
key: 'status'
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|||||||
@@ -145,7 +145,6 @@
|
|||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
const onDeleteItem = (index: number) => {
|
||||||
images.value.splice(index, 1);
|
images.value.splice(index, 1);
|
||||||
form.value = '';
|
|
||||||
form.type = 0;
|
form.type = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -166,7 +165,6 @@
|
|||||||
const saveOrUpdate = isUpdate.value
|
const saveOrUpdate = isUpdate.value
|
||||||
? updateWebsiteField
|
? updateWebsiteField
|
||||||
: addWebsiteField;
|
: addWebsiteField;
|
||||||
console.log(isUpdate.value);
|
|
||||||
saveOrUpdate(data)
|
saveOrUpdate(data)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -192,11 +190,13 @@
|
|||||||
if (props.data) {
|
if (props.data) {
|
||||||
assignFields(props.data);
|
assignFields(props.data);
|
||||||
form.comments = props.data.comments;
|
form.comments = props.data.comments;
|
||||||
|
if (form.type == 1) {
|
||||||
images.value.push({
|
images.value.push({
|
||||||
uid: uuid(),
|
uid: uuid(),
|
||||||
url: props.data.value,
|
url: props.data.value,
|
||||||
status: 'done'
|
status: 'done'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
} else {
|
} else {
|
||||||
isUpdate.value = false;
|
isUpdate.value = false;
|
||||||
|
|||||||
@@ -296,9 +296,9 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
listMpMenu({}).then((list) => {
|
listMpMenu({ type: 4 }).then((list) => {
|
||||||
server.value = list.filter((d) => d.type == 0);
|
server.value = list.filter((d) => d.type == 0);
|
||||||
order.value = list.filter((d) => d.type == 1);
|
order.value = list.filter((d) => d.rows == 0);
|
||||||
scrollList.value = list.filter((d) => d.type == 2);
|
scrollList.value = list.filter((d) => d.type == 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,23 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>添加</span>
|
<span>添加</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-select ref="select" v-model:value="menuType" style="width: 120px" @change="onChange">
|
||||||
|
<a-select-option value="图片广告">图片广告</a-select-option>
|
||||||
|
<a-select-option value="幻灯片">幻灯片</a-select-option>
|
||||||
|
<a-select-option value="视频广告">视频广告</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<!-- <a-button-->
|
||||||
|
<!-- type="primary"-->
|
||||||
|
<!-- style="background-color: var(--orange-6); border-color: var(--orange-5)"-->
|
||||||
|
<!-- @click="openPeriod"-->
|
||||||
|
<!-- >导航展示方式</a-button-->
|
||||||
|
<!-- >-->
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import { watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import useSearch from '@/utils/use-search';
|
import useSearch from '@/utils/use-search';
|
||||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||||
|
|
||||||
@@ -45,6 +56,12 @@
|
|||||||
emit('add');
|
emit('add');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const menuType = ref(0);
|
||||||
|
|
||||||
|
const onChange = () => {
|
||||||
|
console.log(menuType.value);
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.selection,
|
() => props.selection,
|
||||||
() => {}
|
() => {}
|
||||||
|
|||||||
@@ -148,6 +148,7 @@
|
|||||||
if (hasRole('commander')) {
|
if (hasRole('commander')) {
|
||||||
where.commander = userStore.info?.userId;
|
where.commander = userStore.info?.userId;
|
||||||
}
|
}
|
||||||
|
where.appId = props.appId;
|
||||||
return pageTask({
|
return pageTask({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
|
|||||||
Reference in New Issue
Block a user