From a377fcb43bd0f4b9eaa731ed7d0fad3fc6d6c0df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?=
<7507756+jiang_yuqi@user.noreply.gitee.com>
Date: Sun, 28 Jul 2024 12:06:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/manage/otherTool/add.vue | 20 +++++++-
src/views/manage/otherTool/view.vue | 73 ++++++++++++++++-------------
src/views/system/user/index.vue | 4 +-
3 files changed, 60 insertions(+), 37 deletions(-)
diff --git a/src/views/manage/otherTool/add.vue b/src/views/manage/otherTool/add.vue
index 21be4a8..171e2c6 100644
--- a/src/views/manage/otherTool/add.vue
+++ b/src/views/manage/otherTool/add.vue
@@ -39,8 +39,24 @@
-
-
+
+
+
+ {{ scope.row.connection_state }}
+
+
+ {{ scope.row.connection_state }}
+
+
diff --git a/src/views/manage/otherTool/view.vue b/src/views/manage/otherTool/view.vue
index a6a39e9..8ccdebf 100644
--- a/src/views/manage/otherTool/view.vue
+++ b/src/views/manage/otherTool/view.vue
@@ -128,12 +128,14 @@
确 定
取 消
-
-
+
+
@@ -183,12 +185,7 @@
-
+
@@ -200,11 +197,7 @@
-
+
{{ dataInfo.modl_sub_type_name }}
@@ -226,12 +219,7 @@
/>
-
+
@@ -271,7 +259,15 @@ const baseRules = reactive({
});
// 表单数据
-const form = reactive({});
+const form = reactive({
+ tool_id: null,
+ params_name: null,
+ params_desc: null,
+ modl_sub_type: null,
+ params_content: null,
+ params_content: null,
+});
+const paramsContent = ref(""); // 表单
const formRef = ref(ElForm); // 表单
const fileStatus = ref(false); // 文件状态
const formLoading = ref(false); // 表单加载状态
@@ -339,8 +335,10 @@ const handleSubmitFile = useThrottleFn(() => {
ToolChainshApi.addToolParams(form)
.then((res) => {
if (res.data.code == 0) {
- ElMessage.success("修改成功");
- closeBack();
+ ElMessage.success("保存成功");
+ handleQuery();
+ resultForm();
+ dialogFormVisible.value = false;
}
})
.finally(() => {
@@ -352,10 +350,18 @@ const handleSubmitFile = useThrottleFn(() => {
/** 添加运行参数 */
function handlePushParams() {
- form.value = {};
dialogFormVisible.value = true;
}
+/** 表单重置 */
+function resultForm() {
+ form.params_name = null;
+ form.params_desc = null;
+ form.modl_sub_type = null;
+ form.params_content = null;
+ form.params_content = null;
+}
+
// 文件上传
function handleFileChange(file) {
//先创建一个读文件的对象 FileReader
@@ -371,7 +377,7 @@ function handleFileChange(file) {
uploadFile(file).then((res) => {
if (isJSON(res)) {
form.params_content = JSON.parse(res);
- form.params_content_v2 = res;
+ paramsContent.value = res;
formRef.value.validateField("params_content");
fileStatus.value = true;
}
@@ -392,7 +398,7 @@ function isJSON(str) {
uploadRef.value.clearFiles();
fileStatus.value = false;
form.params_content = "";
- form.params_content_v2 = "";
+ paramsContent.value = "";
return false;
}
}
@@ -413,7 +419,7 @@ function uploadFile(file) {
// 文件删除
function handleFileRemove() {
form.params_content = "";
- form.params_content_v2 = "{}";
+ paramsContent.value = "{}";
fileStatus.value = false;
}
@@ -435,9 +441,9 @@ function handleDetail(row: { [key: string]: any }) {
ToolChainshApi.paramsInfo(row.params_id)
.then((res) => {
//JSON转换
- res.data.data.params_content_v2 = JSON.stringify(res.data.data.params_content);
+ paramsContent.value = JSON.stringify(res.data.data.params_content);
dataInfo.value = res.data.data;
- if (res.data.data.params_content_v2 == "{}") {
+ if (paramsContent.value == "{}") {
fileStatus.value = false;
} else {
fileStatus.value = true;
@@ -469,6 +475,7 @@ function handleDelete(row: { [key: string]: any }) {
function initData() {
let id = route.query.id;
ID.value = id;
+ form.tool_id = id;
handleQuery();
loading.value = true;
ToolChainshApi.toolChains(id)
@@ -491,7 +498,7 @@ function handleQuery() {
queryParams.tool_id = ID;
ToolChainshApi.paramsList(queryParams)
.then((res) => {
- pageData.value = res.data.data.ParamsList;
+ pageData.value = res.data.data.ToolParamsList;
total.value = res.data.data.total;
})
.finally(() => {
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 3ac7734..478a91f 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -95,7 +95,7 @@
v-for="item in listOpt.roleList"
:key="item.key"
:label="item.name"
- :value="item.id"
+ :value="item.key"
/>
@@ -321,7 +321,7 @@ function handleDelete(id?: number) {
UserAPI.deleteUser(id).then((res) => {
if (res.data.code == 0) {
ElMessage.success("删除成功");
- resetQuery();
+ handleQuery();
} else {
ElMessage.error("删除失败");
}