<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<script src="./config/adminTool.config.js"></script>
<script src="./js/utils.js"></script>
<link rel="stylesheet" href="./css/_reset.css" />
<link rel="stylesheet" href="./css/base.css" />
<script src="./lib/axios.min.js"></script>
<script src="./js/request.js"></script>
<script src="./lib/tailwindcss.min.js"></script>
<script src="./lib/vue@3.js"></script>
<script src="./lib/ElementPlus/icons-vue.js"></script>
<script src="./lib/ElementPlus/element-plus.js"></script>
<link rel="stylesheet" href="./lib/ElementPlus/index.css" />
<script src="./lib/ElementPlus/locale/zh-cn.js"></script>
<script src="./lib/vue-i18n.global.js"></script>
<script src="./js/components/common/departmentTree.js"></script>
<script src="./js/components/common/userSelect.js"></script>
<script src="./js/components/common/roleUserAuth.js"></script>
<script src="./js/components/addApplication.js"></script>
<link rel="stylesheet" href="./css/base.css" />
<script>
if (
typeof VueI18n !== "undefined" &&
typeof window !== "undefined" &&
!window.VueI18n
) {
window.VueI18n = VueI18n;
}
</script>
<script src="./js/i18n/index.js" type="module"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: "#4F46E5",
secondary: "#10B981",
},
},
},
};
</script>
<style type="text/tailwindcss">
@layer utilities {
.content-auto {
content-visibility: auto;
}
.card-shadow {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
}
</style>
</head>
<body>
<div id="app"></div>
<template id="softwareCpn">
<div class="px-2">
<div class="title smallHeader py-2 border-b border-gray-200 box-border">
基础功能配置
</div>
<div class="content">
<el-checkbox v-model="baseInfo.flowCenterEnable">流程中心</el-checkbox>
</div>
</div> -->
<div class="list">
<div class="title smallHeader py-2 border-b border-gray-200 box-border">
自定义软件配置
</div>
<div class="content">
<div class="search flex align-center py-2 justify-between">
<div class="left flex align-center">
<el-input v-model="list.params.name" placeholder="请输入软件名称"></el-input>
<el-button type="primary" @click="searchSoftware" class="ml-2">搜索</el-button>
<el-button @click="resetSoftware" class="ml-2">重置</el-button>
</div>
<div class="right flex align-center">
<el-button type="primary" @click="openAddApplication">添加</el-button>
<el-button type="danger" @click="deleteSoftware">移除</el-button>
</div>
</div>
<div class="table" style="width: 100%;">
<el-table :data="list.data" stripe @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="name" label="软件名称"></el-table-column>
<el-table-column label="模式" width="85">
<template #default="scope">
<el-link :type="scope.row.type == 0 ? 'success' : 'primary'">
{{ scope.row.type == 0 ? '常规模式' : '平台模式' }}
</el-link>
</template>
</el-table-column>
<el-table-column label="描述" prop="description"></el-table-column>
<el-table-column label="状态" width="100" >
<template #default="scope">
<el-tag v-if="scope.row.activated" type="success">激活</el-tag>
<el-tag v-else type="danger">失效</el-tag>
</template>
</el-table-column>
<template #default="scope">
<el-button v-if="scope.row.type == 0"
@click.stop="openUserSelect(scope.row)"
type="primary"
plain
>
添加角色
</el-button>
<el-button v-if="scope.row.type == 1"
@click.stop="onBpmModeConf(scope.row)"
type="primary"
plain
>
平台模式配置
</el-button>
</template>
</el-table-column> -->
<template #default="scope">
<el-button type="primary"
plain
@click.stop="exportbasicdataauthority(scope.row, 'basicData')"
>
基础数据
</el-button>
<el-button @click.stop="exportrolemenuauthority(scope.row, 'roleMenu')"
type="primary"
plain
>
角色&菜单
</el-button>
<el-button @click.stop="exportroleuserauthority(scope.row, 'roleAuth')"
type="primary"
plain
>
角色&用户
</el-button>
</template>
</el-table-column> -->
</el-table>
<div class="pagination py-2 flex justify-end">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="list.currpage"
:page-sizes="[10, 20, 50, 100]"
:page-size="list.pagelines"
layout="total, sizes, prev, pager, next, jumper"
:total="list.total"
></el-pagination>
</div>
</div>
</div>
</div>
</div>
<role-user-auth v-model="applicationRole.visible" :application="applicationRole.data"></role-user-auth>
<add-application v-model="addApplication.visible"
v-if="addApplication.visible"
@success="getBindSoftwareList"
></add-application>
</template>
<script>
document.addEventListener("DOMContentLoaded", function () {
let checkCount = 0;
const maxChecks = 40;
function checkDependencies() {
checkCount++;
const depsReady =
typeof Vue !== "undefined" &&
typeof userSelectComponent !== "undefined" &&
typeof useRoleUserAuthComponent !== "undefined" &&
typeof useAddApplicationComponent !== "undefined";
const isInIframe = window.self !== window.top;
let sizeReady = true;
if (isInIframe) {
const minSize = 100;
sizeReady = window.innerWidth >= minSize && window.innerHeight >= minSize;
}
if (depsReady && sizeReady) {
initApp();
} else if (checkCount < maxChecks) {
setTimeout(checkDependencies, 50);
} else {
console.warn('依赖检查超时,强制初始化应用');
if (depsReady) {
initApp();
}
}
}
function initApp() {
if (typeof Vue === "undefined") {
console.error("Vue 未加载");
return;
}
if(typeof userSelectComponent === "undefined") {
console.error("userSelectComponent 未加载");
return;
}
const userSelect = userSelectComponent();
if(typeof useRoleUserAuthComponent === "undefined") {
console.error("roleUserAuthComponent 未加载");
return;
}
const roleUserAuth = useRoleUserAuthComponent();
if(typeof useAddApplicationComponent === "undefined") {
console.error("addApplicationComponent 未加载");
return;
}
const addApplication = useAddApplicationComponent();
const softwareCpn = Vue.createApp({
template: "#softwareCpn",
components: {
userSelect: userSelect,
roleUserAuth: roleUserAuth,
addApplication: addApplication
},
data() {
return {
baseInfo: {
flowCenterEnable: false,
},
list: {
data: [],
total: 10,
currpage: 1,
pagelines: 10,
params: {
name: '',
}
},
applicationRole: {
visible: false,
data: null
},
addApplication: {
visible: false,
},
selectedSoftware: [],
}
},
created() {
this.$nextTick(() => {
this.searchSoftware();
});
},
methods: {
handleSelectionChange(val) {
this.selectedSoftware = val;
},
async getBindSoftwareList() {
try {
this.list.load = true;
const res = await API.getBindSoftwareList({
name: this.list.params.name,
currpage: this.list.currpage,
pagelines: this.list.pagelines
});
if(res.data.errcode == 0) {
this.list.data = res.data.data.datas;
this.list.total = res.data.data.rowCount;
this.list.currpage = res.data.data.pageNo;
this.selectedSoftware = [];
} else {
this.$message.error(res.data.errmsg || '获取已绑定的软件列表失败');
}
}
catch (error) {
console.error(error);
}
finally {
this.list.load = false;
}
},
searchSoftware() {
this.list.currpage = 1;
this.getBindSoftwareList();
},
resetSoftware() {
this.list.params.name = '';
this.searchSoftware();
},
handleSizeChange(val) {
this.list.pagelines = val;
this.getBindSoftwareList();
},
handleCurrentChange(val) {
this.list.currpage = val;
this.getBindSoftwareList();
},
exportbasicdataauthority(row, type) {
const msgMap = {
'basicData': '基础数据',
'roleMenu': '角色&菜单',
'roleAuth': '角色&用户',
}
let msg = `确定要导出 ${msgMap[type] ? msgMap[type] : '所选'} 数据吗?`;
const domainId = getQueryParams().domainId;
if(!domainId) {
this.$message.error('请先选择域');
return;
}
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(() => {
console.log('确定');
}).catch(() => {
console.log('取消');
});
},
openUserSelect(row) {
this.applicationRole.data = row;
this.applicationRole.visible = true;
},
openAddApplication() {
this.addApplication.visible = true;
},
deleteSoftware() {
if(this.selectedSoftware.length == 0) {
this.$message.error('请选择要删除的软件');
return;
}
this.$confirm('确定删除选中的软件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(async () => {
const applicationIds = this.selectedSoftware.map(item => item.id);
const res = await API.deleteSoftware(applicationIds);
if(res.data.errcode == 0) {
this.$message.success('删除软件成功');
this.selectedSoftware = [];
this.getBindSoftwareList();
} else {
this.$message.error(res.data.errmsg || '删除软件失败');
}
}).catch(() => {
this.$message.error('删除软件失败');
});
}
}
});
if (typeof ElementPlusIconsVue !== "undefined") {
const reservedElements = ['filter', 'link', 'menu', 'picture', 'select', 'switch', 'view'];
const toKebabCase = (str) => {
return str
.replace(/([A-Z])/g, "-$1")
.toLowerCase()
.replace(/^-/, "");
};
for (const [key, component] of Object.entries(
ElementPlusIconsVue
)) {
const kebabKey = toKebabCase(key);
const lowerKey = key.toLowerCase();
const isReserved = reservedElements.includes(kebabKey) || reservedElements.includes(lowerKey);
if (!isReserved) {
softwareCpn.component(key, component);
if (kebabKey !== key) {
softwareCpn.component(kebabKey, component);
}
if (lowerKey !== key && lowerKey !== kebabKey) {
softwareCpn.component(lowerKey, component);
}
}
}
} else {
console.error(
"ElementPlusIconsVue 未加载,请检查 icons-vue.js 是否正确引入"
);
}
if (typeof useI18n !== "undefined") {
const i18n = useI18n();
if (i18n) {
softwareCpn.use(i18n);
}
}
let zhCnLocale = null;
if (typeof ElementPlusLocaleZhCn !== "undefined") {
zhCnLocale = ElementPlusLocaleZhCn;
} else if (window.ElementPlusLocaleZhCn) {
zhCnLocale = window.ElementPlusLocaleZhCn;
} else if (ElementPlus && ElementPlus.locale) {
zhCnLocale =
ElementPlus.locale.zhCn ||
ElementPlus.locale.zhCN ||
ElementPlus.locale.zh_CN;
}
if (zhCnLocale) {
softwareCpn.use(ElementPlus, { locale: zhCnLocale });
console.log("Element Plus 已配置为中文");
} else {
softwareCpn.use(ElementPlus);
console.warn("未找到 Element Plus 中文语言包,使用默认语言");
}
softwareCpn.mount("#app");
}
checkDependencies();
});
</script>
</body>
</html>