mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-22 12:58:55 +08:00
格式化相关代码
This commit is contained in:
parent
8d9d473716
commit
1063d68063
140
auto-imports.d.ts
vendored
140
auto-imports.d.ts
vendored
@ -1,73 +1,73 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
export {};
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const createPinia: typeof import('pinia')['createPinia']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||
const defineComponent: typeof import('vue')['defineComponent']
|
||||
const defineStore: typeof import('pinia')['defineStore']
|
||||
const effectScope: typeof import('vue')['effectScope']
|
||||
const getActivePinia: typeof import('pinia')['getActivePinia']
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const mapActions: typeof import('pinia')['mapActions']
|
||||
const mapGetters: typeof import('pinia')['mapGetters']
|
||||
const mapState: typeof import('pinia')['mapState']
|
||||
const mapStores: typeof import('pinia')['mapStores']
|
||||
const mapWritableState: typeof import('pinia')['mapWritableState']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
|
||||
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||
const onMounted: typeof import('vue')['onMounted']
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const resolveDirective: typeof import('vue')['resolveDirective']
|
||||
const setActivePinia: typeof import('pinia')['setActivePinia']
|
||||
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
|
||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||
const shallowRef: typeof import('vue')['shallowRef']
|
||||
const storeToRefs: typeof import('pinia')['storeToRefs']
|
||||
const toRaw: typeof import('vue')['toRaw']
|
||||
const toRef: typeof import('vue')['toRef']
|
||||
const toRefs: typeof import('vue')['toRefs']
|
||||
const triggerRef: typeof import('vue')['triggerRef']
|
||||
const unref: typeof import('vue')['unref']
|
||||
const useAttrs: typeof import('vue')['useAttrs']
|
||||
const useCssModule: typeof import('vue')['useCssModule']
|
||||
const useCssVars: typeof import('vue')['useCssVars']
|
||||
const useLink: typeof import('vue-router')['useLink']
|
||||
const useRoute: typeof import('vue-router')['useRoute']
|
||||
const useRouter: typeof import('vue-router')['useRouter']
|
||||
const useSlots: typeof import('vue')['useSlots']
|
||||
const watch: typeof import('vue')['watch']
|
||||
const watchEffect: typeof import('vue')['watchEffect']
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||
const EffectScope: typeof import('vue')['EffectScope'];
|
||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'];
|
||||
const computed: typeof import('vue')['computed'];
|
||||
const createApp: typeof import('vue')['createApp'];
|
||||
const createPinia: typeof import('pinia')['createPinia'];
|
||||
const customRef: typeof import('vue')['customRef'];
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'];
|
||||
const defineComponent: typeof import('vue')['defineComponent'];
|
||||
const defineStore: typeof import('pinia')['defineStore'];
|
||||
const effectScope: typeof import('vue')['effectScope'];
|
||||
const getActivePinia: typeof import('pinia')['getActivePinia'];
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance'];
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope'];
|
||||
const h: typeof import('vue')['h'];
|
||||
const inject: typeof import('vue')['inject'];
|
||||
const isProxy: typeof import('vue')['isProxy'];
|
||||
const isReactive: typeof import('vue')['isReactive'];
|
||||
const isReadonly: typeof import('vue')['isReadonly'];
|
||||
const isRef: typeof import('vue')['isRef'];
|
||||
const mapActions: typeof import('pinia')['mapActions'];
|
||||
const mapGetters: typeof import('pinia')['mapGetters'];
|
||||
const mapState: typeof import('pinia')['mapState'];
|
||||
const mapStores: typeof import('pinia')['mapStores'];
|
||||
const mapWritableState: typeof import('pinia')['mapWritableState'];
|
||||
const markRaw: typeof import('vue')['markRaw'];
|
||||
const nextTick: typeof import('vue')['nextTick'];
|
||||
const onActivated: typeof import('vue')['onActivated'];
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount'];
|
||||
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'];
|
||||
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'];
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'];
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'];
|
||||
const onDeactivated: typeof import('vue')['onDeactivated'];
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured'];
|
||||
const onMounted: typeof import('vue')['onMounted'];
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked'];
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered'];
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose'];
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch'];
|
||||
const onUnmounted: typeof import('vue')['onUnmounted'];
|
||||
const onUpdated: typeof import('vue')['onUpdated'];
|
||||
const provide: typeof import('vue')['provide'];
|
||||
const reactive: typeof import('vue')['reactive'];
|
||||
const readonly: typeof import('vue')['readonly'];
|
||||
const ref: typeof import('vue')['ref'];
|
||||
const resolveComponent: typeof import('vue')['resolveComponent'];
|
||||
const resolveDirective: typeof import('vue')['resolveDirective'];
|
||||
const setActivePinia: typeof import('pinia')['setActivePinia'];
|
||||
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix'];
|
||||
const shallowReactive: typeof import('vue')['shallowReactive'];
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly'];
|
||||
const shallowRef: typeof import('vue')['shallowRef'];
|
||||
const storeToRefs: typeof import('pinia')['storeToRefs'];
|
||||
const toRaw: typeof import('vue')['toRaw'];
|
||||
const toRef: typeof import('vue')['toRef'];
|
||||
const toRefs: typeof import('vue')['toRefs'];
|
||||
const triggerRef: typeof import('vue')['triggerRef'];
|
||||
const unref: typeof import('vue')['unref'];
|
||||
const useAttrs: typeof import('vue')['useAttrs'];
|
||||
const useCssModule: typeof import('vue')['useCssModule'];
|
||||
const useCssVars: typeof import('vue')['useCssVars'];
|
||||
const useLink: typeof import('vue-router')['useLink'];
|
||||
const useRoute: typeof import('vue-router')['useRoute'];
|
||||
const useRouter: typeof import('vue-router')['useRouter'];
|
||||
const useSlots: typeof import('vue')['useSlots'];
|
||||
const watch: typeof import('vue')['watch'];
|
||||
const watchEffect: typeof import('vue')['watchEffect'];
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect'];
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect'];
|
||||
}
|
||||
|
@ -1,47 +1,47 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/act/leave-bill/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill/page',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
export function addObj(obj) {
|
||||
return request({
|
||||
url: '/act/leave-bill',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export function getObj(id) {
|
||||
return request({
|
||||
url: '/act/leave-bill/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export function submit(id) {
|
||||
return request({
|
||||
url: '/act/leave-bill/submit/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill/submit/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export function delObj(ids?: Object) {
|
||||
return request({
|
||||
url: '/act/leave-bill',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill',
|
||||
method: 'delete',
|
||||
data: ids,
|
||||
});
|
||||
}
|
||||
|
||||
export function putObj(obj) {
|
||||
return request({
|
||||
url: '/act/leave-bill/',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
return request({
|
||||
url: '/act/leave-bill/',
|
||||
method: 'put',
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/act/process',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: '/act/process',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
export function delObj(ids?: Object) {
|
||||
return request({
|
||||
url: '/act/process',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
return request({
|
||||
url: '/act/process',
|
||||
method: 'delete',
|
||||
data: ids,
|
||||
});
|
||||
}
|
||||
|
||||
export function status(id, type) {
|
||||
return request({
|
||||
url: '/act/process/status/' + id + '/' + type,
|
||||
method: 'put'
|
||||
})
|
||||
return request({
|
||||
url: '/act/process/status/' + id + '/' + type,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
@ -30,11 +30,10 @@ export function doTask(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function delObj(ids?:Object) {
|
||||
return request({
|
||||
url: '/act/task',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
export function delObj(ids?: Object) {
|
||||
return request({
|
||||
url: '/act/task',
|
||||
method: 'delete',
|
||||
data: ids,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,135 +1,134 @@
|
||||
<!-- excel 导入组件 -->
|
||||
<template>
|
||||
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="headers"
|
||||
:action="other.adaptationUrl(url)"
|
||||
:disabled="state.upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-error="handleFileError"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">
|
||||
{{ $t('excel.operationNotice') }}
|
||||
<em>{{ $t('excel.clickUpload') }}</em>
|
||||
</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>{{ $t('excel.fileFormat') }}</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||
@click="downExcelTemp" v-if="tempUrl"
|
||||
>{{ $t('excel.downloadTemplate') }}
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="submitFileForm">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
<el-button @click="state.upload.open = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="headers"
|
||||
:action="other.adaptationUrl(url)"
|
||||
:disabled="state.upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-error="handleFileError"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">
|
||||
{{ $t('excel.operationNotice') }}
|
||||
<em>{{ $t('excel.clickUpload') }}</em>
|
||||
</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>{{ $t('excel.fileFormat') }}</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="downExcelTemp" v-if="tempUrl"
|
||||
>{{ $t('excel.downloadTemplate') }}
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="submitFileForm">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
<el-button @click="state.upload.open = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!--校验失败错误数据-->
|
||||
<el-dialog :title="$t('common.validationFailureData')" v-model="state.errorVisible">
|
||||
<el-table :data="state.errorData">
|
||||
<el-table-column property="lineNum" :label="$t('excel.lineNumbers')" width="100"></el-table-column>
|
||||
<el-table-column property="errors" :label="$t('excel.misDescription')" show-overflow-tooltip>
|
||||
<template v-slot="scope">
|
||||
<el-tag type="danger" v-for="error in scope.row.errors" :key="error">{{ error }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<!--校验失败错误数据-->
|
||||
<el-dialog :title="$t('common.validationFailureData')" v-model="state.errorVisible">
|
||||
<el-table :data="state.errorData">
|
||||
<el-table-column property="lineNum" :label="$t('excel.lineNumbers')" width="100"></el-table-column>
|
||||
<el-table-column property="errors" :label="$t('excel.misDescription')" show-overflow-tooltip>
|
||||
<template v-slot="scope">
|
||||
<el-tag type="danger" v-for="error in scope.row.errors" :key="error">{{ error }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="upload-excel">
|
||||
import {useMessage} from '/@/hooks/message';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import other from '/@/utils/other';
|
||||
import {Session} from '/@/utils/storage';
|
||||
import { Session } from '/@/utils/storage';
|
||||
|
||||
const emit = defineEmits(['sizeChange', 'refreshDataList']);
|
||||
const prop = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
tempUrl: {
|
||||
type: String,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
tempUrl: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
const uploadRef = ref();
|
||||
|
||||
const state = reactive({
|
||||
errorVisible: false,
|
||||
errorData: [],
|
||||
dialog: {
|
||||
title: '',
|
||||
isShowDialog: false,
|
||||
},
|
||||
upload: {
|
||||
open: false,
|
||||
isUploading: false,
|
||||
},
|
||||
errorVisible: false,
|
||||
errorData: [],
|
||||
dialog: {
|
||||
title: '',
|
||||
isShowDialog: false,
|
||||
},
|
||||
upload: {
|
||||
open: false,
|
||||
isUploading: false,
|
||||
},
|
||||
});
|
||||
|
||||
const downExcelTemp = () => {
|
||||
other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, 'temp.xlsx');
|
||||
other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, 'temp.xlsx');
|
||||
};
|
||||
|
||||
const handleFileUploadProgress = () => {
|
||||
state.upload.isUploading = true;
|
||||
state.upload.isUploading = true;
|
||||
};
|
||||
|
||||
const handleFileError = () => {
|
||||
useMessage().error('上传失败,数据格式不合法!');
|
||||
state.upload.open = false;
|
||||
useMessage().error('上传失败,数据格式不合法!');
|
||||
state.upload.open = false;
|
||||
};
|
||||
const handleFileSuccess = (response: any) => {
|
||||
state.upload.isUploading = false;
|
||||
state.upload.open = false;
|
||||
uploadRef.value.clearFiles();
|
||||
state.upload.isUploading = false;
|
||||
state.upload.open = false;
|
||||
uploadRef.value.clearFiles();
|
||||
|
||||
// 校验失败
|
||||
if (response.code === 1) {
|
||||
useMessage().error('导入失败,以下数据不合法');
|
||||
state.errorVisible = true;
|
||||
state.errorData = response.data;
|
||||
uploadRef.value.clearFiles();
|
||||
// 刷新表格
|
||||
emit('refreshDataList');
|
||||
} else {
|
||||
useMessage().success(response.msg ? response.msg : '导入成功');
|
||||
// 刷新表格
|
||||
emit('refreshDataList');
|
||||
}
|
||||
// 校验失败
|
||||
if (response.code === 1) {
|
||||
useMessage().error('导入失败,以下数据不合法');
|
||||
state.errorVisible = true;
|
||||
state.errorData = response.data;
|
||||
uploadRef.value.clearFiles();
|
||||
// 刷新表格
|
||||
emit('refreshDataList');
|
||||
} else {
|
||||
useMessage().success(response.msg ? response.msg : '导入成功');
|
||||
// 刷新表格
|
||||
emit('refreshDataList');
|
||||
}
|
||||
};
|
||||
const submitFileForm = () => {
|
||||
uploadRef.value.submit();
|
||||
uploadRef.value.submit();
|
||||
};
|
||||
const show = () => {
|
||||
state.upload.isUploading = false;
|
||||
state.upload.open = true;
|
||||
state.upload.isUploading = false;
|
||||
state.upload.open = true;
|
||||
};
|
||||
|
||||
const headers = computed(() => {
|
||||
return {
|
||||
Authorization: 'Bearer ' + Session.getToken(),
|
||||
'TENANT-ID': Session.getTenant(),
|
||||
};
|
||||
return {
|
||||
Authorization: 'Bearer ' + Session.getToken(),
|
||||
'TENANT-ID': Session.getTenant(),
|
||||
};
|
||||
});
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
show,
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import { watch } from 'vue';
|
||||
import other from "/@/utils/other";
|
||||
import other from '/@/utils/other';
|
||||
|
||||
const imageUrl = ref('');
|
||||
const fileUpload = ref();
|
||||
|
@ -1,15 +1,15 @@
|
||||
export default {
|
||||
excel: {
|
||||
downloadTemplate :"downloading the template",
|
||||
fileFormat:"only xls, xlsx format files are allowed",
|
||||
operationNotice:"Drag the file here and",
|
||||
clickUpload:"click upload",
|
||||
lineNumbers:"line numbers",
|
||||
misDescription:"misDescription",
|
||||
validationFailureData:"validation failure data",
|
||||
pleaseUpload:"please upload",
|
||||
size:"size not exceeding",
|
||||
format:"format",
|
||||
file:"file"
|
||||
downloadTemplate: 'downloading the template',
|
||||
fileFormat: 'only xls, xlsx format files are allowed',
|
||||
operationNotice: 'Drag the file here and',
|
||||
clickUpload: 'click upload',
|
||||
lineNumbers: 'line numbers',
|
||||
misDescription: 'misDescription',
|
||||
validationFailureData: 'validation failure data',
|
||||
pleaseUpload: 'please upload',
|
||||
size: 'size not exceeding',
|
||||
format: 'format',
|
||||
file: 'file',
|
||||
},
|
||||
};
|
||||
|
@ -1,15 +1,15 @@
|
||||
export default {
|
||||
excel: {
|
||||
downloadTemplate :"下载模板",
|
||||
fileFormat:"仅允许导入xls、xlsx格式文件。",
|
||||
operationNotice:"将文件拖到此处,或",
|
||||
clickUpload:"点击上传",
|
||||
lineNumbers:"行号",
|
||||
misDescription:"错误描述",
|
||||
validationFailureData:"校验失败数据",
|
||||
pleaseUpload:"请上传",
|
||||
size:"大小不超过",
|
||||
format:"格式为",
|
||||
file:"的文件",
|
||||
downloadTemplate: '下载模板',
|
||||
fileFormat: '仅允许导入xls、xlsx格式文件。',
|
||||
operationNotice: '将文件拖到此处,或',
|
||||
clickUpload: '点击上传',
|
||||
lineNumbers: '行号',
|
||||
misDescription: '错误描述',
|
||||
validationFailureData: '校验失败数据',
|
||||
pleaseUpload: '请上传',
|
||||
size: '大小不超过',
|
||||
format: '格式为',
|
||||
file: '的文件',
|
||||
},
|
||||
};
|
||||
|
@ -60,7 +60,7 @@
|
||||
<script setup lang="ts" name="upload-file">
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { Local, Session } from '/@/utils/storage';
|
||||
import other from "/@/utils/other";
|
||||
import other from '/@/utils/other';
|
||||
const props = defineProps({
|
||||
modelValue: [String, Array],
|
||||
// 数量限制
|
||||
|
@ -3,8 +3,7 @@
|
||||
<div v-loading="mainLoading" class="msg-main">
|
||||
<div id="msg-div" class="msg-div">
|
||||
<div v-if="!tableLoading">
|
||||
<div v-if="loadMore" class="el-table__empty-block" @click="loadingMore"><span
|
||||
class="el-table__empty-text">点击加载更多</span></div>
|
||||
<div v-if="loadMore" class="el-table__empty-block" @click="loadingMore"><span class="el-table__empty-text">点击加载更多</span></div>
|
||||
<div v-if="!loadMore" class="el-table__empty-block"><span class="el-table__empty-text">没有更多了</span></div>
|
||||
</div>
|
||||
<div v-for="item in tableData" :key="item.id" class="execution" id="msgTable">
|
||||
@ -50,22 +49,28 @@
|
||||
<svg-icon name="local-wx-video" :size="80" @click="loadVideo(item)"></svg-icon>
|
||||
</div>
|
||||
<div v-if="item.repType === 'location'">
|
||||
<el-link type="primary" target="_blank" :href="
|
||||
'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=' +
|
||||
item.repLocationY +
|
||||
'&pointy=' +
|
||||
item.repLocationX +
|
||||
'&name=' +
|
||||
item.repContent +
|
||||
'&ref=joolun'
|
||||
">
|
||||
<img :src="
|
||||
'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|' +
|
||||
item.repLocationX +
|
||||
',' +
|
||||
<el-link
|
||||
type="primary"
|
||||
target="_blank"
|
||||
:href="
|
||||
'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=' +
|
||||
item.repLocationY +
|
||||
'&key=PFFBZ-RBM3V-IEEPP-UH6KE-6QUQE-C4BVJ&size=250*180'
|
||||
" />
|
||||
'&pointy=' +
|
||||
item.repLocationX +
|
||||
'&name=' +
|
||||
item.repContent +
|
||||
'&ref=joolun'
|
||||
"
|
||||
>
|
||||
<img
|
||||
:src="
|
||||
'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|' +
|
||||
item.repLocationX +
|
||||
',' +
|
||||
item.repLocationY +
|
||||
'&key=PFFBZ-RBM3V-IEEPP-UH6KE-6QUQE-C4BVJ&size=250*180'
|
||||
"
|
||||
/>
|
||||
<p />
|
||||
<i class="el-icon-map-location"></i>{{ item.repContent }}
|
||||
</el-link>
|
||||
@ -144,7 +149,7 @@ const sendMsg = () => {
|
||||
if (objData.value.repType === 'news') {
|
||||
if (JSON.parse(objData.value.content).length > 1) {
|
||||
useMessage().error('图文消息条数限制在1条以内,已默认发送第一条');
|
||||
objData.value.content = (JSON.parse(objData.value.content))[0];
|
||||
objData.value.content = JSON.parse(objData.value.content)[0];
|
||||
}
|
||||
}
|
||||
sendLoading.value = true;
|
||||
@ -161,10 +166,10 @@ const sendMsg = () => {
|
||||
tableData.value = [];
|
||||
getData().then(() => {
|
||||
//box-container是添加overflow的父div,也就是出现滚动条的div
|
||||
var scrollTarget = document.getElementById("msgTable");
|
||||
var scrollTarget = document.getElementById('msgTable');
|
||||
//scrollTarget.scrollHeight是获取dom元素的高度,然后设置scrollTop
|
||||
scrollTarget.scrollTop = scrollTarget.scrollHeight;
|
||||
})
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
sendLoading.value = false;
|
||||
@ -175,7 +180,6 @@ const sendMsg = () => {
|
||||
const tableData = ref([] as any);
|
||||
const tableLoading = ref(false);
|
||||
|
||||
|
||||
const openDialog = (data: any) => {
|
||||
wxData.wxUserId = data.wxUserId;
|
||||
wxData.appId = data.appId;
|
||||
|
@ -18,8 +18,8 @@
|
||||
<div v-if="!objData.repUrl" style="width: 100%">
|
||||
<el-row style="text-align: center">
|
||||
<el-col :span="12" class="col-select">
|
||||
<el-button type="success" @click="openMaterial({ type: 'image', accountId: props.objData.appId })">素材库选择<i
|
||||
class="fansel-icon--right"></i>
|
||||
<el-button type="success" @click="openMaterial({ type: 'image', accountId: props.objData.appId })"
|
||||
>素材库选择<i class="fansel-icon--right"></i>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12" class="col-add">
|
||||
@ -45,8 +45,8 @@
|
||||
<div v-if="!objData.repName" style="width: 100%">
|
||||
<el-row style="text-align: center">
|
||||
<el-col :span="12" class="col-select">
|
||||
<el-button type="success" @click="openMaterial({ type: 'voice', accountId: props.objData.appId })">素材库选择<i
|
||||
class="fansel-icon--right"></i>
|
||||
<el-button type="success" @click="openMaterial({ type: 'voice', accountId: props.objData.appId })"
|
||||
>素材库选择<i class="fansel-icon--right"></i>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12" class="col-add">
|
||||
@ -66,11 +66,10 @@
|
||||
<el-row style="text-align: center">
|
||||
<el-col :span="12" class="col-select">
|
||||
<a v-if="objData.repUrl" target="_blank" :href="objData.repUrl">
|
||||
<SvgIcon name="local-wx-video" :size="45" />
|
||||
</a></el-col>
|
||||
<SvgIcon name="local-wx-video" :size="45" /> </a
|
||||
></el-col>
|
||||
<el-col :span="12" class="col-add">
|
||||
<el-button type="success" @click="openMaterial({ type: 'video', accountId: props.objData.appId })">素材库选择
|
||||
</el-button>
|
||||
<el-button type="success" @click="openMaterial({ type: 'video', accountId: props.objData.appId })">素材库选择 </el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
@ -87,8 +86,8 @@
|
||||
<div v-if="!objData.content" style="width: 100%">
|
||||
<el-row style="text-align: center">
|
||||
<el-col :span="24" class="col-select2">
|
||||
<el-button type="success" @click="openMaterial({ type: 'news', accountId: props.objData.appId })">素材库选择<i
|
||||
class="fansel-icon--right"></i>
|
||||
<el-button type="success" @click="openMaterial({ type: 'news', accountId: props.objData.appId })"
|
||||
>素材库选择<i class="fansel-icon--right"></i>
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -189,9 +189,7 @@ const dataRules = ref({
|
||||
encFlag: [{ required: true, message: '是否开启密码加密传输', trigger: 'blur' }],
|
||||
onlineQuantity: [{ required: true, message: '是否允许同时在线', trigger: 'blur' }],
|
||||
autoapprove: [{ required: true, message: '自动放行不能为空', trigger: 'blur' }],
|
||||
webServerRedirectUri: [
|
||||
{ required: true, message: '回调地址不能为空', trigger: 'blur' }
|
||||
],
|
||||
webServerRedirectUri: [{ required: true, message: '回调地址不能为空', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
|
@ -1,158 +1,147 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('client.clientId')" prop="clientId">
|
||||
<el-input :placeholder="$t('client.clientId')" style="max-width: 180px"
|
||||
v-model="state.queryForm.clientId"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('client.clientSecret')" prop="clientSecret">
|
||||
<el-input :placeholder="$t('client.clientSecret')" style="max-width: 180px"
|
||||
v-model="state.queryForm.clientSecret"/>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary"
|
||||
v-auth="'sys_client_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'sys_client_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
|
||||
{{ $t('common.refreshCacheBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||
v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('client.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('client.clientId')" prop="clientId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('client.clientSecret')" prop="clientSecret" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('client.scope')" prop="scope" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('client.authorizedGrantTypes')" prop="authorizedGrantTypes"
|
||||
show-overflow-tooltip width="200px">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="grant_types" :value="scope.row.authorizedGrantTypes"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('client.accessTokenValidity')" prop="accessTokenValidity"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column :label="t('client.refreshTokenValidity')" prop="refreshTokenValidity"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.clientId)" text type="primary"
|
||||
v-auth="'sys_client_add'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'sys_client_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('client.clientId')" prop="clientId">
|
||||
<el-input :placeholder="$t('client.clientId')" style="max-width: 180px" v-model="state.queryForm.clientId" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('client.clientSecret')" prop="clientSecret">
|
||||
<el-input :placeholder="$t('client.clientSecret')" style="max-width: 180px" v-model="state.queryForm.clientSecret" />
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary" v-auth="'sys_client_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'sys_client_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
|
||||
{{ $t('common.refreshCacheBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="60" />
|
||||
<el-table-column :label="t('client.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('client.clientId')" prop="clientId" show-overflow-tooltip />
|
||||
<el-table-column :label="t('client.clientSecret')" prop="clientSecret" show-overflow-tooltip />
|
||||
<el-table-column :label="t('client.scope')" prop="scope" show-overflow-tooltip />
|
||||
<el-table-column :label="t('client.authorizedGrantTypes')" prop="authorizedGrantTypes" show-overflow-tooltip width="200px">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="grant_types" :value="scope.row.authorizedGrantTypes"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('client.accessTokenValidity')" prop="accessTokenValidity" show-overflow-tooltip />
|
||||
<el-table-column :label="t('client.refreshTokenValidity')" prop="refreshTokenValidity" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.clientId)" text type="primary" v-auth="'sys_client_add'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'sys_client_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemSysOauthClientDetails" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObj, fetchList, refreshCache} from '/@/api/admin/client';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList, refreshCache } from '/@/api/admin/client';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n();
|
||||
// 定义查询字典
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
const {grant_types} = useDict('grant_types');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const queryRef = ref();
|
||||
// 搜索变量
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const { grant_types } = useDict('grant_types');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const queryRef = ref();
|
||||
// 搜索变量
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
descs: ['id'],
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
descs: ['id'],
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile} = useTable(state);
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 删除缓存
|
||||
const handleRefreshCache = () => {
|
||||
refreshCache().then(() => {
|
||||
useMessage().success('同步成功');
|
||||
});
|
||||
};
|
||||
// 删除缓存
|
||||
const handleRefreshCache = () => {
|
||||
refreshCache().then(() => {
|
||||
useMessage().success('同步成功');
|
||||
});
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
// state.queryForm = {};
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
// state.queryForm = {};
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/client/export', state.queryForm, 'client.xlsx');
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/client/export', state.queryForm, 'client.xlsx');
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,184 +1,174 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" shadow="hover" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('tenant.name')" prop="name">
|
||||
<el-input :placeholder="$t('tenant.inputnameTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.name"/>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary"
|
||||
v-auth="'admin_systenant_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" shadow="hover" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('tenant.name')" prop="name">
|
||||
<el-input :placeholder="$t('tenant.inputnameTip')" style="max-width: 180px" v-model="state.queryForm.name" />
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary" v-auth="'admin_systenant_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary"
|
||||
v-auth="'admin_systenant_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary" v-auth="'admin_systenant_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete"
|
||||
type="primary" v-auth="'admin_systenant_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'admin_systenant_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
|
||||
<el-button @click="handleTenantMenu()" class="ml10" type="primary"
|
||||
v-auth="'admin_systenant_tenantmenu'">
|
||||
{{ $t('tenantmenu.name') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||
v-loading="state.loading">
|
||||
<el-table-column :selectable="handleSelectable" align="center" type="selection" width="50"/>
|
||||
<el-table-column :label="t('tenant.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('tenant.name')" prop="name" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('tenant.code')" prop="code" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('tenant.tenantDomain')" prop="tenantDomain" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('tenant.startTime')" prop="startTime" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ parseDate(scope.row.startTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('tenant.endTime')" prop="endTime" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ parseDate(scope.row.endTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('tenant.status')" prop="status" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status_type" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary"
|
||||
v-auth="'admin_systenant_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleTenantMenu()" class="ml10" type="primary" v-auth="'admin_systenant_tenantmenu'">
|
||||
{{ $t('tenantmenu.name') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column :selectable="handleSelectable" align="center" type="selection" width="50" />
|
||||
<el-table-column :label="t('tenant.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('tenant.name')" prop="name" show-overflow-tooltip />
|
||||
<el-table-column :label="t('tenant.code')" prop="code" show-overflow-tooltip />
|
||||
<el-table-column :label="t('tenant.tenantDomain')" prop="tenantDomain" show-overflow-tooltip />
|
||||
<el-table-column :label="t('tenant.startTime')" prop="startTime" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ parseDate(scope.row.startTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('tenant.endTime')" prop="endTime" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ parseDate(scope.row.endTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('tenant.status')" prop="status" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status_type" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary" v-auth="'admin_systenant_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
|
||||
<el-tooltip :content="$t('tenant.deleteDisabledTip')" :disabled="scope.row.id !== '1'"
|
||||
placement="top">
|
||||
<el-tooltip :content="$t('tenant.deleteDisabledTip')" :disabled="scope.row.id !== '1'" placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button :disabled="scope.row.id === '1'" @click="handleDelete([scope.row.id])" text
|
||||
type="primary" v-auth="'admin_systenant_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
<el-button :disabled="scope.row.id === '1'" @click="handleDelete([scope.row.id])" text type="primary" v-auth="'admin_systenant_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
<!-- 导入excel -->
|
||||
<upload-excel
|
||||
:title="$t('tenant.importTenantTip')"
|
||||
@refreshDataList="getDataList"
|
||||
ref="excelUploadRef"
|
||||
temp-url="/admin/sys-file/local/file/tenant.xlsx"
|
||||
url="/admin/tenant/import"
|
||||
/>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
<!-- 导入excel -->
|
||||
<upload-excel
|
||||
:title="$t('tenant.importTenantTip')"
|
||||
@refreshDataList="getDataList"
|
||||
ref="excelUploadRef"
|
||||
temp-url="/admin/sys-file/local/file/tenant.xlsx"
|
||||
url="/admin/tenant/import"
|
||||
/>
|
||||
|
||||
<tenant-menu ref="TenantMenuRef"></tenant-menu>
|
||||
</div>
|
||||
<tenant-menu ref="TenantMenuRef"></tenant-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemTenant" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObj, fetchPage} from '/@/api/admin/tenant';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchPage } from '/@/api/admin/tenant';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const TenantMenu = defineAsyncComponent(() => import('./tenantMenu/index.vue'));
|
||||
const {t} = useI18n();
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const TenantMenu = defineAsyncComponent(() => import('./tenantMenu/index.vue'));
|
||||
const { t } = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const excelUploadRef = ref();
|
||||
const TenantMenuRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const excelUploadRef = ref();
|
||||
const TenantMenuRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
// 字典
|
||||
const {status_type} = useDict('status_type');
|
||||
// 字典
|
||||
const { status_type } = useDict('status_type');
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchPage,
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchPage,
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile} = useTable(state);
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
getDataList();
|
||||
};
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 是否可以多选
|
||||
const handleSelectable = (row: any) => {
|
||||
return row.id !== '1';
|
||||
};
|
||||
// 是否可以多选
|
||||
const handleSelectable = (row: any) => {
|
||||
return row.id !== '1';
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/tenant/export', state.queryForm, 'tenant.xlsx');
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/tenant/export', state.queryForm, 'tenant.xlsx');
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const handleTenantMenu = () => {
|
||||
TenantMenuRef.value.open();
|
||||
};
|
||||
const handleTenantMenu = () => {
|
||||
TenantMenuRef.value.open();
|
||||
};
|
||||
</script>
|
||||
|
@ -1,224 +1,221 @@
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :title="state.ruleForm.menuId ? $t('common.editBtn') : $t('common.addBtn')"
|
||||
draggable v-model="visible">
|
||||
<el-form :model="state.ruleForm" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.menuType')" prop="menType">
|
||||
<el-radio-group v-model="state.ruleForm.menuType">
|
||||
<el-radio-button label="0">页面</el-radio-button>
|
||||
<el-radio-button label="1">按钮</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.parentId')" prop="parentId">
|
||||
<el-tree-select
|
||||
:data="state.parentData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
check-strictly
|
||||
class="w100"
|
||||
clearable
|
||||
default-expand-all
|
||||
placeholder="请选择上级菜单"
|
||||
v-model="state.ruleForm.parentId"
|
||||
>
|
||||
</el-tree-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.name')" prop="name">
|
||||
<el-input :placeholder="$t('sysmenu.inputMenuNameTip')" clearable
|
||||
v-model="state.ruleForm.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType !== '1'">
|
||||
<el-form-item :label="$t('sysmenu.path')" prop="path">
|
||||
<el-input :placeholder="$t('sysmenu.inputPathTip')" v-model="state.ruleForm.path"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType == '1'">
|
||||
<el-form-item :label="$t('sysmenu.permission')" prop="permission">
|
||||
<el-input :placeholder="$t('sysmenu.inputPermissionTip')" maxlength="50"
|
||||
v-model="state.ruleForm.permission"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.sortOrder')" prop="sortOrder">
|
||||
<el-input-number :min="0" controls-position="right" v-model="state.ruleForm.sortOrder"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType !== '1'">
|
||||
<el-form-item :label="$t('sysmenu.visible')" prop="visible">
|
||||
<el-radio-group v-model="state.ruleForm.visible">
|
||||
<el-radio-button label="1">显示</el-radio-button>
|
||||
<el-radio-button label="0">隐藏</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-dialog :close-on-click-modal="false" :title="state.ruleForm.menuId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
|
||||
<el-form :model="state.ruleForm" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.menuType')" prop="menType">
|
||||
<el-radio-group v-model="state.ruleForm.menuType">
|
||||
<el-radio-button label="0">页面</el-radio-button>
|
||||
<el-radio-button label="1">按钮</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.parentId')" prop="parentId">
|
||||
<el-tree-select
|
||||
:data="state.parentData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
check-strictly
|
||||
class="w100"
|
||||
clearable
|
||||
default-expand-all
|
||||
placeholder="请选择上级菜单"
|
||||
v-model="state.ruleForm.parentId"
|
||||
>
|
||||
</el-tree-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.name')" prop="name">
|
||||
<el-input :placeholder="$t('sysmenu.inputMenuNameTip')" clearable v-model="state.ruleForm.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType !== '1'">
|
||||
<el-form-item :label="$t('sysmenu.path')" prop="path">
|
||||
<el-input :placeholder="$t('sysmenu.inputPathTip')" v-model="state.ruleForm.path" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType == '1'">
|
||||
<el-form-item :label="$t('sysmenu.permission')" prop="permission">
|
||||
<el-input :placeholder="$t('sysmenu.inputPermissionTip')" maxlength="50" v-model="state.ruleForm.permission" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysmenu.sortOrder')" prop="sortOrder">
|
||||
<el-input-number :min="0" controls-position="right" v-model="state.ruleForm.sortOrder" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType !== '1'">
|
||||
<el-form-item :label="$t('sysmenu.visible')" prop="visible">
|
||||
<el-radio-group v-model="state.ruleForm.visible">
|
||||
<el-radio-button label="1">显示</el-radio-button>
|
||||
<el-radio-button label="0">隐藏</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemMenuDialog" setup>
|
||||
import {addObj, info, pageList, update, validateByName, validatePermission} from '/@/api/app/appmenu';
|
||||
import {useMessage} from '/@/hooks/message';
|
||||
import {rule} from '/@/utils/validate';
|
||||
import { addObj, info, pageList, update, validateByName, validatePermission } from '/@/api/app/appmenu';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { rule } from '/@/utils/validate';
|
||||
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(['refresh']);
|
||||
// 引入组件
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(['refresh']);
|
||||
// 引入组件
|
||||
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
|
||||
// 定义需要的数据
|
||||
const state = reactive({
|
||||
ruleForm: {
|
||||
menuId: '',
|
||||
name: '',
|
||||
permission: '',
|
||||
parentId: '',
|
||||
icon: '',
|
||||
path: '',
|
||||
sortOrder: 0,
|
||||
menuType: '0',
|
||||
visible: '1',
|
||||
id: '',
|
||||
},
|
||||
parentData: [] as any[], // 上级菜单数据
|
||||
});
|
||||
// 定义需要的数据
|
||||
const state = reactive({
|
||||
ruleForm: {
|
||||
menuId: '',
|
||||
name: '',
|
||||
permission: '',
|
||||
parentId: '',
|
||||
icon: '',
|
||||
path: '',
|
||||
sortOrder: 0,
|
||||
menuType: '0',
|
||||
visible: '1',
|
||||
id: '',
|
||||
},
|
||||
parentData: [] as any[], // 上级菜单数据
|
||||
});
|
||||
|
||||
// 从后端获取菜单信息
|
||||
const getMenuData = () => {
|
||||
state.parentData = [];
|
||||
loading.value = true;
|
||||
pageList()
|
||||
.then((res) => {
|
||||
let menu = {
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
delFlag: '',
|
||||
icon: '',
|
||||
keepAlive: '',
|
||||
menuId: '',
|
||||
menuType: '',
|
||||
parentId: '',
|
||||
path: '',
|
||||
sortOrder: 0,
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
visible: '',
|
||||
id: '-1',
|
||||
name: '根菜单',
|
||||
children: [] as any[],
|
||||
};
|
||||
menu.children = res.data;
|
||||
state.parentData.push(menu);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
// 从后端获取菜单信息
|
||||
const getMenuData = () => {
|
||||
state.parentData = [];
|
||||
loading.value = true;
|
||||
pageList()
|
||||
.then((res) => {
|
||||
let menu = {
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
delFlag: '',
|
||||
icon: '',
|
||||
keepAlive: '',
|
||||
menuId: '',
|
||||
menuType: '',
|
||||
parentId: '',
|
||||
path: '',
|
||||
sortOrder: 0,
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
visible: '',
|
||||
id: '-1',
|
||||
name: '根菜单',
|
||||
children: [] as any[],
|
||||
};
|
||||
menu.children = res.data;
|
||||
state.parentData.push(menu);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const dataRules = reactive({
|
||||
name: [
|
||||
{required: true, message: '菜单名称不能为空', trigger: 'blur'},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateByName(rule, value, callback, state.ruleForm.menuId !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
path: [
|
||||
{required: true, message: '路由路径不能为空', trigger: 'blur'},
|
||||
{validate: rule.noChinese, trigger: 'blur'},
|
||||
],
|
||||
permission: [
|
||||
{required: true, message: '权限标识不能为空', trigger: 'blur'},
|
||||
{validator: rule.validatorLowercase, trigger: 'blur'},
|
||||
{min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur'},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validatePermission(rule, value, callback, state.ruleForm.menuId !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = (type: string, row?: any) => {
|
||||
if (row?.id && type === 'edit') {
|
||||
state.ruleForm.id = row.id;
|
||||
// 模拟数据,实际请走接口
|
||||
loading.value = true;
|
||||
info(row.id)
|
||||
.then((res) => {
|
||||
Object.assign(state.ruleForm, res.data);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
// 清空表单,此项需加表单验证才能使用
|
||||
nextTick(() => {
|
||||
dataFormRef?.value?.resetFields();
|
||||
state.ruleForm.parentId = row?.id || '-1';
|
||||
});
|
||||
}
|
||||
visible.value = true;
|
||||
getMenuData();
|
||||
};
|
||||
const dataRules = reactive({
|
||||
name: [
|
||||
{ required: true, message: '菜单名称不能为空', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateByName(rule, value, callback, state.ruleForm.menuId !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
path: [
|
||||
{ required: true, message: '路由路径不能为空', trigger: 'blur' },
|
||||
{ validate: rule.noChinese, trigger: 'blur' },
|
||||
],
|
||||
permission: [
|
||||
{ required: true, message: '权限标识不能为空', trigger: 'blur' },
|
||||
{ validator: rule.validatorLowercase, trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validatePermission(rule, value, callback, state.ruleForm.menuId !== '');
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = (type: string, row?: any) => {
|
||||
if (row?.id && type === 'edit') {
|
||||
state.ruleForm.id = row.id;
|
||||
// 模拟数据,实际请走接口
|
||||
loading.value = true;
|
||||
info(row.id)
|
||||
.then((res) => {
|
||||
Object.assign(state.ruleForm, res.data);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
// 清空表单,此项需加表单验证才能使用
|
||||
nextTick(() => {
|
||||
dataFormRef?.value?.resetFields();
|
||||
state.ruleForm.parentId = row?.id || '-1';
|
||||
});
|
||||
}
|
||||
visible.value = true;
|
||||
getMenuData();
|
||||
};
|
||||
|
||||
// 保存数据
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 保存 调用刷新
|
||||
if (state.ruleForm.id) {
|
||||
loading.value = true;
|
||||
update(state.ruleForm)
|
||||
.then(() => {
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
loading.value = true;
|
||||
addObj(state.ruleForm)
|
||||
.then(() => {
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// 保存数据
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 保存 调用刷新
|
||||
if (state.ruleForm.id) {
|
||||
loading.value = true;
|
||||
update(state.ruleForm)
|
||||
.then(() => {
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
loading.value = true;
|
||||
addObj(state.ruleForm)
|
||||
.then(() => {
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 暴露变量 只有暴漏出来的变量 父组件才能使用
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
// 暴露变量 只有暴漏出来的变量 父组件才能使用
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
</script>
|
||||
|
@ -1,166 +1,161 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="t('appsocial.type')" class="ml2" prop="type">
|
||||
<el-select :placeholder="t('appsocial.inputTypeTip')" v-model="state.queryForm.type">
|
||||
<el-option :key="index" :label="item.label" :value="item.value"
|
||||
v-for="(item, index) in app_social_type"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
@click="formDialogRef.openDialog()"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
v-auth="'app_social_details_add'"
|
||||
>
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
@click="handleDelete(selectObjs)"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'app_social_details_del'"
|
||||
>
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChangeHandle"
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('appsocial.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('appsocial.type')" prop="type" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="app_social_type" :value="scope.row.type"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('appsocial.remark')" prop="remark" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('appsocial.appId')" prop="appId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('appsocial.appSecret')" prop="appSecret" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('appsocial.createTime')" prop="createTime" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary"
|
||||
v-auth="'app_social_details_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary"
|
||||
v-auth="'app_social_details_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="t('appsocial.type')" class="ml2" prop="type">
|
||||
<el-select :placeholder="t('appsocial.inputTypeTip')" v-model="state.queryForm.type">
|
||||
<el-option :key="index" :label="item.label" :value="item.value" v-for="(item, index) in app_social_type"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
@click="formDialogRef.openDialog()"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
v-auth="'app_social_details_add'"
|
||||
>
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
@click="handleDelete(selectObjs)"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'app_social_details_del'"
|
||||
>
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChangeHandle"
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="60" />
|
||||
<el-table-column :label="t('appsocial.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('appsocial.type')" prop="type" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="app_social_type" :value="scope.row.type"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('appsocial.remark')" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column :label="t('appsocial.appId')" prop="appId" show-overflow-tooltip />
|
||||
<el-table-column :label="t('appsocial.appSecret')" prop="appSecret" show-overflow-tooltip />
|
||||
<el-table-column :label="t('appsocial.createTime')" prop="createTime" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary" v-auth="'app_social_details_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'app_social_details_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemAppSocialDetails" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObj, fetchList} from '/@/api/app/appsocial';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList } from '/@/api/app/appsocial';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n();
|
||||
// 定义查询字典
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
const {app_social_type} = useDict('app_social_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const { app_social_type } = useDict('app_social_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
type: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
descs: ['create_time'],
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
type: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
descs: ['create_time'],
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile} = useTable(state);
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/app/appsocial/export', state.queryForm, 'appsocial.xlsx');
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/app/appsocial/export', state.queryForm, 'appsocial.xlsx');
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: any) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: any) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,282 +1,265 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" ref="queryRef">
|
||||
<el-form-item :label="$t('job.jobName')" prop="jobName">
|
||||
<el-input
|
||||
:placeholder="$t('job.inputjobNameTip')"
|
||||
@keyup.enter="getDataList"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
v-model="state.queryForm.jobName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('job.jobGroup')" prop="jobGroup">
|
||||
<el-input
|
||||
:placeholder="$t('job.inputjobGroupTip')"
|
||||
@keyup.enter="getDataList"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
v-model="state.queryForm.jobGroup"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" ref="queryRef">
|
||||
<el-form-item :label="$t('job.jobName')" prop="jobName">
|
||||
<el-input
|
||||
:placeholder="$t('job.inputjobNameTip')"
|
||||
@keyup.enter="getDataList"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
v-model="state.queryForm.jobName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('job.jobGroup')" prop="jobGroup">
|
||||
<el-input
|
||||
:placeholder="$t('job.inputjobGroupTip')"
|
||||
@keyup.enter="getDataList"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
v-model="state.queryForm.jobGroup"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="t('job.jobStatus')" prop="jobStatus">
|
||||
<el-select :placeholder="t('job.inputjobStatusTip')" v-model="state.queryForm.jobStatus">
|
||||
<el-option :key="index" :label="item.label" :value="item.value"
|
||||
v-for="(item, index) in job_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('job.jobExecuteStatus')" prop="jobExecuteStatus">
|
||||
<el-select :placeholder="t('job.inputjobExecuteStatusTip')"
|
||||
v-model="state.queryForm.jobExecuteStatus">
|
||||
<el-option :key="index" :label="item.label" :value="item.value"
|
||||
v-for="(item, index) in job_execute_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('job.jobStatus')" prop="jobStatus">
|
||||
<el-select :placeholder="t('job.inputjobStatusTip')" v-model="state.queryForm.jobStatus">
|
||||
<el-option :key="index" :label="item.label" :value="item.value" v-for="(item, index) in job_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('job.jobExecuteStatus')" prop="jobExecuteStatus">
|
||||
<el-select :placeholder="t('job.inputjobExecuteStatusTip')" v-model="state.queryForm.jobExecuteStatus">
|
||||
<el-option :key="index" :label="item.label" :value="item.value" v-for="(item, index) in job_execute_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList" icon="Search" type="primary">{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(undefined)" class="ml10" icon="Delete"
|
||||
type="primary">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||
v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="50"/>
|
||||
<el-table-column :label="t('job.index')" fixed="left" type="index" width="80"/>
|
||||
<el-table-column :label="t('job.jobName')" fixed="left" prop="jobName" show-overflow-tooltip
|
||||
width="120"/>
|
||||
<el-table-column :label="t('job.jobGroup')" prop="jobGroup" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.jobStatus')" prop="jobStatus" show-overflow-tooltip width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_status" :value="scope.row.jobStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('job.jobExecuteStatus')" prop="jobExecuteStatus" show-overflow-tooltip
|
||||
width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_execute_status" :value="scope.row.jobExecuteStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList" icon="Search" type="primary">{{ $t('common.queryBtn') }} </el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(undefined)" class="ml10" icon="Delete" type="primary">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="50" />
|
||||
<el-table-column :label="t('job.index')" fixed="left" type="index" width="80" />
|
||||
<el-table-column :label="t('job.jobName')" fixed="left" prop="jobName" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.jobGroup')" prop="jobGroup" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.jobStatus')" prop="jobStatus" show-overflow-tooltip width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_status" :value="scope.row.jobStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('job.jobExecuteStatus')" prop="jobExecuteStatus" show-overflow-tooltip width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_execute_status" :value="scope.row.jobExecuteStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="t('job.startTime')" prop="startTime" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.startTime')" prop="startTime" show-overflow-tooltip width="120" />
|
||||
|
||||
<el-table-column :label="t('job.previousTime')" prop="previousTime" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.nextTime')" prop="nextTime" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.jobType')" prop="jobType" show-overflow-tooltip width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_type" :value="scope.row.jobType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('job.executePath')" prop="executePath" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.className')" prop="className" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.methodName')" prop="methodName" show-overflow-tooltip width="120"/>
|
||||
<el-table-column :label="t('job.methodParamsValue')" prop="methodParamsValue" show-overflow-tooltip
|
||||
width="120"/>
|
||||
<el-table-column :label="t('job.cronExpression')" prop="cronExpression" show-overflow-tooltip
|
||||
width="120"/>
|
||||
<el-table-column :label="t('job.misfirePolicy')" prop="misfirePolicy" show-overflow-tooltip width="200">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="misfire_policy" :value="scope.row.misfirePolicy"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('job.previousTime')" prop="previousTime" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.nextTime')" prop="nextTime" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.jobType')" prop="jobType" show-overflow-tooltip width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="job_type" :value="scope.row.jobType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('job.executePath')" prop="executePath" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.className')" prop="className" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.methodName')" prop="methodName" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.methodParamsValue')" prop="methodParamsValue" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.cronExpression')" prop="cronExpression" show-overflow-tooltip width="120" />
|
||||
<el-table-column :label="t('job.misfirePolicy')" prop="misfirePolicy" show-overflow-tooltip width="200">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="misfire_policy" :value="scope.row.misfirePolicy"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('common.action')" fixed="right" width="300">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleJobLog(scope.row)" text type="primary">日志</el-button>
|
||||
<el-table-column :label="$t('common.action')" fixed="right" width="300">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleJobLog(scope.row)" text type="primary">日志</el-button>
|
||||
|
||||
<el-button @click="handleStartJob(scope.row)" text type="primary"
|
||||
v-if="scope.row.jobStatus !== '2'">启动
|
||||
</el-button>
|
||||
<el-button @click="handleStartJob(scope.row)" text type="primary" v-if="scope.row.jobStatus !== '2'">启动 </el-button>
|
||||
|
||||
<el-button @click="handleShutDownJob(scope.row)" text type="primary"
|
||||
v-if="scope.row.jobStatus === '2'">暂停
|
||||
</el-button>
|
||||
<el-button @click="handleShutDownJob(scope.row)" text type="primary" v-if="scope.row.jobStatus === '2'">暂停 </el-button>
|
||||
|
||||
<el-button @click="handleEditJob(scope.row)" text type="primary">{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleEditJob(scope.row)" text type="primary">{{ $t('common.editBtn') }} </el-button>
|
||||
|
||||
<el-button @click="handleRunJob(scope.row)" text type="primary">执行</el-button>
|
||||
<el-button @click="handleRunJob(scope.row)" text type="primary">执行</el-button>
|
||||
|
||||
<el-button @click="handleDelete(scope.row)" text type="primary">{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
<el-button @click="handleDelete(scope.row)" text type="primary">{{ $t('common.delBtn') }} </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
<job-log ref="jobLogRef"></job-log>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
<job-log ref="jobLogRef"></job-log>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemSysJob" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObj, fetchList, runJobRa, shutDownJobRa, startJobRa} from '/@/api/daemon/job';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList, runJobRa, shutDownJobRa, startJobRa } from '/@/api/daemon/job';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const JobLog = defineAsyncComponent(() => import('./job-log.vue'));
|
||||
const {t} = useI18n();
|
||||
// 定义查询字典
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const JobLog = defineAsyncComponent(() => import('./job-log.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
const {job_status, job_execute_status, misfire_policy, job_type} = useDict('job_status', 'job_execute_status', 'misfire_policy', 'job_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const jobLogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]);
|
||||
const multiple = ref(true);
|
||||
const { job_status, job_execute_status, misfire_policy, job_type } = useDict('job_status', 'job_execute_status', 'misfire_policy', 'job_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const jobLogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]);
|
||||
const multiple = ref(true);
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
jobName: '',
|
||||
jobGroup: '',
|
||||
jobStatus: '',
|
||||
jobExecuteStatus: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
jobName: '',
|
||||
jobGroup: '',
|
||||
jobStatus: '',
|
||||
jobExecuteStatus: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile} = useTable(state);
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
getDataList();
|
||||
};
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (val: any) => {
|
||||
selectObjs.value = val;
|
||||
multiple.value = !val.length;
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (val: any) => {
|
||||
selectObjs.value = val;
|
||||
multiple.value = !val.length;
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/daemon/sys-job/export', state.queryForm, 'job.xlsx');
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/daemon/sys-job/export', state.queryForm, 'job.xlsx');
|
||||
};
|
||||
|
||||
const handleJobLog = (row: any) => {
|
||||
jobLogRef.value.openDialog(row.jobId);
|
||||
};
|
||||
const handleJobLog = (row: any) => {
|
||||
jobLogRef.value.openDialog(row.jobId);
|
||||
};
|
||||
|
||||
const handleEditJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '1' || jobStatus === '3') {
|
||||
formDialogRef.value.openDialog(row.jobId);
|
||||
} else {
|
||||
useMessage().error('运行中定时任务不可修改,请先暂停后操作');
|
||||
}
|
||||
};
|
||||
const handleEditJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '1' || jobStatus === '3') {
|
||||
formDialogRef.value.openDialog(row.jobId);
|
||||
} else {
|
||||
useMessage().error('运行中定时任务不可修改,请先暂停后操作');
|
||||
}
|
||||
};
|
||||
|
||||
const handleStartJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '1' || jobStatus === '3') {
|
||||
useMessageBox()
|
||||
.confirm('即将发布或启动(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
startJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
useMessage().error('定时任务已运行');
|
||||
}
|
||||
};
|
||||
const handleStartJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '1' || jobStatus === '3') {
|
||||
useMessageBox()
|
||||
.confirm('即将发布或启动(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
startJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
useMessage().error('定时任务已运行');
|
||||
}
|
||||
};
|
||||
|
||||
const handleShutDownJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '2') {
|
||||
useMessageBox()
|
||||
.confirm('即将暂停(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
shutDownJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
useMessage().error('已暂停,不要重复操作');
|
||||
}
|
||||
};
|
||||
const handleShutDownJob = (row: any) => {
|
||||
const jobStatus = row.jobStatus;
|
||||
if (jobStatus === '2') {
|
||||
useMessageBox()
|
||||
.confirm('即将暂停(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
shutDownJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
useMessage().error('已暂停,不要重复操作');
|
||||
}
|
||||
};
|
||||
|
||||
const handleRunJob = (row: any) => {
|
||||
useMessageBox()
|
||||
.confirm('立刻执行一次任务(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
runJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
const handleRunJob = (row: any) => {
|
||||
useMessageBox()
|
||||
.confirm('立刻执行一次任务(任务名称:' + row.jobName + '), 是否继续?')
|
||||
.then(() => {
|
||||
runJobRa(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (row: any) => {
|
||||
if (!row) {
|
||||
selectObjs.value.forEach((val: any) => {
|
||||
handleDelete(val);
|
||||
});
|
||||
return;
|
||||
}
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText') + '(任务名称:' + row.jobName + ')')
|
||||
.then(() => {
|
||||
delObj(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (row: any) => {
|
||||
if (!row) {
|
||||
selectObjs.value.forEach((val: any) => {
|
||||
handleDelete(val);
|
||||
});
|
||||
return;
|
||||
}
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText') + '(任务名称:' + row.jobName + ')')
|
||||
.then(() => {
|
||||
delObj(row.jobId)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,140 +1,130 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('template.id')" prop="id">
|
||||
<el-input :placeholder="t('template.inputIdTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.id"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('template.templateName')" prop="templateName">
|
||||
<el-input :placeholder="t('template.inputTemplateNameTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.templateName"/>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary"
|
||||
v-auth="'codegen_template_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary"
|
||||
v-auth="'codegen_template_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete"
|
||||
type="primary" v-auth="'codegen_template_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||
v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('template.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('template.templateName')" prop="templateName" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('template.generatorPath')" prop="generatorPath" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('template.desc')" prop="templateDesc" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary"
|
||||
v-auth="'codegen_template_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary"
|
||||
v-auth="'codegen_template_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</div>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('template.id')" prop="id">
|
||||
<el-input :placeholder="t('template.inputIdTip')" style="max-width: 180px" v-model="state.queryForm.id" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('template.templateName')" prop="templateName">
|
||||
<el-input :placeholder="t('template.inputTemplateNameTip')" style="max-width: 180px" v-model="state.queryForm.templateName" />
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary" v-auth="'codegen_template_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary" v-auth="'codegen_template_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'codegen_template_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="60" />
|
||||
<el-table-column :label="t('template.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('template.templateName')" prop="templateName" show-overflow-tooltip />
|
||||
<el-table-column :label="t('template.generatorPath')" prop="generatorPath" show-overflow-tooltip />
|
||||
<el-table-column :label="t('template.desc')" prop="templateDesc" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.id)" text type="primary" v-auth="'codegen_template_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.id])" text type="primary" v-auth="'codegen_template_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemGenTemplate" setup>
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {delObjs, fetchList} from '/@/api/gen/template';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
import {useI18n} from 'vue-i18n';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObjs, fetchList } from '/@/api/gen/template';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n();
|
||||
// 定义查询字典
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile} = useTable(state);
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/gen/template/export', state.queryForm, 'template.xlsx');
|
||||
};
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/gen/template/export', state.queryForm, 'template.xlsx');
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObjs(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObjs(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,147 +1,151 @@
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :title="form.leaveId ? $t('common.editBtn') : $t('common.addBtn')"
|
||||
draggable v-model="visible">
|
||||
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.username')" prop="username">
|
||||
<el-input :placeholder="t('leave.inputUsernameTip')" disabled v-model="form.username"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-dialog :close-on-click-modal="false" :title="form.leaveId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
|
||||
<el-form :model="form" :rules="dataRules" formDialogRef label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.username')" prop="username">
|
||||
<el-input :placeholder="t('leave.inputUsernameTip')" disabled v-model="form.username" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.days')" prop="days">
|
||||
<el-input-number :max="1000" :min="1" :placeholder="t('leave.inputDaysTip')"
|
||||
v-model="form.days"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.days')" prop="days">
|
||||
<el-input-number :max="1000" :min="1" :placeholder="t('leave.inputDaysTip')" v-model="form.days"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.leaveTime')" prop="leaveTime">
|
||||
<el-date-picker
|
||||
:placeholder="t('leave.inputLeaveTimeTip')"
|
||||
:value-format="dateTimeStr"
|
||||
type="datetime"
|
||||
v-model="form.leaveTime"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.leaveTime')" prop="leaveTime">
|
||||
<el-date-picker :placeholder="t('leave.inputLeaveTimeTip')" :value-format="dateTimeStr"
|
||||
type="datetime"
|
||||
v-model="form.leaveTime"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.content')" prop="content">
|
||||
<editor :placeholder="t('leave.inputContentTip')" v-model:get-html="form.content"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.content')" prop="content">
|
||||
<editor :placeholder="t('leave.inputContentTip')" v-model:get-html="form.content" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="OaLeaveBillDialog" setup>
|
||||
import {useMessage} from "/@/hooks/message";
|
||||
import {addObj, getObj, putObj} from '../../../api/oa/leave-bill'
|
||||
import {useI18n} from "vue-i18n"
|
||||
import {useUserInfo} from "/@/stores/userInfo";
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { addObj, getObj, putObj } from '../../../api/oa/leave-bill';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const {t} = useI18n();
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
leaveId: '',
|
||||
username: '',
|
||||
days: 0,
|
||||
content: '',
|
||||
leaveTime: '',
|
||||
});
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
leaveId: '',
|
||||
username: '',
|
||||
days: 0,
|
||||
content: '',
|
||||
leaveTime: '',
|
||||
});
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
|
||||
days: [{ required: true, message: '请假天数不能为空', trigger: 'blur' }],
|
||||
content: [{ required: true, message: '事由不能为空', trigger: 'blur' }],
|
||||
leaveTime: [{ required: true, message: '时间不能为空', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
username: [{required: true, message: '用户名不能为空', trigger: 'blur'}],
|
||||
days: [{required: true, message: '请假天数不能为空', trigger: 'blur'}],
|
||||
content: [{required: true, message: '事由不能为空', trigger: 'blur'}],
|
||||
leaveTime: [{required: true, message: '时间不能为空', trigger: 'blur'}],
|
||||
})
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true;
|
||||
form.leaveId = '';
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.leaveId = ''
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields();
|
||||
}
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields()
|
||||
}
|
||||
// 获取oaLeaveBill信息
|
||||
if (id) {
|
||||
form.leaveId = id;
|
||||
getoaLeaveBillData(id);
|
||||
} else {
|
||||
form.username = useUserInfo().userInfos.user.username;
|
||||
}
|
||||
};
|
||||
|
||||
// 获取oaLeaveBill信息
|
||||
if (id) {
|
||||
form.leaveId = id
|
||||
getoaLeaveBillData(id)
|
||||
} else {
|
||||
form.username = useUserInfo().userInfos.user.username
|
||||
}
|
||||
};
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 更新
|
||||
if (form.leaveId) {
|
||||
loading.value = true;
|
||||
putObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.editSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
loading.value = true;
|
||||
addObj(form)
|
||||
.then(() => {
|
||||
useMessage().success(t('common.addSuccessText'));
|
||||
visible.value = false; // 关闭弹窗
|
||||
emit('refresh');
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
// 更新
|
||||
if (form.leaveId) {
|
||||
loading.value = true
|
||||
putObj(form).then(() => {
|
||||
useMessage().success(t('common.editSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
loading.value = true
|
||||
addObj(form).then(() => {
|
||||
useMessage().success(t('common.addSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 初始化表单数据
|
||||
const getoaLeaveBillData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true;
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getoaLeaveBillData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
</script>
|
||||
|
@ -1,169 +1,171 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('leave.username')" prop="username">
|
||||
<el-input :placeholder="t('leave.inputUsernameTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.username"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('leave.state')" class="ml2" prop="state">
|
||||
<el-select :placeholder="t('leave.inputStateTip')" v-model="state.queryForm.state">
|
||||
<el-option :key="index" :label="item.label" :value="item.value"
|
||||
v-for="(item, index) in leave_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary"
|
||||
v-auth="'oa_leave_bill_view'">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" formDialogRef icon="folder-add"
|
||||
type="primary" v-auth="'oa_leave_bill_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary"
|
||||
v-auth="'oa_leave_bill_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" formDialogRef
|
||||
icon="Delete"
|
||||
type="primary" v-auth="'oa_leave_bill_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar @queryTable="getDataList" class="ml10" style="float: right;margin-right: 20px"
|
||||
v-model:showSearch="showSearch"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" @sort-change="sortChangeHandle"
|
||||
style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('leave.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('leave.leaveId')" prop="leaveId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('leave.username')" prop="username" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('leave.days')" prop="days" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('leave.state')" prop="state" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="leave_status" :value="scope.row.state"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('leave.leaveTime')" prop="leaveTime" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleSubmit(scope.row)" text type="primary" v-if="scope.row.state === '0'">
|
||||
提交
|
||||
</el-button>
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.leaveId)" text type="primary"
|
||||
v-auth="'oa_leave_bill_edit'">{{
|
||||
$t('common.editBtn')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.leaveId])" text type="primary"
|
||||
v-auth="'oa_leave_bill_del'">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</el-card>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row class="mb8" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('leave.username')" prop="username">
|
||||
<el-input :placeholder="t('leave.inputUsernameTip')" style="max-width: 180px" v-model="state.queryForm.username" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('leave.state')" class="ml2" prop="state">
|
||||
<el-select :placeholder="t('leave.inputStateTip')" v-model="state.queryForm.state">
|
||||
<el-option :key="index" :label="item.label" :value="item.value" v-for="(item, index) in leave_status"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" formDialogRef icon="search" type="primary" v-auth="'oa_leave_bill_view'">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" formDialogRef icon="Refresh">{{ $t('common.resetBtn') }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" formDialogRef icon="folder-add" type="primary" v-auth="'oa_leave_bill_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="exportExcel" class="ml10" formDialogRef icon="Download" type="primary" v-auth="'oa_leave_bill_export'">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
@click="handleDelete(selectObjs)"
|
||||
class="ml10"
|
||||
formDialogRef
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'oa_leave_bill_del'"
|
||||
>
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChangeHandle"
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="60" />
|
||||
<el-table-column :label="t('leave.index')" type="index" width="80" />
|
||||
<el-table-column :label="t('leave.leaveId')" prop="leaveId" show-overflow-tooltip />
|
||||
<el-table-column :label="t('leave.username')" prop="username" show-overflow-tooltip />
|
||||
<el-table-column :label="t('leave.days')" prop="days" show-overflow-tooltip />
|
||||
<el-table-column :label="t('leave.state')" prop="state" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="leave_status" :value="scope.row.state"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('leave.leaveTime')" prop="leaveTime" show-overflow-tooltip />
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleSubmit(scope.row)" text type="primary" v-if="scope.row.state === '0'"> 提交 </el-button>
|
||||
<el-button @click="formDialogRef.openDialog(scope.row.leaveId)" text type="primary" v-auth="'oa_leave_bill_edit'"
|
||||
>{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.leaveId])" text type="primary" v-auth="'oa_leave_bill_del'"
|
||||
>{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</el-card>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList(false)" ref="formDialogRef"/>
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog @refresh="getDataList(false)" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemOaLeaveBill" setup>
|
||||
import {BasicTableProps, useTable} from "/@/hooks/table";
|
||||
import {delObj, fetchList, submit} from "/@/api/oa/leave-bill";
|
||||
import {useMessage, useMessageBox} from "/@/hooks/message";
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from "vue-i18n";
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList, submit } from '/@/api/oa/leave-bill';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n()
|
||||
// 定义查询字典
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
// 定义查询字典
|
||||
|
||||
const {leave_status} = useDict('leave_status')
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
const { leave_status } = useDict('leave_status');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile
|
||||
} = useTable(state)
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile } = useTable(state);
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields();
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/act/leave-bill/export', state.queryForm, 'leave.xlsx')
|
||||
}
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/act/leave-bill/export', state.queryForm, 'leave.xlsx');
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = []
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.leaveId)
|
||||
});
|
||||
console.log(selectObjs)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.leaveId);
|
||||
});
|
||||
console.log(selectObjs);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox().confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids).then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = (row) => {
|
||||
useMessageBox().confirm(t('common.optConfirmText'))
|
||||
.then(() => {
|
||||
submit(row.leaveId).then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
}
|
||||
const handleSubmit = (row) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.optConfirmText'))
|
||||
.then(() => {
|
||||
submit(row.leaveId)
|
||||
.then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,146 +1,131 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto" shadow="hover">
|
||||
<el-row class="mb8" shadow="hover" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('model.category')" prop="category">
|
||||
<el-input :placeholder="$t('model.inputCategoryTip')" style="max-width: 180px"
|
||||
v-model="state.queryForm.category"/>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary"
|
||||
v-auth="'oa_model_view'">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary"
|
||||
v-auth="'oa_model_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete"
|
||||
type="primary" v-auth="'oa_model_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar @queryTable="getDataList" class="ml10" style="float: right;margin-right: 20px"
|
||||
v-model:showSearch="showSearch"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||
v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="50"/>
|
||||
<el-table-column :label="$t('model.index')" type="index" width="80"/>
|
||||
<el-table-column :label="$t('model.name')" prop="name" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.key')" prop="key" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.category')" prop="category" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.version')" prop="version" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.createTime')" prop="createTime"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.lastUpdateTime')" prop="lastUpdateTime"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="200">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleView(scope.row.id)" text type="primary" v-auth="'oa_model_view'">模型图
|
||||
</el-button>
|
||||
<el-button @click="handleDeploy(scope.row.id)" text type="primary" v-auth="'oa_model_add'">
|
||||
部署
|
||||
</el-button>
|
||||
<el-button @click="handleDelete([scope.row.roleId])" text type="primary"
|
||||
v-auth="'oa_model_del'">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||
v-bind="state.pagination"/>
|
||||
</el-card>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto" shadow="hover">
|
||||
<el-row class="mb8" shadow="hover" v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('model.category')" prop="category">
|
||||
<el-input :placeholder="$t('model.inputCategoryTip')" style="max-width: 180px" v-model="state.queryForm.category" />
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button @click="getDataList" icon="search" type="primary" v-auth="'oa_model_view'">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button @click="formDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary" v-auth="'oa_model_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'oa_model_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right; margin-right: 20px"
|
||||
v-model:showSearch="showSearch"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
|
||||
<el-table-column align="center" type="selection" width="50" />
|
||||
<el-table-column :label="$t('model.index')" type="index" width="80" />
|
||||
<el-table-column :label="$t('model.name')" prop="name" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.key')" prop="key" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.category')" prop="category" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.version')" prop="version" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.createTime')" prop="createTime" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('model.lastUpdateTime')" prop="lastUpdateTime" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="200">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleView(scope.row.id)" text type="primary" v-auth="'oa_model_view'">模型图 </el-button>
|
||||
<el-button @click="handleDeploy(scope.row.id)" text type="primary" v-auth="'oa_model_add'"> 部署 </el-button>
|
||||
<el-button @click="handleDelete([scope.row.roleId])" text type="primary" v-auth="'oa_model_del'">{{ $t('common.delBtn') }} </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
|
||||
</el-card>
|
||||
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef"/>
|
||||
</div>
|
||||
<form-dialog @refresh="getDataList()" ref="formDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="model" setup>
|
||||
import {BasicTableProps, useTable} from "/@/hooks/table";
|
||||
import {delObj, deploy, fetchList} from "/@/api/oa/model";
|
||||
import {useMessage, useMessageBox} from "/@/hooks/message";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, deploy, fetchList } from '/@/api/oa/model';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n()
|
||||
const router = useRouter()
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any;
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any
|
||||
// 是否可以多选
|
||||
const multiple = ref(true);
|
||||
|
||||
// 是否可以多选
|
||||
const multiple = ref(true)
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
category: '',
|
||||
},
|
||||
pageList: fetchList, // H
|
||||
});
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
category: ''
|
||||
},
|
||||
pageList: fetchList // H
|
||||
});
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle } = useTable(state);
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
} = useTable(state)
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields();
|
||||
getDataList();
|
||||
};
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
queryRef.value.resetFields()
|
||||
getDataList()
|
||||
}
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = [];
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id);
|
||||
});
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
selectObjs.value = []
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id)
|
||||
});
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox()
|
||||
.confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids)
|
||||
.then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
})
|
||||
.catch((err: any) => {
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox().confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObj(ids).then(() => {
|
||||
getDataList();
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
const handleDeploy = (id: string) => {
|
||||
deploy(id).then(() => {
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const handleView = (id: string) => {
|
||||
router.push({
|
||||
path: "/oa/model/detail",
|
||||
query: {id: id},
|
||||
});
|
||||
}
|
||||
const handleDeploy = (id: string) => {
|
||||
deploy(id).then(() => {
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
});
|
||||
};
|
||||
|
||||
const handleView = (id: string) => {
|
||||
router.push({
|
||||
path: '/oa/model/detail',
|
||||
query: { id: id },
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -1,136 +1,139 @@
|
||||
<template>
|
||||
<el-dialog :title="form.taskId ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.username')" prop="username">
|
||||
<el-input v-model="form.username" :placeholder="t('leave.inputUsernameTip')" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-dialog :title="form.taskId ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('leave.username')" prop="username">
|
||||
<el-input v-model="form.username" :placeholder="t('leave.inputUsernameTip')" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.days')" prop="days">
|
||||
<el-input-number :min="1" :max="1000" v-model="form.days" :placeholder="t('leave.inputDaysTip')"
|
||||
disabled></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.days')" prop="days">
|
||||
<el-input-number :min="1" :max="1000" v-model="form.days" :placeholder="t('leave.inputDaysTip')" disabled></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.leaveTime')" prop="leaveTime">
|
||||
<el-date-picker type="datetime" :placeholder="t('leave.inputLeaveTimeTip')" v-model="form.leaveTime"
|
||||
:value-format="dateTimeStr" disabled></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="t('leave.leaveTime')" prop="leaveTime">
|
||||
<el-date-picker
|
||||
type="datetime"
|
||||
:placeholder="t('leave.inputLeaveTimeTip')"
|
||||
v-model="form.leaveTime"
|
||||
:value-format="dateTimeStr"
|
||||
disabled
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('task.content')" prop="content">
|
||||
<div v-html="form.content"></div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('task.content')" prop="content">
|
||||
<div v-html="form.content"></div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('task.comment')" prop="comment">
|
||||
<editor v-model:get-html="form.comment" :placeholder="t('task.inputCommentTip')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" v-for="flag in form.flagList" :key="flag"
|
||||
@click="handleTask(flag)">{{ flag }}
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('task.comment')" prop="comment">
|
||||
<editor v-model:get-html="form.comment" :placeholder="t('task.inputCommentTip')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" v-for="flag in form.flagList" :key="flag" @click="handleTask(flag)">{{ flag }} </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="OaLeaveBillDialog">
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { doTask, fetchDetail } from '/@/api/oa/task'
|
||||
import { useI18n } from "vue-i18n"
|
||||
import { useUserInfo } from "/@/stores/userInfo";
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { doTask, fetchDetail } from '/@/api/oa/task';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
taskId: '',
|
||||
taskName: '',
|
||||
username: '',
|
||||
comment: '',
|
||||
days: 0,
|
||||
content: '',
|
||||
createTime: '',
|
||||
time: '',
|
||||
flagList: [],
|
||||
taskFlag: '',
|
||||
taskId: '',
|
||||
taskName: '',
|
||||
username: '',
|
||||
comment: '',
|
||||
days: 0,
|
||||
content: '',
|
||||
createTime: '',
|
||||
time: '',
|
||||
flagList: [],
|
||||
taskFlag: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
comment: [{ required: true, message: '批注不能为空', trigger: 'blur' }]
|
||||
})
|
||||
comment: [{ required: true, message: '批注不能为空', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.taskId = ''
|
||||
visible.value = true;
|
||||
form.taskId = '';
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields()
|
||||
}
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields();
|
||||
}
|
||||
|
||||
// 获取oaLeaveBill信息
|
||||
if (id) {
|
||||
form.taskId = id
|
||||
getTaskById(id)
|
||||
} else {
|
||||
form.username = useUserInfo().userInfos.user.username
|
||||
}
|
||||
// 获取oaLeaveBill信息
|
||||
if (id) {
|
||||
form.taskId = id;
|
||||
getTaskById(id);
|
||||
} else {
|
||||
form.username = useUserInfo().userInfos.user.username;
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const handleTask = (result) => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
loading.value = true
|
||||
form.taskFlag = result
|
||||
doTask(form).then(() => {
|
||||
useMessage().success(t('common.optSuccessText'))
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
})
|
||||
})
|
||||
}
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
form.taskFlag = result;
|
||||
doTask(form).then(() => {
|
||||
useMessage().success(t('common.optSuccessText'));
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getTaskById = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
fetchDetail(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
form.comment = res.data.comment ? res.data.comment : ''
|
||||
}).catch((err) => {
|
||||
useMessage().error('操作失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
// 获取数据
|
||||
loading.value = true;
|
||||
fetchDetail(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data);
|
||||
form.comment = res.data.comment ? res.data.comment : '';
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error('操作失败');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
openDialog,
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
@ -1,19 +1,19 @@
|
||||
export default {
|
||||
task: {
|
||||
index: 'index',
|
||||
taskId: 'taskId',
|
||||
taskName: 'taskName',
|
||||
time: 'time',
|
||||
comment: 'comment',
|
||||
content: 'content',
|
||||
cancel:'cancel ',
|
||||
inputTaskNameTip: 'input Task Name',
|
||||
inputCommentTip: 'input comment'
|
||||
},
|
||||
comment: {
|
||||
index: 'index',
|
||||
userId: 'userId',
|
||||
fullMessage: 'fullMessage',
|
||||
time: 'time'
|
||||
}
|
||||
}
|
||||
task: {
|
||||
index: 'index',
|
||||
taskId: 'taskId',
|
||||
taskName: 'taskName',
|
||||
time: 'time',
|
||||
comment: 'comment',
|
||||
content: 'content',
|
||||
cancel: 'cancel ',
|
||||
inputTaskNameTip: 'input Task Name',
|
||||
inputCommentTip: 'input comment',
|
||||
},
|
||||
comment: {
|
||||
index: 'index',
|
||||
userId: 'userId',
|
||||
fullMessage: 'fullMessage',
|
||||
time: 'time',
|
||||
},
|
||||
};
|
||||
|
@ -1,20 +1,19 @@
|
||||
export default {
|
||||
task: {
|
||||
index: '序号',
|
||||
taskId: 'ID',
|
||||
taskName: '任务名称',
|
||||
time: '提交时间',
|
||||
comment: '批注',
|
||||
content: '事由',
|
||||
cancel: '作废',
|
||||
inputTaskNameTip: '请输入任务名称',
|
||||
inputCommentTip: '请输入批注名称',
|
||||
|
||||
},
|
||||
comment: {
|
||||
index: '序号',
|
||||
userId: '用户',
|
||||
fullMessage: '批注',
|
||||
time: '时间'
|
||||
}
|
||||
}
|
||||
task: {
|
||||
index: '序号',
|
||||
taskId: 'ID',
|
||||
taskName: '任务名称',
|
||||
time: '提交时间',
|
||||
comment: '批注',
|
||||
content: '事由',
|
||||
cancel: '作废',
|
||||
inputTaskNameTip: '请输入任务名称',
|
||||
inputCommentTip: '请输入批注名称',
|
||||
},
|
||||
comment: {
|
||||
index: '序号',
|
||||
userId: '用户',
|
||||
fullMessage: '批注',
|
||||
time: '时间',
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user