Browse Source

添加权限控制

gepangpang 1 year ago
parent
commit
af169182a2

+ 7 - 2
src/api/index.ts

@@ -85,6 +85,12 @@ export const delete_strategy_program = (params: any, callback: any) => {
     if (data) callback && callback(data);
   });
 };
+// 策略管理-获取上个版本参数
+export const get_strategy_program_params_list = (params: any, callback: any) => {
+  return http.request("/strategyProgram/getLastParams", "get", params).then((data) => {
+    if (data) callback && callback(data);
+  });
+};
 
 // 交易所
 // 交易所管理-交易所列表
@@ -212,7 +218,6 @@ export const delete_pem = (params: any, callback: any) => {
   });
 };
 
-
 // 指令管理-指令列表
 export const get_instruct_list = (params: any, callback: any) => {
   return http.request("/serverInstruct/getPage", "get", params).then((data) => {
@@ -221,7 +226,7 @@ export const get_instruct_list = (params: any, callback: any) => {
 };
 // 指令管理-指令列表下拉
 export const get_instruct_list_all = (params: any, callback: any) => {
-  return http.request("/serverInstruct/getPage", "get", params).then((data) => {
+  return http.request("/serverInstruct/getList", "get", params).then((data) => {
     if (data) callback && callback(data);
   });
 };

+ 3 - 0
src/assets/css/index.scss

@@ -44,6 +44,9 @@ body,
   }
 }
 
+.max-height {
+  min-height: 100%;
+}
 .custom-card {
   .operator-wp {
     display: flex;

+ 1 - 1
src/components/PageLayout/Side.vue

@@ -5,7 +5,7 @@
     </div>
     <lay-menu class="menu-wp" :selected-key="selectedKey" theme="light" v-model:openKeys="openKeys" :collapse="collapse" :tree="true">
       <template v-for="item in list">
-        <lay-menu-item :id="item.path" v-if="item.childMenu.length == 0" @click="jumpPage(item)">
+        <lay-menu-item :id="item.path" v-if="item.childMenu.length == 0 || item.type == 2" @click="jumpPage(item)">
           <template #icon>
             <lay-icon :type="item.icon" />
           </template>

+ 11 - 3
src/views/exchange/apikey/components/Batch.vue

@@ -1,5 +1,5 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1000px', '550px']">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1000px', '550px']" :close="handleClose">
     <div style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef">
         <lay-form-item prop="remark">
@@ -63,6 +63,9 @@ const show = () => {
   getExchagneList();
   modelConfig.visible = true;
   modelConfig.title = "批量添加ApiKey";
+  modelParams.value = {};
+  exchangeList.value = [];
+  addResultList.value = [];
   return new Promise(async (resolve, reject) => {
     handleResult.resolve = resolve;
     handleResult.reject = reject;
@@ -80,12 +83,13 @@ const getExchagneList = () => {
 
 const handleInfo = (value: string) => {
   const list = value.split(/\n+/);
+  let isRquest = true;
   let result = list.map((item: any) => {
     const data = item.split(/\s+/);
     const exchangeInfo = exchangeList.value.find((items: any) => data[0] == items.code);
     if (!exchangeInfo) {
       proxy.$message("请确认交易所是否正确!", 2);
-      return false;
+      isRquest = false;
     }
     return {
       exchangeId: exchangeInfo.exchangeId,
@@ -95,7 +99,7 @@ const handleInfo = (value: string) => {
       pass: data[4],
     };
   });
-  return result;
+  return isRquest ? result : false;
 };
 const handleRun = () => {
   const params = handleInfo(modelParams.value.info || "");
@@ -108,6 +112,10 @@ const handleRun = () => {
     }
   });
 };
+
+const handleClose = () => {
+  handleResult.resolve(addResultList.value.length > 0);
+};
 defineExpose({ show });
 </script>
 <style lang="scss" scoped>

+ 12 - 13
src/views/exchange/apikey/index.vue

@@ -4,8 +4,8 @@
       <span class="card-title">ApiKey管理</span>
     </template>
     <template v-slot:extra>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleBatch()">批量添加ApiKey</lay-button>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">添加ApiKey</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/userProof/save')" @click="handleBatch()">批量添加ApiKey</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/userProof/save')" @click="handleUpdate()">添加ApiKey</lay-button>
     </template>
 
     <template v-slot:body>
@@ -23,8 +23,8 @@
         <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="pageConfig.loading" @change="handleCurrentChange">
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/userProof/update')" text="编辑" @click="handleUpdate(row)" />
+              <TableButton v-if="apiList?.includes('/userProof/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -70,17 +70,16 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "名称", width: "80px", key: "name" },
-  { title: "ApiKey", width: "80px", key: "name" },
-  { title: "API", width: "80px", key: "api" },
-  { title: "KEY", width: "80px", key: "key" },
-  { title: "PASS", width: "80px", key: "pass" },
-  { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
-  { title: "更新时间", width: "80px", key: "updateTime" },
-  { title: "创建时间", width: "80px", key: "creationTime" },
+  { title: "名称", key: "name" },
+  { title: "ApiKey", key: "name", ellipsisTooltip: true },
+  { title: "API", key: "api", ellipsisTooltip: true },
+  { title: "KEY", key: "key", ellipsisTooltip: true },
+  { title: "PASS", key: "pass", ellipsisTooltip: true },
+  { title: "备注", key: "remark", ellipsisTooltip: true },
+  { title: "更新时间", key: "updateTime", ellipsisTooltip: true },
+  { title: "创建时间", key: "creationTime", ellipsisTooltip: true },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,

+ 1 - 1
src/views/exchange/manage/components/Update.vue

@@ -1,5 +1,5 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '450px']" :btn="operator">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '350px']" :btn="operator">
     <div style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef" required>
         <lay-form-item label="交易所名称" prop="name">

+ 7 - 8
src/views/exchange/manage/index.vue

@@ -4,7 +4,7 @@
       <span class="card-title">交易所管理</span>
     </template>
     <template v-slot:extra>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">添加交易所</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/exchange/save')" @click="handleUpdate()">添加交易所</lay-button>
     </template>
 
     <template v-slot:body>
@@ -28,9 +28,9 @@
           </template>
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/user/setStatus')" :text="row.status == 0 ? '启用' : '禁用'" @click="handleStatus(row)" />
-              <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/exchange/setStatus')" :text="row.status == 0 ? '启用' : '禁用'" @click="handleStatus(row)" />
+              <TableButton v-if="apiList?.includes('/exchange/update')" text="编辑" @click="handleUpdate(row)" />
+              <TableButton v-if="apiList?.includes('/exchange/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -74,12 +74,11 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "名称", width: "80px", key: "name" },
-  { title: "编码", width: "80px", key: "code" },
-  { title: "状态", width: "80px", key: "status", customSlot: "status" },
+  { title: "名称", key: "name" },
+  { title: "编码", key: "code" },
+  { title: "状态", key: "status", customSlot: "status" },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,

+ 91 - 0
src/views/quant/manage/components/UpdateParams.vue

@@ -0,0 +1,91 @@
+<template>
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '450px']" :btn="operator">
+    <div style="padding: 20px">
+      <lay-form :model="modelParams" ref="modelFormRef" required>
+        <lay-form-item label="名称" prop="name">
+          <lay-input v-model="modelParams.name" />
+        </lay-form-item>
+        <lay-form-item label="字段" prop="code">
+          <lay-input v-model="modelParams.code" />
+        </lay-form-item>
+        <lay-form-item label="类型" prop="valType">
+          <lay-select v-model="modelParams.valType">
+            <lay-select-option v-for="item in paramsTypeList" :value="item.key" :label="item.value" />
+          </lay-select>
+        </lay-form-item>
+        <lay-form-item v-if="modelParams.valType == 3" label="可选值" prop="contentVal">
+          <lay-input v-model="modelParams.contentVal" />
+        </lay-form-item>
+        <lay-form-item v-if="modelParams.valType != 4" label="默认值" prop="defaultVal">
+          <lay-input v-model="modelParams.defaultVal" />
+        </lay-form-item>
+      </lay-form>
+    </div>
+  </lay-layer>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive } from "vue";
+
+const paramsTypeList = [
+  { key: 1, value: "String" },
+  { key: 2, value: "Number" },
+  { key: 3, value: "List" },
+  { key: 4, value: "ApiKey" },
+];
+interface ModelConfig {
+  title: string;
+  visible: boolean;
+  isUpdate: boolean;
+  loading: boolean;
+}
+interface ModelParams {
+  id?: string;
+  name?: string;
+  code?: string;
+  valType?: number;
+  contentVal?: string;
+  defaultVal?: string;
+}
+
+let modelParams = ref<ModelParams>({});
+let modelConfig: ModelConfig = reactive({ title: "", visible: false, isUpdate: false, loading: false });
+
+let handleResult = reactive<{ resolve?: any; reject?: any }>({});
+
+const show = (params?: any) => {
+  modelConfig.visible = true;
+  modelConfig.isUpdate = !!params;
+  modelConfig.title = modelConfig.isUpdate ? "编辑参数" : "添加参数";
+  modelParams.value = modelConfig.isUpdate ? { ...params } : { sequence: 1 };
+  return new Promise(async (resolve, reject) => {
+    handleResult.resolve = resolve;
+    handleResult.reject = reject;
+  });
+};
+
+const operator = reactive([
+  {
+    text: "确认",
+    callback: () => {
+      if (modelConfig.isUpdate) {
+        const params = { ...modelParams.value };
+        modelConfig.visible = false;
+        handleResult.resolve(params);
+      } else {
+        const params = { ...modelParams.value };
+        modelConfig.visible = false;
+        handleResult.resolve(params);
+      }
+    },
+  },
+  {
+    text: "取消",
+    callback: () => {
+      modelConfig.visible = false;
+      handleResult.resolve(false);
+    },
+  },
+]);
+defineExpose({ show });
+</script>

+ 137 - 14
src/views/quant/manage/components/UpdateVersion.vue

@@ -1,6 +1,6 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '550px']" :btn="operator">
-    <div style="padding: 20px">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '550px']" :btn="modelConfig.step == 1 ? operator1 : operator2">
+    <div v-show="modelConfig.step == 1" style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef" required>
         <lay-form-item label="版本名称" prop="name">
           <lay-input v-model="modelParams.name" />
@@ -8,58 +8,166 @@
         <lay-form-item label="版本文件" prop="path">
           <DragUpload v-model="modelParams.path" />
         </lay-form-item>
-        <lay-form-item label="备注" prop="remark">
-          <lay-textarea placeholder="请输入备注" v-model="modelParams.remark" />
+        <lay-form-item label="更新说明" prop="updateInstructions">
+          <lay-textarea placeholder="请输入更新说明" v-model="modelParams.updateInstructions" />
         </lay-form-item>
       </lay-form>
     </div>
+    <div v-show="modelConfig.step == 2" style="padding: 20px">
+      <lay-card class="custom-card">
+        <div class="operator-wp">
+          <lay-button class="custom-button-primary" @click="handleUpVersion()">引用上个版本</lay-button>
+          <lay-button class="custom-button-primary" @click="handleUpdate()">添加参数</lay-button>
+        </div>
+        <div class="table-wp">
+          <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="modelConfig.loading" @change="handleCurrentChange">
+            <template v-slot:status="{ row }">
+              {{ row.status ? "启用" : "禁用" }}
+            </template>
+            <template v-slot:operator="{ row }">
+              <lay-space>
+                <TableButton text="编辑" @click="handleUpdate(row)" />
+                <TableButton type="danger" text="删除" @click="handleDelete(row)" />
+              </lay-space>
+            </template>
+          </lay-table>
+        </div>
+      </lay-card>
+    </div>
+    <UpdateParams ref="updateParams" />
   </lay-layer>
 </template>
 
 <script lang="ts" setup>
 import { ref, reactive, getCurrentInstance } from "vue";
-import { add_strategy, update_strategy } from "@/api";
+import TableButton from "@/components/TableButton.vue";
 import DragUpload from "@/components/DragUpload.vue";
+import UpdateParams from "./UpdateParams.vue";
+import { add_strategy_program, update_strategy_program, get_strategy_program_params_list } from "@/api";
 
 const { proxy }: any = getCurrentInstance();
+const updateParams = ref();
 
 interface ModelConfig {
   title: string;
   visible: boolean;
   isUpdate: boolean;
   loading: boolean;
+  step: number;
 }
 interface ModelParams {
   id?: string;
   name?: string;
   path?: string;
-  remark?: string;
+  strategyId?: string;
+  updateInstructions?: string;
 }
 
 let modelParams = ref<ModelParams>({});
-let modelConfig: ModelConfig = reactive({ title: "", visible: false, isUpdate: false, loading: false });
+let modelConfig: ModelConfig = reactive({ step: 1, title: "", visible: false, isUpdate: false, loading: false });
 
 let handleResult = reactive<{ resolve?: any; reject?: any }>({});
 
+interface FormItem {
+  pageNum?: number;
+  pageSize?: number;
+  strategyId?: string;
+}
+const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });
+
+interface TablePage {
+  current: number;
+  limit: number;
+  total: number;
+}
+const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
+const columns = ref([
+  { title: "名称", key: "name" },
+  { title: "字段", key: "code" },
+  { title: "类型", key: "valType" },
+  { title: "默认值", key: "defaultVal" },
+  { title: "可选值", key: "contentVal" },
+  {
+    title: "操作",
+    customSlot: "operator",
+    key: "operator",
+    ignoreExport: true,
+  },
+]);
+let dataSource = ref<Array<any>>([]);
+
 const show = (params: any, version?: any) => {
   modelConfig.visible = true;
+  modelConfig.step = 1;
   modelConfig.isUpdate = !!version;
   modelConfig.title = modelConfig.isUpdate ? "编辑版本" : "添加版本";
-  modelParams.value = modelConfig.isUpdate ? { ...params } : { status: 1 };
+  modelParams.value = modelConfig.isUpdate ? { ...version, strategyId: params.id } : { strategyId: params.id, status: 1 };
+  dataSource.value = modelConfig.isUpdate ? version.parameters : [];
   return new Promise(async (resolve, reject) => {
     handleResult.resolve = resolve;
     handleResult.reject = reject;
   });
 };
-const operator = reactive([
+
+const handleUpVersion = async () => {
+  let result = await proxy.$waitingConfirm("引用参数会覆盖当前参数,确认引用?");
+  if (!result) return;
+  const params = { strategyId: modelParams.value.strategyId };
+  modelConfig.loading = true;
+  get_strategy_program_params_list(params, (data: any) => {
+    modelConfig.loading = false;
+    if (data.code == 200) {
+      dataSource.value = data.data;
+    }
+  });
+};
+
+const handleUpdate = async (value?: any) => {
+  const result = await updateParams.value.show(value);
+  if (result) {
+    const isUpdate = !!value;
+    if (isUpdate) {
+      dataSource.value = dataSource.value.map((item: any) => (result.id == value.id ? result : item));
+    } else {
+      dataSource.value.push({ ...result, id: -new Date() });
+    }
+  }
+};
+
+const handleDelete = async (value?: any) => {
+  let result = await proxy.$waitingConfirm("是否确认删除该参数?");
+  if (!result) return;
+  dataSource.value = dataSource.value.filter((item: any) => item.id != value.id);
+};
+
+const operator1 = reactive([
+  {
+    text: "下一步",
+    callback: () => {
+      modelConfig.step = 2;
+    },
+  },
+  {
+    text: "取消",
+    callback: () => {
+      modelConfig.visible = false;
+      handleResult.resolve(false);
+    },
+  },
+]);
+const operator2 = reactive([
   {
     text: "确认",
+    hidden: true,
     callback: () => {
       modelConfig.loading = true;
-      console.log(modelParams.value)
       if (modelConfig.isUpdate) {
-        const params = { ...modelParams.value };
-        update_strategy(params, (data: any) => {
+        const parameters = dataSource.value.map((item: any) => {
+          if (item.id < 0) item.id = undefined;
+          return item;
+        });
+        const params = { ...modelParams.value, parameters };
+        update_strategy_program(params, (data: any) => {
           modelConfig.loading = false;
           if (data.code == 200) {
             proxy.$message("编辑成功!");
@@ -68,8 +176,12 @@ const operator = reactive([
           }
         });
       } else {
-        const params = { ...modelParams.value };
-        add_strategy(params, (data: any) => {
+        const parameters = dataSource.value.map((item: any) => {
+          if (item.id < 0) item.id = undefined;
+          return item;
+        });
+        const params = { ...modelParams.value, parameters };
+        add_strategy_program(params, (data: any) => {
           modelConfig.loading = false;
           if (data.code == 200) {
             proxy.$message("添加成功!");
@@ -80,6 +192,12 @@ const operator = reactive([
       }
     },
   },
+  {
+    text: "上一步",
+    callback: () => {
+      modelConfig.step = 1;
+    },
+  },
   {
     text: "取消",
     callback: () => {
@@ -88,5 +206,10 @@ const operator = reactive([
     },
   },
 ]);
+
+// 分页设置
+const handleCurrentChange = (val: any) => {
+  pageParams.pageNum = val.current;
+};
 defineExpose({ show });
 </script>

+ 6 - 8
src/views/quant/manage/components/Version.vue

@@ -2,7 +2,7 @@
   <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1200px', '600px']">
     <lay-card class="custom-card">
       <div class="operator-wp">
-        <lay-button class="custom-button-primary" v-if="apiList?.includes('/menu/save')" @click="handleUpdate()">添加版本</lay-button>
+        <lay-button class="custom-button-primary" v-if="apiList?.includes('/strategyProgram/save')" @click="handleUpdate()">添加版本</lay-button>
       </div>
       <div class="table-wp">
         <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="modelConfig.loading" @change="handleCurrentChange">
@@ -11,9 +11,9 @@
           </template>
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/user/setStatus')" :text="row.status == 0 ? '启用' : '禁用'" @click="handleStatus(row)" />
-              <TableButton v-if="apiList?.includes('/menu/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/menu/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/strategyProgram/setStatus')" :text="row.status == 0 ? '启用' : '禁用'" @click="handleStatus(row)" />
+              <TableButton v-if="apiList?.includes('/strategyProgram/update')" text="编辑" @click="handleUpdate(row)" />
+              <TableButton v-if="apiList?.includes('/strategyProgram/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -60,16 +60,14 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "版本名称", key: "name" },
+  { title: "版本名称", width: "100px", key: "name" },
   { title: "存储路径", key: "path" },
-  { title: "状态", key: "status", customSlot: "status" },
+  { title: "状态", width: "80px", key: "status", customSlot: "status" },
   { title: "备注", key: "remark" },
   {
     title: "操作",
-    width: "300px",
     customSlot: "operator",
     key: "operator",
-    fixed: "right",
     ignoreExport: true,
   },
 ]);

+ 6 - 10
src/views/quant/manage/index.vue

@@ -5,7 +5,7 @@
     </template>
     <template v-slot:extra>
       <lay-button class="card-button" @click="handleUpdate()">添加策略</lay-button>
-      <!-- <lay-button class="card-button" v-if="apiList?.includes('/strategy/save')" @click="handleUpdate()">添加策略</lay-button> -->
+      <lay-button class="card-button" v-if="apiList?.includes('/strategy/save')" @click="handleUpdate()">添加策略</lay-button>
     </template>
 
     <template v-slot:body>
@@ -23,12 +23,9 @@
         <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="pageConfig.loading" @change="handleCurrentChange">
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton text="版本管理" @click="showVersion(row)" />
-              <TableButton text="编辑" @click="handleUpdate(row)" />
-              <TableButton type="danger" text="删除" @click="handleDelete(row)" />
-              <!-- <TableButton v-if="apiList?.includes('/strategy/setStatus')" text="版本管理" @click="handleStatus(row)" />
+              <TableButton v-if="apiList?.includes('/strategyProgram/getPage')" text="版本管理" @click="showVersion(row)" />
               <TableButton v-if="apiList?.includes('/strategy/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/strategy/delete')" type="danger" text="删除" @click="handleDelete(row)" /> -->
+              <TableButton v-if="apiList?.includes('/strategy/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -50,7 +47,7 @@ const { proxy }: any = getCurrentInstance();
 const updateRef = ref();
 const versionRef = ref();
 
-// const apiList = ref(window.sessionStorage.getItem("_4L_API_LIST"));
+const apiList = ref(window.sessionStorage.getItem("_4L_API_LIST"));
 
 interface PageConfig {
   loading: boolean;
@@ -74,11 +71,10 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "策略名称", width: "80px", key: "name" },
-  { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
+  { title: "策略名称", key: "name" },
+  { title: "备注", key: "remark", ellipsisTooltip: true },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,

+ 1 - 1
src/views/server/command/components/Update.vue

@@ -1,5 +1,5 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['600px', '650px']" :btn="operator">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['550px', '650px']" :btn="operator">
     <div style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef" required>
         <lay-form-item label="名称" prop="title">

+ 8 - 9
src/views/server/command/index.vue

@@ -4,7 +4,7 @@
       <span class="card-title">指令管理</span>
     </template>
     <template v-slot:extra>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate()">添加指令</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/serverInstruct/save')" @click="handleUpdate()">添加指令</lay-button>
     </template>
 
     <template v-slot:body>
@@ -25,8 +25,8 @@
           </template>
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/serverInstruct/update')" text="编辑" @click="handleUpdate(row)" />
+              <TableButton v-if="apiList?.includes('/serverInstruct/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -69,14 +69,13 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "名称", width: "80px", key: "title" },
-  { title: "CODE", width: "80px", key: "code" },
-  { title: "系统类型", width: "80px", key: "osType",customSlot: "osType"},
-  { title: "描述", width: "80px", key: "remark", ellipsisTooltip: true },
-  { title: "更新时间", width: "80px", key: "updateTime" },
+  { title: "名称", key: "title" },
+  { title: "CODE", key: "code" },
+  { title: "系统类型", key: "osType", customSlot: "osType" },
+  { title: "描述", key: "remark", ellipsisTooltip: true },
+  { title: "更新时间", key: "updateTime" },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,

+ 8 - 9
src/views/server/command_record/index.vue

@@ -61,16 +61,15 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "名称", width: "80px", key: "name" },
-  { title: "服务器", width: "80px", key: "account" },
-  { title: "状态", width: "80px", key: "status", customSlot: "status" },
-  { title: "执行CODE", width: "80px", key: "account" },
-  { title: "系统类型", width: "80px", key: "account" },
-  { title: "执行时间", width: "80px", key: "account" },
-  { title: "执行人", width: "80px", key: "account" },
+  { title: "名称", key: "name" },
+  { title: "服务器", key: "account" },
+  { title: "状态", key: "status", customSlot: "status" },
+  { title: "执行CODE", key: "account" },
+  { title: "系统类型", key: "account" },
+  { title: "执行时间", key: "account" },
+  { title: "执行人", key: "account" },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,
@@ -96,7 +95,7 @@ getPageInfo();
 const handleDelete = async (value: any) => {
   let result = await proxy.$waitingConfirm("是否确认删除该指令记录?");
   if (!result) return;
-  console.log(value)
+  console.log(value);
   // let params = [value.userId];
   // pageConfig.loading = true;
   // delete_user(params, (data: any) => {

+ 22 - 20
src/views/server/manage/components/Batch.vue

@@ -2,26 +2,28 @@
   <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1000px', '750px']">
     <div style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef">
-        <lay-form-item label="操作系统" prop="osType">
-          <lay-select v-model="modelParams.osType">
-            <lay-select-option :value="0" label="Ubuntu" />
-          </lay-select>
-        </lay-form-item>
-        <lay-form-item label="登录方式" prop="code">
-          <lay-radio v-model="modelParams.loginType" name="action" :value="0" label="账号密码" />
-          <lay-radio v-model="modelParams.loginType" name="action" :value="1" label="PEM" />
-        </lay-form-item>
-        <lay-form-item label="账号" prop="accountComplex">
-          <lay-input v-model="modelParams.accountComplex" />
-        </lay-form-item>
-        <lay-form-item v-if="modelParams.loginType == 0" label="密码" prop="passwordComplex">
-          <lay-input v-model="modelParams.passwordComplex" />
-        </lay-form-item>
-        <lay-form-item v-if="modelParams.loginType == 1" label="PEM" prop="pemId">
-          <lay-select v-model="modelParams.pemId">
-            <lay-select-option v-for="item in pemList" :value="item.id" :label="item.value" />
-          </lay-select>
-        </lay-form-item>
+        <div style="width: 500px;">
+          <lay-form-item label="操作系统" prop="osType">
+            <lay-select v-model="modelParams.osType">
+              <lay-select-option :value="0" label="Ubuntu" />
+            </lay-select>
+          </lay-form-item>
+          <lay-form-item label="登录方式" prop="code">
+            <lay-radio v-model="modelParams.loginType" name="action" :value="0" label="账号密码" />
+            <lay-radio v-model="modelParams.loginType" name="action" :value="1" label="PEM" />
+          </lay-form-item>
+          <lay-form-item label="账号" prop="accountComplex">
+            <lay-input v-model="modelParams.accountComplex" />
+          </lay-form-item>
+          <lay-form-item v-if="modelParams.loginType == 0" label="密码" prop="passwordComplex">
+            <lay-input v-model="modelParams.passwordComplex" />
+          </lay-form-item>
+          <lay-form-item v-if="modelParams.loginType == 1" label="PEM" prop="pemId">
+            <lay-select v-model="modelParams.pemId">
+              <lay-select-option v-for="item in pemList" :value="item.id" :label="item.value" />
+            </lay-select>
+          </lay-form-item>
+        </div>
         <lay-form-item prop="remark">
           <lay-textarea placeholder="服务器名称 IP PROT" v-model="modelParams.info" rows="12" />
         </lay-form-item>

+ 4 - 6
src/views/server/manage/components/Pem.vue

@@ -1,8 +1,8 @@
 <template>
   <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1200px', '600px']">
-    <lay-card class="custom-card">
+    <lay-card class="custom-card max-height">
       <div class="operator-wp">
-        <lay-button class="custom-button-primary" v-if="apiList?.includes('/menu/save')" @click="handleUpdate()">添加PEM</lay-button>
+        <lay-button class="custom-button-primary" v-if="apiList?.includes('/serverAuth/save')" @click="handleUpdate()">添加PEM</lay-button>
       </div>
       <div class="table-wp">
         <lay-table :page="tablePage" :columns="columns" resize :data-source="dataSource" :loading="modelConfig.loading" @change="handleCurrentChange">
@@ -11,8 +11,8 @@
           </template>
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/menu/update')" text="编辑" @click="handleUpdate(row)" />
-              <TableButton v-if="apiList?.includes('/menu/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/serverAuth/update')" text="编辑" @click="handleUpdate(row)" />
+              <TableButton v-if="apiList?.includes('/serverAuth/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -64,10 +64,8 @@ const columns = ref([
   { title: "备注", key: "remark" },
   {
     title: "操作",
-    width: "300px",
     customSlot: "operator",
     key: "operator",
-    fixed: "right",
     ignoreExport: true,
   },
 ]);

+ 1 - 1
src/views/server/manage/components/Update.vue

@@ -1,5 +1,5 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['600px', '650px']" :btn="operator">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['500px', '650px']" :btn="operator">
     <div style="padding: 20px">
       <lay-form :model="modelParams" ref="modelFormRef" required>
         <lay-form-item label="名称" prop="name">

+ 11 - 14
src/views/server/manage/index.vue

@@ -4,9 +4,9 @@
       <span class="card-title">服务器管理</span>
     </template>
     <template v-slot:extra>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handlePem()">PEM管理</lay-button>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleBatch()">批量添加服务器</lay-button>
-      <lay-button class="card-button" v-if="apiList?.includes('/user/save')" @click="handleUpdate(0)">添加服务器</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/serverAuth/getPage')" @click="handlePem()">PEM管理</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/userServer/save')" @click="handleBatch()">批量添加服务器</lay-button>
+      <lay-button class="card-button" v-if="apiList?.includes('/userServer/save')" @click="handleUpdate(0)">添加服务器</lay-button>
     </template>
 
     <template v-slot:body>
@@ -27,10 +27,10 @@
           </template>
           <template v-slot:operator="{ row }">
             <lay-space>
-              <TableButton v-if="apiList?.includes('/user/setStatus')" text="测试连接" @click="handleTest(row)" />
-              <TableButton v-if="apiList?.includes('/user/update')" text="编辑" @click="handleUpdate(1, row)" />
-              <TableButton v-if="apiList?.includes('/user/update')" text="复制" @click="handleUpdate(2, row)" />
-              <TableButton v-if="apiList?.includes('/user/delete')" type="danger" text="删除" @click="handleDelete(row)" />
+              <TableButton v-if="apiList?.includes('/userServer/testConnect')" text="测试连接" @click="handleTest(row)" />
+              <TableButton v-if="apiList?.includes('/userServer/update')" text="编辑" @click="handleUpdate(1, row)" />
+              <TableButton v-if="apiList?.includes('/userServer/save')" text="复制" @click="handleUpdate(2, row)" />
+              <TableButton v-if="apiList?.includes('/userServer/delete')" type="danger" text="删除" @click="handleDelete(row)" />
             </lay-space>
           </template>
         </lay-table>
@@ -79,15 +79,14 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "名称", width: "80px", key: "name" },
-  { title: "IP", width: "80px", key: "ipAddrComplex" },
+  { title: "名称", key: "name" },
+  { title: "IP", key: "ipAddrComplex" },
   { title: "端口号", width: "80px", key: "portComplex" },
   { title: "状态", width: "80px", key: "status", customSlot: "status" },
-  { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
-  { title: "更新时间", width: "80px", key: "updateTime" },
+  { title: "备注", key: "remark", ellipsisTooltip: true },
+  { title: "更新时间", key: "updateTime" },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,
@@ -127,9 +126,7 @@ const handleUpdate = async (type: number, value?: any) => {
 // 测试连接
 const handleTest = async (value: any) => {
   let params = { ...value };
-  pageConfig.loading = true;
   test_connect_server(params, (data: any) => {
-    pageConfig.loading = false;
     if (data.code == 200) {
       proxy.$message(`连接成功!`);
     }

+ 4 - 6
src/views/system/organization/index.vue

@@ -72,16 +72,14 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "组织名称", width: "80px", key: "groupName"  },
-  { title: "组织编码", width: "80px", key: "code"  },
-  { title: "状态", width: "80px", key: "status", customSlot: "status"  },
-  { title: "说明", width: "80px", key: "describe", ellipsisTooltip: true },
+  { title: "组织名称", key: "groupName" },
+  { title: "组织编码", key: "code" },
+  { title: "状态", key: "status", customSlot: "status" },
+  { title: "说明", key: "describe", ellipsisTooltip: true },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
-    fixed: "right",
     ignoreExport: true,
   },
 ]);

+ 5 - 6
src/views/system/user/index.vue

@@ -74,14 +74,13 @@ interface TablePage {
 }
 const tablePage: TablePage = reactive({ current: 1, limit: 10, total: 0 });
 const columns = ref([
-  { title: "昵称", width: "80px", key: "name" },
-  { title: "账号", width: "80px", key: "account" },
-  { title: "组织", width: "80px", key: "groupNames", customSlot: "groupNames", ellipsisTooltip: true },
-  { title: "状态", width: "80px", key: "status", customSlot: "status" },
-  { title: "备注", width: "80px", key: "remark", ellipsisTooltip: true },
+  { title: "昵称", key: "name" },
+  { title: "账号", key: "account" },
+  { title: "组织", key: "groupNames", customSlot: "groupNames", ellipsisTooltip: true },
+  { title: "状态", key: "status", customSlot: "status" },
+  { title: "备注", key: "remark", ellipsisTooltip: true },
   {
     title: "操作",
-    width: "150px",
     customSlot: "operator",
     key: "operator",
     ignoreExport: true,

+ 1 - 3
src/views/system/webpage/components/Operator.vue

@@ -1,5 +1,5 @@
 <template>
-  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1200px', '600px']">
+  <lay-layer :title="modelConfig.title" v-model="modelConfig.visible" :area="['1200px', '700px']">
     <lay-card class="custom-card">
       <div class="operator-wp">
         <lay-button class="custom-button-primary" v-if="apiList?.includes('/menu/save')" @click="handleUpdate()">添加</lay-button>
@@ -63,10 +63,8 @@ const columns = ref([
   { title: "类型", key: "menuType", customSlot: "menuType" },
   {
     title: "操作",
-    width: "300px",
     customSlot: "operator",
     key: "operator",
-    fixed: "right",
     ignoreExport: true,
   },
 ]);

+ 1 - 3
src/views/system/webpage/index.vue

@@ -53,7 +53,7 @@ interface FormItem {
   pageNum?: Number;
   pageSize?: Number;
 }
-const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10 });
+const pageParams: FormItem = reactive({ pageNum: 1, pageSize: 10, menuType: 1 });
 
 interface TablePage {
   current: number;
@@ -66,10 +66,8 @@ const columns = ref([
   { title: "类型", key: "menuType", customSlot: "menuType" },
   {
     title: "操作",
-    width: "300px",
     customSlot: "operator",
     key: "operator",
-    fixed: "right",
     ignoreExport: true,
   },
 ]);