汪钰 пре 3 година
родитељ
комит
4d8730fe84

+ 5 - 5
src/api/system/dictionary/index.js

@@ -4,8 +4,8 @@ import request from '@/utils/request';
  * 查询字典列表
  * @param params 查询条件
  */
-export async function listDictionaries () {
-  const res = await request.get('/system/dict/getPage', {});
+export async function listDictionaries(params) {
+  const res = await request.get('/system/dict/getPage', { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -16,7 +16,7 @@ export async function listDictionaries () {
  * 添加字典
  * @param data 字典信息
  */
-export async function addDictionary (data) {
+export async function addDictionary(data) {
   const res = await request.post('/system/dict/submit', data);
   if (res.data.code == 0) {
     return res.data.message;
@@ -28,7 +28,7 @@ export async function addDictionary (data) {
  * 修改字典
  * @param data 字典信息
  */
-export async function updateDictionary (data) {
+export async function updateDictionary(data) {
   const res = await request.post('/system/dict/update', data);
   if (res.data.code == 0) {
     return res.data.message;
@@ -40,7 +40,7 @@ export async function updateDictionary (data) {
  * 删除字典
  * @param id 字典id
  */
-export async function removeDictionary (id, f) {
+export async function removeDictionary(id, f) {
   let res;
   if (f) {
     res = await request.post('/system/dict/removeDictInfoById', id);

+ 41 - 6
src/views/system/dictionary/components/dict-data-search.vue

@@ -2,23 +2,48 @@
 <template>
   <el-form
     size="small"
+    label-width="77px"
     class="ele-form-search"
     @keyup.enter.native="search"
     @submit.native.prevent
   >
     <el-row :gutter="10">
-      <el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
-        <el-form-item>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item label="编码">
           <el-input
             clearable
             size="small"
-            v-model="where.keywords"
-            placeholder="输入关键字搜索"
+            v-model="where.code"
+            placeholder="输入"
           />
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { md: 16 } : { span: 16 }">
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item label="名称">
+          <el-input
+            clearable
+            size="small"
+            v-model="where.name"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item label="应用类型">
+          <el-select v-model="where.appType" placeholder="请选择">
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
         <el-form-item>
+          <el-button @click="reset">重置</el-button>
           <el-button
             size="small"
             type="primary"
@@ -40,9 +65,16 @@
     data() {
       // 默认表单数据
       const defaultWhere = {
-        keywords: ''
+        name: '',
+        code: '',
+        appType: ''
       };
       return {
+        options: [
+          { value: 0, label: '全部' },
+          { value: 1, label: '业务字典' },
+          { value: 2, label: '数据字典' }
+        ],
         defaultWhere,
         // 表单数据
         where: { ...defaultWhere }
@@ -57,6 +89,9 @@
     methods: {
       /* 搜索 */
       search() {
+        if (this.where.appType === 0) {
+          this.where.appType = '';
+        }
         this.$emit('search', this.where);
       },
       /*  重置 */

+ 1 - 1
src/views/system/dictionary/components/dict-data.vue

@@ -166,7 +166,7 @@
     methods: {
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
-        return listDictionaries();
+        return listDictionaries({ pageNum: page, size: limit, ...where });
       },
       /* 刷新表格 */
       reload(where) {

+ 5 - 3
src/views/system/dictionary/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="ele-body">
+    <DictDataSearch @search="reload" />
     <el-card shadow="never">
       <div style="margin: 5px 0; padding-left: 262px">
         <el-button
@@ -69,11 +70,12 @@
 <script>
   import DictData from './components/dict-data.vue';
   import DictEdit from './components/dict-edit.vue';
+  import DictDataSearch from './components/dict-data-search.vue';
   import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
 
   export default {
     name: 'SystemDictionary',
-    components: { DictData, DictEdit },
+    components: { DictData, DictEdit, DictDataSearch },
     data() {
       return {
         // 表格列配置
@@ -113,9 +115,9 @@
         }
       },
       /* 刷新表格 */
-      reload() {
+      reload(where) {
         this.$refs.table.reload();
-        this.$refs.dictData.reload();
+        this.$refs.dictData.reload(where);
       },
       /* 显示编辑 */
       openEdit(row) {

+ 3 - 3
vue.config.js

@@ -17,9 +17,9 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.3.51:18086', // 跨域请求的地址
         // target: 'http://192.168.3.35:8080', // kang杨威
-        // target: 'http://192.168.3.25:8080', // 黄峥嵘
+        target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        target: 'http://192.168.3.33:8080', // 谢一平
+        // target: 'http://192.168.3.33:8080', // 谢一平
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
@@ -28,7 +28,7 @@ module.exports = {
       }
     }
   },
-  chainWebpack (config) {
+  chainWebpack(config) {
     config.plugins.delete('prefetch');
     if (process.env.NODE_ENV !== 'development') {
       // gzip 压缩