Browse Source

白名单分组

Administrator 1 year ago
parent
commit
0ee594dcae

+ 3 - 1
src/api/request.ts

@@ -5,8 +5,10 @@ import { useUserStore } from "@/store/modules/user"
 const service = axios.create({
     // 默认请求地址,根据环境的不同可在.env 文件中进行修改
     // baseURL: import.meta.env.VUE_APP_BASE_
-    // baseURL: "http://192.168.123.216:8001",
+    // 本地地址
     baseURL: "http://localhost:8001/api",
+    // 华为云地址
+    // baseURL: "http://119.3.30.56:8001/api",
     // 设置接口访问超时时间
     timeout: 3000000, // request timeout,
     // 跨域时候允许携带凭证

+ 1 - 1
src/components/Table/PropTable/index.vue

@@ -5,7 +5,7 @@
                class="search-form"
                :model="formInline"  ref="ruleFormRef" >
         <template v-for="(item, index) in formSearchData" :key="index">
-          <el-form-item :label="item.label" v-show="isExpand ? isExpand : index < 2">
+          <el-form-item :label="item.label" v-show="isExpand ? isExpand : index < 4">
             <template v-if="item.valueType === 'input'">
               <el-input v-model="formInline[item.name]" :placeholder="`请输入${item.label}`" />
             </template>

+ 67 - 12
src/views/operation/whitelist/index.vue

@@ -14,12 +14,13 @@
             </el-icon>删除</el-button>
         </div>
       </template>
-      <template v-slot:type="scope">{{ getStateLabel(scope.row.type) }}</template>
+      <template v-slot:type="scope">{{ getTypeLabel(scope.row.type) }}</template>
+      <template v-slot:group="scope">{{ getGroupLabel(scope.row.group) }}</template>
       <template v-slot:createTime="scope">{{ dateUtils.getDate(scope.row.createTime) }}</template>
       <template v-slot:operation="scope">
-        <!-- <el-button type="primary" size="small" icon="Edit" @click="edit(scope.row)">
+        <el-button type="primary" size="small" icon="Edit" @click="edit(scope.row)">
           编辑
-        </el-button> -->
+        </el-button>
         <el-button @click="del(scope.row)" type="danger" size="small" icon="Delete">
           删除
         </el-button>
@@ -32,13 +33,21 @@
         <el-form-item label="白名单值" prop="value">
           <el-input v-model="ruleForm.value" />
         </el-form-item>
-        <el-form-item label="白名单类型" prop="type">
+        <el-form-item label="白名单类型" prop="type">
           <el-radio-group v-model="ruleForm.type">
             <el-radio :label="0">IP</el-radio>
             <el-radio :label="1">账号</el-radio>
             <el-radio :label="2">角色</el-radio>
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="白名单分组" prop="group">
+          <el-radio-group v-model="ruleForm.group">
+            <el-radio :label="0">程序</el-radio>
+            <el-radio :label="1">策划</el-radio>
+            <el-radio :label="2">测试</el-radio>
+            <el-radio :label="3">运营</el-radio>
+          </el-radio-group>
+        </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
@@ -91,7 +100,7 @@ const tableData = ref([])
 const tableHeader = ref([])
 const upload = ref<UploadInstance>()
 
-const tableColumn = ["value","type"]
+const tableColumn = ["value","type","group"]
 const beforeUploadAction = (file, fileLi) => {
   return new Promise((resolve, reject) => {
     const reader = new FileReader()
@@ -184,7 +193,7 @@ const column = [
   { name: 'value', label: '白名单值', inSearch: true, valueType: 'input'},
   {
     name: 'type',
-    label: '白名单类型',
+    label: '白名单类型',
     slot: true,
     inSearch: true,
     options: [
@@ -197,23 +206,60 @@ const column = [
         label: '账号',
       },
       {
-        value: 1,
+        value: 2,
         label: '角色',
       }
     ],
     valueType: 'select',
   },
+  {
+    name: 'group',
+    label: '白名单分组',
+    slot: true,
+    inSearch: true,
+    options: [
+      {
+        value: 0,
+        label: '程序',
+      },
+      {
+        value: 1,
+        label: '策划',
+      },
+      {
+        value: 2,
+        label: '测试',
+      },
+      {
+        value: 3,
+        label: '运营',
+      }
+    ],
+    valueType: 'select',
+  },
   { name: 'createTime', label: '白名单创建时间', slot: true },
   { name: 'operation', slot: true, fixed: 'right', width: 200, label: '操作' },
 ]
 
-const getStateLabel = (val) => {
+const getTypeLabel = (val) => {
   if (val == 0) {
     return 'IP'
   } else if (val == 1) {
     return '账号'
   } else if (val == 2) {
-    return '角色'
+    return '测试'
+  }
+}
+
+const getGroupLabel = (val) => {
+  if (val == 0) {
+    return '程序'
+  } else if (val == 1) {
+    return '策划'
+  } else if (val == 2) {
+    return '测试'
+  } else if (val == 3) {
+    return '运营'
   }
 }
 
@@ -223,7 +269,8 @@ const formSize = ref('default')
 const ruleFormRef = ref<FormInstance>()
 const ruleForm = reactive({
   value: null,
-  type: null
+  type: null,
+  group: null
 })
 
 const rules = reactive({
@@ -237,7 +284,14 @@ const rules = reactive({
   type: [
     {
       required: true,
-      message: '请选择白名单类型',
+      message: '请选择白名单值类型',
+      trigger: 'change',
+    },
+  ],
+  group: [
+    {
+      required: true,
+      message: '请选择白名单分组',
       trigger: 'change',
     },
   ],
@@ -363,6 +417,7 @@ const edit = (row) => {
   dialogVisible.value = true
   ruleForm.type = row.type
   ruleForm.value = row.value
+  ruleForm.group = row.group
 }
 
 const del = (row) => {
@@ -399,7 +454,7 @@ const reset = () => {
 }
 
 const onSubmit = (val) => {
-  if ((val.value == null || val.value == "") && val.type == null) {
+  if ((val.value == null || val.value == "") && val.type == null && val.group == null) {
     ElMessage.warning('请输入查询条件')
     return
   }