feat: 字典模型初版

master
baize 2024-05-01 11:26:59 +08:00
parent 029b5aaaa8
commit 86545423b5
1 changed files with 21 additions and 28 deletions

View File

@ -32,7 +32,7 @@
<el-col :span="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>基础字典</span>
<span> <span></span>基础字典</span>
<el-popover
placement="top-start"
title="基础字典"
@ -50,47 +50,49 @@
<el-input v-model="dictAddName"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict"></el-button>
<el-button @click="addDict(bb,dictAddName)"></el-button>
</el-col>
</el-row>
<el-button style="float: right; padding: 3px 0" type="text" slot="reference" >新增字典</el-button>
</el-popover>
</div>
<el-row :gutter="20">
<el-col v-for="(val,key) in dictMap" :md="8" :sm="24" :xs="12">
<el-col :key="index" v-for="(item ,index) in dictionaryTypeList" :md="8" :sm="24" :xs="12">
<el-card class="box-card" style="height: 300px">
<div slot="header" class="clearfix">
<span>{{key}}</span>
<span>{{item.dictionaryName}}({{item.dictionaryType}})</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="val.push({ label: null, val: null, isEdit: true })"
@click="item.dictionaryDataList.push( {dictionaryLabel: null, dictionaryValue: null, status :0 })"
>新增</el-button>
</div>
<el-table :data="val" style="width: 100%" height="280px">
<el-table-column prop="label" label="标签">
<el-table :data="item.dictionaryDataList" style="width: 100%" height="280px">
<el-table-column prop="dictionaryName" label="标签">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{scope.row.label}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.label" size="mini"></el-input>
<span v-if="scope.row.status === 0">{{scope.row.dictionaryLabel}}</span>
<el-input v-if="scope.row.status ===1" v-model="scope.row.dictionaryLabel" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="值">
<el-table-column prop="dictionaryValue" label="值">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{scope.row.val}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.val" size="mini"></el-input>
<span v-if="scope.row.status === 0">{{scope.row.dictionaryValue}}</span>
<el-input v-if="scope.row.status === 1" v-model="scope.row.dictionaryValue" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="操作">
<template slot-scope="scope">
<el-button
v-if="!scope.row.isEdit"
v-if="scope.row.status === 0"
size="mini"
type="text"
icon="el-icon-edit"
@click="scope.row.isEdit = true"
@click="scope.row.status =1"
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="editConfirm(scope.row)"
v-if="scope.row.status === 1"
@click="editConfirm(item,scope.row)"
size="mini"
type="text"
icon="el-icon-finished"
@ -137,6 +139,7 @@ export default {
childrenList:{
},
dictionaryTypeList: [],
},
data() {
return {
@ -144,17 +147,7 @@ export default {
activeName: '0',
table:null,
databaseTable:[],
dictMap: {
"性别(system_sex)": [
{ label: '男', val: '1', isEdit: false },
{ label: '女', val: '2', isEdit: false },
{ label: '未知', val: '0', isEdit: false },
],
"开关(system_y_n)": [
{ label: '是', val: '1', isEdit: false },
{ label: '否', val: '0', isEdit: false }
],
}
}
},
created() {