feat:字典模块
Showing
6 changed files
with
342 additions
and
1 deletions
| ... | @@ -13,6 +13,13 @@ Vue.mixin(mixin); | ... | @@ -13,6 +13,13 @@ Vue.mixin(mixin); |
| 13 | import { theme } from "@/directive/theme.js" | 13 | import { theme } from "@/directive/theme.js" |
| 14 | Vue.directive("theme", theme) | 14 | Vue.directive("theme", theme) |
| 15 | 15 | ||
| 16 | Vue.directive('fo', { | ||
| 17 | inserted (el, binding, vnode) { | ||
| 18 | // 聚焦元素 | ||
| 19 | el.querySelector('input').focus() | ||
| 20 | } | ||
| 21 | }) | ||
| 22 | |||
| 16 | import './image/icons' // icon | 23 | import './image/icons' // icon |
| 17 | import store from './store' | 24 | import store from './store' |
| 18 | import router from './router' | 25 | import router from './router' | ... | ... |
| ... | @@ -213,7 +213,7 @@ export const asyncRoutes = [ | ... | @@ -213,7 +213,7 @@ export const asyncRoutes = [ |
| 213 | path: 'dictionaries', | 213 | path: 'dictionaries', |
| 214 | id: '91', | 214 | id: '91', |
| 215 | parentId: '9', | 215 | parentId: '9', |
| 216 | component: () => import('@/views/system/dictionaries.vue'), | 216 | component: () => import('@/views/system/dictionaries/dictionaries.vue'), |
| 217 | name: 'dictionaries', | 217 | name: 'dictionaries', |
| 218 | meta: { title: '字典管理' } | 218 | meta: { title: '字典管理' } |
| 219 | }, | 219 | }, | ... | ... |
src/views/system/dictionaries.vue
deleted
100644 → 0
File mode changed
| 1 | <template> | ||
| 2 | <!-- 编辑 --> | ||
| 3 | <dialogBox submitForm="submitForm" @closeDialog="closeDialog" v-model="myValue" title="字典信息"> | ||
| 4 | <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px"> | ||
| 5 | <el-row :gutter="20"> | ||
| 6 | <el-col :span="12"> | ||
| 7 | <el-form-item label="字典类型编码" prop="dcode"> | ||
| 8 | <el-input v-model.trim="ruleForm.dcode" placeholder="字典类型编码"></el-input> | ||
| 9 | </el-form-item> | ||
| 10 | </el-col> | ||
| 11 | <el-col :span="12"> | ||
| 12 | <el-form-item label="字典类型名称" prop="dname"> | ||
| 13 | <el-input v-model.trim="ruleForm.dname" placeholder="字典类型名称"></el-input> | ||
| 14 | </el-form-item> | ||
| 15 | </el-col> | ||
| 16 | </el-row> | ||
| 17 | </el-form> | ||
| 18 | <lb-table :column="column" :heightNum="520" :key="key" :expand-row-keys="keyList" row-key="dictid" | ||
| 19 | :tree-props="{ children: 'children' }" :pagination="false" :data="tableData"> | ||
| 20 | </lb-table> | ||
| 21 | </dialogBox> | ||
| 22 | </template> | ||
| 23 | |||
| 24 | <script> | ||
| 25 | export default { | ||
| 26 | props: { | ||
| 27 | value: { type: Boolean, default: false }, | ||
| 28 | }, | ||
| 29 | data () { | ||
| 30 | return { | ||
| 31 | key: 0, | ||
| 32 | myValue: this.value, | ||
| 33 | keyList: [], | ||
| 34 | ruleForm: { | ||
| 35 | dcode: '', | ||
| 36 | dname: '' | ||
| 37 | }, | ||
| 38 | column: [ | ||
| 39 | { | ||
| 40 | width: '60', | ||
| 41 | renderHeader: (h, scope) => { | ||
| 42 | return <i class="el-icon-plus" onClick={() => { this.handleAdd() }} style="cursor:pointer;color:#409EFF"></i> | ||
| 43 | }, | ||
| 44 | render: (h, scope) => { | ||
| 45 | return ( | ||
| 46 | <span>{scope.row.index}</span> | ||
| 47 | ) | ||
| 48 | } | ||
| 49 | }, | ||
| 50 | { | ||
| 51 | prop: 'dcode', | ||
| 52 | label: '字典项编码', | ||
| 53 | render: (h, scope) => { | ||
| 54 | return ( | ||
| 55 | <div> | ||
| 56 | <el-input placeholder="字典项编码" v-show={scope.row.codeShow} v-fo value={scope.row[scope.column.property]} | ||
| 57 | onFocus={() => { this.itemShowFalse(); scope.row.codeShow = true; }} | ||
| 58 | onInput={(val) => { scope.row[scope.column.property] = val }}></el-input> | ||
| 59 | |||
| 60 | |||
| 61 | <el-input placeholder="字典项编码" v-show={!scope.row.codeShow} value={scope.row[scope.column.property]} | ||
| 62 | onFocus={() => { this.itemShowFalse(); scope.row.codeShow = true; }} | ||
| 63 | onInput={(val) => { scope.row[scope.column.property] = val }}></el-input> | ||
| 64 | </div> | ||
| 65 | ) | ||
| 66 | } | ||
| 67 | }, | ||
| 68 | { | ||
| 69 | prop: 'dname', | ||
| 70 | label: '字典项名称', | ||
| 71 | render: (h, scope) => { | ||
| 72 | return ( | ||
| 73 | <div> | ||
| 74 | <el-input placeholder="字典项编码" v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]} | ||
| 75 | onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }} | ||
| 76 | onInput={(val) => { scope.row[scope.column.property] = val }}></el-input> | ||
| 77 | |||
| 78 | <el-input placeholder="字典项名称" v-show={!scope.row.nameShow} value={scope.row[scope.column.property]} | ||
| 79 | onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }} | ||
| 80 | onInput={(val) => { scope.row[scope.column.property] = val }}></el-input> | ||
| 81 | </div> | ||
| 82 | ) | ||
| 83 | } | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | width: '130px', | ||
| 87 | label: '移动', | ||
| 88 | render: (h, scope) => { | ||
| 89 | return ( | ||
| 90 | <div> | ||
| 91 | <el-button type='text' disabled={scope.$index == 0} onClick={() => { this.moveUpward(scope.$index, scope.row) }}>上移</el-button> | ||
| 92 | <el-button type='text' disabled={(scope.$index + 1) == this.tableData.length} onClick={() => { this.moveDown(scope.$index, scope.row) }}>下移</el-button > | ||
| 93 | </div > | ||
| 94 | ) | ||
| 95 | } | ||
| 96 | }, | ||
| 97 | { | ||
| 98 | width: '150px', | ||
| 99 | label: '操作', | ||
| 100 | render: (h, scope) => { | ||
| 101 | return ( | ||
| 102 | <div> | ||
| 103 | <el-button type="text" style="margin-right:10px" onClick={() => { this.handleAddSubordinate(scope.row) }}>增加下级</el-button> | ||
| 104 | <el-button type="text" style="margin-left:0" onClick={() => { this.handleMinus(scope.$index, scope.row) }}>删除</el-button> | ||
| 105 | </div> | ||
| 106 | ) | ||
| 107 | } | ||
| 108 | } | ||
| 109 | ], | ||
| 110 | tableData: [], | ||
| 111 | rules: { | ||
| 112 | } | ||
| 113 | } | ||
| 114 | }, | ||
| 115 | watch: { | ||
| 116 | value (val) { | ||
| 117 | this.myValue = val | ||
| 118 | } | ||
| 119 | }, | ||
| 120 | methods: { | ||
| 121 | // 添加索引 | ||
| 122 | addIndexes () { | ||
| 123 | this.tableData.forEach((item, index) => { | ||
| 124 | if (index == 0) { | ||
| 125 | item.codeShow = true | ||
| 126 | } else { | ||
| 127 | item.codeShow = false | ||
| 128 | item.nameShow = false | ||
| 129 | } | ||
| 130 | item.index = index + 1 | ||
| 131 | }) | ||
| 132 | }, | ||
| 133 | itemShowFalse () { | ||
| 134 | this.tableData.forEach((item, index) => { | ||
| 135 | item.codeShow = false | ||
| 136 | item.nameShow = false | ||
| 137 | }) | ||
| 138 | }, | ||
| 139 | handleMinus (index, row) { | ||
| 140 | }, | ||
| 141 | async handleSubmit () { | ||
| 142 | }, | ||
| 143 | closeDialog () { | ||
| 144 | this.$emit('input', false) | ||
| 145 | }, | ||
| 146 | // 增加下级 | ||
| 147 | handleAddSubordinate (row) { | ||
| 148 | if (!row.children) { | ||
| 149 | row.children = [] | ||
| 150 | } | ||
| 151 | row.children.push( | ||
| 152 | { | ||
| 153 | dcode: '', | ||
| 154 | dname: '', | ||
| 155 | typeid: row.typeid, | ||
| 156 | children: null | ||
| 157 | } | ||
| 158 | ) | ||
| 159 | this.keyList = []; | ||
| 160 | this.keyList.push(row.dictid) | ||
| 161 | }, | ||
| 162 | // 增加 | ||
| 163 | handleAdd () { | ||
| 164 | this.$nextTick(() => { | ||
| 165 | let container = this.$el.querySelector('.el-table__body-wrapper'); | ||
| 166 | container.scrollTop = container.scrollHeight; | ||
| 167 | }) | ||
| 168 | this.tableData.push( | ||
| 169 | { | ||
| 170 | dcode: '', | ||
| 171 | dname: '', | ||
| 172 | children: null | ||
| 173 | } | ||
| 174 | ) | ||
| 175 | this.addIndexes() | ||
| 176 | }, | ||
| 177 | // 上移下移 | ||
| 178 | moveUpward (index, row) { | ||
| 179 | |||
| 180 | }, | ||
| 181 | moveDown (index, row) { | ||
| 182 | |||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | </script> | ||
| 187 | <style rel="stylesheet/scss" lang="scss" scoped> | ||
| 188 | </style> | ||
| 189 |
| 1 | import filter from '@/utils/filter.js' | ||
| 2 | let vm = null | ||
| 3 | |||
| 4 | const sendThis = (_this) => { | ||
| 5 | vm = _this | ||
| 6 | } | ||
| 7 | class data extends filter { | ||
| 8 | constructor() { | ||
| 9 | super() | ||
| 10 | } | ||
| 11 | columns () { | ||
| 12 | return [ | ||
| 13 | { | ||
| 14 | label: '序号', | ||
| 15 | type: 'index', | ||
| 16 | width: '50', | ||
| 17 | render: (h, scope) => { | ||
| 18 | return ( | ||
| 19 | <div> | ||
| 20 | {(vm.pageData.currentPage - 1) * vm.pageData.pageSize + scope.$index + 1} | ||
| 21 | </div> | ||
| 22 | ) | ||
| 23 | } | ||
| 24 | }, | ||
| 25 | { | ||
| 26 | prop: "zdlxbm", | ||
| 27 | label: "字典类型编码", | ||
| 28 | }, | ||
| 29 | { | ||
| 30 | prop: "zdlxmc", | ||
| 31 | label: "字典类型名称", | ||
| 32 | }, | ||
| 33 | { | ||
| 34 | prop: "sfyxxg", | ||
| 35 | label: "是否允许修改", | ||
| 36 | render: (h, scope) => { | ||
| 37 | return ( | ||
| 38 | <div> | ||
| 39 | {scope.row.sfyxxg} | ||
| 40 | </div> | ||
| 41 | ) | ||
| 42 | } | ||
| 43 | }, | ||
| 44 | { | ||
| 45 | label: '操作', | ||
| 46 | width: '150', | ||
| 47 | align: 'center', | ||
| 48 | fixed: 'right', | ||
| 49 | render: (h, scope) => { | ||
| 50 | return ( | ||
| 51 | <div> | ||
| 52 | <el-button type="text" icon="el-icon-edit-outline" onClick={() => { vm.editClick(scope) }}>修改</el-button> | ||
| 53 | </div> | ||
| 54 | ) | ||
| 55 | } | ||
| 56 | } | ||
| 57 | ] | ||
| 58 | } | ||
| 59 | |||
| 60 | } | ||
| 61 | let datas = new data() | ||
| 62 | export { | ||
| 63 | datas, | ||
| 64 | sendThis | ||
| 65 | } |
| 1 | <template> | ||
| 2 | <div class="from-clues"> | ||
| 3 | <!-- 表单部分 --> | ||
| 4 | <div class="from-clues-header"> | ||
| 5 | <el-form :model="ruleForm" ref="ruleForm"> | ||
| 6 | <el-row> | ||
| 7 | <el-col :span="6"> | ||
| 8 | <el-form-item label="字典类型编码"> | ||
| 9 | <el-input v-model="ruleForm.zdlxbm" placeholder="字典类型编码"></el-input> | ||
| 10 | </el-form-item> | ||
| 11 | </el-col> | ||
| 12 | <el-col :span="6"> | ||
| 13 | <el-form-item label="字典类型名称"> | ||
| 14 | <el-input v-model="ruleForm.zdlxmc" placeholder="字典类型名称"></el-input> | ||
| 15 | </el-form-item> | ||
| 16 | </el-col> | ||
| 17 | <el-col :span="12" class="btnCol"> | ||
| 18 | <el-form-item> | ||
| 19 | <el-button type="primary" @click="fetchData()">查询</el-button> | ||
| 20 | <el-button @click="moreQueryClick()">高级查询</el-button> | ||
| 21 | </el-form-item> | ||
| 22 | </el-col> | ||
| 23 | </el-row> | ||
| 24 | </el-form> | ||
| 25 | </div> | ||
| 26 | <!-- 表格 --> | ||
| 27 | <div class="from-clues-content"> | ||
| 28 | <lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="tableData.total" | ||
| 29 | @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns" | ||
| 30 | :data="tableData.data"> | ||
| 31 | </lb-table> | ||
| 32 | </div> | ||
| 33 | <editDialog v-model="isDialog" /> | ||
| 34 | </div> | ||
| 35 | </template> | ||
| 36 | <script> | ||
| 37 | import table from "@/utils/mixin/table" | ||
| 38 | import { datas, sendThis } from "./dictionaries" | ||
| 39 | import editDialog from "./components/editDialog.vue" | ||
| 40 | export default { | ||
| 41 | name: "djbcx", | ||
| 42 | components: { | ||
| 43 | editDialog | ||
| 44 | }, | ||
| 45 | mixins: [table], | ||
| 46 | mounted () { | ||
| 47 | sendThis(this); | ||
| 48 | }, | ||
| 49 | data () { | ||
| 50 | return { | ||
| 51 | isDialog: false, | ||
| 52 | ruleForm: { | ||
| 53 | zdlxbm: '', | ||
| 54 | zdlxmc: '' | ||
| 55 | }, | ||
| 56 | tableData: { | ||
| 57 | total: 0, | ||
| 58 | columns: datas.columns(), | ||
| 59 | data: [ | ||
| 60 | { | ||
| 61 | zdlxbm: "66666666666666", | ||
| 62 | } | ||
| 63 | ] | ||
| 64 | } | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | methods: { | ||
| 68 | // 初始化数据 | ||
| 69 | fetchData () { | ||
| 70 | }, | ||
| 71 | moreQueryClick () { }, | ||
| 72 | editClick () { | ||
| 73 | this.isDialog = true | ||
| 74 | } | ||
| 75 | }, | ||
| 76 | }; | ||
| 77 | </script> | ||
| 78 | <style scoped lang="scss"> | ||
| 79 | @import "~@/styles/public.scss"; | ||
| 80 | </style> |
-
Please register or sign in to post a comment