!33 Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

Merge pull request !33 from QuAoLi/auto-5159892-develop-1629788990634
This commit is contained in:
QuAoLi 2021-08-24 07:11:25 +00:00 committed by Gitee
commit 300ff20db3
8 changed files with 84 additions and 184 deletions

View File

@ -2,7 +2,6 @@ import request from '@/utils/request'
const dictionaryApi = { const dictionaryApi = {
add: '/sys/dictionary/add', add: '/sys/dictionary/add',
get: '/sys/dictionary/get',
update: '/sys/dictionary/edit', update: '/sys/dictionary/edit',
del: '/sys/dictionary/del', del: '/sys/dictionary/del',
page: '/sys/dictionary/pageList' page: '/sys/dictionary/pageList'
@ -15,13 +14,6 @@ export function dictionaryAdd (params) {
data: params data: params
}) })
} }
export function dictionaryGet (params) {
return request({
url: dictionaryApi.get,
method: 'post',
data: params
})
}
export function dictionaryUpdate (params) { export function dictionaryUpdate (params) {
return request({ return request({
url: dictionaryApi.update, url: dictionaryApi.update,
@ -33,13 +25,14 @@ export function dictionaryDel (params) {
return request({ return request({
url: dictionaryApi.del, url: dictionaryApi.del,
method: 'post', method: 'post',
data: params params: params
}) })
} }
export function dictionaryPage (params) { export function dictionaryPage (params) {
console.log(params)
return request({ return request({
url: dictionaryApi.page, url: dictionaryApi.page,
method: 'get', method: 'get',
data: params params: params
}) })
} }

View File

@ -1,11 +1,10 @@
import request from '@/utils/request' import request from '@/utils/request'
const dictionaryItemApi = { const dictionaryItemApi = {
add: '/sys/dictionaryItem/add', add: 'sys/dictionary/item/add',
get: '/sys/dictionaryItem/get', update: 'sys/dictionary/item/edit',
update: '/sys/dictionaryItem/edit', del: 'sys/dictionary/item/del',
del: '/sys/dictionaryItem/del', page: 'sys/dictionary/item/pageList'
page: '/sys/dictionaryItem/pageList'
} }
export function dictionaryItemAdd (params) { export function dictionaryItemAdd (params) {
@ -15,13 +14,6 @@ export function dictionaryItemAdd (params) {
data: params data: params
}) })
} }
export function dictionaryItemGet (params) {
return request({
url: dictionaryItemApi.get,
method: 'post',
data: params
})
}
export function dictionaryItemUpdate (params) { export function dictionaryItemUpdate (params) {
return request({ return request({
url: dictionaryItemApi.update, url: dictionaryItemApi.update,
@ -33,13 +25,13 @@ export function dictionaryItemDel (params) {
return request({ return request({
url: dictionaryItemApi.del, url: dictionaryItemApi.del,
method: 'post', method: 'post',
data: params params: params
}) })
} }
export function dictionaryItemPage (params) { export function dictionaryItemPage (params) {
return request({ return request({
url: dictionaryItemApi.page, url: dictionaryItemApi.page,
method: 'get', method: 'get',
data: params params: params
}) })
} }

View File

@ -1,40 +0,0 @@
<template>
<a-drawer
title="词典分类详情"
width="640"
placement="right"
:visible="visible"
@close="onClose">
<a-descriptions :column="{ sm: 2, xs: 1 }">
<a-descriptions-item label="词典名称">{{ model.dictionaryName }}</a-descriptions-item>
<a-descriptions-item label="词典标识">{{ model.dictionaryCode }}</a-descriptions-item>
<a-descriptions-item label="创建时间">{{ model.createTime | moment('YYYY-MM-DD HH:mm:ss') }}</a-descriptions-item>
<a-descriptions-item label="最近修改">{{ model.updateTime | moment('YYYY-MM-DD HH:mm:ss') }}</a-descriptions-item>
</a-descriptions>
</a-drawer>
</template>
<script>
import { dictionaryGet } from '@/api/sys/dictionary'
export default {
data () {
return {
model: {},
visible: false
}
},
methods: {
show (id) {
this.visible = true
dictionaryGet({ id: id }).then(data => {
this.model = data.data
})
},
onClose () {
this.model = {}
this.visible = false
}
}
}
</script>

View File

@ -1,5 +1,5 @@
<template> <template>
<a-modal centered :visible="visible" :title="modalTitle" :width="720" @close="onCancel"> <a-modal :visible="visible" :title="modalTitle" @ok="onSubmit" @cancel="onCancel">
<a-form-model <a-form-model
ref="ruleForm" ref="ruleForm"
:model="form" :model="form"
@ -9,25 +9,29 @@
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="dictionaryName" label="词典名称" prop="dictionaryName"> <a-form-model-item ref="dictionaryName" label="词典名称" prop="dictionaryName">
<a-input v-model="form.dictionaryName"/> <a-input v-if="operable" v-model="form.dictionaryName"/>
</a-form-model-item> <span v-else>{{ form.dictionaryName }}</span>
</a-col>
<a-col :span="12">
<a-form-model-item ref="dictionaryCode" label="词典标识" prop="dictionaryCode">
<a-input v-model="form.dictionaryCode"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<!-- <a-row>
<a-col :span="12">
<a-form-model-item ref="dictionaryCode" label="词典标识" prop="dictionaryCode">
<a-input v-if="operable" v-model="form.dictionaryCode"/>
<span v-else>{{ form.dictionaryCode }}</span>
</a-form-model-item>
</a-col>
</a-row> -->
</a-form-model> </a-form-model>
<div class="draw-button-container align-center"> <div class="draw-button-container align-center">
<a-button @click="onCancel">取消</a-button> <a-button @click="onCancel">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button> <a-button type="primary" @click="onSubmit" :disabled="!operable">保存</a-button>
</div> </div>
</a-drawer> </a-modal>
</a-modal></template> </template>
<script> <script>
import { dictionaryAdd, dictionaryUpdate, dictionaryGet } from '@/api/sys/dictionary' import { dictionaryAdd, dictionaryUpdate } from '@/api/sys/dictionary'
export default { export default {
props: { props: {
@ -40,19 +44,16 @@ export default {
return { return {
modalTitle: '新增', modalTitle: '新增',
visible: false, visible: false,
operable: false,
labelCol: { span: 8 }, labelCol: { span: 8 },
wrapperCol: { span: 16 }, wrapperCol: { span: 16 },
form: { form: {
dictionaryName: '', dictionaryName: ''
dictionaryCode: ''
}, },
rules: { rules: {
dictionaryName: [ dictionaryName: [
{ required: true, message: '请输入词典名称', trigger: 'blur' }, { required: true, message: '请输入词典名称', trigger: 'blur' },
{ max: 25, message: '长度不能超过25', trigger: 'blur' } { max: 25, message: '长度不能超过25', trigger: 'blur' }
],
dictionaryCode: [
{ required: true, message: '请输入词典标识', trigger: 'blur' }
] ]
} }
} }
@ -61,19 +62,25 @@ export default {
add () { add () {
this.modalTitle = '新增' this.modalTitle = '新增'
this.visible = true this.visible = true
this.operable = true
this.form.id = undefined this.form.id = undefined
}, },
edit (obj) { edit (obj) {
this.modalTitle = '修改' this.modalTitle = '修改'
this.visible = true this.visible = true
dictionaryGet({ id: obj.id }).then(data => { this.operable = true
const form = data.data this.form = obj
this.form = form },
}) detail (obj) {
this.modalTitle = '详情'
this.visible = true
this.operable = false
this.form = obj
}, },
onSubmit (e) { onSubmit (e) {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
console.log(this.form)
if (this.form.id) { if (this.form.id) {
dictionaryUpdate(this.form).then(data => { dictionaryUpdate(this.form).then(data => {
this.$emit('ok') this.$emit('ok')
@ -91,12 +98,8 @@ export default {
}) })
}, },
onCancel () { onCancel () {
this.$refs.ruleForm.resetFields() this.form = {}
delete this.form.id
this.visible = false this.visible = false
},
onReset () {
this.$refs.ruleForm.resetFields()
} }
} }
} }

View File

@ -38,13 +38,12 @@
<a href="javascript:;">删除</a> <a href="javascript:;">删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record.id)">详情</a> <a href="javascript:;" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<router-link :to="'/dictionary/dictionaryItem/list/' + record.id">词典项</router-link> <router-link :to="'/dictionary/dictionaryItem/list/' + record.dictionaryCode">词典项</router-link>
</template> </template>
</s-table> </s-table>
<dictionary-form ref="modal" @ok="handleOk" /> <dictionary-form ref="modal" @ok="handleOk" />
<dictionary-detail ref="detail" />
</a-card> </a-card>
</page-header-wrapper> </page-header-wrapper>
</template> </template>
@ -53,18 +52,16 @@
import { dictionaryPage, dictionaryDel } from '@/api/sys/dictionary' import { dictionaryPage, dictionaryDel } from '@/api/sys/dictionary'
import { STable } from '@/components' import { STable } from '@/components'
import DictionaryForm from './DictionaryForm' import DictionaryForm from './DictionaryForm'
import DictionaryDetail from './DictionaryDetail'
export default { export default {
name: 'DictionaryList', name: 'DictionaryList',
components: { components: {
STable, STable,
DictionaryForm, DictionaryForm
DictionaryDetail
}, },
data () { data () {
return { return {
queryParam: { dictionaryName: '', dictionaryCode: '' }, queryParam: { dictionaryName: null, dictionaryCode: null },
selectedRowKeys: [], // key selectedRowKeys: [], // key
selectedRows: [], // selectedRows: [], //
columns: [ columns: [
@ -81,8 +78,7 @@ export default {
loadData: parameter => { loadData: parameter => {
return dictionaryPage(Object.assign(parameter, this.queryParam)) return dictionaryPage(Object.assign(parameter, this.queryParam))
.then(res => { .then(res => {
const data = res.data return res
return data
}) })
} }
} }
@ -104,9 +100,13 @@ export default {
handleEdit (record) { handleEdit (record) {
this.$refs.modal.edit(record) this.$refs.modal.edit(record)
}, },
//
handleDetail (record) {
this.$refs.modal.detail(record)
},
// //
handleDelete (record) { handleDelete (record) {
dictionaryDel({ id: record.id }).then(() => { dictionaryDel({ ids: record.id, deleteReason: "" }).then(() => {
this.$refs.table.refresh() this.$refs.table.refresh()
}) })
}, },
@ -114,10 +114,6 @@ export default {
handleOk () { handleOk () {
this.$refs.table.refresh() this.$refs.table.refresh()
}, },
//
handleDetail (id) {
this.$refs.detail.show(id)
},
handleRefresh () { handleRefresh () {
this.$refs.table.refresh(true) this.$refs.table.refresh(true)
} }

View File

@ -1,48 +0,0 @@
<template>
<a-drawer
title="词典项详情"
width="640"
placement="right"
:visible="visible"
@close="onClose">
<a-descriptions :column="{ sm: 2, xs: 1 }">
<a-descriptions-item label="词典项名称">{{ model.name }}</a-descriptions-item>
<a-descriptions-item label="词典项值">{{ model.value }}</a-descriptions-item>
<a-descriptions-item label="所属上级">{{ model.parentid }}</a-descriptions-item>
<a-descriptions-item label="排序">{{ model.sortid }}</a-descriptions-item>
<a-descriptions-item label="描述">{{ model.description }}</a-descriptions-item>
<a-descriptions-item label="创建时间">{{ model.createTime | moment('YYYY-MM-DD HH:mm:ss') }}</a-descriptions-item>
<a-descriptions-item label="最近修改">{{ model.updateTime | moment('YYYY-MM-DD HH:mm:ss') }}</a-descriptions-item>
</a-descriptions>
</a-drawer>
</template>
<script>
import { dictionaryItemGet } from '@/api/sys/dictionaryItem'
export default {
data () {
return {
model: {},
visible: false
}
},
filters: {
statusFilter (status) {
return statusMap[status]
}
},
methods: {
show (id) {
this.visible = true
dictionaryItemGet({ id: id }).then(data => {
this.model = data.data
})
},
onClose () {
this.model = {}
this.visible = false
}
}
}
</script>

View File

@ -1,47 +1,52 @@
<template> <template>
<a-modal :visible="visible" :title="modalTitle" :width="720" @close="onCancel"> <a-modal :visible="visible" :title="modalTitle" :width="720" @cancel="onCancel">
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol"> <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="name" label="词典项名称" prop="name"> <a-form-model-item ref="name" label="词典项名称" prop="name">
<a-input v-model="form.name"/> <a-input v-if="operable" v-model="form.name"/>
<span v-else>{{ form.name }}</span>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="value" label="词典项值" prop="value"> <a-form-model-item ref="value" label="词典项值" prop="value">
<a-input v-model="form.value"/> <a-input-number v-if="operable" v-model="form.value"/>
<span v-else>{{ form.value }}</span>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="parentid" label="所属上级" prop="parentid"> <a-form-model-item ref="parentid" label="所属上级" prop="parentid">
<a-input-number v-model="form.parentid" :min="0"/> <a-input-number v-if="operable" v-model="form.parentid" :min="0"/>
<span v-else>{{ form.parentid }}</span>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="sortid" label="排序" prop="sortid"> <a-form-model-item ref="sortid" label="排序" prop="sortid">
<a-input-number v-model="form.sortid" :min="0"/> <a-input-number v-if="operable" v-model="form.sortid" :min="0"/>
<span v-else>{{ form.sortid }}</span>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item ref="description" label="描述" prop="description" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }"> <a-form-model-item ref="description" label="描述" prop="description" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
<a-textarea :autoSize="{ minRows: 3, maxRows: 10 }" v-model="form.description"/> <a-textarea :autoSize="{ minRows: 3, maxRows: 10 }" v-model="form.description" v-if="operable"/>
<span v-else>{{ form.description }}</span>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
<div class="draw-button-container align-center"> <div class="draw-button-container align-center">
<a-button @click="onCancel">取消</a-button> <a-button @click="onCancel">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button> <a-button type="primary" @click="onSubmit" :disabled="!operable">保存</a-button>
</div> </div>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { dictionaryItemAdd, dictionaryItemUpdate, dictionaryItemGet } from '@/api/sys/dictionaryItem' import { dictionaryItemAdd, dictionaryItemUpdate } from '@/api/sys/dictionaryItem'
export default { export default {
props: { props: {
@ -54,10 +59,10 @@ export default {
return { return {
modalTitle: '新增', modalTitle: '新增',
visible: false, visible: false,
operable: false,
labelCol: { span: 8 }, labelCol: { span: 8 },
wrapperCol: { span: 16 }, wrapperCol: { span: 16 },
form: { form: {
dictionaryCode: this.$route.params.id,
name: '', name: '',
value: '', value: '',
parentid: 0, parentid: 0,
@ -69,8 +74,7 @@ export default {
{ required: true, message: '请输入词典项名称', trigger: 'blur' } { required: true, message: '请输入词典项名称', trigger: 'blur' }
], ],
value: [ value: [
{ required: true, message: '请输入词典项值', trigger: 'blur' }, { required: true, message: '请输入词典项值', trigger: 'blur' }
{ max: 4, message: '长度不能超过4', trigger: 'blur' }
], ],
parentid: [ parentid: [
{ required: true, message: '请输入所属上级', trigger: 'blur' } { required: true, message: '请输入所属上级', trigger: 'blur' }
@ -83,21 +87,29 @@ export default {
}, },
methods: { methods: {
add () { add () {
console.log(this.form)
this.modalTitle = '新增' this.modalTitle = '新增'
this.visible = true this.visible = true
this.operable = true
this.form.id = undefined this.form.id = undefined
}, },
edit (obj) { edit (obj) {
this.modalTitle = '修改' this.modalTitle = '修改'
this.visible = true this.visible = true
dictionaryItemGet({ id: obj.id }).then(data => { this.operable = true
const form = data.data this.form = obj
this.form = form },
}) detail (obj) {
this.modalTitle = '详情'
this.visible = true
this.operable = false
this.form = obj
}, },
onSubmit (e) { onSubmit (e) {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
this.form.dictionaryCode = this.$route.params.id
console.log(this.form)
if (this.form.id) { if (this.form.id) {
dictionaryItemUpdate(this.form).then(data => { dictionaryItemUpdate(this.form).then(data => {
this.$emit('ok') this.$emit('ok')
@ -115,12 +127,8 @@ export default {
}) })
}, },
onCancel () { onCancel () {
this.$refs.ruleForm.resetFields() this.form = {}
delete this.form.id
this.visible = false this.visible = false
},
onReset () {
this.$refs.ruleForm.resetFields()
} }
} }
} }

View File

@ -38,11 +38,10 @@
<a href="javascript:;">删除</a> <a href="javascript:;">删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record.id)">详情</a> <a href="javascript:;" @click="handleDetail(record)">详情</a>
</template> </template>
</s-table> </s-table>
<dictionaryItem-form ref="modal" @ok="handleOk" /> <dictionaryItem-form ref="modal" @ok="handleOk" />
<dictionaryItem-detail ref="detail" />
</a-card> </a-card>
</page-header-wrapper> </page-header-wrapper>
</template> </template>
@ -51,14 +50,12 @@
import { dictionaryItemPage, dictionaryItemDel } from '@/api/sys/dictionaryItem' import { dictionaryItemPage, dictionaryItemDel } from '@/api/sys/dictionaryItem'
import { STable } from '@/components' import { STable } from '@/components'
import DictionaryItemForm from './DictionaryItemForm' import DictionaryItemForm from './DictionaryItemForm'
import DictionaryItemDetail from './DictionaryItemDetail'
export default { export default {
name: 'DictionaryItemList', name: 'DictionaryItemList',
components: { components: {
STable, STable,
DictionaryItemForm, DictionaryItemForm
DictionaryItemDetail
}, },
data () { data () {
return { return {
@ -69,7 +66,7 @@ export default {
{ title: '词典项名称', width: 30, dataIndex: 'name', key: 'name' }, { title: '词典项名称', width: 30, dataIndex: 'name', key: 'name' },
{ title: '词典项值', width: 30, dataIndex: 'value', key: 'value' }, { title: '词典项值', width: 30, dataIndex: 'value', key: 'value' },
{ title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' }, { title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
{ title: '上级', width: 30, dataIndex: 'parentId', key: 'parentId' }, { title: '上级', width: 30, dataIndex: 'parentid', key: 'parentid' },
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' }, { title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' },
{ {
title: '操作', title: '操作',
@ -82,8 +79,7 @@ export default {
loadData: parameter => { loadData: parameter => {
return dictionaryItemPage(Object.assign(parameter, this.queryParam)) return dictionaryItemPage(Object.assign(parameter, this.queryParam))
.then(res => { .then(res => {
const data = res.data return res
return data
}) })
} }
} }
@ -105,9 +101,13 @@ export default {
handleEdit (record) { handleEdit (record) {
this.$refs.modal.edit(record) this.$refs.modal.edit(record)
}, },
//
handleDetail (record) {
this.$refs.modal.detail(record)
},
// //
handleDelete (record) { handleDelete (record) {
dictionaryItemDel({ id: record.id }).then(() => { dictionaryItemDel({ ids: record.id, deleteReason: "" }).then(() => {
this.$refs.table.refresh() this.$refs.table.refresh()
}) })
}, },
@ -115,10 +115,6 @@ export default {
handleOk () { handleOk () {
this.$refs.table.refresh() this.$refs.table.refresh()
}, },
//
handleDetail (id) {
this.$refs.detail.show(id)
},
handleRefresh () { handleRefresh () {
this.$refs.table.refresh(true) this.$refs.table.refresh(true)
}, },