ソースを参照

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

LAPTOP-16IUEB3P\Lenovo 3 年 前
コミット
26c5715209

+ 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);

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

@@ -2,22 +2,46 @@
 <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.code"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <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.name"
+            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-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
             size="small"
@@ -28,6 +52,15 @@
           >
             查询
           </el-button>
+
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh"
+            class="ele-btn-icon"
+            size="medium"
+            >重置</el-button
+          >
+
           <slot></slot>
         </el-form-item>
       </el-col>
@@ -40,9 +73,16 @@
     data() {
       // 默认表单数据
       const defaultWhere = {
-        keywords: ''
+        name: '',
+        code: '',
+        appType: ''
       };
       return {
+        options: [
+          { value: 0, label: '全部' },
+          { value: 1, label: '业务字典' },
+          { value: 2, label: '数据字典' }
+        ],
         defaultWhere,
         // 表单数据
         where: { ...defaultWhere }
@@ -57,6 +97,9 @@
     methods: {
       /* 搜索 */
       search() {
+        if (this.where.appType === 0) {
+          this.where.appType = '';
+        }
         this.$emit('search', this.where);
       },
       /*  重置 */

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

@@ -37,6 +37,9 @@
         </dict-data-search>
       </template> -->
       <!-- 操作列 -->
+      <template v-slot:appType="{ row }">
+        {{ types[row.appType] }}
+      </template>
       <template v-slot:action="{ row }">
         <el-link
           type="primary"
@@ -97,12 +100,13 @@
           {
             prop: 'code',
             label: '字典编码',
+            align: 'center',
             showOverflowTooltip: true
           },
           {
             prop: 'name',
             label: '字典名称',
-
+            align: 'center',
             showOverflowTooltip: true
           },
           // {
@@ -114,20 +118,21 @@
           // },
           {
             prop: 'appType',
+            align: 'center',
             label: '应用类型',
-
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            slot: 'appType'
           },
           {
             prop: 'remark',
             label: '描述',
-
+            align: 'center',
             showOverflowTooltip: true
           },
           {
             prop: 'updateTime',
             label: '上次更新时间',
-
+            align: 'center',
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (_row, _column, cellValue) => {
@@ -144,6 +149,10 @@
             showOverflowTooltip: true
           }
         ],
+        types: {
+          1: '业务字典',
+          2: '数据字典'
+        },
         // 表格选中数据
         selection: [],
         // 当前编辑数据
@@ -157,7 +166,7 @@
     methods: {
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
-        return listDictionaries();
+        return listDictionaries({ pageNum: page, size: limit, ...where });
       },
       /* 刷新表格 */
       reload(where) {

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

@@ -38,6 +38,7 @@
           <el-form-item label="字典值:" prop="code">
             <el-input
               clearable
+              :disabled="isUpdate"
               :maxlength="20"
               v-model="form.code"
               placeholder="请输入字典值"

+ 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) {

+ 1 - 1
vue.config.js

@@ -28,7 +28,7 @@ module.exports = {
       }
     }
   },
-  chainWebpack (config) {
+  chainWebpack(config) {
     config.plugins.delete('prefetch');
     if (process.env.NODE_ENV !== 'development') {
       // gzip 压缩