新增:并入shop、cms、oa三大模块代码
This commit is contained in:
@@ -0,0 +1,676 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="appName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用名称"
|
||||
v-model:value="form.appName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用标识" name="appCode">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用标识"
|
||||
v-model:value="form.appCode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用秘钥" name="appSecret">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用秘钥"
|
||||
v-model:value="form.appSecret"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="上级id, 0是顶级" name="parentId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入上级id, 0是顶级"
|
||||
v-model:value="form.parentId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用类型" name="appType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用类型"
|
||||
v-model:value="form.appType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用类型" name="appTypeMultiple">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用类型"
|
||||
v-model:value="form.appTypeMultiple"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="类型, 0菜单, 1按钮" name="menuType">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入类型, 0菜单, 1按钮"
|
||||
v-model:value="form.menuType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="企业ID" name="companyId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入企业ID"
|
||||
v-model:value="form.companyId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="企业名称" name="companyName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入企业名称"
|
||||
v-model:value="form.companyName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用图标" name="appIcon">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用图标"
|
||||
v-model:value="form.appIcon"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="二维码" name="appQrcode">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入二维码"
|
||||
v-model:value="form.appQrcode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="链接地址" name="appUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入链接地址"
|
||||
v-model:value="form.appUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="后台管理地址" name="adminUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入后台管理地址"
|
||||
v-model:value="form.adminUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="下载地址" name="downUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入下载地址"
|
||||
v-model:value="form.downUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="链接地址" name="serverUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入链接地址"
|
||||
v-model:value="form.serverUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="文件服务器" name="fileUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入文件服务器"
|
||||
v-model:value="form.fileUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="回调地址" name="callbackUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入回调地址"
|
||||
v-model:value="form.callbackUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="腾讯文档地址" name="docsUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入腾讯文档地址"
|
||||
v-model:value="form.docsUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="代码仓库地址" name="gitUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入代码仓库地址"
|
||||
v-model:value="form.gitUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="原型图地址" name="prototypeUrl">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入原型图地址"
|
||||
v-model:value="form.prototypeUrl"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="IP白名单" name="ipAddress">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入IP白名单"
|
||||
v-model:value="form.ipAddress"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用截图" name="images">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用截图"
|
||||
v-model:value="form.images"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用包名" name="packageName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用包名"
|
||||
v-model:value="form.packageName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="下载次数" name="clicks">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入下载次数"
|
||||
v-model:value="form.clicks"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="安装次数" name="installs">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入安装次数"
|
||||
v-model:value="form.installs"
|
||||
/>
|
||||
</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="content">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用介绍"
|
||||
v-model:value="form.content"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="项目需求" name="requirement">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入项目需求"
|
||||
v-model:value="form.requirement"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="开发者(个人或公司)" name="developer">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入开发者(个人或公司)"
|
||||
v-model:value="form.developer"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="项目负责人" name="director">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入项目负责人"
|
||||
v-model:value="form.director"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="项目经理" name="projectDirector">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入项目经理"
|
||||
v-model:value="form.projectDirector"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="业务员" name="salesman">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入业务员"
|
||||
v-model:value="form.salesman"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="软件定价" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入软件定价"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="划线价格" name="linePrice">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入划线价格"
|
||||
v-model:value="form.linePrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="评分" name="score">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入评分"
|
||||
v-model:value="form.score"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="星级" name="star">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入星级"
|
||||
v-model:value="form.star"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单组件地址, 目录可为空" name="component">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单组件地址, 目录可为空"
|
||||
v-model:value="form.component"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="权限标识" name="authority">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入权限标识"
|
||||
v-model:value="form.authority"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="打开位置" name="target">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入打开位置"
|
||||
v-model:value="form.target"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)" name="hide">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)"
|
||||
v-model:value="form.hide"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="禁止搜索,1禁止 0 允许" name="search">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入禁止搜索,1禁止 0 允许"
|
||||
v-model:value="form.search"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单侧栏选中的path" name="active">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单侧栏选中的path"
|
||||
v-model:value="form.active"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="其它路由元信息" name="meta">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入其它路由元信息"
|
||||
v-model:value="form.meta"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="版本,0正式版 1体验版 2开发版" name="edition">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入版本,0正式版 1体验版 2开发版"
|
||||
v-model:value="form.edition"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="版本号" name="version">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入版本号"
|
||||
v-model:value="form.version"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否已安装" name="isUse">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否已安装"
|
||||
v-model:value="form.isUse"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="附近1" name="file1">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入附近1"
|
||||
v-model:value="form.file1"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="附件2" name="file2">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入附件2"
|
||||
v-model:value="form.file2"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="附件3" name="file3">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入附件3"
|
||||
v-model:value="form.file3"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否显示续费提醒" name="showExpiration">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否显示续费提醒"
|
||||
v-model:value="form.showExpiration"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否作为案例展示" name="showCase">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否作为案例展示"
|
||||
v-model:value="form.showCase"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否显示在首页" name="showIndex">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否显示在首页"
|
||||
v-model:value="form.showIndex"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否推荐" name="recommend">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否推荐"
|
||||
v-model:value="form.recommend"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="到期时间" name="expirationTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入到期时间"
|
||||
v-model:value="form.expirationTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="续费金额" name="renewMoney">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入续费金额"
|
||||
v-model:value="form.renewMoney"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用状态" name="appStatus">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用状态"
|
||||
v-model:value="form.appStatus"
|
||||
/>
|
||||
</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-item label="状态, 0正常, 1冻结" 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="是否删除, 0否, 1是" name="deleted">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否删除, 0否, 1是"
|
||||
v-model:value="form.deleted"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户ID" name="userId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户ID"
|
||||
v-model:value="form.userId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="机构id" name="organizationId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入机构id"
|
||||
v-model:value="form.organizationId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="租户编号" name="tenantCode">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入租户编号"
|
||||
v-model:value="form.tenantCode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="修改时间" name="updateTime">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入修改时间"
|
||||
v-model:value="form.updateTime"
|
||||
/>
|
||||
</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 { addOaApp, updateOaApp } from '@/api/oa/oaApp';
|
||||
import { OaApp } from '@/api/oa/oaApp/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?: OaApp | 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<OaApp>({
|
||||
appId: undefined,
|
||||
appName: undefined,
|
||||
appCode: undefined,
|
||||
appSecret: undefined,
|
||||
parentId: undefined,
|
||||
appType: undefined,
|
||||
appTypeMultiple: undefined,
|
||||
menuType: undefined,
|
||||
companyId: undefined,
|
||||
companyName: undefined,
|
||||
appIcon: undefined,
|
||||
appQrcode: undefined,
|
||||
appUrl: undefined,
|
||||
adminUrl: undefined,
|
||||
downUrl: undefined,
|
||||
serverUrl: undefined,
|
||||
fileUrl: undefined,
|
||||
callbackUrl: undefined,
|
||||
docsUrl: undefined,
|
||||
gitUrl: undefined,
|
||||
prototypeUrl: undefined,
|
||||
ipAddress: undefined,
|
||||
images: undefined,
|
||||
packageName: undefined,
|
||||
clicks: undefined,
|
||||
installs: undefined,
|
||||
comments: undefined,
|
||||
content: undefined,
|
||||
requirement: undefined,
|
||||
developer: undefined,
|
||||
director: undefined,
|
||||
projectDirector: undefined,
|
||||
salesman: undefined,
|
||||
price: undefined,
|
||||
linePrice: undefined,
|
||||
score: undefined,
|
||||
star: undefined,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
authority: undefined,
|
||||
target: undefined,
|
||||
hide: undefined,
|
||||
search: undefined,
|
||||
active: undefined,
|
||||
meta: undefined,
|
||||
edition: undefined,
|
||||
version: undefined,
|
||||
isUse: undefined,
|
||||
file1: undefined,
|
||||
file2: undefined,
|
||||
file3: undefined,
|
||||
showExpiration: undefined,
|
||||
showCase: undefined,
|
||||
showIndex: undefined,
|
||||
recommend: undefined,
|
||||
expirationTime: undefined,
|
||||
renewMoney: undefined,
|
||||
appStatus: undefined,
|
||||
sortNumber: undefined,
|
||||
status: undefined,
|
||||
deleted: undefined,
|
||||
userId: undefined,
|
||||
organizationId: undefined,
|
||||
tenantCode: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
oaAppId: undefined,
|
||||
oaAppName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
oaAppName: [
|
||||
{
|
||||
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.path;
|
||||
};
|
||||
|
||||
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 ? updateOaApp : addOaApp;
|
||||
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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,599 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="oaAppId"
|
||||
: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 === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</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>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<OaAppEdit 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 OaAppEdit from './components/oaAppEdit.vue';
|
||||
import { pageOaApp, removeOaApp, removeBatchOaApp } from '@/api/oa/oaApp';
|
||||
import type { OaApp, OaAppParam } from '@/api/oa/oaApp/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<OaApp[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<OaApp | 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 pageOaApp({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '应用ID',
|
||||
dataIndex: 'appId',
|
||||
key: 'appId',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '应用名称',
|
||||
dataIndex: 'appName',
|
||||
key: 'appName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用标识',
|
||||
dataIndex: 'appCode',
|
||||
key: 'appCode',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用秘钥',
|
||||
dataIndex: 'appSecret',
|
||||
key: 'appSecret',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '上级id, 0是顶级',
|
||||
dataIndex: 'parentId',
|
||||
key: 'parentId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用类型',
|
||||
dataIndex: 'appType',
|
||||
key: 'appType',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用类型',
|
||||
dataIndex: 'appTypeMultiple',
|
||||
key: 'appTypeMultiple',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '类型, 0菜单, 1按钮',
|
||||
dataIndex: 'menuType',
|
||||
key: 'menuType',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '企业ID',
|
||||
dataIndex: 'companyId',
|
||||
key: 'companyId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '企业名称',
|
||||
dataIndex: 'companyName',
|
||||
key: 'companyName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用图标',
|
||||
dataIndex: 'appIcon',
|
||||
key: 'appIcon',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '二维码',
|
||||
dataIndex: 'appQrcode',
|
||||
key: 'appQrcode',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '链接地址',
|
||||
dataIndex: 'appUrl',
|
||||
key: 'appUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '后台管理地址',
|
||||
dataIndex: 'adminUrl',
|
||||
key: 'adminUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '下载地址',
|
||||
dataIndex: 'downUrl',
|
||||
key: 'downUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '链接地址',
|
||||
dataIndex: 'serverUrl',
|
||||
key: 'serverUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '文件服务器',
|
||||
dataIndex: 'fileUrl',
|
||||
key: 'fileUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '回调地址',
|
||||
dataIndex: 'callbackUrl',
|
||||
key: 'callbackUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '腾讯文档地址',
|
||||
dataIndex: 'docsUrl',
|
||||
key: 'docsUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '代码仓库地址',
|
||||
dataIndex: 'gitUrl',
|
||||
key: 'gitUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '原型图地址',
|
||||
dataIndex: 'prototypeUrl',
|
||||
key: 'prototypeUrl',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: 'IP白名单',
|
||||
dataIndex: 'ipAddress',
|
||||
key: 'ipAddress',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用截图',
|
||||
dataIndex: 'images',
|
||||
key: 'images',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用包名',
|
||||
dataIndex: 'packageName',
|
||||
key: 'packageName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '下载次数',
|
||||
dataIndex: 'clicks',
|
||||
key: 'clicks',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '安装次数',
|
||||
dataIndex: 'installs',
|
||||
key: 'installs',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用介绍',
|
||||
dataIndex: 'content',
|
||||
key: 'content',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '项目需求',
|
||||
dataIndex: 'requirement',
|
||||
key: 'requirement',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '开发者(个人或公司)',
|
||||
dataIndex: 'developer',
|
||||
key: 'developer',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '项目负责人',
|
||||
dataIndex: 'director',
|
||||
key: 'director',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '项目经理',
|
||||
dataIndex: 'projectDirector',
|
||||
key: 'projectDirector',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '业务员',
|
||||
dataIndex: 'salesman',
|
||||
key: 'salesman',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '软件定价',
|
||||
dataIndex: 'price',
|
||||
key: 'price',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '划线价格',
|
||||
dataIndex: 'linePrice',
|
||||
key: 'linePrice',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '评分',
|
||||
dataIndex: 'score',
|
||||
key: 'score',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '星级',
|
||||
dataIndex: 'star',
|
||||
key: 'star',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '菜单路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '菜单组件地址, 目录可为空',
|
||||
dataIndex: 'component',
|
||||
key: 'component',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '权限标识',
|
||||
dataIndex: 'authority',
|
||||
key: 'authority',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '打开位置',
|
||||
dataIndex: 'target',
|
||||
key: 'target',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)',
|
||||
dataIndex: 'hide',
|
||||
key: 'hide',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '禁止搜索,1禁止 0 允许',
|
||||
dataIndex: 'search',
|
||||
key: 'search',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '菜单侧栏选中的path',
|
||||
dataIndex: 'active',
|
||||
key: 'active',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '其它路由元信息',
|
||||
dataIndex: 'meta',
|
||||
key: 'meta',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '版本,0正式版 1体验版 2开发版',
|
||||
dataIndex: 'edition',
|
||||
key: 'edition',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '版本号',
|
||||
dataIndex: 'version',
|
||||
key: 'version',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否已安装',
|
||||
dataIndex: 'isUse',
|
||||
key: 'isUse',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '附近1',
|
||||
dataIndex: 'file1',
|
||||
key: 'file1',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '附件2',
|
||||
dataIndex: 'file2',
|
||||
key: 'file2',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '附件3',
|
||||
dataIndex: 'file3',
|
||||
key: 'file3',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否显示续费提醒',
|
||||
dataIndex: 'showExpiration',
|
||||
key: 'showExpiration',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否作为案例展示',
|
||||
dataIndex: 'showCase',
|
||||
key: 'showCase',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否显示在首页',
|
||||
dataIndex: 'showIndex',
|
||||
key: 'showIndex',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否推荐',
|
||||
dataIndex: 'recommend',
|
||||
key: 'recommend',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '到期时间',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '续费金额',
|
||||
dataIndex: 'renewMoney',
|
||||
key: 'renewMoney',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '应用状态',
|
||||
dataIndex: 'appStatus',
|
||||
key: 'appStatus',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '排序(数字越小越靠前)',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '状态, 0正常, 1冻结',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '是否删除, 0否, 1是',
|
||||
dataIndex: 'deleted',
|
||||
key: 'deleted',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '机构id',
|
||||
dataIndex: 'organizationId',
|
||||
key: 'organizationId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '租户编号',
|
||||
dataIndex: 'tenantCode',
|
||||
key: 'tenantCode',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: OaAppParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: OaApp) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: OaApp) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeOaApp(row.oaAppId)
|
||||
.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);
|
||||
removeBatchOaApp(selection.value.map((d) => d.oaAppId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: OaApp) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'OaApp'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
Reference in New Issue
Block a user