修复:项目管理的关联工单列表增加查询条件appId

This commit is contained in:
gxwebsoft
2024-06-06 12:07:53 +08:00
parent 62bd0f7e36
commit 153b571705
14 changed files with 832 additions and 87 deletions

View File

@@ -20,18 +20,19 @@
"
>
<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>
</a-form-item>
<template v-if="form.adType == '幻灯片'">
<a-form-item
label="广告图片"
name="images"
extra="请上传广告图片,最多可上传9张图"
>
<a-form-item label="广告图片" name="images">
<SelectFile
:placeholder="`请选择图片`"
:limit="9"
@@ -39,35 +40,16 @@
@done="chooseFile"
@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>
</template>
<template v-if="form.adType == '图片广告'">
<a-form-item label="广告图片" name="images" extra="请上传广告图片">
<a-form-item label="广告图片" name="images">
<SelectFile
:placeholder="`请选择图片`"
:limit="1"
:data="images"
@done="chooseFile"
@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>
</template>
<template v-if="form.adType == '视频广告'">
@@ -83,41 +65,44 @@
@done="chooseFile"
@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>
</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
allow-clear
:maxlength="100"
:placeholder="`请输入地址${index + 1}`"
v-model:value="pathList[index]"
/>
</template>
</template>
<template v-else>
<a-input
allow-clear
:maxlength="100"
placeholder="请输入路由/链接地址"
v-model:value="form.path"
/>
</template>
</a-form-item>
<a-form-item label="标题" name="name">
<a-input
allow-clear
:maxlength="100"
placeholder="请输入广告位名称"
placeholder="请输入广告标题"
v-model:value="form.name"
/>
</a-form-item>
<a-form-item label="广告描述" name="comments">
<a-form-item label="广告描述" name="comments">
<a-textarea
:rows="4"
:maxlength="200"
placeholder="请输入广告描述"
placeholder="请输入广告描述"
v-model:value="form.comments"
/>
</a-form-item>
<a-form-item label="路由/链接地址" name="path">
<a-input
allow-clear
:maxlength="100"
placeholder="请输入路由/链接地址"
v-model:value="form.path"
/>
</a-form-item>
<a-form-item label="排序号" name="sortNumber">
<a-input-number
:min="0"
@@ -145,10 +130,14 @@
import { Ad } from '@/api/cms/ad/model';
import { useThemeStore } from '@/store/modules/theme';
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 { uploadFile } from '@/api/system/file';
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);
@@ -173,6 +162,7 @@
const loading = ref(false);
// 已上传数据
const images = ref<ItemType[]>([]);
const pathList = ref<any[]>([]);
// 是否显示最大化切换按钮
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<void>((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 = [];