b77f9725 by 任超

style:字典

1 parent f968dc8e
......@@ -5,4 +5,4 @@ NODE_ENV=development
VUE_APP_BASE_API = '/dev-api'
# 开发环境
VUE_APP_API_BASE_URL = 'http://192.168.2.44:8009'
VUE_APP_API_BASE_URL = 'http://192.168.2.95:8009'
......
import { Message } from "element-ui";
export function removeTreeListItem (treeList, dictId, idName = 'bsmDict') {
if (!treeList || !treeList.length) {
return
}
for (let i = 0; i < treeList.length; i++) {
if (treeList[i][idName] === dictId) {
treeList.splice(i, 1);
break;
}
removeTreeListItem(treeList[i].children, dictId)
}
}
// 上移下移
export function upward (index, data) {
if (index > 0) {
......
<template>
<!-- 编辑 -->
<dialogBox submitForm="submitForm" @closeDialog="closeDialog" v-model="myValue" title="字典信息">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
<el-form :model="ruleForm" ref="ruleForm" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="字典类型编码" prop="dcode">
<el-input v-model.trim="ruleForm.dcode" placeholder="字典类型编码"></el-input>
<el-col :span="6">
<el-form-item label="字典类型编码">
{{ ruleForm.dcode }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字典类型名称" prop="dname">
<el-input v-model.trim="ruleForm.dname" placeholder="字典类型名称"></el-input>
<el-col :span="6">
<el-form-item label="字典类型名称">
{{ ruleForm.dname }}
</el-form-item>
</el-col>
</el-row>
......@@ -22,6 +22,7 @@
</template>
<script>
import { upward, down, removeTreeListItem } from '@/utils/operation'
export default {
props: {
value: { type: Boolean, default: false },
......@@ -93,6 +94,53 @@ export default {
}
},
{
prop: 'isenable',
width: '160px',
label: '是否禁用',
render: (h, scope) => {
return (
<el-radio-group v-model={scope.row.isenable}>
<el-radio label="1">启用</el-radio>
<el-radio label="0">禁用</el-radio>
</el-radio-group>
)
}
},
{
prop: 'normcode',
label: '部标编码',
render: (h, scope) => {
return (
<div>
<el-input placeholder="部标编码" disabled={this.details.isenable == 2} v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
<el-input placeholder="部标编码" disabled={this.details.isenable == 2} v-show={!scope.row.nameShow} value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
</div>
)
}
},
{
prop: 'normname',
label: '部标名称',
render: (h, scope) => {
return (
<div>
<el-input placeholder="部标名称" disabled={this.details.isenable == 2} v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
<el-input placeholder="部标名称" disabled={this.details.isenable == 2} v-show={!scope.row.nameShow} value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
</div>
)
}
},
{
width: '130px',
label: '移动',
render: (h, scope) => {
......@@ -118,8 +166,6 @@ export default {
}
],
tableData: [],
rules: {
}
}
},
watch: {
......@@ -128,10 +174,11 @@ export default {
},
details: {
handler: function (newValue) {
this.tableData = newValue.dataList
this.tableData = _.cloneDeep(newValue.dataList)
if (newValue.isenable == 2) {
this.column = this.column.slice(0, 3)
}
this.ruleForm = newValue.rowData
this.addIndexes()
},
deep: true
......@@ -157,6 +204,7 @@ export default {
})
},
handleMinus (index, row) {
removeTreeListItem(this.tableData, row.bsmDict)
},
async handleSubmit () {
},
......@@ -189,21 +237,25 @@ export default {
{
dcode: '',
dname: '',
children: null
}
)
this.addIndexes()
},
// 上移下移
moveUpward (index, row) {
upward(index, this.tableData)
this.key++
},
moveDown (index, row) {
down(index, this.tableData)
this.key++
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/.el-radio {
margin-right: 5px !important;
}
</style>
......
......@@ -52,7 +52,8 @@ export default {
isDialog: false,
details: {
dataList: [],
isenable: 1
isenable: 1,
rowData: {}
},
ruleForm: {
dcode: '',
......@@ -76,6 +77,7 @@ export default {
},
moreQueryClick () { },
editClick (row, val) {
this.details.rowData = row
this.details.isenable = val
getChildDictList(row.bsmDict).then(res => {
this.isDialog = true
......