b77f9725 by 任超

style:字典

1 parent f968dc8e
...@@ -5,4 +5,4 @@ NODE_ENV=development ...@@ -5,4 +5,4 @@ NODE_ENV=development
5 VUE_APP_BASE_API = '/dev-api' 5 VUE_APP_BASE_API = '/dev-api'
6 6
7 # 开发环境 7 # 开发环境
8 VUE_APP_API_BASE_URL = 'http://192.168.2.44:8009' 8 VUE_APP_API_BASE_URL = 'http://192.168.2.95:8009'
......
1 import { Message } from "element-ui"; 1 import { Message } from "element-ui";
2 export function removeTreeListItem (treeList, dictId, idName = 'bsmDict') {
3 if (!treeList || !treeList.length) {
4 return
5 }
6 for (let i = 0; i < treeList.length; i++) {
7 if (treeList[i][idName] === dictId) {
8 treeList.splice(i, 1);
9 break;
10 }
11 removeTreeListItem(treeList[i].children, dictId)
12 }
13 }
14
2 // 上移下移 15 // 上移下移
3 export function upward (index, data) { 16 export function upward (index, data) {
4 if (index > 0) { 17 if (index > 0) {
......
1 <template> 1 <template>
2 <!-- 编辑 --> 2 <!-- 编辑 -->
3 <dialogBox submitForm="submitForm" @closeDialog="closeDialog" v-model="myValue" title="字典信息"> 3 <dialogBox submitForm="submitForm" @closeDialog="closeDialog" v-model="myValue" title="字典信息">
4 <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px"> 4 <el-form :model="ruleForm" ref="ruleForm" label-width="120px">
5 <el-row :gutter="20"> 5 <el-row :gutter="20">
6 <el-col :span="12"> 6 <el-col :span="6">
7 <el-form-item label="字典类型编码" prop="dcode"> 7 <el-form-item label="字典类型编码">
8 <el-input v-model.trim="ruleForm.dcode" placeholder="字典类型编码"></el-input> 8 {{ ruleForm.dcode }}
9 </el-form-item> 9 </el-form-item>
10 </el-col> 10 </el-col>
11 <el-col :span="12"> 11 <el-col :span="6">
12 <el-form-item label="字典类型名称" prop="dname"> 12 <el-form-item label="字典类型名称">
13 <el-input v-model.trim="ruleForm.dname" placeholder="字典类型名称"></el-input> 13 {{ ruleForm.dname }}
14 </el-form-item> 14 </el-form-item>
15 </el-col> 15 </el-col>
16 </el-row> 16 </el-row>
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
22 </template> 22 </template>
23 23
24 <script> 24 <script>
25 import { upward, down, removeTreeListItem } from '@/utils/operation'
25 export default { 26 export default {
26 props: { 27 props: {
27 value: { type: Boolean, default: false }, 28 value: { type: Boolean, default: false },
...@@ -93,6 +94,53 @@ export default { ...@@ -93,6 +94,53 @@ export default {
93 } 94 }
94 }, 95 },
95 { 96 {
97 prop: 'isenable',
98 width: '160px',
99 label: '是否禁用',
100 render: (h, scope) => {
101 return (
102 <el-radio-group v-model={scope.row.isenable}>
103 <el-radio label="1">启用</el-radio>
104 <el-radio label="0">禁用</el-radio>
105 </el-radio-group>
106 )
107 }
108 },
109 {
110 prop: 'normcode',
111 label: '部标编码',
112 render: (h, scope) => {
113 return (
114 <div>
115 <el-input placeholder="部标编码" disabled={this.details.isenable == 2} v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]}
116 onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
117 onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
118
119 <el-input placeholder="部标编码" disabled={this.details.isenable == 2} v-show={!scope.row.nameShow} value={scope.row[scope.column.property]}
120 onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
121 onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
122 </div>
123 )
124 }
125 },
126 {
127 prop: 'normname',
128 label: '部标名称',
129 render: (h, scope) => {
130 return (
131 <div>
132 <el-input placeholder="部标名称" disabled={this.details.isenable == 2} v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]}
133 onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
134 onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
135
136 <el-input placeholder="部标名称" disabled={this.details.isenable == 2} v-show={!scope.row.nameShow} value={scope.row[scope.column.property]}
137 onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
138 onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
139 </div>
140 )
141 }
142 },
143 {
96 width: '130px', 144 width: '130px',
97 label: '移动', 145 label: '移动',
98 render: (h, scope) => { 146 render: (h, scope) => {
...@@ -118,8 +166,6 @@ export default { ...@@ -118,8 +166,6 @@ export default {
118 } 166 }
119 ], 167 ],
120 tableData: [], 168 tableData: [],
121 rules: {
122 }
123 } 169 }
124 }, 170 },
125 watch: { 171 watch: {
...@@ -128,10 +174,11 @@ export default { ...@@ -128,10 +174,11 @@ export default {
128 }, 174 },
129 details: { 175 details: {
130 handler: function (newValue) { 176 handler: function (newValue) {
131 this.tableData = newValue.dataList 177 this.tableData = _.cloneDeep(newValue.dataList)
132 if (newValue.isenable == 2) { 178 if (newValue.isenable == 2) {
133 this.column = this.column.slice(0, 3) 179 this.column = this.column.slice(0, 3)
134 } 180 }
181 this.ruleForm = newValue.rowData
135 this.addIndexes() 182 this.addIndexes()
136 }, 183 },
137 deep: true 184 deep: true
...@@ -157,6 +204,7 @@ export default { ...@@ -157,6 +204,7 @@ export default {
157 }) 204 })
158 }, 205 },
159 handleMinus (index, row) { 206 handleMinus (index, row) {
207 removeTreeListItem(this.tableData, row.bsmDict)
160 }, 208 },
161 async handleSubmit () { 209 async handleSubmit () {
162 }, 210 },
...@@ -189,21 +237,25 @@ export default { ...@@ -189,21 +237,25 @@ export default {
189 { 237 {
190 dcode: '', 238 dcode: '',
191 dname: '', 239 dname: '',
192 children: null
193 } 240 }
194 ) 241 )
195 this.addIndexes() 242 this.addIndexes()
196 }, 243 },
197 // 上移下移 244 // 上移下移
198 moveUpward (index, row) { 245 moveUpward (index, row) {
199 246 upward(index, this.tableData)
247 this.key++
200 }, 248 },
201 moveDown (index, row) { 249 moveDown (index, row) {
202 250 down(index, this.tableData)
251 this.key++
203 } 252 }
204 } 253 }
205 } 254 }
206 </script> 255 </script>
207 <style rel="stylesheet/scss" lang="scss" scoped> 256 <style rel="stylesheet/scss" lang="scss" scoped>
257 /deep/.el-radio {
258 margin-right: 5px !important;
259 }
208 </style> 260 </style>
209 261
......
...@@ -52,7 +52,8 @@ export default { ...@@ -52,7 +52,8 @@ export default {
52 isDialog: false, 52 isDialog: false,
53 details: { 53 details: {
54 dataList: [], 54 dataList: [],
55 isenable: 1 55 isenable: 1,
56 rowData: {}
56 }, 57 },
57 ruleForm: { 58 ruleForm: {
58 dcode: '', 59 dcode: '',
...@@ -76,6 +77,7 @@ export default { ...@@ -76,6 +77,7 @@ export default {
76 }, 77 },
77 moreQueryClick () { }, 78 moreQueryClick () { },
78 editClick (row, val) { 79 editClick (row, val) {
80 this.details.rowData = row
79 this.details.isenable = val 81 this.details.isenable = val
80 getChildDictList(row.bsmDict).then(res => { 82 getChildDictList(row.bsmDict).then(res => {
81 this.isDialog = true 83 this.isDialog = true
......