87 changed files with 3267 additions and 612 deletions
@ -1,102 +0,0 @@ |
|||
{ |
|||
"name": "io.sc.platform.system.frontend", |
|||
"version": "8.1.38", |
|||
"description": "", |
|||
"private": false, |
|||
"keywords": [], |
|||
"author": "", |
|||
"license": "ISC", |
|||
"scripts": { |
|||
"dev": "nodemon", |
|||
"serve": "node ./util-components-generator.cjs && cross-env NODE_ENV=development webpack serve --config webpack.env.serve.cjs", |
|||
"build": "node ./util-components-generator.cjs && cross-env NODE_ENV=development webpack --config webpack.env.build.cjs", |
|||
"prod": "node ./util-components-generator.cjs && cross-env NODE_ENV=production webpack --config webpack.env.prod.cjs", |
|||
"sync": "platform sync", |
|||
"clean": "rm -rf ./node_modules && rm -rf pnpm-lock.yaml" |
|||
}, |
|||
"engines": { |
|||
"node": ">=18", |
|||
"pnpm": ">=7" |
|||
}, |
|||
"publishConfig": { |
|||
"registry": "http://nexus.sc.io:8000/repository/npm-releases/", |
|||
"access": "public" |
|||
}, |
|||
"devDependencies": { |
|||
"@babel/core": "7.23.7", |
|||
"@babel/preset-env": "7.23.7", |
|||
"@babel/preset-typescript": "7.23.3", |
|||
"@babel/plugin-transform-class-properties": "7.23.3", |
|||
"@babel/plugin-transform-object-rest-spread": "7.23.4", |
|||
"@quasar/app-webpack": "3.12.1", |
|||
"@quasar/cli": "2.3.0", |
|||
"@types/mockjs": "1.0.10", |
|||
"@types/node": "20.10.6", |
|||
"@typescript-eslint/eslint-plugin": "6.17.0", |
|||
"@typescript-eslint/parser": "6.17.0", |
|||
"@vue/compiler-sfc": "3.4.3", |
|||
"@webpack-cli/serve": "2.0.5", |
|||
"autoprefixer": "10.4.16", |
|||
"babel-loader": "9.1.3", |
|||
"clean-webpack-plugin": "4.0.0", |
|||
"copy-webpack-plugin": "11.0.0", |
|||
"cross-env": "7.0.3", |
|||
"css-loader": "6.8.1", |
|||
"eslint": "8.56.0", |
|||
"eslint-config-prettier": "9.1.0", |
|||
"eslint-plugin-prettier": "5.1.2", |
|||
"eslint-plugin-vue": "9.19.2", |
|||
"eslint-webpack-plugin": "4.0.1", |
|||
"html-webpack-plugin": "5.6.0", |
|||
"json5": "2.2.3", |
|||
"mini-css-extract-plugin": "2.7.6", |
|||
"nodemon": "3.0.2", |
|||
"postcss": "8.4.32", |
|||
"postcss-import": "16.0.0", |
|||
"postcss-loader": "7.3.4", |
|||
"postcss-preset-env": "9.3.0", |
|||
"prettier": "3.1.1", |
|||
"sass": "1.69.7", |
|||
"sass-loader": "13.3.3", |
|||
"typescript": "5.3.3", |
|||
"vue-loader": "17.4.2", |
|||
"webpack": "5.89.0", |
|||
"webpack-bundle-analyzer": "4.10.1", |
|||
"webpack-cli": "5.1.4", |
|||
"webpack-dev-server": "4.15.1", |
|||
"webpack-merge": "5.10.0", |
|||
"@vue/babel-plugin-jsx": "1.1.5" |
|||
}, |
|||
"dependencies": { |
|||
"@codemirror/autocomplete": "6.11.1", |
|||
"@codemirror/commands": "6.3.3", |
|||
"@codemirror/lang-html": "6.4.7", |
|||
"@codemirror/lang-java": "6.0.1", |
|||
"@codemirror/lang-javascript": "6.2.1", |
|||
"@codemirror/lang-json": "6.0.1", |
|||
"@codemirror/lang-sql": "6.5.4", |
|||
"@codemirror/lang-xml": "6.0.2", |
|||
"@codemirror/language": "6.10.0", |
|||
"@codemirror/search": "6.5.5", |
|||
"@codemirror/state": "6.4.0", |
|||
"@codemirror/view": "6.23.0", |
|||
"@maxgraph/core": "0.9.0", |
|||
"@quasar/extras": "1.16.9", |
|||
"@vueuse/core": "10.7.1", |
|||
"axios": "1.6.3", |
|||
"codemirror": "6.0.1", |
|||
"dayjs": "1.11.10", |
|||
"echarts": "5.4.3", |
|||
"exceljs": "4.4.0", |
|||
"file-saver": "2.0.5", |
|||
"luckyexcel": "1.0.1", |
|||
"mockjs": "1.1.0", |
|||
"pinia": "2.1.7", |
|||
"quasar": "2.14.5", |
|||
"tailwindcss": "3.4.0", |
|||
"vue": "3.4.3", |
|||
"vue-dompurify-html": "5.0.1", |
|||
"vue-i18n": "9.8.0", |
|||
"vue-router": "4.2.5" |
|||
} |
|||
} |
@ -1,160 +1,41 @@ |
|||
<template> |
|||
<div> |
|||
<div class="row justify-end q-gutter-md q-py-md"> |
|||
<q-select |
|||
v-model="selectedTheme" |
|||
:label="$t('theme')" |
|||
:options="themeOptions" |
|||
option-label="name" |
|||
option-value="id" |
|||
emit-value |
|||
map-options |
|||
dense |
|||
outlined |
|||
style="min-width: 200px" |
|||
@update:model-value="themeChanged" |
|||
> |
|||
<template #option="scope"> |
|||
<q-item v-bind="scope.itemProps"> |
|||
<q-item-section> |
|||
<q-item-label>{{ scope.opt.name }}</q-item-label> |
|||
</q-item-section> |
|||
<q-item-section v-if="scope.opt.active" avatar> |
|||
<q-icon name="bi-check" /> |
|||
</q-item-section> |
|||
<q-item-section v-else avatar> |
|||
<w-icon-empty></w-icon-empty> |
|||
</q-item-section> |
|||
</q-item> |
|||
</template> |
|||
</q-select> |
|||
<q-btn :label="$t('theme.action.setDefaultTheme')" icon="bi-heart" no-caps outline dense padding="2px 10px" @click="defaultTheme" /> |
|||
<q-btn :label="$t('add')" icon="add" no-caps outline dense padding="2px 10px" @click="prompt = true" /> |
|||
<q-btn :label="$t('delete')" icon="delete" no-caps outline dense padding="2px 10px" @click="removeTheme" /> |
|||
<q-btn :label="$t('save')" icon="save" no-caps outline dense padding="2px 10px" @click="saveTheme" /> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-input v-model="frontendWebContextPath" :label="$t('lcdp.frontend.export.frontendWebContextPath')" outlined dense style="width: 300px" /> |
|||
</div> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-input v-model="backendApiWebContextPath" :label="$t('lcdp.frontend.export.backendApiWebContextPath')" outlined dense style="width: 300px" /> |
|||
</div> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-btn :loading="loading" outlined :label="$t('lcdp.frontend.export')" @click="exportFrontend" /> |
|||
</div> |
|||
<q-dialog v-model="prompt" persistent> |
|||
<q-card style="min-width: 350px"> |
|||
<q-card-section class="q-pt-md"> |
|||
<q-input v-model="configureName" :label="$t('name')" outlined dense autofocus @keyup.enter="prompt = false" /> |
|||
</q-card-section> |
|||
|
|||
<q-card-actions align="right" class="text-primary"> |
|||
<q-btn v-close-popup flat :label="$t('cancel')" /> |
|||
<q-btn v-close-popup flat :label="$t('confirm')" @click="newTheme" /> |
|||
</q-card-actions> |
|||
</q-card> |
|||
</q-dialog> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { useQuasar } from 'quasar'; |
|||
import { Environment, axios, Tools, NotifyManager } from '@/platform'; |
|||
|
|||
const { t } = useI18n(); |
|||
const quasar = useQuasar(); |
|||
|
|||
const selectedTab = ref('brand'); |
|||
const selectedTheme = ref(''); |
|||
const themeOptions = ref([]); |
|||
const prompt = ref(false); |
|||
const configureName = ref(''); |
|||
|
|||
let configureMap = new Map<string, object>(); |
|||
|
|||
const newTheme = () => { |
|||
axios.post(Environment.apiContextPath('/api/lcdp/configure'), { name: configureName.value }).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(() => { |
|||
selectedTheme.value = response.data.id; |
|||
configureName.value = ''; |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const themeChanged = (value) => { |
|||
const option = configureMap.get(value); |
|||
if (option) { |
|||
Tools.mergeObject(Environment.getConfigure(), option); |
|||
} |
|||
}; |
|||
|
|||
const defaultTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.setDefaultTheme.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
import { ref, reactive } from 'vue'; |
|||
import { axios, Environment, Downloader } from '@/platform'; |
|||
|
|||
const frontendWebContextPath = ref('/'); |
|||
const backendApiWebContextPath = ref('/'); |
|||
const loading = ref(false); |
|||
const exportFileInfo = reactive({ filePath: '', exportName: '' }); |
|||
const exportFrontend = () => { |
|||
loading.value = true; |
|||
axios |
|||
.post(Environment.apiContextPath('/api/mvc/frontend/export'), { |
|||
frontendWebContextPath: frontendWebContextPath.value, |
|||
backendApiWebContextPath: backendApiWebContextPath.value, |
|||
}) |
|||
.onOk(() => { |
|||
axios.post(Environment.apiContextPath('/api/lcdp/configure/activeConfigure/') + selectedTheme.value).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const removeTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.delete.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
}) |
|||
.onOk(() => { |
|||
axios.delete(Environment.apiContextPath('/api/lcdp/configure/') + selectedTheme.value).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(); |
|||
selectedTheme.value = ''; |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const saveTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.save.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
.then((response) => { |
|||
exportFileInfo.filePath = response.data.filePath; |
|||
exportFileInfo.exportName = response.data.exportName; |
|||
let url = Environment.apiContextPath('/api/mvc/download?'); |
|||
url += 'filePath=' + encodeURIComponent(exportFileInfo.filePath); |
|||
url += '&exportName=' + encodeURIComponent(exportFileInfo.exportName); |
|||
Downloader.get(url); |
|||
}) |
|||
.onOk(() => { |
|||
const data = {}; |
|||
Tools.mergeObject(data, configureMap.get(selectedTheme.value)); |
|||
data.theme = Environment.getConfigure().theme; |
|||
|
|||
axios.put(Environment.apiContextPath('/api/lcdp/configure/') + selectedTheme.value, data).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
}); |
|||
.finally(() => { |
|||
loading.value = false; |
|||
}); |
|||
}; |
|||
|
|||
const refresh = (callback?: any) => { |
|||
axios.get(Environment.apiContextPath('/api/lcdp/configure')).then((response) => { |
|||
configureMap.clear(); |
|||
const options = []; |
|||
selectedTheme.value = ''; |
|||
|
|||
const items = response.data.content; |
|||
if (items && items.length > 0) { |
|||
for (const item of items) { |
|||
options.push(item); |
|||
configureMap.set(item.id, item); |
|||
if (item.active) { |
|||
selectedTheme.value = item.id; |
|||
} |
|||
} |
|||
} |
|||
themeOptions.value = options; |
|||
if (callback) { |
|||
callback(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
refresh(); |
|||
</script> |
|||
|
@ -0,0 +1,70 @@ |
|||
<template> |
|||
<div style="height: 100%"> |
|||
<q-btn-dropdown dense outline> |
|||
<template #label><div>更多</div></template> |
|||
</q-btn-dropdown> |
|||
<q-splitter v-model="splitterModelRef" style="height: 100%"> |
|||
<template #before> |
|||
<q-tabs v-model="selectedTabRef" vertical> |
|||
<q-tab name="Industry" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.industry.grid.title')">{{ $t('standard.industry.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="AdminDivision" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.adminDivision.grid.title')">{{ $t('standard.adminDivision.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="PerformanceStatus" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.performanceStatus.grid.title')"> |
|||
{{ $t('standard.performanceStatus.grid.title') }} |
|||
</div> |
|||
</q-tab> |
|||
<q-tab name="Counterparty" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.counterparty.grid.title')">{{ $t('standard.counterparty.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="Country" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.country.grid.title')">{{ $t('standard.country.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="Currency" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.currency.grid.title')">{{ $t('standard.currency.grid.title') }}</div> |
|||
</q-tab> |
|||
</q-tabs> |
|||
</template> |
|||
|
|||
<template #after> |
|||
<div class="pl-1" style="height: 100%"> |
|||
<q-tab-panels v-model="selectedTabRef" animated swipeable style="height: 100%"> |
|||
<q-tab-panel name="Industry" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Industry></Industry> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="AdminDivision" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<AdminDivision></AdminDivision> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="PerformanceStatus" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<PerformanceStatus></PerformanceStatus> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Counterparty" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Counterparty></Counterparty> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Country" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Country></Country> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Currency" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Currency></Currency> |
|||
</q-tab-panel> |
|||
</q-tab-panels> |
|||
</div> |
|||
</template> |
|||
</q-splitter> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref } from 'vue'; |
|||
import Industry from './standard/Industry.vue'; |
|||
import AdminDivision from './standard/AdminDivision.vue'; |
|||
import PerformanceStatus from './standard/PerformanceStatus.vue'; |
|||
import Counterparty from './standard/Counterparty.vue'; |
|||
import Country from './standard/Country.vue'; |
|||
import Currency from './standard/Currency.vue'; |
|||
|
|||
const splitterModelRef = ref(15); |
|||
const selectedTabRef = ref('Industry'); |
|||
</script> |
@ -0,0 +1,109 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.adminDivision.grid.title')" |
|||
hide-bottom |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
dense |
|||
:tree="true" |
|||
:tree-icon=" |
|||
(row) => { |
|||
return { name: 'folder', color: 'amber' }; |
|||
} |
|||
" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/adminDivision')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="[ |
|||
'refresh', |
|||
'separator', |
|||
[ |
|||
{ |
|||
extend: 'add', |
|||
click: undefined, |
|||
}, |
|||
{ |
|||
extend: 'addTop', |
|||
label: $t('standard.adminDivision.grid.toolbar.addTop'), |
|||
}, |
|||
{ |
|||
extend: 'addChild', |
|||
label: $t('standard.adminDivision.grid.toolbar.addChild'), |
|||
}, |
|||
], |
|||
'edit', |
|||
'remove', |
|||
'separator', |
|||
'view', |
|||
'separator', |
|||
'export', |
|||
]" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 300, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 300, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,79 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.counterparty.grid.title')" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/counterparty')" |
|||
:pageable="true" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 150, name: 'code', label: $t('code') }, |
|||
{ width: 200, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 150, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 200, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,257 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.country.grid.title')" |
|||
:hide-bottom="false" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/country')" |
|||
:pageable="false" |
|||
:sort-by="['codeLatin3']" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:query-form-cols-num="5" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('standard.country.entity.code'), type: 'text', clearable: true }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3'), type: 'text', clearable: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', clearable: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', clearable: true }, |
|||
]" |
|||
:columns="columnsComputed" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '800px', |
|||
}, |
|||
form: { |
|||
colsNum: 3, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.country.entity.code'), type: 'text', required: true }, |
|||
{ name: 'codeLatin2', label: $t('standard.country.entity.codeLatin2'), type: 'text', required: true }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3'), type: 'text', required: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', required: true }, |
|||
{ name: 'nameChineseFull', label: $t('standard.country.entity.nameChineseFull'), type: 'text', colSpan: 2 }, |
|||
{ name: 'remarkChinese', label: $t('standard.country.entity.remarkChinese'), type: 'text', colSpan: 3 }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', required: true }, |
|||
{ name: 'nameEnglishFull', label: $t('standard.country.entity.nameEnglishFull'), type: 'text', colSpan: 2 }, |
|||
{ name: 'remarkEnglish', label: $t('standard.country.entity.remarkEnglish'), type: 'text', colSpan: 3 }, |
|||
{ name: 'nameLocalShort', label: $t('standard.country.entity.nameLocalShort'), type: 'text', colSpan: 2 }, |
|||
{ name: 'isIndependent', label: $t('standard.country.entity.isIndependent'), type: 'select', options: Options.yesNo() }, |
|||
{ |
|||
name: 'currency', |
|||
label: $t('standard.country.entity.currency'), |
|||
type: 'select', |
|||
options: currencyOptionsRef, |
|||
colSpan: 2, |
|||
useInput: true, |
|||
hideSelected: true, |
|||
fillInput: true, |
|||
onFilter: (val, update) => { |
|||
if (val) { |
|||
update(() => { |
|||
const input = val.toUpperCase(); |
|||
const currencyOptions = []; |
|||
for (const currency of currencyList) { |
|||
if ( |
|||
currency.code?.indexOf(input) > -1 || |
|||
currency.codeLatin?.indexOf(input) > -1 || |
|||
currency.nameChinese?.indexOf(input) > -1 || |
|||
currency.nameEnglish?.indexOf(input) > -1 |
|||
) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
} |
|||
currencyOptionsRef = currencyOptions; |
|||
}); |
|||
} else { |
|||
update(() => { |
|||
const currencyOptions = []; |
|||
for (const currency of currencyList) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
currencyOptionsRef = currencyOptions; |
|||
}); |
|||
} |
|||
}, |
|||
}, |
|||
{ name: 'languageCode2', label: $t('standard.country.entity.languageCode2'), type: 'text', colsFirst: true }, |
|||
{ name: 'languageCode3', label: $t('standard.country.entity.languageCode3'), type: 'text' }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.country.entity.code') }, |
|||
{ name: 'codeLatin2', label: $t('standard.country.entity.codeLatin2') }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3') }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese') }, |
|||
{ name: 'nameChineseFull', label: $t('standard.country.entity.nameChineseFull') }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish') }, |
|||
{ name: 'nameEnglishFull', label: $t('standard.country.entity.nameEnglishFull') }, |
|||
{ name: 'nameLocalShort', label: $t('standard.country.entity.nameLocalShort') }, |
|||
{ name: 'remarkChinese', label: $t('standard.country.entity.remarkChinese') }, |
|||
{ name: 'remarkEnglish', label: $t('standard.country.entity.remarkEnglish') }, |
|||
{ name: 'languageCode2', label: $t('standard.country.entity.languageCode2') }, |
|||
{ name: 'languageCode3', label: $t('standard.country.entity.languageCode3') }, |
|||
{ name: 'isIndependent', label: $t('standard.country.entity.isIndependent') }, |
|||
{ |
|||
name: 'currency', |
|||
label: $t('standard.country.entity.currency'), |
|||
format: (value, row) => { |
|||
return getCurrencyLabel(currencyMap[row.currency]); |
|||
}, |
|||
}, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref, onMounted, computed } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment, Formater, Options, eventBus } from '@/platform'; |
|||
|
|||
let currentLocale = Environment.getConfigure().setting.i18n.locale; |
|||
let currencyMap = {}; |
|||
let currencyList = []; |
|||
const { t } = useI18n(); |
|||
const currencyOptionsRef = ref([]); |
|||
|
|||
const columnsComputed = computed(() => { |
|||
const result = [ |
|||
{ width: 70, name: 'code', label: t('code') }, |
|||
{ width: 70, name: 'codeLatin3', label: t('code') + '3' }, |
|||
{ |
|||
width: 150, |
|||
name: 'nameChinese', |
|||
label: t('name'), |
|||
format: (value, row) => { |
|||
if (row) { |
|||
return getCountryName(row); |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
name: 'currency', |
|||
label: t('standard.entity.currency'), |
|||
columns: [ |
|||
{ |
|||
width: 70, |
|||
name: 'currencyCode', |
|||
label: t('code'), |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return currencyMap[row.currency]?.code; |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
width: 70, |
|||
name: 'currencyCodeLatin', |
|||
label: t('code') + '2', |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return currencyMap[row.currency]?.codeLatin; |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
width: 150, |
|||
name: 'currencyname', |
|||
label: t('name'), |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return getCurrencyName(currencyMap[row.currency]); |
|||
} |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'language', |
|||
label: t('standard.entity.language'), |
|||
columns: [{ width: 100, name: 'languageCode3', label: t('code') }], |
|||
}, |
|||
|
|||
{ width: 100, name: 'lastModifier', label: t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]; |
|||
|
|||
currentLocale = Environment.getConfigure().setting.i18n.locale; |
|||
if (currentLocale.endsWith('CN')) { |
|||
result[2].name = 'nameChinese'; |
|||
} else { |
|||
result[2].name = 'nameEnglish'; |
|||
} |
|||
return result; |
|||
}); |
|||
|
|||
onMounted(() => { |
|||
axios.get(Environment.apiContextPath('/api/standard/currency?pageable=false&sortBy=code')).then((response) => { |
|||
currencyMap = {}; |
|||
currencyList = []; |
|||
const currencyOptions = []; |
|||
if (response?.data?.content) { |
|||
for (const currency of response.data.content) { |
|||
currencyMap[currency.code] = currency; |
|||
currencyList.push(currency); |
|||
} |
|||
|
|||
for (const currency of currencyList) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
} |
|||
currencyOptionsRef.value = currencyOptions; |
|||
}); |
|||
}); |
|||
|
|||
const getCurrencyLabel = (currency) => { |
|||
return currency.code + ' ' + currency.codeLatin + ' ' + (currentLocale.endsWith('CN') ? currency.nameChinese : currency.nameEnglish); |
|||
}; |
|||
|
|||
const createCurrencyOptionItem = (currency) => { |
|||
if (currency) { |
|||
return { |
|||
value: currency.code, |
|||
label: getCurrencyLabel(currency), |
|||
}; |
|||
} |
|||
return null; |
|||
}; |
|||
|
|||
const getCountryName = (country) => { |
|||
if (country) { |
|||
return currentLocale.endsWith('CN') ? country.nameChinese : country.nameEnglish; |
|||
} |
|||
return null; |
|||
}; |
|||
|
|||
const getCurrencyName = (currency) => { |
|||
if (currency) { |
|||
return currentLocale.endsWith('CN') ? currency.nameChinese : currency.nameEnglish; |
|||
} |
|||
return null; |
|||
}; |
|||
</script> |
@ -0,0 +1,72 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.currency.grid.title')" |
|||
:hide-bottom="false" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/currency')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'codeLatin', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:query-form-cols-num="4" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('standard.currency.entity.code'), type: 'text', clearable: true }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin'), type: 'text', clearable: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', clearable: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', clearable: true }, |
|||
]" |
|||
:columns="[ |
|||
{ width: 80, name: 'code', label: $t('standard.currency.entity.code') }, |
|||
{ width: 80, name: 'codeLatin', label: $t('standard.currency.entity.codeLatin') }, |
|||
{ width: 150, name: 'nameChinese', label: $t('standard.currency.entity.nameChinese') }, |
|||
{ width: 150, name: 'nameEnglish', label: $t('standard.currency.entity.nameEnglish') }, |
|||
{ width: 100, name: 'precision', label: $t('standard.currency.entity.precision') }, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.currency.entity.code'), type: 'text', required: true }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin'), type: 'text', required: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', required: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text' }, |
|||
{ name: 'precision', label: $t('standard.currency.entity.precision'), type: 'text', required: true, defaultValue: 2 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.currency.entity.code') }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin') }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese') }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish') }, |
|||
{ name: 'precision', label: $t('standard.currency.entity.precision') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater, Options } from '@/platform'; |
|||
</script> |
@ -0,0 +1,109 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="treeGridRef" |
|||
:title="$t('standard.industry.grid.title')" |
|||
hide-bottom |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
dense |
|||
:tree="true" |
|||
:tree-icon=" |
|||
(row) => { |
|||
return { name: 'folder', color: 'amber' }; |
|||
} |
|||
" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/industry')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="[ |
|||
'refresh', |
|||
'separator', |
|||
[ |
|||
{ |
|||
extend: 'add', |
|||
click: undefined, |
|||
}, |
|||
{ |
|||
extend: 'addTop', |
|||
label: $t('standard.industry.grid.toolbar.addTop'), |
|||
}, |
|||
{ |
|||
extend: 'addChild', |
|||
label: $t('standard.industry.grid.toolbar.addChild'), |
|||
}, |
|||
], |
|||
'edit', |
|||
'remove', |
|||
'separator', |
|||
'view', |
|||
'separator', |
|||
'export', |
|||
]" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 300, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 300, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,79 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.performanceStatus.grid.title')" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/performanceStatus')" |
|||
:pageable="true" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -1,160 +1,41 @@ |
|||
<template> |
|||
<div> |
|||
<div class="row justify-end q-gutter-md q-py-md"> |
|||
<q-select |
|||
v-model="selectedTheme" |
|||
:label="$t('theme')" |
|||
:options="themeOptions" |
|||
option-label="name" |
|||
option-value="id" |
|||
emit-value |
|||
map-options |
|||
dense |
|||
outlined |
|||
style="min-width: 200px" |
|||
@update:model-value="themeChanged" |
|||
> |
|||
<template #option="scope"> |
|||
<q-item v-bind="scope.itemProps"> |
|||
<q-item-section> |
|||
<q-item-label>{{ scope.opt.name }}</q-item-label> |
|||
</q-item-section> |
|||
<q-item-section v-if="scope.opt.active" avatar> |
|||
<q-icon name="bi-check" /> |
|||
</q-item-section> |
|||
<q-item-section v-else avatar> |
|||
<w-icon-empty></w-icon-empty> |
|||
</q-item-section> |
|||
</q-item> |
|||
</template> |
|||
</q-select> |
|||
<q-btn :label="$t('theme.action.setDefaultTheme')" icon="bi-heart" no-caps outline dense padding="2px 10px" @click="defaultTheme" /> |
|||
<q-btn :label="$t('add')" icon="add" no-caps outline dense padding="2px 10px" @click="prompt = true" /> |
|||
<q-btn :label="$t('delete')" icon="delete" no-caps outline dense padding="2px 10px" @click="removeTheme" /> |
|||
<q-btn :label="$t('save')" icon="save" no-caps outline dense padding="2px 10px" @click="saveTheme" /> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-input v-model="frontendWebContextPath" :label="$t('lcdp.frontend.export.frontendWebContextPath')" outlined dense style="width: 300px" /> |
|||
</div> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-input v-model="backendApiWebContextPath" :label="$t('lcdp.frontend.export.backendApiWebContextPath')" outlined dense style="width: 300px" /> |
|||
</div> |
|||
<div class="fit row wrap justify-center items-start content-start q-pt-md q-gutter-md"> |
|||
<q-btn :loading="loading" outlined :label="$t('lcdp.frontend.export')" @click="exportFrontend" /> |
|||
</div> |
|||
<q-dialog v-model="prompt" persistent> |
|||
<q-card style="min-width: 350px"> |
|||
<q-card-section class="q-pt-md"> |
|||
<q-input v-model="configureName" :label="$t('name')" outlined dense autofocus @keyup.enter="prompt = false" /> |
|||
</q-card-section> |
|||
|
|||
<q-card-actions align="right" class="text-primary"> |
|||
<q-btn v-close-popup flat :label="$t('cancel')" /> |
|||
<q-btn v-close-popup flat :label="$t('confirm')" @click="newTheme" /> |
|||
</q-card-actions> |
|||
</q-card> |
|||
</q-dialog> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { useQuasar } from 'quasar'; |
|||
import { Environment, axios, Tools, NotifyManager } from '@/platform'; |
|||
|
|||
const { t } = useI18n(); |
|||
const quasar = useQuasar(); |
|||
|
|||
const selectedTab = ref('brand'); |
|||
const selectedTheme = ref(''); |
|||
const themeOptions = ref([]); |
|||
const prompt = ref(false); |
|||
const configureName = ref(''); |
|||
|
|||
let configureMap = new Map<string, object>(); |
|||
|
|||
const newTheme = () => { |
|||
axios.post(Environment.apiContextPath('/api/lcdp/configure'), { name: configureName.value }).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(() => { |
|||
selectedTheme.value = response.data.id; |
|||
configureName.value = ''; |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const themeChanged = (value) => { |
|||
const option = configureMap.get(value); |
|||
if (option) { |
|||
Tools.mergeObject(Environment.getConfigure(), option); |
|||
} |
|||
}; |
|||
|
|||
const defaultTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.setDefaultTheme.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
import { ref, reactive } from 'vue'; |
|||
import { axios, Environment, Downloader } from '@/platform'; |
|||
|
|||
const frontendWebContextPath = ref('/'); |
|||
const backendApiWebContextPath = ref('/'); |
|||
const loading = ref(false); |
|||
const exportFileInfo = reactive({ filePath: '', exportName: '' }); |
|||
const exportFrontend = () => { |
|||
loading.value = true; |
|||
axios |
|||
.post(Environment.apiContextPath('/api/mvc/frontend/export'), { |
|||
frontendWebContextPath: frontendWebContextPath.value, |
|||
backendApiWebContextPath: backendApiWebContextPath.value, |
|||
}) |
|||
.onOk(() => { |
|||
axios.post(Environment.apiContextPath('/api/lcdp/configure/activeConfigure/') + selectedTheme.value).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const removeTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.delete.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
}) |
|||
.onOk(() => { |
|||
axios.delete(Environment.apiContextPath('/api/lcdp/configure/') + selectedTheme.value).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
refresh(); |
|||
selectedTheme.value = ''; |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const saveTheme = () => { |
|||
quasar |
|||
.dialog({ |
|||
title: t('confirm'), |
|||
message: t('theme.action.save.confirm', { themeName: configureMap.get(selectedTheme.value).name }), |
|||
cancel: true, |
|||
persistent: true, |
|||
.then((response) => { |
|||
exportFileInfo.filePath = response.data.filePath; |
|||
exportFileInfo.exportName = response.data.exportName; |
|||
let url = Environment.apiContextPath('/api/mvc/download?'); |
|||
url += 'filePath=' + encodeURIComponent(exportFileInfo.filePath); |
|||
url += '&exportName=' + encodeURIComponent(exportFileInfo.exportName); |
|||
Downloader.get(url); |
|||
}) |
|||
.onOk(() => { |
|||
const data = {}; |
|||
Tools.mergeObject(data, configureMap.get(selectedTheme.value)); |
|||
data.theme = Environment.getConfigure().theme; |
|||
|
|||
axios.put(Environment.apiContextPath('/api/lcdp/configure/') + selectedTheme.value, data).then((response) => { |
|||
NotifyManager.info(t('success')); |
|||
}); |
|||
.finally(() => { |
|||
loading.value = false; |
|||
}); |
|||
}; |
|||
|
|||
const refresh = (callback?: any) => { |
|||
axios.get(Environment.apiContextPath('/api/lcdp/configure')).then((response) => { |
|||
configureMap.clear(); |
|||
const options = []; |
|||
selectedTheme.value = ''; |
|||
|
|||
const items = response.data.content; |
|||
if (items && items.length > 0) { |
|||
for (const item of items) { |
|||
options.push(item); |
|||
configureMap.set(item.id, item); |
|||
if (item.active) { |
|||
selectedTheme.value = item.id; |
|||
} |
|||
} |
|||
} |
|||
themeOptions.value = options; |
|||
if (callback) { |
|||
callback(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
refresh(); |
|||
</script> |
|||
|
@ -0,0 +1,70 @@ |
|||
<template> |
|||
<div style="height: 100%"> |
|||
<q-btn-dropdown dense outline> |
|||
<template #label><div>更多</div></template> |
|||
</q-btn-dropdown> |
|||
<q-splitter v-model="splitterModelRef" style="height: 100%"> |
|||
<template #before> |
|||
<q-tabs v-model="selectedTabRef" vertical> |
|||
<q-tab name="Industry" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.industry.grid.title')">{{ $t('standard.industry.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="AdminDivision" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.adminDivision.grid.title')">{{ $t('standard.adminDivision.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="PerformanceStatus" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.performanceStatus.grid.title')"> |
|||
{{ $t('standard.performanceStatus.grid.title') }} |
|||
</div> |
|||
</q-tab> |
|||
<q-tab name="Counterparty" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.counterparty.grid.title')">{{ $t('standard.counterparty.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="Country" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.country.grid.title')">{{ $t('standard.country.grid.title') }}</div> |
|||
</q-tab> |
|||
<q-tab name="Currency" no-caps> |
|||
<div class="text-left" style="width: 200px" :title="$t('standard.currency.grid.title')">{{ $t('standard.currency.grid.title') }}</div> |
|||
</q-tab> |
|||
</q-tabs> |
|||
</template> |
|||
|
|||
<template #after> |
|||
<div class="pl-1" style="height: 100%"> |
|||
<q-tab-panels v-model="selectedTabRef" animated swipeable style="height: 100%"> |
|||
<q-tab-panel name="Industry" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Industry></Industry> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="AdminDivision" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<AdminDivision></AdminDivision> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="PerformanceStatus" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<PerformanceStatus></PerformanceStatus> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Counterparty" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Counterparty></Counterparty> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Country" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Country></Country> |
|||
</q-tab-panel> |
|||
<q-tab-panel name="Currency" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<Currency></Currency> |
|||
</q-tab-panel> |
|||
</q-tab-panels> |
|||
</div> |
|||
</template> |
|||
</q-splitter> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref } from 'vue'; |
|||
import Industry from './standard/Industry.vue'; |
|||
import AdminDivision from './standard/AdminDivision.vue'; |
|||
import PerformanceStatus from './standard/PerformanceStatus.vue'; |
|||
import Counterparty from './standard/Counterparty.vue'; |
|||
import Country from './standard/Country.vue'; |
|||
import Currency from './standard/Currency.vue'; |
|||
|
|||
const splitterModelRef = ref(15); |
|||
const selectedTabRef = ref('Industry'); |
|||
</script> |
@ -0,0 +1,109 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.adminDivision.grid.title')" |
|||
hide-bottom |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
dense |
|||
:tree="true" |
|||
:tree-icon=" |
|||
(row) => { |
|||
return { name: 'folder', color: 'amber' }; |
|||
} |
|||
" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/adminDivision')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="[ |
|||
'refresh', |
|||
'separator', |
|||
[ |
|||
{ |
|||
extend: 'add', |
|||
click: undefined, |
|||
}, |
|||
{ |
|||
extend: 'addTop', |
|||
label: $t('standard.adminDivision.grid.toolbar.addTop'), |
|||
}, |
|||
{ |
|||
extend: 'addChild', |
|||
label: $t('standard.adminDivision.grid.toolbar.addChild'), |
|||
}, |
|||
], |
|||
'edit', |
|||
'remove', |
|||
'separator', |
|||
'view', |
|||
'separator', |
|||
'export', |
|||
]" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 300, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 300, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,79 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.counterparty.grid.title')" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/counterparty')" |
|||
:pageable="true" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 150, name: 'code', label: $t('code') }, |
|||
{ width: 200, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 150, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 200, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,257 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.country.grid.title')" |
|||
:hide-bottom="false" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/country')" |
|||
:pageable="false" |
|||
:sort-by="['codeLatin3']" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:query-form-cols-num="5" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('standard.country.entity.code'), type: 'text', clearable: true }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3'), type: 'text', clearable: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', clearable: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', clearable: true }, |
|||
]" |
|||
:columns="columnsComputed" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '800px', |
|||
}, |
|||
form: { |
|||
colsNum: 3, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.country.entity.code'), type: 'text', required: true }, |
|||
{ name: 'codeLatin2', label: $t('standard.country.entity.codeLatin2'), type: 'text', required: true }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3'), type: 'text', required: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', required: true }, |
|||
{ name: 'nameChineseFull', label: $t('standard.country.entity.nameChineseFull'), type: 'text', colSpan: 2 }, |
|||
{ name: 'remarkChinese', label: $t('standard.country.entity.remarkChinese'), type: 'text', colSpan: 3 }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', required: true }, |
|||
{ name: 'nameEnglishFull', label: $t('standard.country.entity.nameEnglishFull'), type: 'text', colSpan: 2 }, |
|||
{ name: 'remarkEnglish', label: $t('standard.country.entity.remarkEnglish'), type: 'text', colSpan: 3 }, |
|||
{ name: 'nameLocalShort', label: $t('standard.country.entity.nameLocalShort'), type: 'text', colSpan: 2 }, |
|||
{ name: 'isIndependent', label: $t('standard.country.entity.isIndependent'), type: 'select', options: Options.yesNo() }, |
|||
{ |
|||
name: 'currency', |
|||
label: $t('standard.country.entity.currency'), |
|||
type: 'select', |
|||
options: currencyOptionsRef, |
|||
colSpan: 2, |
|||
useInput: true, |
|||
hideSelected: true, |
|||
fillInput: true, |
|||
onFilter: (val, update) => { |
|||
if (val) { |
|||
update(() => { |
|||
const input = val.toUpperCase(); |
|||
const currencyOptions = []; |
|||
for (const currency of currencyList) { |
|||
if ( |
|||
currency.code?.indexOf(input) > -1 || |
|||
currency.codeLatin?.indexOf(input) > -1 || |
|||
currency.nameChinese?.indexOf(input) > -1 || |
|||
currency.nameEnglish?.indexOf(input) > -1 |
|||
) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
} |
|||
currencyOptionsRef = currencyOptions; |
|||
}); |
|||
} else { |
|||
update(() => { |
|||
const currencyOptions = []; |
|||
for (const currency of currencyList) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
currencyOptionsRef = currencyOptions; |
|||
}); |
|||
} |
|||
}, |
|||
}, |
|||
{ name: 'languageCode2', label: $t('standard.country.entity.languageCode2'), type: 'text', colsFirst: true }, |
|||
{ name: 'languageCode3', label: $t('standard.country.entity.languageCode3'), type: 'text' }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.country.entity.code') }, |
|||
{ name: 'codeLatin2', label: $t('standard.country.entity.codeLatin2') }, |
|||
{ name: 'codeLatin3', label: $t('standard.country.entity.codeLatin3') }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese') }, |
|||
{ name: 'nameChineseFull', label: $t('standard.country.entity.nameChineseFull') }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish') }, |
|||
{ name: 'nameEnglishFull', label: $t('standard.country.entity.nameEnglishFull') }, |
|||
{ name: 'nameLocalShort', label: $t('standard.country.entity.nameLocalShort') }, |
|||
{ name: 'remarkChinese', label: $t('standard.country.entity.remarkChinese') }, |
|||
{ name: 'remarkEnglish', label: $t('standard.country.entity.remarkEnglish') }, |
|||
{ name: 'languageCode2', label: $t('standard.country.entity.languageCode2') }, |
|||
{ name: 'languageCode3', label: $t('standard.country.entity.languageCode3') }, |
|||
{ name: 'isIndependent', label: $t('standard.country.entity.isIndependent') }, |
|||
{ |
|||
name: 'currency', |
|||
label: $t('standard.country.entity.currency'), |
|||
format: (value, row) => { |
|||
return getCurrencyLabel(currencyMap[row.currency]); |
|||
}, |
|||
}, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref, onMounted, computed } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment, Formater, Options, eventBus } from '@/platform'; |
|||
|
|||
let currentLocale = Environment.getConfigure().setting.i18n.locale; |
|||
let currencyMap = {}; |
|||
let currencyList = []; |
|||
const { t } = useI18n(); |
|||
const currencyOptionsRef = ref([]); |
|||
|
|||
const columnsComputed = computed(() => { |
|||
const result = [ |
|||
{ width: 70, name: 'code', label: t('code') }, |
|||
{ width: 70, name: 'codeLatin3', label: t('code') + '3' }, |
|||
{ |
|||
width: 150, |
|||
name: 'nameChinese', |
|||
label: t('name'), |
|||
format: (value, row) => { |
|||
if (row) { |
|||
return getCountryName(row); |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
name: 'currency', |
|||
label: t('standard.entity.currency'), |
|||
columns: [ |
|||
{ |
|||
width: 70, |
|||
name: 'currencyCode', |
|||
label: t('code'), |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return currencyMap[row.currency]?.code; |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
width: 70, |
|||
name: 'currencyCodeLatin', |
|||
label: t('code') + '2', |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return currencyMap[row.currency]?.codeLatin; |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
width: 150, |
|||
name: 'currencyname', |
|||
label: t('name'), |
|||
sortable: false, |
|||
format: (value, row) => { |
|||
if (row.currency) { |
|||
return getCurrencyName(currencyMap[row.currency]); |
|||
} |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'language', |
|||
label: t('standard.entity.language'), |
|||
columns: [{ width: 100, name: 'languageCode3', label: t('code') }], |
|||
}, |
|||
|
|||
{ width: 100, name: 'lastModifier', label: t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]; |
|||
|
|||
currentLocale = Environment.getConfigure().setting.i18n.locale; |
|||
if (currentLocale.endsWith('CN')) { |
|||
result[2].name = 'nameChinese'; |
|||
} else { |
|||
result[2].name = 'nameEnglish'; |
|||
} |
|||
return result; |
|||
}); |
|||
|
|||
onMounted(() => { |
|||
axios.get(Environment.apiContextPath('/api/standard/currency?pageable=false&sortBy=code')).then((response) => { |
|||
currencyMap = {}; |
|||
currencyList = []; |
|||
const currencyOptions = []; |
|||
if (response?.data?.content) { |
|||
for (const currency of response.data.content) { |
|||
currencyMap[currency.code] = currency; |
|||
currencyList.push(currency); |
|||
} |
|||
|
|||
for (const currency of currencyList) { |
|||
const item = createCurrencyOptionItem(currency); |
|||
if (item) { |
|||
currencyOptions.push(item); |
|||
} |
|||
} |
|||
} |
|||
currencyOptionsRef.value = currencyOptions; |
|||
}); |
|||
}); |
|||
|
|||
const getCurrencyLabel = (currency) => { |
|||
return currency.code + ' ' + currency.codeLatin + ' ' + (currentLocale.endsWith('CN') ? currency.nameChinese : currency.nameEnglish); |
|||
}; |
|||
|
|||
const createCurrencyOptionItem = (currency) => { |
|||
if (currency) { |
|||
return { |
|||
value: currency.code, |
|||
label: getCurrencyLabel(currency), |
|||
}; |
|||
} |
|||
return null; |
|||
}; |
|||
|
|||
const getCountryName = (country) => { |
|||
if (country) { |
|||
return currentLocale.endsWith('CN') ? country.nameChinese : country.nameEnglish; |
|||
} |
|||
return null; |
|||
}; |
|||
|
|||
const getCurrencyName = (currency) => { |
|||
if (currency) { |
|||
return currentLocale.endsWith('CN') ? currency.nameChinese : currency.nameEnglish; |
|||
} |
|||
return null; |
|||
}; |
|||
</script> |
@ -0,0 +1,72 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.currency.grid.title')" |
|||
:hide-bottom="false" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/currency')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'codeLatin', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:query-form-cols-num="4" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('standard.currency.entity.code'), type: 'text', clearable: true }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin'), type: 'text', clearable: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', clearable: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text', clearable: true }, |
|||
]" |
|||
:columns="[ |
|||
{ width: 80, name: 'code', label: $t('standard.currency.entity.code') }, |
|||
{ width: 80, name: 'codeLatin', label: $t('standard.currency.entity.codeLatin') }, |
|||
{ width: 150, name: 'nameChinese', label: $t('standard.currency.entity.nameChinese') }, |
|||
{ width: 150, name: 'nameEnglish', label: $t('standard.currency.entity.nameEnglish') }, |
|||
{ width: 100, name: 'precision', label: $t('standard.currency.entity.precision') }, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.currency.entity.code'), type: 'text', required: true }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin'), type: 'text', required: true }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese'), type: 'text', required: true }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish'), type: 'text' }, |
|||
{ name: 'precision', label: $t('standard.currency.entity.precision'), type: 'text', required: true, defaultValue: 2 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.currency.entity.code') }, |
|||
{ name: 'codeLatin', label: $t('standard.currency.entity.codeLatin') }, |
|||
{ name: 'nameChinese', label: $t('standard.country.entity.nameChinese') }, |
|||
{ name: 'nameEnglish', label: $t('standard.country.entity.nameEnglish') }, |
|||
{ name: 'precision', label: $t('standard.currency.entity.precision') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater, Options } from '@/platform'; |
|||
</script> |
@ -0,0 +1,109 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="treeGridRef" |
|||
:title="$t('standard.industry.grid.title')" |
|||
hide-bottom |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
dense |
|||
:tree="true" |
|||
:tree-icon=" |
|||
(row) => { |
|||
return { name: 'folder', color: 'amber' }; |
|||
} |
|||
" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/industry')" |
|||
:pageable="false" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="[ |
|||
'refresh', |
|||
'separator', |
|||
[ |
|||
{ |
|||
extend: 'add', |
|||
click: undefined, |
|||
}, |
|||
{ |
|||
extend: 'addTop', |
|||
label: $t('standard.industry.grid.toolbar.addTop'), |
|||
}, |
|||
{ |
|||
extend: 'addChild', |
|||
label: $t('standard.industry.grid.toolbar.addChild'), |
|||
}, |
|||
], |
|||
'edit', |
|||
'remove', |
|||
'separator', |
|||
'view', |
|||
'separator', |
|||
'export', |
|||
]" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 300, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 300, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,79 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('standard.performanceStatus.grid.title')" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:tree="false" |
|||
primary-key="code" |
|||
:data-url="Environment.apiContextPath('/api/standard/performanceStatus')" |
|||
:pageable="true" |
|||
:pagination="{ |
|||
sortBy: 'code', |
|||
descending: false, |
|||
}" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:columns="[ |
|||
{ |
|||
name: 'target', |
|||
label: $t('standard.entity.target'), |
|||
columns: [ |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: 100, name: 'name', label: $t('name') }, |
|||
{ width: 100, name: 'description', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ |
|||
name: 'source', |
|||
label: $t('standard.entity.source'), |
|||
columns: [ |
|||
{ width: 100, name: 'mappingCode', label: $t('code') }, |
|||
{ width: 100, name: 'mappingName', label: $t('name') }, |
|||
{ width: 100, name: 'mappingDescription', label: $t('description') }, |
|||
], |
|||
}, |
|||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('standard.entity.name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('standard.entity.description'), type: 'textarea', rows: 3 }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode'), type: 'text', required: true }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName'), type: 'text' }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription'), type: 'textarea', rows: 3 }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('standard.entity.code') }, |
|||
{ name: 'name', label: $t('standard.entity.name') }, |
|||
{ name: 'description', label: $t('standard.entity.description') }, |
|||
{ name: 'mappingCode', label: $t('standard.entity.mappingCode') }, |
|||
{ name: 'mappingName', label: $t('standard.entity.mappingName') }, |
|||
{ name: 'mappingDescription', label: $t('standard.entity.mappingDescription') }, |
|||
|
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { Environment, Formater } from '@/platform'; |
|||
</script> |
@ -0,0 +1,69 @@ |
|||
package io.sc.platform.system.api.application; |
|||
|
|||
import io.sc.platform.orm.api.vo.CorporationAuditorVo; |
|||
|
|||
public class ApplicationVo extends CorporationAuditorVo { |
|||
private String id; |
|||
private String code; |
|||
private String name; |
|||
private String description; |
|||
private Boolean enable; |
|||
private Integer order; |
|||
private boolean selected; |
|||
|
|||
public String getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(String id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getDescription() { |
|||
return description; |
|||
} |
|||
|
|||
public void setDescription(String description) { |
|||
this.description = description; |
|||
} |
|||
|
|||
public Boolean getEnable() { |
|||
return enable; |
|||
} |
|||
|
|||
public void setEnable(Boolean enable) { |
|||
this.enable = enable; |
|||
} |
|||
|
|||
public Integer getOrder() { |
|||
return order; |
|||
} |
|||
|
|||
public void setOrder(Integer order) { |
|||
this.order = order; |
|||
} |
|||
|
|||
public boolean getSelected() { |
|||
return selected; |
|||
} |
|||
|
|||
public void setSelected(boolean selected) { |
|||
this.selected = selected; |
|||
} |
|||
} |
@ -0,0 +1,127 @@ |
|||
<template> |
|||
<q-splitter :model-value="60" class="w-full" style="height: 100%"> |
|||
<template #before> |
|||
<div class="pr-1" style="height: 100%"> |
|||
<w-grid |
|||
ref="applicationGridRef" |
|||
:title="$t('system.application.grid.title')" |
|||
:config-button="true" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:data-url="Environment.apiContextPath('/api/system/application')" |
|||
:sort-by="['order']" |
|||
:query-form-cols-num="3" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('code'), type: 'text' }, |
|||
{ name: 'name', label: $t('name'), type: 'text' }, |
|||
{ name: 'enable', label: $t('isEnable'), type: 'select', options: Options.yesNo() }, |
|||
]" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|||
:columns="[ |
|||
{ width: 60, name: 'order', label: $t('order') }, |
|||
{ width: 100, name: 'code', label: $t('code') }, |
|||
{ width: '100%', name: 'name', label: $t('name') }, |
|||
{ width: 80, name: 'enable', label: $t('status'), format: Formater.enableTag() }, |
|||
{ width: 120, name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ width: 120, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|||
]" |
|||
:editor="{ |
|||
dialog: { |
|||
width: '600px', |
|||
height: '300px', |
|||
}, |
|||
form: { |
|||
colsNum: 1, |
|||
fields: [ |
|||
{ name: 'code', label: $t('code'), type: 'text', required: true }, |
|||
{ name: 'name', label: $t('name'), type: 'text', required: true }, |
|||
{ name: 'description', label: $t('description'), type: 'textarea', rows: 1 }, |
|||
{ name: 'order', label: $t('order'), type: 'number' }, |
|||
{ name: 'enable', label: $t('enable'), type: 'checkbox', defaultValue: true }, |
|||
], |
|||
}, |
|||
}" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'id', label: $t('id') }, |
|||
{ name: 'code', label: $t('code') }, |
|||
{ name: 'name', label: $t('name') }, |
|||
{ name: 'description', label: $t('description') }, |
|||
{ name: 'enable', label: $t('enable'), format: Formater.none() }, |
|||
{ name: 'order', label: $t('order') }, |
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|||
{ name: 'corporationCode', label: $t('corporationCode') }, |
|||
], |
|||
}, |
|||
}" |
|||
@row-click=" |
|||
(evt, row, index) => { |
|||
currentSelectedRoleId = row.id; |
|||
menuTreeGridRef?.refresh(); |
|||
userGridRef?.refresh(); |
|||
} |
|||
" |
|||
@before-request-data=" |
|||
() => { |
|||
currentSelectedRoleId = ''; |
|||
menuTreeGridRef?.refresh(); |
|||
userGridRef?.refresh(); |
|||
} |
|||
" |
|||
> |
|||
</w-grid> |
|||
</div> |
|||
</template> |
|||
<template #after> |
|||
<div class="pl-1" style="height: 100%"> |
|||
<q-tabs v-model="selectedTabRef" inline-label align="left" :breakpoint="0" no-caps> |
|||
<q-tab name="menu" icon="bi-menu-app" :label="$t('menu')" /> |
|||
</q-tabs> |
|||
|
|||
<q-tab-panels v-model="selectedTabRef" animated swipeable keep-alive style="height: calc(100% - 48px)"> |
|||
<q-tab-panel name="menu" class="px-0 pb-0" style="height: 100%; padding-left: 0px; padding-right: 0px; padding-bottom: 0px"> |
|||
<SelectMenuTreeGrid |
|||
ref="menuTreeGridRef" |
|||
:fetch-data-url="Environment.apiContextPath('/api/system/menu/listAllMenusWithSelectedStatusByRole')" |
|||
foreign-key="roleId" |
|||
:foreign-value="currentSelectedRoleId" |
|||
@update="update" |
|||
></SelectMenuTreeGrid> |
|||
</q-tab-panel> |
|||
</q-tab-panels> |
|||
</div> |
|||
</template> |
|||
</q-splitter> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref } from 'vue'; |
|||
import { Environment, axios, EnumTools, Options, Formater } from 'platform-core'; |
|||
import SelectMenuTreeGrid from '../shared/SelectMenuTreeGrid.vue'; |
|||
|
|||
const DataComeFromEnum = await EnumTools.fetch('io.sc.platform.orm.api.enums.DataComeFrom'); |
|||
|
|||
const applicationGridRef = ref(); |
|||
const userGridRef = ref(); |
|||
const menuTreeGridRef = ref(); |
|||
|
|||
const selectedTabRef = ref('menu'); |
|||
const currentSelectedRoleId = ref(''); |
|||
|
|||
const update = (ids, gridComponent) => { |
|||
axios |
|||
.post(Environment.apiContextPath('/api/system/application/updateMenus'), { |
|||
one: applicationGridRef.value.getSelectedRows()[0].id, |
|||
many: ids, |
|||
}) |
|||
.then(() => { |
|||
gridComponent.refresh(); |
|||
}); |
|||
}; |
|||
</script> |
@ -0,0 +1,102 @@ |
|||
<template> |
|||
<w-dialog |
|||
ref="dialogRef" |
|||
:title="$t('system.shared.selectApplication.dialog.title')" |
|||
width="800px" |
|||
height="500px" |
|||
:can-maximize="false" |
|||
:buttons="[ |
|||
{ |
|||
label: $t('confirm'), |
|||
click: () => { |
|||
const ids = Tools.extractProperties(gridRef.getSelectedRows(), 'id'); |
|||
emit('afterSelected', ids, dialogRef); |
|||
}, |
|||
}, |
|||
]" |
|||
> |
|||
<div class="px-2" style="height: 100%"> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('system.shared.selectApplication.dialog.grid.title')" |
|||
selection="multiple" |
|||
:full-screen-button="false" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh']" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('code'), type: 'text' }, |
|||
{ name: 'name', label: $t('name'), type: 'text' }, |
|||
{ |
|||
name: 'enable', |
|||
label: $t('enable'), |
|||
type: 'select', |
|||
options: Options.yesNo(), |
|||
queryOperator: 'equals', |
|||
}, |
|||
{ |
|||
name: 'dataComeFrom', |
|||
label: $t('dataComeFrom'), |
|||
type: 'select', |
|||
options: Options.enum(DataComeFromEnum), |
|||
queryOperator: 'equals', |
|||
}, |
|||
]" |
|||
:auto-fetch-data="false" |
|||
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue" |
|||
:columns="[ |
|||
{ name: 'code', label: $t('code') }, |
|||
{ name: 'name', label: $t('name') }, |
|||
{ |
|||
name: 'status', |
|||
label: t('status'), |
|||
format: Formater.enableTag(), |
|||
}, |
|||
{ name: 'lastModifier', label: t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: t('lastModifyDate') }, |
|||
]" |
|||
></w-grid> |
|||
</div> |
|||
</w-dialog> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref, nextTick } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { Environment, Tools, EnumTools, Options, Formater } from 'platform-core'; |
|||
|
|||
const props = defineProps({ |
|||
opener: { type: Object, default: undefined }, |
|||
fetchDataUrl: { type: String, default: '' }, |
|||
foreignKey: { type: String, default: '' }, |
|||
foreignValue: { type: String, default: '' }, |
|||
}); |
|||
|
|||
const emit = defineEmits<{ |
|||
(e: 'afterSelected', ids: string[], dialogComponent: any): void; |
|||
}>(); |
|||
|
|||
const { t } = useI18n(); |
|||
|
|||
const dialogRef = ref(); |
|||
const gridRef = ref(); |
|||
const foreignKeyRef = ref(); |
|||
|
|||
const open = (foreignKey: string) => { |
|||
foreignKeyRef.value = foreignKey; |
|||
dialogRef.value.show(); |
|||
|
|||
nextTick(() => { |
|||
gridRef.value.refresh(); |
|||
}); |
|||
}; |
|||
|
|||
const close = () => { |
|||
dialogRef.value.hide(); |
|||
}; |
|||
|
|||
defineExpose({ |
|||
open, |
|||
close, |
|||
}); |
|||
|
|||
const DataComeFromEnum = await EnumTools.fetch('io.sc.platform.orm.api.enums.DataComeFrom'); |
|||
</script> |
@ -0,0 +1,141 @@ |
|||
<template> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('system.shared.selectApplication.grid.title')" |
|||
:config-button="false" |
|||
selection="multiple" |
|||
:checkbox-selection="true" |
|||
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue" |
|||
:auto-fetch-data="false" |
|||
:toolbar-configure="{ noIcon: true }" |
|||
:toolbar-actions="[ |
|||
'refresh', |
|||
'separator', |
|||
{ |
|||
name: 'selectIn', |
|||
label: $t('system.shared.selectApplication.grid.toolbar.selectIn'), |
|||
enableIf: () => { |
|||
return foreignValue ? true : false; |
|||
}, |
|||
click: () => { |
|||
dialogRef.open(foreignValue); |
|||
}, |
|||
}, |
|||
{ |
|||
name: 'selectOut', |
|||
label: $t('system.shared.selectApplication.grid.toolbar.selectOut'), |
|||
enableIf: () => { |
|||
return foreignValue && gridRef?.getSelectedRows()?.length > 0; |
|||
}, |
|||
click: (arg) => { |
|||
const ids = Tools.extractProperties(arg.selecteds, 'id'); |
|||
DialogManager.confirm($t('system.shared.selectApplication.grid.toolbar.selectOut.tip'), () => { |
|||
emit('selectOut', ids, gridRef); |
|||
}); |
|||
}, |
|||
}, |
|||
'separator', |
|||
{ |
|||
name: 'selectAllIn', |
|||
label: $t('system.shared.selectApplication.grid.toolbar.selectAllIn'), |
|||
enableIf: () => { |
|||
return foreignValue ? true : false; |
|||
}, |
|||
click: () => { |
|||
DialogManager.confirm($t('system.shared.selectApplication.grid.toolbar.selectAllIn.tip'), () => { |
|||
emit('selectAllIn', gridRef); |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
name: 'selectAllOut', |
|||
label: $t('system.shared.selectApplication.grid.toolbar.selectAllOut'), |
|||
enableIf: () => { |
|||
return foreignValue && gridRef?.getRows()?.length > 0; |
|||
}, |
|||
click: () => { |
|||
DialogManager.confirm($t('system.shared.selectApplication.grid.toolbar.selectAllOut.tip'), () => { |
|||
emit('selectAllOut', gridRef); |
|||
}); |
|||
}, |
|||
}, |
|||
'separator', |
|||
'view', |
|||
]" |
|||
:columns="[ |
|||
{ width: 150, name: 'code', label: $t('code') }, |
|||
{ width: '100%', name: 'name', label: $t('name') }, |
|||
{ |
|||
width: 80, |
|||
name: 'enable', |
|||
label: $t('status'), |
|||
format: Formater.enableTag(), |
|||
}, |
|||
]" |
|||
:viewer="{ |
|||
panel: { |
|||
columnNum: 1, |
|||
fields: [ |
|||
{ name: 'id', label: $t('id') }, |
|||
{ name: 'code', label: $t('code') }, |
|||
{ name: 'name', label: $t('name') }, |
|||
{ name: 'description', label: $t('description') }, |
|||
{ name: 'enable', label: $t('enable') }, |
|||
{ name: 'dataComeFrom', label: $t('dataComeFrom') }, |
|||
{ name: 'creator', label: $t('creator') }, |
|||
{ name: 'createDate', label: $t('createDate') }, |
|||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: $t('lastModifyDate') }, |
|||
{ name: 'corporationCode', label: $t('corporationCode') }, |
|||
], |
|||
}, |
|||
}" |
|||
></w-grid> |
|||
<SelectApplicationDialog |
|||
ref="dialogRef" |
|||
:opener="gridRef" |
|||
:fetch-data-url="fetchOtherDataUrl" |
|||
:foreign-key="foreignKey" |
|||
:foreign-value="foreignValue" |
|||
@after-selected=" |
|||
(ids: string[]) => { |
|||
emit('selectIn', ids, gridRef, dialogRef); |
|||
} |
|||
" |
|||
></SelectApplicationDialog> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref, onUpdated } from 'vue'; |
|||
|
|||
import { EnumTools, DialogManager, Formater, Tools } from 'platform-core'; |
|||
import SelectApplicationDialog from './SelectApplicationDialog.vue'; |
|||
|
|||
const props = defineProps({ |
|||
fetchDataUrl: { type: String, default: '' }, |
|||
fetchOtherDataUrl: { type: String, default: '' }, |
|||
foreignKey: { type: String, default: '' }, |
|||
foreignValue: { type: String, default: '' }, |
|||
}); |
|||
|
|||
const emit = defineEmits<{ |
|||
(e: 'selectIn', ids: string[], gridComponent: any, dialogComponent: any): void; |
|||
(e: 'selectOut', ids: string[], gridComponent: any): void; |
|||
(e: 'selectAllIn', gridComponent: any): void; |
|||
(e: 'selectAllOut', gridComponent: any): void; |
|||
}>(); |
|||
|
|||
const gridRef = ref(); |
|||
const dialogRef = ref(); |
|||
|
|||
const refresh = () => { |
|||
gridRef.value.refresh(); |
|||
}; |
|||
|
|||
onUpdated(() => { |
|||
gridRef.value.refresh(); |
|||
}); |
|||
|
|||
defineExpose({ |
|||
refresh, |
|||
}); |
|||
</script> |
@ -0,0 +1,110 @@ |
|||
package io.sc.platform.system.application.controller; |
|||
|
|||
import io.sc.platform.mvc.controller.support.RestCrudController; |
|||
import io.sc.platform.mvc.support.One2Many; |
|||
import io.sc.platform.orm.service.support.QueryParameter; |
|||
import io.sc.platform.orm.service.support.QueryResult; |
|||
import io.sc.platform.orm.util.EntityVoUtil; |
|||
import io.sc.platform.system.api.application.ApplicationVo; |
|||
import io.sc.platform.system.application.jpa.entity.ApplicationEntity; |
|||
import io.sc.platform.system.application.jpa.repository.ApplicationRepository; |
|||
import io.sc.platform.system.application.service.ApplicationService; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.util.StringUtils; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@RequestMapping("/api/system/application") |
|||
public class ApplicationWebController extends RestCrudController<ApplicationVo,ApplicationEntity,String,ApplicationRepository, ApplicationService> { |
|||
/** |
|||
* 查询菜单所属的应用 |
|||
* @param menuId 菜单ID |
|||
* @param queryParameter 查询参数 |
|||
* @return 菜单所属的应用 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@GetMapping("queryApplicationsByMenu") |
|||
public Page<ApplicationVo> queryApplicationsByMenu(String menuId,QueryParameter queryParameter) throws Exception{ |
|||
if(StringUtils.hasText(menuId)){ |
|||
Page<ApplicationEntity> result =service.queryApplicationsByMenu(menuId,queryParameter); |
|||
return EntityVoUtil.toVo(result); |
|||
} |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
/** |
|||
* 查询菜单不属于的应用 |
|||
* @param menuId 菜单ID |
|||
* @param queryParameter 查询参数 |
|||
* @return 菜单不属于的应用 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@GetMapping("queryOtherApplicationsByMenu") |
|||
public Page<ApplicationVo> queryOtherApplicationsByMenu(@RequestParam(name="menuId",required=false) String menuId, QueryParameter queryParameter) throws Exception{ |
|||
if(StringUtils.hasText(menuId)){ |
|||
Page<ApplicationEntity> result =service.queryOtherApplicationsByMenu(menuId,queryParameter); |
|||
return EntityVoUtil.toVo(result); |
|||
} |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
/** |
|||
* 给应用添加菜单 |
|||
* @param wrapper 一对多关系(ID关系)封装器, one: 代表应用名, many: 代表菜单ID集合 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@PostMapping("addMenus") |
|||
public void addMenus(@RequestBody One2Many<String,String> wrapper) throws Exception{ |
|||
if(wrapper!=null){ |
|||
service.addMenus(wrapper.getOne(), wrapper.getMany()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 给应用添加所有菜单 |
|||
* @param wrapper 一对多关系(ID关系)封装器, one: 代表应用名 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@PostMapping("addAllMenus") |
|||
public void addAllMenus(@RequestBody One2Many<String,String> wrapper) throws Exception{ |
|||
if(wrapper!=null){ |
|||
service.addAllMenus(wrapper.getOne()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 移除应用包含的菜单 |
|||
* @param wrapper 一对多关系(ID关系)封装器, one: 代表应用名, many: 代表菜单ID集合 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@PostMapping("removeMenus") |
|||
public void removeMenus(@RequestBody One2Many<String,String> wrapper) throws Exception{ |
|||
if(wrapper!=null){ |
|||
service.removeMenus(wrapper.getOne(), wrapper.getMany()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 移除应用包含的所有菜单 |
|||
* @param wrapper 一对多关系(ID关系)封装器, one: 代表应用名 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@PostMapping("removeAllMenus") |
|||
public void removeAllMenus(@RequestBody One2Many<String,String> wrapper) throws Exception{ |
|||
if(wrapper!=null){ |
|||
service.removeAllMenus(wrapper.getOne()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 更新应用包含的菜单 |
|||
* @param wrapper 一对多关系(ID关系)封装器, one: 代表应用名, many: 代表菜单ID集合 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
@PostMapping("updateMenus") |
|||
public void updateMenus(@RequestBody One2Many<String,String> wrapper) throws Exception{ |
|||
if(wrapper!=null){ |
|||
service.updateMenus(wrapper.getOne(),wrapper.getMany()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,169 @@ |
|||
package io.sc.platform.system.application.jpa.entity; |
|||
|
|||
import io.sc.platform.orm.converter.NumericBooleanConverter; |
|||
import io.sc.platform.orm.entity.CorporationAuditorEntity; |
|||
import io.sc.platform.system.api.application.ApplicationVo; |
|||
import io.sc.platform.system.menu.jpa.entity.MenuEntity; |
|||
import org.hibernate.annotations.GenericGenerator; |
|||
|
|||
import javax.persistence.*; |
|||
import javax.validation.constraints.Size; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
@Entity |
|||
@Table(name="SYS_APPLICATION") |
|||
public class ApplicationEntity extends CorporationAuditorEntity<ApplicationVo> { |
|||
//主键
|
|||
@Id |
|||
@GeneratedValue(generator = "system-uuid") |
|||
@GenericGenerator(name = "system-uuid", strategy = "uuid2") |
|||
@Column(name="ID_", length=36) |
|||
@Size(max=36) |
|||
private String id; |
|||
|
|||
//代码
|
|||
@Column(name="CODE_",nullable=false,length=254) |
|||
@Size(max=254) |
|||
private String code; |
|||
|
|||
//名称
|
|||
@Column(name="NAME_", length=254) |
|||
@Size(min=1,max=255) |
|||
private String name; |
|||
|
|||
//描述
|
|||
@Column(name="DESCRIPTION_", length=254) |
|||
@Size(max=254) |
|||
private String description; |
|||
|
|||
//是否可用
|
|||
@Column(name="ENABLE_") |
|||
@Convert(converter= NumericBooleanConverter.class) |
|||
private Boolean enable; |
|||
|
|||
//顺序
|
|||
@Column(name="ORDER_") |
|||
private Integer order; |
|||
|
|||
@ManyToMany(mappedBy="applications",fetch=FetchType.LAZY) |
|||
private List<MenuEntity> menus =new ArrayList<MenuEntity>(); |
|||
|
|||
@Override |
|||
public ApplicationVo toVo() { |
|||
ApplicationVo vo =new ApplicationVo(); |
|||
super.toVo(vo); |
|||
vo.setId(this.getId()); |
|||
vo.setCode(this.getCode()); |
|||
vo.setName(this.getName()); |
|||
vo.setDescription(this.getDescription()); |
|||
vo.setEnable(this.getEnable()); |
|||
vo.setOrder(this.getOrder()); |
|||
return vo; |
|||
} |
|||
|
|||
public String getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(String id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getDescription() { |
|||
return description; |
|||
} |
|||
|
|||
public void setDescription(String description) { |
|||
this.description = description; |
|||
} |
|||
|
|||
public Boolean getEnable() { |
|||
return enable; |
|||
} |
|||
|
|||
public void setEnable(Boolean enable) { |
|||
this.enable = enable; |
|||
} |
|||
|
|||
public Integer getOrder() { |
|||
return order; |
|||
} |
|||
|
|||
public void setOrder(Integer order) { |
|||
this.order = order; |
|||
} |
|||
|
|||
public List<MenuEntity> getMenus() { |
|||
return menus; |
|||
} |
|||
|
|||
public void setMenus(List<MenuEntity> menus) { |
|||
this.menus = menus; |
|||
} |
|||
|
|||
/** |
|||
* 增加菜单 |
|||
* @param menus 菜单 |
|||
*/ |
|||
public void addMenus(MenuEntity... menus){ |
|||
if(menus!=null && menus.length>0){ |
|||
for(MenuEntity menu : menus){ |
|||
if(menu.getApplications()!=null && !menu.getApplications().contains(this)){ |
|||
menu.getApplications().add(this); |
|||
} |
|||
if(this.getMenus()!=null && !this.getMenus().contains(menu)){ |
|||
this.getMenus().add(menu); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 移除菜单 |
|||
* @param menus 菜单 |
|||
*/ |
|||
public void removeMenus(MenuEntity...menus){ |
|||
if(menus!=null && menus.length>0){ |
|||
for(MenuEntity menu : menus){ |
|||
if(menu.getApplications()!=null && menu.getApplications().contains(this)){ |
|||
menu.getApplications().remove(this); |
|||
} |
|||
if(this.getMenus()!=null && this.getMenus().contains(menu)){ |
|||
this.getMenus().remove(menu); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public boolean equals(Object o) { |
|||
if (this == o) return true; |
|||
if (o == null || getClass() != o.getClass()) return false; |
|||
if (!super.equals(o)) return false; |
|||
ApplicationEntity that = (ApplicationEntity) o; |
|||
return Objects.equals(id, that.id); |
|||
} |
|||
|
|||
@Override |
|||
public int hashCode() { |
|||
return Objects.hash(super.hashCode(), id); |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
package io.sc.platform.system.application.jpa.repository; |
|||
|
|||
import io.sc.platform.orm.repository.DaoRepository; |
|||
import io.sc.platform.system.application.jpa.entity.ApplicationEntity; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.data.repository.query.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface ApplicationRepository extends DaoRepository<ApplicationEntity,String> { |
|||
@Query("select max(e.order)+1 from io.sc.platform.system.application.jpa.entity.ApplicationEntity e") |
|||
public Integer getNextOrder(); |
|||
public ApplicationEntity findByCode(String code); |
|||
public List<ApplicationEntity> findAllByOrderByName(); |
|||
} |
@ -0,0 +1,77 @@ |
|||
package io.sc.platform.system.application.service; |
|||
|
|||
import io.sc.platform.orm.service.DaoService; |
|||
import io.sc.platform.orm.service.support.QueryParameter; |
|||
import io.sc.platform.system.application.jpa.entity.ApplicationEntity; |
|||
import io.sc.platform.system.application.jpa.repository.ApplicationRepository; |
|||
import org.springframework.data.domain.Page; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
public interface ApplicationService extends DaoService<ApplicationEntity, String, ApplicationRepository> { |
|||
/** |
|||
* 查询应用列表 |
|||
* @param filter 过滤文本 |
|||
* @param queryParameter 查询参数 |
|||
* @return 匹配的应用 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public Page<ApplicationEntity> queryApplicationsByCodeOrName(String filter, QueryParameter queryParameter) throws Exception; |
|||
|
|||
/** |
|||
* 查询菜单所属的应用 |
|||
* @param menuId 菜单ID |
|||
* @param queryParameter 查询参数 |
|||
* @return 菜单所属的应用 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public Page<ApplicationEntity> queryApplicationsByMenu(String menuId,QueryParameter queryParameter) throws Exception; |
|||
|
|||
/** |
|||
* 查询菜单不属于的应用 |
|||
* @param menuId 菜单ID |
|||
* @param queryParameter 查询参数 |
|||
* @return 菜单不属于的应用 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public Page<ApplicationEntity> queryOtherApplicationsByMenu(String menuId, QueryParameter queryParameter) throws Exception; |
|||
|
|||
/** |
|||
* 给应用添加菜单 |
|||
* @param ApplicationId 应用ID |
|||
* @param menuIds 需要添加的菜单ID列表 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public void addMenus(String ApplicationId,Set<String> menuIds) throws Exception; |
|||
|
|||
/** |
|||
* 给应用添加所有菜单 |
|||
* @param ApplicationId 应用ID |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public void addAllMenus(String ApplicationId) throws Exception; |
|||
|
|||
/** |
|||
* 移除应用包含的菜单 |
|||
* @param ApplicationId 应用ID |
|||
* @param menuIds 需要移除的菜单ID列表 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public void removeMenus(String ApplicationId,Set<String> menuIds) throws Exception; |
|||
|
|||
/** |
|||
* 移除应用包含的所有菜单 |
|||
* @param ApplicationId 应用ID |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public void removeAllMenus(String ApplicationId) throws Exception; |
|||
|
|||
/** |
|||
* 更新应用包含的菜单 |
|||
* @param ApplicationId 应用ID |
|||
* @param menuIds 需要更新的菜单ID列表 |
|||
* @throws Exception 违例 |
|||
*/ |
|||
public void updateMenus(String ApplicationId,Set<String> menuIds) throws Exception; |
|||
} |
@ -0,0 +1,146 @@ |
|||
package io.sc.platform.system.application.service.impl; |
|||
|
|||
import io.sc.platform.jdbc.util.SqlBatcher; |
|||
import io.sc.platform.orm.entity.support.EntityChangedEventType; |
|||
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
|||
import io.sc.platform.orm.service.support.QueryParameter; |
|||
import io.sc.platform.orm.service.support.QueryResult; |
|||
import io.sc.platform.system.application.jpa.entity.ApplicationEntity; |
|||
import io.sc.platform.system.application.jpa.repository.ApplicationRepository; |
|||
import io.sc.platform.system.application.service.ApplicationService; |
|||
import io.sc.platform.system.menu.jpa.entity.MenuEntity; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.jpa.domain.Specification; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.jdbc.core.RowCallbackHandler; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import javax.persistence.criteria.Join; |
|||
import javax.persistence.criteria.Subquery; |
|||
import javax.transaction.Transactional; |
|||
import java.sql.ResultSet; |
|||
import java.sql.SQLException; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
@Service |
|||
public class ApplicationServiceImpl extends DaoServiceImpl<ApplicationEntity, String, ApplicationRepository> implements ApplicationService { |
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
|
|||
@Override |
|||
public ApplicationEntity add(ApplicationEntity entity) throws Exception { |
|||
Integer nextOrder =repository.getNextOrder(); |
|||
entity.setOrder(nextOrder==null?1:nextOrder); |
|||
return super.add(entity); |
|||
} |
|||
|
|||
@Override |
|||
public Page<ApplicationEntity> queryApplicationsByCodeOrName(String filter, QueryParameter queryParameter) throws Exception { |
|||
if(StringUtils.hasText(filter)) { |
|||
Specification<ApplicationEntity> specification = (root, query, criteriaBuilder) -> { |
|||
return criteriaBuilder.or( |
|||
criteriaBuilder.like(root.get("code"),filter), |
|||
criteriaBuilder.like(root.get("name"),filter) |
|||
); |
|||
}; |
|||
return this.query(specification, queryParameter); |
|||
} |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
@Override |
|||
public Page<ApplicationEntity> queryApplicationsByMenu(String menuId, QueryParameter queryParameter) throws Exception { |
|||
if(StringUtils.hasText(menuId)) { |
|||
Specification<ApplicationEntity> specification = (root, query, criteriaBuilder) -> { |
|||
Subquery<Integer> subquery =query.subquery(Integer.class); |
|||
Join<ApplicationEntity,MenuEntity> join = subquery.correlate(root).join("menus"); |
|||
|
|||
subquery.select(criteriaBuilder.literal(1)); |
|||
subquery.where(criteriaBuilder.equal(join.get("id"), menuId)); |
|||
|
|||
return criteriaBuilder.exists(subquery); |
|||
}; |
|||
return this.query(specification, queryParameter); |
|||
} |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
@Override |
|||
public Page<ApplicationEntity> queryOtherApplicationsByMenu(String menuId, QueryParameter queryParameter) throws Exception { |
|||
if(StringUtils.hasText(menuId)) { |
|||
Specification<ApplicationEntity> baseSpecification = (root, query, criteriaBuilder) -> { |
|||
Subquery<Integer> subquery =query.subquery(Integer.class); |
|||
Join<ApplicationEntity,MenuEntity> join = subquery.correlate(root).join("menus"); |
|||
|
|||
subquery.select(criteriaBuilder.literal(1)); |
|||
subquery.where(criteriaBuilder.equal(join.get("id"), menuId)); |
|||
|
|||
return criteriaBuilder.not(criteriaBuilder.exists(subquery)); |
|||
}; |
|||
|
|||
Specification<ApplicationEntity> specification =buildSpecification(queryParameter); |
|||
return this.query(baseSpecification.and(specification), queryParameter); |
|||
} |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void addMenus(String applicationId, Set<String> menuIds) throws Exception { |
|||
if(StringUtils.hasText(applicationId) && menuIds!=null && !menuIds.isEmpty()){ |
|||
SqlBatcher sqlBatcher =new SqlBatcher("insert into SYS_APPLICATION_MENU(MENU_ID_,APPLICATION_ID_) values(?,?)"); |
|||
for(String menuId : menuIds){ |
|||
sqlBatcher.addArg(new Object[]{menuId,applicationId}); |
|||
} |
|||
sqlBatcher.execute(jdbcTemplate); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void addAllMenus(final String applicationId) throws Exception { |
|||
if(StringUtils.hasText(applicationId)){ |
|||
removeAllMenus(applicationId); |
|||
ApplicationEntity application =repository.getOne(applicationId); |
|||
if(application!=null){ |
|||
final SqlBatcher sqlBatcher =new SqlBatcher("insert into SYS_APPLICATION_MENU(MENU_ID_,APPLICATION_ID_) values(?,?)"); |
|||
String query ="select ID_ from SYS_MENU"; |
|||
jdbcTemplate.query(query, new RowCallbackHandler() { |
|||
@Override |
|||
public void processRow(ResultSet rs) throws SQLException { |
|||
sqlBatcher.addArg(new Object[]{rs.getString("ID_"),applicationId}); |
|||
} |
|||
}); |
|||
sqlBatcher.execute(jdbcTemplate); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void removeMenus(String applicationId, Set<String> menuIds) throws Exception { |
|||
if(StringUtils.hasText(applicationId) && menuIds!=null && !menuIds.isEmpty()){ |
|||
SqlBatcher sqlBatcher =new SqlBatcher("delete from SYS_APPLICATION_MENU where MENU_ID_=? and APPLICATION_ID_=?"); |
|||
for(String menuId : menuIds){ |
|||
sqlBatcher.addArg(new Object[]{menuId,applicationId}); |
|||
} |
|||
sqlBatcher.execute(jdbcTemplate); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void removeAllMenus(String applicationId) throws Exception { |
|||
jdbcTemplate.update("delete from SYS_APPLICATION_MENU where APPLICATION_ID_=?", applicationId); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void updateMenus(String applicationId, Set<String> menuIds) throws Exception { |
|||
removeAllMenus(applicationId); |
|||
addMenus(applicationId,menuIds); |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
package io.sc.platform.system.application.support; |
|||
|
|||
public class ApplicationComparator { |
|||
public static final ApplicationVoNameComparator voName =new ApplicationVoNameComparator(true); |
|||
public static final ApplicationVoNameComparator voNameDesc =new ApplicationVoNameComparator(false); |
|||
public static final ApplicationVoCodeComparator voCode =new ApplicationVoCodeComparator(true); |
|||
public static final ApplicationVoCodeComparator voCodeDesc =new ApplicationVoCodeComparator(false); |
|||
|
|||
public static final ApplicationEntityNameComparator entityName =new ApplicationEntityNameComparator(); |
|||
public static final ApplicationEntityNameComparator entityNameDesc =new ApplicationEntityNameComparator(); |
|||
} |
@ -0,0 +1,26 @@ |
|||
package io.sc.platform.system.application.support; |
|||
|
|||
import io.sc.platform.core.util.PinyinUtil; |
|||
import io.sc.platform.system.application.jpa.entity.ApplicationEntity; |
|||
import io.sc.platform.system.org.jpa.entity.OrgEntity; |
|||
|
|||
import java.util.Comparator; |
|||
|
|||
public class ApplicationEntityNameComparator implements Comparator<ApplicationEntity> { |
|||
private boolean asc =true; |
|||
|
|||
public ApplicationEntityNameComparator(){} |
|||
|
|||
public ApplicationEntityNameComparator(boolean asc){ |
|||
this.asc =asc; |
|||
} |
|||
|
|||
@Override |
|||
public int compare(ApplicationEntity o1, ApplicationEntity o2) { |
|||
if(asc) { |
|||
return PinyinUtil.compare(o1.getName(), o2.getName()); |
|||
}else{ |
|||
return PinyinUtil.compare(o2.getName(), o1.getName()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package io.sc.platform.system.application.support; |
|||
|
|||
import io.sc.platform.core.util.PinyinUtil; |
|||
import io.sc.platform.system.api.application.ApplicationVo; |
|||
import io.sc.platform.system.api.org.OrgVo; |
|||
|
|||
import java.util.Comparator; |
|||
|
|||
public class ApplicationVoCodeComparator implements Comparator<ApplicationVo> { |
|||
private boolean asc =true; |
|||
|
|||
public ApplicationVoCodeComparator(){} |
|||
|
|||
public ApplicationVoCodeComparator(boolean asc){ |
|||
this.asc =asc; |
|||
} |
|||
|
|||
@Override |
|||
public int compare(ApplicationVo o1, ApplicationVo o2) { |
|||
if(asc) { |
|||
return PinyinUtil.compare(o1.getCode(), o2.getCode()); |
|||
}else{ |
|||
return PinyinUtil.compare(o2.getCode(), o1.getCode()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package io.sc.platform.system.application.support; |
|||
|
|||
import io.sc.platform.core.util.PinyinUtil; |
|||
import io.sc.platform.system.api.application.ApplicationVo; |
|||
import io.sc.platform.system.api.org.OrgVo; |
|||
|
|||
import java.util.Comparator; |
|||
|
|||
public class ApplicationVoNameComparator implements Comparator<ApplicationVo> { |
|||
private boolean asc =true; |
|||
|
|||
public ApplicationVoNameComparator(){} |
|||
|
|||
public ApplicationVoNameComparator(boolean asc){ |
|||
this.asc =asc; |
|||
} |
|||
|
|||
@Override |
|||
public int compare(ApplicationVo o1, ApplicationVo o2) { |
|||
if(asc) { |
|||
return PinyinUtil.compare(o1.getName(), o2.getName()); |
|||
}else{ |
|||
return PinyinUtil.compare(o2.getName(), o1.getName()); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue