提交代码
parent
c67385b592
commit
9ceff45975
|
@ -438,9 +438,9 @@ class MenuAPI {
|
|||
},
|
||||
},
|
||||
{
|
||||
path: "otherToolEdit",
|
||||
component: "manage/otherTool/edit",
|
||||
name: "otherToolEdit",
|
||||
path: "otherToolAdd",
|
||||
component: "manage/otherTool/add",
|
||||
name: "otherToolAdd",
|
||||
meta: {
|
||||
title: "第三方工具编辑",
|
||||
hidden: true,
|
||||
|
@ -450,9 +450,9 @@ class MenuAPI {
|
|||
}
|
||||
},
|
||||
{
|
||||
path: "otherToolView",
|
||||
path: "otherToolDetail",
|
||||
component: "manage/otherTool/view",
|
||||
name: "otherToolView",
|
||||
name: "otherToolDetail",
|
||||
meta: {
|
||||
title: "查看第三方工具",
|
||||
hidden: true,
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子管理 -->
|
||||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<!-- 算子新增表单 -->
|
||||
<el-card v-loading="loading">
|
||||
<template #header
|
||||
><svg-icon icon-class="pause" style="width: 20px; height: 20px" /> 算子基本信息
|
||||
</template>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="80px">
|
||||
<el-form-item label="算子名称" prop="operator_name">
|
||||
<el-input v-model="formData.operator_name" placeholder="请输入算子名称" />
|
||||
</el-form-item>
|
||||
|
@ -89,10 +84,7 @@
|
|||
</el-col>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<div style="padding-left: 35px" v-if="fileStatus">
|
||||
<el-form
|
||||
label-width="100px"
|
||||
size="small"
|
||||
>
|
||||
<el-form label-width="100px" size="small">
|
||||
<el-divider content-position="left"
|
||||
><strong style="color: #409eff">算子文件预览</strong></el-divider
|
||||
>
|
||||
|
@ -121,7 +113,7 @@ const codeHtml = ref(""); // 文件信息
|
|||
|
||||
// 上传组件
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
// 用户表单数据
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
status: 1,
|
||||
});
|
||||
|
@ -143,9 +135,9 @@ const rules = reactive({
|
|||
});
|
||||
|
||||
// 主动验证
|
||||
function handleChangeRules(){
|
||||
formRef.value.validateField('oper_main_type');
|
||||
formRef.value.validateField('oper_sub_type');
|
||||
function handleChangeRules() {
|
||||
formRef.value.validateField("oper_main_type");
|
||||
formRef.value.validateField("oper_sub_type");
|
||||
}
|
||||
|
||||
/** 表单提交 */
|
||||
|
@ -155,13 +147,16 @@ const handleSubmit = useThrottleFn(() => {
|
|||
loading.value = true;
|
||||
formData.user_id = userStore.user?.id;
|
||||
formData.create_time = new Date();
|
||||
OperatorApi.add(formData).then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage.success("保存成功");
|
||||
OperatorApi.add(formData)
|
||||
.then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage.success("保存成功");
|
||||
closeBack();
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
closeBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
|
@ -196,7 +191,7 @@ function handleFileChange(file) {
|
|||
if (isJSON(res)) {
|
||||
let jsonStr = JSON.stringify(res);
|
||||
formData.parameters = jsonStr;
|
||||
formRef.value.validateField('parameters');
|
||||
formRef.value.validateField("parameters");
|
||||
let json = JSON.parse(jsonStr);
|
||||
codeHtml.value = highlightJSON(json);
|
||||
fileStatus.value = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子管理 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="never" class="table-container">
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子管理 -->
|
||||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<!-- 算子管理详情 -->
|
||||
<el-card>
|
||||
<template #header><svg-icon icon-class="pause" style="width:20px;height:20px;" />算子基本信息</template>
|
||||
<template #header
|
||||
><svg-icon
|
||||
icon-class="pause"
|
||||
style="width: 20px; height: 20px"
|
||||
/>算子基本信息</template
|
||||
>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="loading"
|
||||
label-width="100px"
|
||||
size="small"
|
||||
>
|
||||
<el-form-item label="算子名称">{{dataInfo.operator_name}}</el-form-item>
|
||||
<el-form ref="formRef" v-loading="loading" label-width="100px" size="small">
|
||||
<el-form-item label="算子名称">{{ dataInfo.operator_name }}</el-form-item>
|
||||
<el-form-item label="算子主类型">
|
||||
{{dataInfo.oper_main_type_name}}</el-form-item
|
||||
{{ dataInfo.oper_main_type_name }}</el-form-item
|
||||
>
|
||||
<el-form-item label="算子子类型">
|
||||
{{dataInfo.oper_sub_type_name}}</el-form-item
|
||||
{{ dataInfo.oper_sub_type_name }}</el-form-item
|
||||
>
|
||||
<el-form-item label="算子说明">
|
||||
<el-input
|
||||
|
@ -28,12 +28,8 @@
|
|||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人">
|
||||
{{dataInfo.user_name}}</el-form-item
|
||||
>
|
||||
<el-form-item label="创建时间">
|
||||
{{dataInfo.create_time}}</el-form-item
|
||||
>
|
||||
<el-form-item label="创建人"> {{ dataInfo.user_name }}</el-form-item>
|
||||
<el-form-item label="创建时间"> {{ dataInfo.create_time }}</el-form-item>
|
||||
<el-form-item label="算子参数">
|
||||
<el-input
|
||||
v-model="dataInfo.parametersJson"
|
||||
|
@ -58,15 +54,15 @@
|
|||
</el-row>
|
||||
</el-card>
|
||||
<el-card class="card-footer">
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import OperatorApi from '@/api/operator'
|
||||
import OperatorApi from "@/api/operator";
|
||||
|
||||
const route =useRoute()
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const loading = ref(false); // 加载状态
|
||||
// 算子表单数据
|
||||
|
@ -74,49 +70,52 @@ const dataInfo = ref({});
|
|||
|
||||
/** 返回默认页面 */
|
||||
function closeBack() {
|
||||
router.replace({ path: "/operatorLibrary/calculate" });
|
||||
router.replace({ path: "/operatorLibrary/calculate" });
|
||||
}
|
||||
|
||||
/** 初始化数据 */
|
||||
function initData(){
|
||||
let id=route.query.id;
|
||||
function initData() {
|
||||
let id = route.query.id;
|
||||
loading.value = true;
|
||||
OperatorApi.findOne(id).then(res =>{
|
||||
//JSON转换
|
||||
res.data.data.parametersJson = JSON.stringify(res.data.data.parameters);
|
||||
dataInfo.value = res.data.data;
|
||||
loading.value = false;
|
||||
});
|
||||
OperatorApi.findOne(id)
|
||||
.then((res) => {
|
||||
//JSON转换
|
||||
res.data.data.parametersJson = JSON.stringify(res.data.data.parameters);
|
||||
dataInfo.value = res.data.data;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initData();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
.model-detail{
|
||||
:deep(.el-card__header){
|
||||
padding:8px 4px;
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
<style scoped lang="scss">
|
||||
.model-detail {
|
||||
:deep(.el-card__header) {
|
||||
padding: 8px 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.sp-file{
|
||||
color:#29d;
|
||||
.sp-file {
|
||||
color: #29d;
|
||||
}
|
||||
.tb-base-info{
|
||||
line-height: 30px;
|
||||
.tb-base-info {
|
||||
line-height: 30px;
|
||||
}
|
||||
:deep(.svg-icon){
|
||||
margin-right:8px;
|
||||
:deep(.svg-icon) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.card-footer{
|
||||
.card-footer {
|
||||
position: fixed;
|
||||
width: calc(100% - 215px);
|
||||
bottom: 0px;
|
||||
:deep(.el-card__body){
|
||||
padding:10px;
|
||||
.el-pagination{
|
||||
:deep(.el-card__body) {
|
||||
padding: 10px;
|
||||
.el-pagination {
|
||||
justify-content: end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子程序管理 -->
|
||||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<!-- 新增/编辑表单 -->
|
||||
<el-card v-loading="loading">
|
||||
<template #header
|
||||
><svg-icon icon-class="pause" style="width: 20px; height: 20px" />
|
||||
|
@ -38,7 +38,7 @@
|
|||
:label="item.operator_name"
|
||||
:value="item.operator_id"
|
||||
>
|
||||
<span style="float: left">{{ item.operator_name }}</span>
|
||||
<span style="float: left">{{ item.operator_name }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
|
@ -98,7 +98,11 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="程序版本" prop="program_version">
|
||||
<el-input v-model="formData.program_version" type="number" placeholder="请输入程序版本" />
|
||||
<el-input
|
||||
v-model="formData.program_version"
|
||||
type="number"
|
||||
placeholder="请输入程序版本"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="程序文件" prop="program_file_name">
|
||||
<el-upload
|
||||
|
@ -158,7 +162,7 @@ const codeJson = ref(""); // 文件信息
|
|||
|
||||
// 上传组件
|
||||
const uploadRef = ref<UploadInstance>();
|
||||
// 用户表单数据
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
status: 1,
|
||||
});
|
||||
|
@ -187,13 +191,16 @@ const handleSubmit = useThrottleFn(() => {
|
|||
loading.value = true;
|
||||
formData.user_id = userStore.user?.id;
|
||||
formData.create_time = new Date();
|
||||
OperatorApi.addPrograms(formData).then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage.success("保存成功");
|
||||
OperatorApi.addPrograms(formData)
|
||||
.then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage.success("保存成功");
|
||||
closeBack();
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
closeBack();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
|
@ -235,7 +242,7 @@ const remoteMethod = (query: string) => {
|
|||
|
||||
/** 算子主类型改变 */
|
||||
function handleChange() {
|
||||
formRef.value.validateField('oper_main_type');
|
||||
formRef.value.validateField("oper_main_type");
|
||||
let param = {
|
||||
page_num: 1,
|
||||
page_size: 999,
|
||||
|
@ -248,7 +255,7 @@ function handleChange() {
|
|||
|
||||
/** 选择算子名称 */
|
||||
function handleChangeOperator() {
|
||||
formRef.value.validateField('operator_id');
|
||||
formRef.value.validateField("operator_id");
|
||||
OperatorApi.findOne(formData.operator_id).then((res) => {
|
||||
//JSON转换
|
||||
codeJson.value = JSON.stringify(res.data.data.parameters);
|
||||
|
@ -257,8 +264,8 @@ function handleChangeOperator() {
|
|||
}
|
||||
|
||||
/** 选择适配硬件 */
|
||||
function handleChangeCmpt(){
|
||||
formRef.value.validateField('cmpt_hardware_type');
|
||||
function handleChangeCmpt() {
|
||||
formRef.value.validateField("cmpt_hardware_type");
|
||||
}
|
||||
|
||||
// 初始化选项列表
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子程序管理 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="never" class="table-container">
|
||||
|
@ -57,7 +57,7 @@
|
|||
<el-button
|
||||
text type="primary" size="small"
|
||||
@click="handleDetail(scope.row.program_id)"
|
||||
><i-ep-view />查看参数</el-button
|
||||
><i-ep-view />查看</el-button
|
||||
>
|
||||
<el-button text type="primary" size="small" @click="handleDelete(scope.row.program_id)"
|
||||
><i-ep-delete />删除</el-button
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
<!-- 用户管理 -->
|
||||
<!-- 算子程序管理 -->
|
||||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<!-- 算子程序详情 -->
|
||||
<el-card>
|
||||
<template #header><svg-icon icon-class="pause" style="width:20px;height:20px;" /> 算子参数基本信息 </template>
|
||||
<template #header
|
||||
><svg-icon icon-class="pause" style="width: 20px; height: 20px" />
|
||||
算子参数基本信息
|
||||
</template>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<el-form
|
||||
ref="userFormRef"
|
||||
:model="formData"
|
||||
v-loading="loading"
|
||||
label-width="100px"
|
||||
size="small"
|
||||
>
|
||||
<el-form v-loading="loading" label-width="100px" size="small">
|
||||
<el-form-item label="参数名称" prop="username"> 目标分类模型 </el-form-item>
|
||||
<el-form-item label="算子类型" prop="nickname33">
|
||||
前处理/缩放算子</el-form-item
|
||||
|
@ -41,24 +38,19 @@
|
|||
</el-row>
|
||||
</el-card>
|
||||
<el-card class="card-footer">
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "User",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
import UserAPI from "@/api/user";
|
||||
import { UserForm } from "@/api/user/model";
|
||||
import OperatorApi from "@/api/operator";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
const calTypeList = ref<OptionType[]>(); // 角色下拉数据源
|
||||
// 算子表单数据
|
||||
const dataInfo = ref({});
|
||||
|
||||
// 用户表单数据
|
||||
const formData = reactive<UserForm>({
|
||||
|
@ -93,101 +85,54 @@ const formData = reactive<UserForm>({
|
|||
}`,
|
||||
});
|
||||
|
||||
// 校验规则
|
||||
const rules = reactive({
|
||||
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
|
||||
nickname: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
||||
deptId: [{ required: true, message: "所属部门不能为空", trigger: "blur" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "blur" }],
|
||||
email: [
|
||||
{
|
||||
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
|
||||
message: "请输入正确的邮箱地址",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
mobile: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const list = [
|
||||
{
|
||||
csmc: "10.0.8.12",
|
||||
csms: "异腾310",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
{
|
||||
csmc: "192.168.1.44",
|
||||
csms: "思源220",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
{
|
||||
csmc: "192.168.1.66",
|
||||
csms: "RTX4090",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
];
|
||||
|
||||
/** 表单提交 */
|
||||
const handleSubmit = useThrottleFn(() => {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
ElMessage.success("修改用户成功");
|
||||
loading.value = false;
|
||||
closeBack();
|
||||
}, 1000);
|
||||
}, 3000);
|
||||
|
||||
/** 返回默认页面 */
|
||||
function closeBack() {
|
||||
router.replace({ path: "/operatorLibrary/calculateParam" });
|
||||
}
|
||||
|
||||
/** 初始化数据 */
|
||||
function initData() {
|
||||
let id = route.query.id;
|
||||
loading.value = true;
|
||||
OperatorApi.findOne(id)
|
||||
.then((res) => {
|
||||
//JSON转换
|
||||
res.data.data.parametersJson = JSON.stringify(res.data.data.parameters);
|
||||
dataInfo.value = res.data.data;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//handleQuery();
|
||||
initData();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
.model-detail{
|
||||
:deep(.el-card__header){
|
||||
padding:8px 4px;
|
||||
display: flex;
|
||||
align-items: center
|
||||
}
|
||||
<style scoped lang="scss">
|
||||
.model-detail {
|
||||
:deep(.el-card__header) {
|
||||
padding: 8px 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.sp-file{
|
||||
color:#29d;
|
||||
.sp-file {
|
||||
color: #29d;
|
||||
}
|
||||
.tb-base-info{
|
||||
line-height: 30px;
|
||||
.tb-base-info {
|
||||
line-height: 30px;
|
||||
}
|
||||
:deep(.svg-icon){
|
||||
margin-right:8px;
|
||||
:deep(.svg-icon) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.card-footer{
|
||||
.card-footer {
|
||||
position: fixed;
|
||||
width: calc(100% - 215px);
|
||||
bottom: 0px;
|
||||
:deep(.el-card__body){
|
||||
padding:10px;
|
||||
.el-pagination{
|
||||
:deep(.el-card__body) {
|
||||
padding: 10px;
|
||||
.el-pagination {
|
||||
justify-content: end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,26 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import OperatorApi from '@/api/operator'
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false); // 加载状态
|
||||
const total = ref(0); // 数据总数
|
||||
const pageData = ref([]); // 分页数据
|
||||
const removeIds = ref([]); // 删除ID集合 用于批量删除
|
||||
const queryFormRef = ref(ElForm); // 查询表单
|
||||
const queryParams = reactive({
|
||||
page_num: 1,
|
||||
page_size: 10,
|
||||
operation_id: null,
|
||||
oper_main_type: null,
|
||||
oper_sub_type: null,
|
||||
cmpt_hardware_type: null,
|
||||
operator_name: null,
|
||||
});
|
||||
|
||||
|
||||
defineOptions({
|
||||
name: "calculateIndex",
|
||||
inheritAttrs: false,
|
||||
|
|
|
@ -1,168 +0,0 @@
|
|||
<!-- 用户管理 -->
|
||||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<el-card v-loading="loading">
|
||||
<template #header
|
||||
><svg-icon
|
||||
icon-class="pause"
|
||||
style="width: 20px; height: 20px"
|
||||
/>工具链基本信息</template
|
||||
>
|
||||
<el-row>
|
||||
<el-col :lg="24" :xs="24">
|
||||
<el-form ref="userFormRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-table :data="list" style="width: 100%" stripe>
|
||||
<el-table-column label="选择" width="60" align="center">
|
||||
<template #default="scope">
|
||||
<el-radio v-model="radioSelected" :label="scope.row.csmc" @change.native="getCurrentRow(scope.row.csmc)">{{ '' }}</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="csmc" label="IP地址" align="left" />
|
||||
<el-table-column prop="csmc" label="类型" align="left" />
|
||||
<el-table-column prop="csmc1" label="ID编号" align="left" />
|
||||
<el-table-column prop="csmc2" label="厂商名称" align="left" />
|
||||
<el-table-column prop="csmc3" label="服务程序版本" align="left" />
|
||||
<el-table-column prop="csmc4" label="连接状态" align="left" />
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="24"> </el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card v-loading="loading" style="margin-top: 12px">
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<el-form ref="userFormRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="工具链名称" prop="username">
|
||||
<el-input
|
||||
v-model="formData.username"
|
||||
:readonly="!!formData.id"
|
||||
placeholder="请输入工具链名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具链标签" prop="nickname">
|
||||
<el-input v-model="formData.nickname" placeholder="请输入工具链标签" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="24"> </el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card class="card-footer">
|
||||
<el-button type="primary" @click="handleSubmit"><i-ep-check />确 定</el-button>
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "User",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
import UserAPI from "@/api/user";
|
||||
import { UserForm } from "@/api/user/model";
|
||||
|
||||
const router = useRouter();
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
const calTypeList = ref<OptionType[]>(); // 角色下拉数据源
|
||||
|
||||
// 用户表单数据
|
||||
const formData = reactive<UserForm>({
|
||||
status: 1,
|
||||
});
|
||||
|
||||
const radioSelected = ref('');
|
||||
|
||||
// 校验规则
|
||||
const rules = reactive({
|
||||
username: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
nickname: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
deptId: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
roleIds: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||
email: [
|
||||
{
|
||||
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
|
||||
message: "请输入正确的邮箱地址",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
mobile: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const list = [
|
||||
{
|
||||
csmc: "10.0.8.12",
|
||||
csms: "DOCKER-TOOL",
|
||||
csmc1: "acd0032a-6833-4348-b0fc-04798f94354c",
|
||||
csmc2: "华为",
|
||||
csmc3: "1.2",
|
||||
csmc4: "已连接",
|
||||
},
|
||||
{
|
||||
csmc: "192.10.71.44",
|
||||
csms: "ETL",
|
||||
csmc1: "ac1232a-6233-4348-b0fc-04798f94551",
|
||||
csmc2: "华为",
|
||||
csmc3: "1.2",
|
||||
csmc4: "已连接",
|
||||
},
|
||||
];
|
||||
|
||||
/** 表单提交 */
|
||||
const handleSubmit = useThrottleFn(() => {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
ElMessage.success("保存成功");
|
||||
loading.value = false;
|
||||
closeBack();
|
||||
}, 1000);
|
||||
}, 3000);
|
||||
|
||||
/** 返回默认页面 */
|
||||
function closeBack() {
|
||||
router.replace({ path: "/tester/otherTool" });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//handleQuery();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.model-detail {
|
||||
:deep(.el-card__header) {
|
||||
padding: 8px 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.sp-file {
|
||||
color: #29d;
|
||||
}
|
||||
.tb-base-info {
|
||||
line-height: 30px;
|
||||
}
|
||||
:deep(.svg-icon) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.card-footer {
|
||||
position: fixed;
|
||||
width: calc(100% - 215px);
|
||||
bottom: 0px;
|
||||
:deep(.el-card__body) {
|
||||
padding: 10px;
|
||||
.el-pagination {
|
||||
justify-content: end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -5,20 +5,25 @@
|
|||
<template #header>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<el-button type="primary" @click="openDialog('user-form')"
|
||||
><i-ep-plus />工具链</el-button
|
||||
>
|
||||
<el-button type="primary" @click="handleAdd()"><i-ep-plus />工具链</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="工具链名称" prop="keywords">
|
||||
<el-input
|
||||
v-model="queryParams.keywords"
|
||||
placeholder="请输入工具链名称"
|
||||
<el-select
|
||||
v-model="queryParams.tool_type"
|
||||
placeholder="请选择工具类型"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in listOpt.typeList"
|
||||
:key="item.type"
|
||||
:label="item.name"
|
||||
:value="item.type"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery"
|
||||
|
@ -35,30 +40,19 @@
|
|||
</template>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:data="pageData"
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column label="工具链名称" align="left" prop="szmc" width="250" />
|
||||
<el-table-column label="标签" align="left" prop="szlx" />
|
||||
<el-table-column label="连接状态" align="left" prop="szzlx" />
|
||||
<el-table-column label="工作状态" width="180" align="left" prop="bb" />
|
||||
<el-table-column label="创建时间" width="180" align="left" prop="hlcjsj" />
|
||||
<el-table-column label="工具链名称" align="left" prop="tool_name" width="250" />
|
||||
<el-table-column label="工具类型" align="left" prop="tool_type_name" />
|
||||
<el-table-column label="匹配硬件" align="left" prop="cmpt_hardware_type" />
|
||||
<el-table-column label="工作状态" align="left" prop="working_state_name" />
|
||||
<el-table-column label="连接状态" align="left" prop="connection_state" />
|
||||
<el-table-column label="操作" fixed="right" width="280">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="openDialogView('user-form', scope.row.id)"
|
||||
><i-ep-view />查看</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="openDialog('user-form', scope.row.id)"
|
||||
><i-ep-edit />修改</el-button
|
||||
<el-button text type="primary" size="small" @click="handleDetail(scope.row)"
|
||||
><i-ep-edit />查看</el-button
|
||||
>
|
||||
<el-button text type="primary" size="small" @click="handleDelete(scope.row)"
|
||||
><i-ep-delete />删除</el-button
|
||||
|
@ -70,8 +64,8 @@
|
|||
<pagination
|
||||
v-if="total > 0"
|
||||
v-model:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.page_num"
|
||||
v-model:limit="queryParams.page_size"
|
||||
@pagination="handleQuery"
|
||||
/>
|
||||
</el-card>
|
||||
|
@ -79,73 +73,61 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "calculateIndex",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
import ToolChainshApi from "@/api/tool";
|
||||
|
||||
import { UserQuery } from "@/api/user/model";
|
||||
|
||||
const queryFormRef = ref(ElForm); // 查询表单
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false); // 加载状态
|
||||
const removeIds = ref([]); // 删除用户ID集合 用于批量删除
|
||||
const queryParams = reactive<UserQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const dateTimeRange = ref("");
|
||||
const total = ref(0); // 数据总数
|
||||
|
||||
watch(dateTimeRange, (newVal) => {
|
||||
if (newVal) {
|
||||
queryParams.startTime = newVal[0];
|
||||
queryParams.endTime = newVal[1];
|
||||
}
|
||||
const pageData = ref([]); // 分页数据
|
||||
const removeIds = ref([]); // 删除ID集合 用于批量删除
|
||||
const queryFormRef = ref(ElForm); // 查询表单
|
||||
const queryParams = reactive({
|
||||
page_num: 1,
|
||||
page_size: 10,
|
||||
tool_type: null,
|
||||
});
|
||||
|
||||
const tableData = [
|
||||
{
|
||||
szmc: "华为Atlas工具链",
|
||||
szlx: "atlas",
|
||||
szzlx: "已连接",
|
||||
bb: "空闲",
|
||||
hlcjsj: "2024-05-03",
|
||||
},
|
||||
{
|
||||
szmc: "寒武纪思元工具链",
|
||||
szlx: "寒武纪",
|
||||
szzlx: "已断开",
|
||||
bb: "- -",
|
||||
hlcjsj: "2024-06-07",
|
||||
},
|
||||
];
|
||||
// 基础数据列表
|
||||
let listOpt = reactive({
|
||||
typeList: [
|
||||
{
|
||||
type: "quantizer",
|
||||
name: "量化工具",
|
||||
},
|
||||
{
|
||||
type: "compiler",
|
||||
name: "编译工具",
|
||||
},
|
||||
{
|
||||
type: "label",
|
||||
name: "标注工具",
|
||||
},
|
||||
{
|
||||
type: "other",
|
||||
name: "其他工具",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
/** 查询 */
|
||||
function handleQuery() {
|
||||
loading.value = true;
|
||||
ElMessage.success("查询成功");
|
||||
loading.value = false;
|
||||
// UserAPI.getPage(queryParams)
|
||||
// .then((data) => {
|
||||
// console.log("handleQuery", data);
|
||||
// pageData.value = data.list;
|
||||
// total.value = data.total;
|
||||
// })
|
||||
// .finally(() => {
|
||||
// loading.value = false;
|
||||
// });
|
||||
ToolChainshApi.toolStatusList(queryParams)
|
||||
.then((res) => {
|
||||
pageData.value = res.data.data.tool_status_list;
|
||||
total.value = res.data.data.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 重置查询 */
|
||||
function resetQuery() {
|
||||
queryFormRef.value.resetFields();
|
||||
dateTimeRange.value = "";
|
||||
queryParams.pageNum = 1;
|
||||
queryParams.deptId = undefined;
|
||||
queryParams.startTime = undefined;
|
||||
queryParams.endTime = undefined;
|
||||
queryParams.page_num = 1;
|
||||
queryParams.tool_type = null;
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
|
@ -161,34 +143,25 @@ function handleDelete(row: { [key: string]: any }) {
|
|||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(function () {
|
||||
ElMessage.success("删除成功");
|
||||
ToolChainshApi.deleteTool(row.tool_id).then((res) => {
|
||||
ElMessage.success("删除成功");
|
||||
resetQuery();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开弹窗
|
||||
*
|
||||
* @param type 弹窗类型 用户表单:user-form | 用户导入:user-import
|
||||
* @param id 用户ID
|
||||
*/
|
||||
async function openDialog(type: string, id?: number) {
|
||||
/** 查看第三方工具链 */
|
||||
function handleDetail(row: { [key: string]: any }) {
|
||||
localStorage.setItem('toolChainsKey-'+row.tool_id, JSON.stringify(row));
|
||||
router.replace({ path: "/tester/otherToolDetail", query: { id: row.tool_id } });
|
||||
}
|
||||
|
||||
/** 新增第三方工具链 */
|
||||
function handleAdd() {
|
||||
router.replace({ path: "/tester/otherToolEdit" });
|
||||
}
|
||||
async function openDialogView(type: string, id?: number) {
|
||||
router.replace({ path: "/tester/otherToolView" });
|
||||
}
|
||||
|
||||
/** 下载导入模板 */
|
||||
function downloadTemplate() {
|
||||
ElMessage.success("下载模板成功");
|
||||
}
|
||||
|
||||
/** 导出用户 */
|
||||
function handleExport() {
|
||||
ElMessage.success("导出成功");
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//handleQuery();
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -2,142 +2,329 @@
|
|||
<template>
|
||||
<div class="app-container model-detail">
|
||||
<!-- 用户新增/编辑表单 -->
|
||||
<el-card>
|
||||
<el-card v-loading="loading">
|
||||
<template #header
|
||||
><svg-icon
|
||||
icon-class="pause"
|
||||
style="width: 20px; height: 20px"
|
||||
/>工具链基本信息</template
|
||||
>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="24">
|
||||
<el-form
|
||||
ref="userFormRef"
|
||||
:model="formData"
|
||||
v-loading="loading"
|
||||
label-width="100px"
|
||||
size="small"
|
||||
>
|
||||
<el-form-item label="工具链名称" prop="username"> 目标分类模型 </el-form-item>
|
||||
<el-form-item label="工具链标签" prop="nickname22">
|
||||
<div class="flex gap-2">
|
||||
<el-tag type="info">设备标签</el-tag>
|
||||
<el-tag type="info">对讲机</el-tag>
|
||||
<el-tag type="info">头像识别</el-tag>
|
||||
</div>
|
||||
<el-form ref="baseFormRef" :model="baseForm" :rules="baseRules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链名称" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="厂商名称" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入厂商名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态" prop="nickname">
|
||||
<el-tag type="success">已连接</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作状态" prop="nickname">
|
||||
<el-tag type="success">空闲</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="nickname33"> PCIE-AI-NPU </el-form-item>
|
||||
<el-form-item label="IP地址" prop="nickname33"> 192.168.1.32 </el-form-item>
|
||||
<el-form-item label="ID编号" prop="nickname33">
|
||||
6c647c8d-774j-sdjksk-fdof67
|
||||
</el-form-item>
|
||||
<el-form-item label="厂商名称" prop="nickname33"> HUAWEI </el-form-item>
|
||||
<el-form-item label="程序版本" prop="nickname33"> V3.0 </el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="24"> </el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链类型" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="ID编号" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入ID编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链版本" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链版本" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="硬件类型" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入硬件类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链描述" prop="tool_desc">
|
||||
<el-input
|
||||
v-model="baseForm.tool_desc"
|
||||
:rows="2"
|
||||
type="textarea"
|
||||
placeholder="请输入工具链描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12"></el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-row style="padding: 10px 15px;">
|
||||
<el-col :lg="24" :xs="24">
|
||||
<el-button type="primary" @click="handlePushParams"><i-ep-plus />添加运行参数</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-card v-loading="loading">
|
||||
<template #header
|
||||
><svg-icon
|
||||
icon-class="pause"
|
||||
style="width: 20px; height: 20px"
|
||||
/>工具链运行参数信息</template
|
||||
>
|
||||
<el-form ref="formRef" :model="baseForm" :rules="rules" label-width="100px">
|
||||
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链名称" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="厂商名称" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入厂商名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链类型" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="ID编号" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入ID编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链版本" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入工具链版本" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="硬件类型" prop="tool_name">
|
||||
<el-input v-model="baseForm.tool_name" disabled placeholder="请输入硬件类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :lg="12" :xs="12">
|
||||
<el-form-item label="工具链描述" prop="tool_desc">
|
||||
<el-input
|
||||
v-model="baseForm.tool_desc"
|
||||
:rows="2"
|
||||
type="textarea"
|
||||
placeholder="请输入工具链描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12" :xs="12"></el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="card-footer">
|
||||
<el-button @click="closeBack"><i-ep-close />取 消</el-button>
|
||||
</el-card>
|
||||
<el-dialog v-model="dialogFormVisible" title="添加工具链运行参数" width="880" v-loading="formLoading">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="108px">
|
||||
<el-form-item label="运行参数名称" prop="params_name">
|
||||
<el-input v-model="form.params_name" placeholder="请输入运行参数名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运行参数描述" prop="params_desc">
|
||||
<el-input
|
||||
v-model="form.params_desc"
|
||||
:rows="3"
|
||||
type="textarea"
|
||||
placeholder="请输入运行参数描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="运行参数文件" prop="params_content">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
:on-change="handleFileChange"
|
||||
:on-remove="handleFileRemove"
|
||||
:on-exceed="handleFileExceed"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
accept="application/json"
|
||||
>
|
||||
<el-button type="primary"
|
||||
><el-icon class="el-icon--upload"> <i-ep-upload-filled /> </el-icon
|
||||
>选择文件</el-button
|
||||
>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
请上传大小不超过 <strong style="color: red">10M</strong>,格式为
|
||||
<strong style="color: red">json</strong> 的文件
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="fileStatus">
|
||||
<el-input
|
||||
v-model="form.params_content"
|
||||
:rows="10"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false"><i-ep-close />取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmitFile">
|
||||
<i-ep-check />确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "User",
|
||||
inheritAttrs: false,
|
||||
});
|
||||
|
||||
import UserAPI from "@/api/user";
|
||||
import { UserForm } from "@/api/user/model";
|
||||
import ToolChainshApi from "@/api/tool";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
// 基础表单
|
||||
const baseForm = reactive({});
|
||||
const baseFormRef = ref(ElForm); // 表单
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
const calTypeList = ref<OptionType[]>(); // 角色下拉数据源
|
||||
|
||||
// 用户表单数据
|
||||
const formData = reactive<UserForm>({
|
||||
status: 1,
|
||||
// 校验规则
|
||||
const baseRules = reactive({
|
||||
tool_name: [{ required: true, message: "工具链名称不能为空", trigger: "blur" }],
|
||||
tool_desc: [{ required: true, message: "工具链描述不能为空", trigger: "blur" }],
|
||||
});
|
||||
|
||||
// 表单数据
|
||||
const form = reactive({});
|
||||
const formRef = ref(ElForm); // 表单
|
||||
const fileStatus = ref(false); // 文件状态
|
||||
const formLoading = ref(false); // 表单加载状态
|
||||
const dialogFormVisible = ref(false); // 弹窗加载状态
|
||||
// 校验规则
|
||||
const rules = reactive({
|
||||
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
|
||||
nickname: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
||||
deptId: [{ required: true, message: "所属部门不能为空", trigger: "blur" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "blur" }],
|
||||
email: [
|
||||
{
|
||||
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
|
||||
message: "请输入正确的邮箱地址",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
mobile: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
params_name: [{ required: true, message: "运行参数名称不能为空", trigger: "blur" }],
|
||||
params_desc: [{ required: true, message: "运行参数描述不能为空", trigger: "blur" }],
|
||||
params_content: [{ required: true, message: "运行参数文件不能为空", trigger: "blur" }],
|
||||
});
|
||||
|
||||
const list = [
|
||||
{
|
||||
csmc: "10.0.8.12",
|
||||
csms: "异腾310",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
{
|
||||
csmc: "192.168.1.44",
|
||||
csms: "思源220",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
{
|
||||
csmc: "192.168.1.66",
|
||||
csms: "RTX4090",
|
||||
csmc1: "Atlas 2000 DK A2",
|
||||
csmc2: "PCIE-AI-NPU",
|
||||
csmc3: "华为",
|
||||
csmc4: "1.2",
|
||||
csmc5: "已连接",
|
||||
},
|
||||
];
|
||||
|
||||
/** 表单提交 */
|
||||
const handleSubmit = useThrottleFn(() => {
|
||||
loading.value = true;
|
||||
setTimeout(() => {
|
||||
ElMessage.success("修改用户成功");
|
||||
loading.value = false;
|
||||
closeBack();
|
||||
}, 1000);
|
||||
const handleSubmitFile = useThrottleFn(() => {
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
ElMessage.success("保存成功");
|
||||
//formLoading.value = true;
|
||||
// ToolChainshApi.editTool(form.tool_id,form)
|
||||
// .then((res) => {
|
||||
// if (res.data.code == 0) {
|
||||
// ElMessage.success("修改成功");
|
||||
// handleQuery();
|
||||
// }
|
||||
// })
|
||||
// .finally(() => {
|
||||
// dialogFormVisible.value = false;
|
||||
// formLoading.value = false;
|
||||
// });
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
/** 添加运行参数 */
|
||||
function handlePushParams(){
|
||||
form.value = {};
|
||||
dialogFormVisible.value = true;
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
function handleFileChange(file) {
|
||||
//先创建一个读文件的对象 FileReader
|
||||
let reader = new FileReader();
|
||||
//判断浏览器是否支持 FileReader
|
||||
if (typeof FileReader === "undefined") {
|
||||
this.$message({
|
||||
type: "info",
|
||||
message: "您的浏览器不支持文件读取。",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uploadFile(file).then((res) => {
|
||||
if (isJSON(res)) {
|
||||
let jsonStr = JSON.stringify(res);
|
||||
form.params_content = jsonStr;
|
||||
formRef.value.validateField("params_content");
|
||||
fileStatus.value = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 解析json */
|
||||
function isJSON(str) {
|
||||
try {
|
||||
// 尝试解析输入的字符串
|
||||
JSON.parse(str);
|
||||
ElMessage.success("JSON文件解析成功");
|
||||
return true;
|
||||
// 成功解析
|
||||
} catch (error) {
|
||||
// 解析失败
|
||||
ElMessage.error("JSON文件解析失败");
|
||||
uploadRef.value.clearFiles();
|
||||
fileStatus.value = false;
|
||||
form.params_content = "";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 文件读取
|
||||
function uploadFile(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let reader = new FileReader();
|
||||
reader.readAsArrayBuffer(file.raw);
|
||||
reader.onload = function (e) {
|
||||
var ints = new Uint8Array(e.target.result); //要使用读取的内容,所以将读取内容转化成Uint8Array
|
||||
let snippets = new TextDecoder("UTF-8").decode(ints); //二进制缓存区内容转化成中文(即也就是读取到的内容)
|
||||
resolve(snippets);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// 文件删除
|
||||
function handleFileRemove() {
|
||||
form.params_content = "";
|
||||
fileStatus.value = false;
|
||||
}
|
||||
|
||||
// 超出限制,清空文件列表
|
||||
function handleFileExceed() {
|
||||
uploadRef.value.clearFiles();
|
||||
ElMessage.warning("已清空文件列表,请重新上传!");
|
||||
handleFileRemove();
|
||||
}
|
||||
|
||||
/** 返回默认页面 */
|
||||
function closeBack() {
|
||||
router.replace({ path: "/tester/otherTool" });
|
||||
router.replace({ path: "/tester/otherTool" });
|
||||
}
|
||||
|
||||
/** 初始化数据 */
|
||||
function initData(){
|
||||
let id=route.query.id;
|
||||
var row = localStorage.getItem('toolChainsKey-'+id);
|
||||
if(!row){
|
||||
ElMessage.error("未找到相关数据,请从列表页进入详情");
|
||||
closeBack();
|
||||
}
|
||||
baseForm = row;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//handleQuery();
|
||||
//initData();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
Loading…
Reference in New Issue