Jelajahi Sumber

角色管理

汪钰 3 tahun lalu
induk
melakukan
b42bc0f98e

+ 4 - 6
ele-admin-template/src/api/system/dictionary-data/index.js

@@ -4,12 +4,10 @@ import request from '@/utils/request';
  * 分页查询字典数据
  * @param params 查询条件
  */
-export async function pageDictionaryData(params) {
-  const res = await request.get('/system/dictionary-data/page', {
-    params
-  });
-  if (res.data.code === 0) {
-    return res.data.data;
+export async function pageDictionaryData(id) {
+  const res = await request.get(`/system/dict/getById/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }

+ 10 - 8
ele-admin-template/src/api/system/dictionary/index.js

@@ -4,12 +4,14 @@ import request from '@/utils/request';
  * 查询字典列表
  * @param params 查询条件
  */
-export async function listDictionaries(params) {
-  const res = await request.get('/system/dictionary', {
-    params
-  });
-  if (res.data.code === 0) {
-    return res.data.data;
+export async function listDictionaries() {
+  const res = await request.get('/system/dict/getPage', {});
+  if (res.data.code == 0) {
+    console.log(res.data);
+    return {
+      list: res.data.data.records,
+      count: res.data.data.total
+    };
   }
   return Promise.reject(new Error(res.data.message));
 }
@@ -19,8 +21,8 @@ export async function listDictionaries(params) {
  * @param data 字典信息
  */
 export async function addDictionary(data) {
-  const res = await request.post('/system/dictionary', data);
-  if (res.data.code === 0) {
+  const res = await request.post('/system/dict/submit', data);
+  if (res.data.code == 0) {
     return res.data.message;
   }
   return Promise.reject(new Error(res.data.message));

+ 9 - 8
ele-admin-template/src/views/system/dictionary/components/dict-data-edit.vue

@@ -60,14 +60,15 @@
   } from '@/api/system/dictionary-data';
 
   export default {
-    props: {
-      // 弹窗是否打开
-      visible: Boolean,
-      // 修改回显的数据
-      data: Object,
-      // 字典id
-      dictId: Number
-    },
+    // props: {
+    //   // 弹窗是否打开
+    //   visible: Boolean,
+    //   // 修改回显的数据
+    //   data: Object,
+    //   // 字典id
+    //   dictId: Object
+    // },
+    props: ['visible', 'data', 'dictId'],
     data() {
       const defaultForm = {
         dictDataId: null,

+ 188 - 46
ele-admin-template/src/views/system/dictionary/components/dict-edit.vue

@@ -1,49 +1,79 @@
 <!-- 字典编辑弹窗 -->
 <template>
   <ele-modal
-    width="460px"
+    width="800px"
+    :maxable="true"
     :visible="visible"
     :close-on-click-modal="true"
     :title="isUpdate ? '修改字典' : '添加字典'"
     @update:visible="updateVisible"
   >
-    <el-form ref="form" :model="form" :rules="rules" label-width="82px">
-      <el-form-item label="字典名称:" prop="dictName">
-        <el-input
-          clearable
-          :maxlength="20"
-          v-model="form.dictName"
-          placeholder="请输入字典名称"
-        />
-      </el-form-item>
-      <el-form-item label="字典值:" prop="dictCode">
-        <el-input
-          clearable
-          :maxlength="20"
-          v-model="form.dictCode"
-          placeholder="请输入字典值"
-        />
-      </el-form-item>
-      <el-form-item label="排序号:" prop="sortNumber">
-        <el-input-number
-          :min="0"
-          :max="9999"
-          v-model="form.sortNumber"
-          controls-position="right"
-          placeholder="请输入排序号"
-          class="ele-fluid ele-text-left"
-        />
-      </el-form-item>
-      <el-form-item label="备注:">
-        <el-input
-          :rows="4"
-          type="textarea"
-          :maxlength="200"
-          v-model="form.comments"
-          placeholder="请输入备注"
-        />
-      </el-form-item>
+    <el-form ref="form" :model="form" :rules="rules" label-width="85px">
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="字典名称:" prop="name">
+            <el-input
+              clearable
+              :disabled="isUpdate"
+              :maxlength="20"
+              v-model="form.name"
+              placeholder="请输入字典名称"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="字典值:" prop="code">
+            <el-input
+              clearable
+              :maxlength="20"
+              v-model="form.code"
+              placeholder="请输入字典值"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="应用类型:" prop="appType">
+            <el-radio-group v-model="form.appType">
+              <el-radio :label="1">业务字典</el-radio>
+              <el-radio :label="2">数据字典</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="是否启用:" prop="enable">
+            <el-radio-group v-model="form.enable">
+              <el-radio :label="1">是</el-radio>
+              <el-radio :label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="12">
+          <el-form-item label="排序号:" prop="sortNumber">
+            <el-input-number
+              :min="0"
+              :max="9999"
+              v-model="form.sortNumber"
+              controls-position="right"
+              placeholder="请输入排序号"
+              class="ele-fluid ele-text-left"
+            />
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="24">
+          <el-form-item label="备注:">
+            <el-input
+              :rows="4"
+              type="textarea"
+              :maxlength="200"
+              v-model="form.remark"
+              placeholder="请输入备注"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
+
     <template v-slot:footer>
       <el-button @click="updateVisible(false)">取消</el-button>
       <el-button type="primary" :loading="loading" @click="save">
@@ -55,43 +85,71 @@
 
 <script>
   import { addDictionary, updateDictionary } from '@/api/system/dictionary';
+  import {
+    pageDictionaryData,
+    removeDictionaryData,
+    removeDictionaryDataBatch
+  } from '@/api/system/dictionary-data';
 
   export default {
+    created() {},
     props: {
       // 弹窗是否打开
       visible: Boolean,
       // 修改回显的数据
-      data: Object
+      id: String
     },
     data() {
       const defaultForm = {
-        dictId: null,
-        dictName: '',
-        dictCode: '',
-        sortNumber: null,
-        comments: ''
+        name: '',
+        code: '',
+        appType: 1,
+        enable: 1,
+        remark: '',
+        dictStaticSubmitPOList: []
       };
       return {
         defaultForm,
         // 表单数据
         form: { ...defaultForm },
+        // form: {
+        //   name: '',
+        //   code: '',
+        //   appType: 1,
+        //   enable: 1,
+        //   remark: ''
+        // },
         // 表单验证规则
         rules: {
-          dictName: [
+          name: [
             {
               required: true,
               message: '请输入字典名称',
               trigger: 'blur'
             }
           ],
-          dictCode: [
+          code: [
             {
               required: true,
               message: '请输入字典值',
               trigger: 'blur'
             }
           ],
-          sortNumber: [
+          appType: [
+            {
+              required: true,
+              message: '请选择应用类型',
+              trigger: 'blur'
+            }
+          ],
+          enable: [
+            {
+              required: true,
+              message: '请选择是否启用',
+              trigger: 'blur'
+            }
+          ],
+          sort: [
             {
               required: true,
               message: '请输入排序号',
@@ -99,12 +157,88 @@
             }
           ]
         },
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '字典编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '字典名称',
+
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'appType',
+          //   label: '字典类型',
+
+          //   showOverflowTooltip: true,
+          //   minWidth: 110
+          // },
+          {
+            prop: 'appType',
+            label: '应用类型',
+
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'remark',
+            label: '描述',
+
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 130,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        // 表格选中数据
+        selection: [],
+        datasource: {
+          list: []
+        },
+
         // 提交状态
         loading: false,
         // 是否是修改
         isUpdate: false
       };
     },
+    created() {
+      if (this.id) {
+        this.getDetail();
+      }
+    },
     methods: {
       /* 保存编辑 */
       save() {
@@ -130,6 +264,14 @@
       /* 更新visible */
       updateVisible(value) {
         this.$emit('update:visible', value);
+      },
+
+      async getDetail() {
+        const res = await pageDictionaryData(this.id);
+        this.form = res.data.dictInfoVO;
+
+        this.form.dictStaticSubmitPOList = res.data.dictStaticVOList;
+        // this.datasource.list = this.from.dictStaticSubmitPOList;
       }
     },
     watch: {

+ 39 - 37
ele-admin-template/src/views/system/dictionary/index.vue

@@ -1,8 +1,39 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
+      <div style="margin: 5px 0; padding-left: 262px">
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-plus"
+          class="ele-btn-icon"
+          @click="openEdit()"
+        >
+          添加
+        </el-button>
+        <el-button
+          size="small"
+          type="warning"
+          icon="el-icon-edit"
+          class="ele-btn-icon"
+          :disabled="!current"
+          @click="openEdit(current)"
+        >
+          修改
+        </el-button>
+        <el-button
+          size="small"
+          type="danger"
+          icon="el-icon-delete"
+          class="ele-btn-icon"
+          :disabled="!current"
+          @click="remove"
+        >
+          删除
+        </el-button>
+      </div>
       <ele-split-layout
-        width="266px"
+        width="244px"
         allow-collapse
         :right-style="{ overflow: 'hidden' }"
       >
@@ -21,48 +52,17 @@
           @done="done"
         >
           <!-- 表头工具栏 -->
-          <template v-slot:toolbar>
-            <div style="margin: 5px 0">
-              <el-button
-                size="small"
-                type="primary"
-                icon="el-icon-plus"
-                class="ele-btn-icon"
-                @click="openEdit()"
-              >
-                添加
-              </el-button>
-              <el-button
-                size="small"
-                type="warning"
-                icon="el-icon-edit"
-                class="ele-btn-icon"
-                :disabled="!current"
-                @click="openEdit(current)"
-              >
-                修改
-              </el-button>
-              <el-button
-                size="small"
-                type="danger"
-                icon="el-icon-delete"
-                class="ele-btn-icon"
-                :disabled="!current"
-                @click="remove"
-              >
-                删除
-              </el-button>
-            </div>
-          </template>
+          <template v-slot:toolbar> </template>
         </ele-pro-table>
+
         <template v-slot:content>
           <!-- 数据字典项列表 -->
-          <dict-data v-if="current" :dict-id="current.dictId" />
+          <dict-data v-if="current" :dict-id="current.id" />
         </template>
       </ele-split-layout>
     </el-card>
     <!-- 编辑弹窗 -->
-    <dict-edit :visible.sync="showEdit" :data="editData" @done="reload" />
+    <dict-edit :visible.sync="showEdit" @done="reload" />
   </div>
 </template>
 
@@ -86,7 +86,7 @@
             showOverflowTooltip: true
           },
           {
-            prop: 'dictName',
+            prop: 'name',
             label: '字典名称',
             showOverflowTooltip: true
           }
@@ -99,9 +99,11 @@
         editData: null
       };
     },
+
     methods: {
       /* 表格数据源 */
       datasource() {
+        // return;
         return listDictionaries();
       },
       /* 表格渲染完成回调 */

+ 9 - 5
ele-admin-template/src/views/system/role/index.vue

@@ -113,6 +113,7 @@
           },
           {
             columnKey: 'index',
+            label: '#',
             type: 'index',
             width: 45,
             align: 'center',
@@ -122,21 +123,24 @@
           {
             prop: 'name',
             label: '角色名称',
-            sortable: 'custom',
+            align: 'center',
+
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
             prop: 'groupId',
             label: '组织ID',
-            sortable: 'custom',
+            align: 'center',
+
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
             prop: 'enable',
             label: '启用状态',
-            sortable: 'custom',
+            align: 'center',
+
             showOverflowTooltip: true,
             slot: 'enable',
 
@@ -145,7 +149,8 @@
           {
             prop: 'createTime',
             label: '创建时间',
-            sortable: 'custom',
+            align: 'center',
+
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (_row, _column, cellValue) => {
@@ -192,7 +197,6 @@
       },
       /* 刷新表格 */
       reload(where) {
-        console.log(where, '1111');
         this.$refs.table.reload({ page: 1, where });
       },
       /* 显示编辑 */

+ 3 - 1
ele-admin-template/vue.config.js

@@ -15,8 +15,10 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.3.51:18086', // 跨域请求的地址
+        // target: 'http://192.168.3.51:18086', // 跨域请求的地址
+        // http://192.168.3.41:8080/
         // target: 'http://192.168.3.35:8080', // kang杨威
+        target: ' http://192.168.3.41:8080', // 何江鹏
         // target: 'http://192.168.3.31:8080', // 黄峥嵘
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {