This commit is contained in:
孟帅
2023-11-25 18:36:11 +08:00
parent 40117c700d
commit 70e9f966c3
142 changed files with 5407 additions and 2058 deletions

View File

@@ -37,194 +37,261 @@
<n-input v-model:value="formValue.uploadFileType" placeholder="" />
</n-form-item>
<n-divider title-placement="left">本地存储</n-divider>
<n-form-item label="本地存储路径" path="uploadLocalPath">
<n-input v-model:value="formValue.uploadLocalPath" placeholder="" />
<template #feedback>填对外访问的相对路径</template>
</n-form-item>
<template v-if="formValue.uploadDrive == 'local'">
<n-divider title-placement="left">本地存储</n-divider>
<n-form-item label="本地存储路径" path="uploadLocalPath">
<n-input v-model:value="formValue.uploadLocalPath" placeholder="" />
<template #feedback>填对外访问的相对路径</template>
</n-form-item>
</template>
<n-divider title-placement="left">ucloud对象存储</n-divider>
<n-form-item label="公钥" path="uploadUCloudPublicKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPublicKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>获取地址https://console.ucloud.cn/ufile/token</template>
</n-form-item>
<template v-if="formValue.uploadDrive == 'ucloud'">
<n-divider title-placement="left">ucloud对象存储</n-divider>
<n-form-item label="公钥" path="uploadUCloudPublicKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPublicKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>获取地址https://console.ucloud.cn/ufile/token</template>
</n-form-item>
<n-form-item label="私钥" path="uploadUCloudPrivateKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPrivateKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadUCloudPath">
<n-input v-model:value="formValue.uploadUCloudPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadUCloudBucketHost">
<n-input v-model:value="formValue.uploadUCloudBucketHost" placeholder="" />
</n-form-item>
<n-form-item label="存储桶名称" path="uploadUCloudBucketName">
<n-input v-model:value="formValue.uploadUCloudBucketName" placeholder="" />
<template #feedback>存储空间名称</template>
</n-form-item>
<n-form-item label="存储桶地域host" path="uploadUCloudFileHost">
<n-input v-model:value="formValue.uploadUCloudFileHost" placeholder="" />
<template #feedback>不需要包含桶名称</template>
</n-form-item>
<n-form-item label="访问域名" path="uploadUCloudEndpoint">
<n-input v-model:value="formValue.uploadUCloudEndpoint" placeholder="" />
<template #feedback>格式http://abc.com 或 https://abc.com不可为空</template>
</n-form-item>
<n-form-item label="私钥" path="uploadUCloudPrivateKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPrivateKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadUCloudPath">
<n-input v-model:value="formValue.uploadUCloudPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadUCloudBucketHost">
<n-input v-model:value="formValue.uploadUCloudBucketHost" placeholder="" />
</n-form-item>
<n-form-item label="存储桶名称" path="uploadUCloudBucketName">
<n-input v-model:value="formValue.uploadUCloudBucketName" placeholder="" />
<template #feedback>存储空间名称</template>
</n-form-item>
<n-form-item label="存储桶地域host" path="uploadUCloudFileHost">
<n-input v-model:value="formValue.uploadUCloudFileHost" placeholder="" />
<template #feedback>不需要包含桶名称</template>
</n-form-item>
<n-form-item label="访问域名" path="uploadUCloudEndpoint">
<n-input v-model:value="formValue.uploadUCloudEndpoint" placeholder="" />
<template #feedback>格式http://abc.com 或 https://abc.com不可为空</template>
</n-form-item>
</template>
<n-divider title-placement="left">腾讯云COS存储</n-divider>
<n-form-item label="secretId" path="uploadCosSecretId">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretId"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
<template v-if="formValue.uploadDrive == 'cos'">
<n-divider title-placement="left">腾讯云COS存储</n-divider>
<n-form-item label="secretId" path="uploadCosSecretId">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretId"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback
>子账号密钥获取地址https://cloud.tencent.com/document/product/598/37140
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback
>子账号密钥获取地址https://cloud.tencent.com/document/product/598/37140</template
>
</n-form-item>
</n-form-item>
<n-form-item label="secretKey" path="uploadCosSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
<n-form-item label="secretKey" path="uploadCosSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadCosBucketURL">
<n-input v-model:value="formValue.uploadCosBucketURL" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadCosPath">
<n-input v-model:value="formValue.uploadCosPath" placeholder="" />
<template #feedback
>控制台查看地址https://console.cloud.tencent.com/cos5/bucket
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadCosBucketURL">
<n-input v-model:value="formValue.uploadCosBucketURL" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadCosPath">
<n-input v-model:value="formValue.uploadCosPath" placeholder="" />
<template #feedback
>控制台查看地址https://console.cloud.tencent.com/cos5/bucket</template
>
</n-form-item>
</n-form-item>
</template>
<n-divider title-placement="left">阿里云OSS存储</n-divider>
<n-form-item label="AccessKey ID" path="uploadOssSecretId">
<n-input
type="password"
v-model:value="formValue.uploadOssSecretId"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>创建地址https://ram.console.aliyun.com/manage/ak</template>
</n-form-item>
<template v-if="formValue.uploadDrive == 'oss'">
<n-divider title-placement="left">阿里云OSS存储</n-divider>
<n-form-item label="AccessKey ID" path="uploadOssSecretId">
<n-input
type="password"
v-model:value="formValue.uploadOssSecretId"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>创建地址https://ram.console.aliyun.com/manage/ak</template>
</n-form-item>
<n-form-item label="AccessKey Secret" path="uploadOssSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadOssSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="Endpoint" path="uploadOssEndpoint">
<n-input v-model:value="formValue.uploadOssEndpoint" placeholder="" />
<template #feedback> Endpoint地域节点</template>
</n-form-item>
<n-form-item label="存储路径" path="uploadOssPath">
<n-input v-model:value="formValue.uploadOssPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="存储空间名称" path="uploadOssBucket">
<n-input v-model:value="formValue.uploadOssBucket" placeholder="" />
</n-form-item>
<n-form-item label="Bucket 域名" path="uploadOssBucketURL">
<n-input v-model:value="formValue.uploadOssBucketURL" placeholder="" />
</n-form-item>
<n-form-item label="AccessKey Secret" path="uploadOssSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadOssSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="Endpoint" path="uploadOssEndpoint">
<n-input v-model:value="formValue.uploadOssEndpoint" placeholder="" />
<template #feedback> Endpoint地域节点</template>
</n-form-item>
<n-form-item label="存储路径" path="uploadOssPath">
<n-input v-model:value="formValue.uploadOssPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="存储空间名称" path="uploadOssBucket">
<n-input v-model:value="formValue.uploadOssBucket" placeholder="" />
</n-form-item>
<n-form-item label="Bucket 域名" path="uploadOssBucketURL">
<n-input v-model:value="formValue.uploadOssBucketURL" placeholder="" />
</n-form-item>
</template>
<n-divider title-placement="left">七牛云对象存储</n-divider>
<n-form-item label="AccessKey" path="uploadQiNiuAccessKey">
<n-input
type="password"
v-model:value="formValue.uploadQiNiuAccessKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>创建地址https://portal.qiniu.com/user/key</template>
</n-form-item>
<template v-if="formValue.uploadDrive == 'qiniu'">
<n-divider title-placement="left">七牛云对象存储</n-divider>
<n-form-item label="AccessKey" path="uploadQiNiuAccessKey">
<n-input
type="password"
v-model:value="formValue.uploadQiNiuAccessKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>创建地址https://portal.qiniu.com/user/key</template>
</n-form-item>
<n-form-item label="SecretKey" path="uploadQiNiuSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadQiNiuSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="储存路径" path="uploadQiNiuPath">
<n-input v-model:value="formValue.uploadQiNiuPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="存储空间名称" path="uploadQiNiuBucket">
<n-input v-model:value="formValue.uploadQiNiuBucket" placeholder="" />
</n-form-item>
<n-form-item label="访问域名" path="uploadQiNiuDomain">
<n-input v-model:value="formValue.uploadQiNiuDomain" placeholder="" />
</n-form-item>
<n-form-item label="SecretKey" path="uploadQiNiuSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadQiNiuSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="储存路径" path="uploadQiNiuPath">
<n-input v-model:value="formValue.uploadQiNiuPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="存储空间名称" path="uploadQiNiuBucket">
<n-input v-model:value="formValue.uploadQiNiuBucket" placeholder="" />
</n-form-item>
<n-form-item label="访问域名" path="uploadQiNiuDomain">
<n-input v-model:value="formValue.uploadQiNiuDomain" placeholder="" />
</n-form-item>
</template>
<template v-if="formValue.uploadDrive == 'minio'">
<n-divider title-placement="left">minio配置</n-divider>
<n-form-item label="AccessKey ID" path="uploadMinioAccessKey">
<n-input
type="password"
v-model:value="formValue.uploadMinioAccessKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>相关文档https://min.io/</template>
</n-form-item>
<n-form-item label="AccessKey Secret" path="uploadMinioSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadMinioSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="Endpoint" path="uploadMinioEndpoint">
<n-input v-model:value="formValue.uploadMinioEndpoint" placeholder="" />
<template #feedback> Endpoint不带http://和路径)</template>
</n-form-item>
<n-form-item path="uploadMinioUseSSL">
<n-switch
v-model:value="formValue.uploadMinioUseSSL"
:checked-value="1"
:unchecked-value="2"
>
<template #checked> 启用SSL</template>
<template #unchecked> 禁用SSL</template>
</n-switch>
</n-form-item>
<n-form-item label="储存路径" path="uploadMinioPath">
<n-input v-model:value="formValue.uploadMinioPath" placeholder="" />
</n-form-item>
<n-form-item label="存储桶名称" path="uploadMinioBucket">
<n-input v-model:value="formValue.uploadMinioBucket" placeholder="" />
</n-form-item>
<n-form-item label="对外访问域名" path="uploadMinioDomain">
<n-input v-model:value="formValue.uploadMinioDomain" placeholder="" />
</n-form-item>
</template>
<div>
<n-space>
<n-button type="primary" @click="formSubmit">保存更新</n-button>
@@ -289,6 +356,13 @@
uploadQiNiuDomain: '',
uploadQiNiuPath: '',
uploadQiNiuBucket: '',
uploadMinioAccessKey: '',
uploadMinioSecretKey: '',
uploadMinioEndpoint: '',
uploadMinioUseSSL: 2,
uploadMinioPath: '',
uploadMinioBucket: '',
uploadMinioDomain: '',
});
function formSubmit() {

View File

@@ -13,21 +13,25 @@ export const columns = [
title: 'ID',
key: 'id',
},
{
title: '任务标题',
key: 'title',
},
{
title: '任务分组',
key: 'groupName',
},
{
title: '任务名称',
title: '执行方法',
key: 'name',
},
{
title: '执行参数',
key: 'params',
render(row) {
return row.params;
},
},
// {
// title: '执行参数',
// key: 'params',
// render(row) {
// return row.params;
// },
// },
{
title: '执行策略',
key: 'policy',

View File

@@ -76,9 +76,13 @@
/>
</n-form-item>
<n-form-item label="任务名称" path="name">
<n-input placeholder="请输入公告标题" v-model:value="formParams.name" />
<template #feedback> go函数名称</template>
<n-form-item label="任务标题" path="title">
<n-input placeholder="请输入任务标题" v-model:value="formParams.title" />
</n-form-item>
<n-form-item label="执行方法" path="name">
<n-input placeholder="请输入执行方法" v-model:value="formParams.name" />
<template #feedback>go方法名称</template>
</n-form-item>
<n-form-item label="执行参数" path="params">
@@ -104,8 +108,8 @@
<n-input placeholder="请输入执行次数" v-model:value="formParams.count" />
</n-form-item>
<n-form-item label="定时表达式" path="pattern">
<n-input placeholder="请输入表达式" v-model:value="formParams.pattern" />
<n-form-item label="表达式" path="pattern">
<n-input placeholder="请输入定时表达式" v-model:value="formParams.pattern" />
<template #feedback>
表达式语法参考:<a
target="_blank"
@@ -144,25 +148,53 @@
</n-modal>
</n-card>
<GroupModal ref="GroupModalRef" @reloadGroupOption="reloadGroupOption"/>
<GroupModal ref="GroupModalRef" @reloadGroupOption="reloadGroupOption" />
<n-modal
v-model:show="showStdout"
style="width: 72%"
:show-icon="false"
preset="dialog"
title="调度日志"
>
<n-form ref="formRef" label-placement="left" :label-width="80" class="py-4">
<n-form-item label="日志文件" path="fileName">
<n-input placeholder="" v-model:value="log.fileName" readonly />
</n-form-item>
<n-form-item label="文件大小" path="sizeFormat">
<n-input placeholder="" v-model:value="log.sizeFormat" readonly />
</n-form-item>
<n-form-item label="日志内容" path="log" class="n-code-container">
<n-code
class="n-code-contents"
id="n-code"
:word-wrap="true"
:code="log?.contents ?? ''"
language="html"
/>
</n-form-item>
</n-form>
</n-modal>
</div>
</template>
<script lang="ts" setup>
import { h, reactive, ref, onBeforeMount } from 'vue';
import { TreeSelectOption, useDialog, useMessage } from 'naive-ui';
import { useDialog, useMessage } from 'naive-ui';
import { BasicTable, TableAction } from '@/components/Table';
import { BasicForm, FormSchema, useForm } from '@/components/Form/index';
import { Delete, Edit, getSelect, List, Status, OnlineExec } from '@/api/sys/cron';
import { Delete, Edit, getSelect, List, Status, OnlineExec, DispatchLog } from '@/api/sys/cron';
import { columns } from './columns';
import { DeleteOutlined, GroupOutlined, PlusOutlined } from '@vicons/antd';
import { statusActions } from '@/enums/optionsiEnum';
import GroupModal from './modal/modal.vue';
const optionTreeData = ref<any>([]);
const defaultValueRef = () => ({
id: 0,
groupId: 0,
title: '',
name: '',
params: '',
pattern: '',
@@ -179,13 +211,7 @@
status: null,
});
const rules = {
name: {
// required: true,
trigger: ['blur', 'input'],
message: '请输入任务名称',
},
};
const rules = {};
const policyOptions = [
{
@@ -221,17 +247,34 @@
return s;
});
const groupOptions = ref<any>([]);
const statusActions = [
{
label: '设为运行中',
key: 1,
},
{
label: '设为已结束',
key: 2,
},
{
label: '删除任务',
key: 3,
},
];
const groupOptions = ref<any>([]);
const showStdout = ref(false);
const log = ref();
const schemas: FormSchema[] = [
{
field: 'groupId',
component: 'NSelect',
component: 'NTreeSelect',
label: '任务分组',
defaultValue: null,
componentProps: {
placeholder: '请选择分组',
options: groupOptions,
clearable: true,
onUpdateValue: (e: any) => {
console.log(e);
},
@@ -300,19 +343,28 @@
{
label: '在线执行',
onClick: handleExecute.bind(null, record),
type: 'success',
},
{
label: '调度日志',
onClick: handleDispatchLog.bind(null, record),
type: 'default',
},
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
label: '删除',
onClick: handleDelete.bind(null, record),
},
],
dropDownActions: statusActions,
select: (key) => {
updateStatus(record.id, key);
if (key < 3) {
updateStatus(record.id, key);
return;
}
if (key == 3) {
handleDelete(record);
return;
}
},
});
},
@@ -367,9 +419,21 @@
formParams.value = record;
}
function handleDispatchLog(record: Recordable) {
DispatchLog(record).then((res) => {
showStdout.value = true;
log.value = res;
setTimeout(() => {
const container = document.getElementById('n-code');
container.scrollTop = container.scrollHeight;
}, 100);
});
}
function handleExecute(record: Recordable) {
dialog.warning({
title: '警告',
dialog.info({
title: '提示',
content: '提交成功后将立即执行一次,你确定要执行吗?',
positiveText: '确定',
negativeText: '取消',
@@ -379,9 +443,6 @@
reloadTable();
});
},
onNegativeClick: () => {
// message.error('取消');
},
});
}
@@ -397,9 +458,6 @@
reloadTable();
});
},
onNegativeClick: () => {
// message.error('取消');
},
});
}
@@ -415,9 +473,6 @@
reloadTable();
});
},
onNegativeClick: () => {
// message.error('取消');
},
});
}
@@ -432,16 +487,12 @@
}
function updateStatus(id, status) {
Status({ id: id, status: status })
.then((_res) => {
message.success('操作成功');
setTimeout(() => {
reloadTable();
});
})
.catch((e: Error) => {
message.error(e.message ?? '操作失败');
Status({ id: id, status: status }).then((_res) => {
message.success('操作成功');
setTimeout(() => {
reloadTable();
});
});
}
const GroupModalRef = ref();
@@ -456,14 +507,18 @@
if (optionTreeData.value === undefined || optionTreeData.value === null) {
optionTreeData.value = [];
}
groupOptions.value = transformGroupData(optionTreeData.value);
}
groupOptions.value = [];
for (let i = 0; i < optionTreeData.value?.length; i++) {
groupOptions.value.push({
value: optionTreeData.value[i].key,
label: optionTreeData.value[i].label,
});
}
function transformGroupData(data: any[]) {
return data.map((item) => {
return {
key: item.key,
value: item.key,
label: item.label,
children: item.children !== null ? transformGroupData(item.children) : null,
};
});
}
onBeforeMount(async () => {
@@ -471,12 +526,23 @@
});
// 处理选项更新
function handleUpdateValue(
value: string | number | Array<string | number> | null,
_option: TreeSelectOption | null | Array<TreeSelectOption | null>
) {
function handleUpdateValue(value: string | number) {
formParams.value.groupId = value;
}
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.n-code-container {
height: 450px;
width: 100%;
}
.n-code-contents {
height: 450px;
width: 100%;
overflow: auto;
background: #2f3129;
color: wheat;
padding: 10px;
}
</style>

View File

@@ -8,34 +8,33 @@ export const columns = [
key: 'id',
width: 100,
},
{
title: '上级ID',
dataIndex: 'pid',
key: 'pid',
width: 100,
},
{
title: '分组名称',
dataIndex: 'name',
key: 'name',
width: 200,
width: 150,
},
{
title: '是否默认',
title: '上级分组',
dataIndex: 'supName',
key: 'supName',
width: 150,
render(row) {
if (row.supName == ''){
return '顶级分组';
}
return row.supName;
},
},
{
title: '默认',
dataIndex: 'isDefault',
key: 'isDefault',
render(row) {
return row.is_default === 1 ? '是' : '否';
return row.isDefault === 1 ? '是' : '否';
},
width: 100,
width: 80,
},
{
title: '排序',
dataIndex: 'sort',
key: 'sort',
width: 100,
},
{
title: '状态',
dataIndex: 'status',
@@ -57,6 +56,12 @@ export const columns = [
},
width: 150,
},
// {
// title: '排序',
// dataIndex: 'sort',
// key: 'sort',
// width: 100,
// },
{
title: '备注',
dataIndex: 'remark',

View File

@@ -40,16 +40,11 @@
:default-value="formParams.pid"
@update:value="handleUpdateValue"
/>
<template #feedback>不选视为顶级分组</template>
</n-form-item>
<n-form-item label="分组名称" path="name">
<n-input placeholder="请输入分组名称" v-model:value="formParams.name" />
</n-form-item>
<n-form-item label="排序" path="sort">
<n-input-number v-model:value="formParams.sort" clearable />
</n-form-item>
<n-form-item label="状态" path="status">
<n-radio-group v-model:value="formParams.status" name="status">
<n-radio-button
@@ -61,6 +56,10 @@
</n-radio-group>
</n-form-item>
<!-- <n-form-item label="排序" path="sort">-->
<!-- <n-input-number v-model:value="formParams.sort" clearable />-->
<!-- </n-form-item>-->
<n-form-item label="备注" path="remark">
<n-input type="textarea" placeholder="请输入备注" v-model:value="formParams.remark" />
</n-form-item>
@@ -87,7 +86,7 @@
import { statusOptions } from '@/enums/optionsiEnum';
const emit = defineEmits(['reloadGroupOption']);
const optionTreeData = ref([]);
const optionTreeData = ref<any>([]);
const message = useMessage();
const statusValue = ref(1);
const defaultValueRef = () => ({
@@ -140,7 +139,7 @@
const formRef = ref<any>({});
const actionColumn = reactive({
width: 220,
width: 150,
title: '操作',
key: 'action',
// fixed: 'right',
@@ -213,10 +212,16 @@
async function setDictSelect() {
const tmp = await getSelect({});
optionTreeData.value = tmp.list;
if (optionTreeData.value === undefined || optionTreeData.value === null) {
optionTreeData.value = [];
}
optionTreeData.value = [
{
id: 0,
key: 0,
label: '顶级分组',
pid: 0,
name: '顶级分组',
},
];
optionTreeData.value = optionTreeData.value.concat(tmp.list);
}
onMounted(async () => {

View File

@@ -18,7 +18,7 @@
const emit = defineEmits(['reloadGroupOption']);
const showModal = ref(false);
const title = ref('管理分组');
const title = ref('任务分组');
function openDrawer() {
showModal.value = true;