Blame view

src/views/system/dictionaries/dictionaries.vue 2.83 KB
任超 committed
1 2 3 4
<template>
  <div class="from-clues">
    <!-- 表单部分 -->
    <div class="from-clues-header">
任超 committed
5
      <el-form :model="ruleForm">
任超 committed
6
        <el-row :gutter="20">
任超 committed
7 8
          <el-col :span="6">
            <el-form-item label="字典类型编码">
任超 committed
9
              <el-input v-model="ruleForm.dcode" placeholder="字典类型编码"></el-input>
任超 committed
10 11 12 13
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="字典类型名称">
任超 committed
14
              <el-input v-model="ruleForm.dname" placeholder="字典类型名称"></el-input>
任超 committed
15 16 17 18
            </el-form-item>
          </el-col>
          <el-col :span="12" class="btnCol">
            <el-form-item>
任超 committed
19
              <el-button type="primary" icon="el-icon-search" @click="fetchData">查询</el-button>
任超 committed
20
              <el-button icon="el-icon-refresh" @click="handleRefresh">刷新缓存</el-button>
任超 committed
21 22 23 24 25 26 27
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 表格 -->
    <div class="from-clues-content">
28 29 30
      <lb-table :page-size="pageData.pageSize" :current-page.sync="pageData.currentPage" :total="tableData.total"
        @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
        :data="tableData.data">
任超 committed
31 32
      </lb-table>
    </div>
任超 committed
33
    <editDialog v-model="isDialog" :details="details" />
任超 committed
34 35 36 37
  </div>
</template>
<script>
import table from "@/utils/mixin/table"
任超 committed
38
import { getQlxxDictList, getChildDictList } from "@/api/dict.js"
任超 committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52
import { datas, sendThis } from "./dictionaries"
import editDialog from "./components/editDialog.vue"
export default {
  name: "djbcx",
  components: {
    editDialog
  },
  mixins: [table],
  mounted () {
    sendThis(this);
  },
  data () {
    return {
      isDialog: false,
任超 committed
53 54
      details: {
        dataList: [],
任超 committed
55 56
        isenable: 1,
        rowData: {}
任超 committed
57
      },
任超 committed
58
      ruleForm: {
任超 committed
59 60
        dcode: '',
        dname: ''
任超 committed
61 62 63 64
      },
      tableData: {
        total: 0,
        columns: datas.columns(),
任超 committed
65
        data: []
任超 committed
66 67 68 69 70 71
      }
    }
  },
  methods: {
    // 初始化数据
    fetchData () {
任超 committed
72 73
      getQlxxDictList({ ...this.ruleForm, ...this.pageData }).then(res => {
        let { records, total } = res.result
任超 committed
74 75
        this.tableData.data = records ? records : []
        this.tableData.total = total ? total : 0
任超 committed
76
      })
任超 committed
77
    },
任超 committed
78 79 80 81 82 83
    async handleRefresh () {
      let refech = await this.$store.dispatch('dict/generateDic')
      refech && this.$message({
        message: '刷新成功',
        type: 'success'
      });
任超 committed
84
    },
任超 committed
85
    editClick (row, val) {
任超 committed
86
      this.details.rowData = row
任超 committed
87 88 89 90
      this.details.isenable = val
      getChildDictList(row.bsmDict).then(res => {
        this.isDialog = true
        let { result } = res
任超 committed
91
        this.details.dataList = result ? result : []
任超 committed
92
      })
任超 committed
93
    }
任超 committed
94
  }
任超 committed
95 96 97 98 99
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>