!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 = {
add: '/sys/dictionary/add',
get: '/sys/dictionary/get',
update: '/sys/dictionary/edit',
del: '/sys/dictionary/del',
page: '/sys/dictionary/pageList'
@ -15,13 +14,6 @@ export function dictionaryAdd (params) {
data: params
})
}
export function dictionaryGet (params) {
return request({
url: dictionaryApi.get,
method: 'post',
data: params
})
}
export function dictionaryUpdate (params) {
return request({
url: dictionaryApi.update,
@ -33,13 +25,14 @@ export function dictionaryDel (params) {
return request({
url: dictionaryApi.del,
method: 'post',
data: params
params: params
})
}
export function dictionaryPage (params) {
console.log(params)
return request({
url: dictionaryApi.page,
method: 'get',
data: params
params: params
})
}

View File

@ -1,11 +1,10 @@
import request from '@/utils/request'
const dictionaryItemApi = {
add: '/sys/dictionaryItem/add',
get: '/sys/dictionaryItem/get',
update: '/sys/dictionaryItem/edit',
del: '/sys/dictionaryItem/del',
page: '/sys/dictionaryItem/pageList'
add: 'sys/dictionary/item/add',
update: 'sys/dictionary/item/edit',
del: 'sys/dictionary/item/del',
page: 'sys/dictionary/item/pageList'
}
export function dictionaryItemAdd (params) {
@ -15,13 +14,6 @@ export function dictionaryItemAdd (params) {
data: params
})
}
export function dictionaryItemGet (params) {
return request({
url: dictionaryItemApi.get,
method: 'post',
data: params
})
}
export function dictionaryItemUpdate (params) {
return request({
url: dictionaryItemApi.update,
@ -33,13 +25,13 @@ export function dictionaryItemDel (params) {
return request({
url: dictionaryItemApi.del,
method: 'post',
data: params
params: params
})
}
export function dictionaryItemPage (params) {
return request({
url: dictionaryItemApi.page,
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>
<a-modal centered :visible="visible" :title="modalTitle" :width="720" @close="onCancel">
<a-modal :visible="visible" :title="modalTitle" @ok="onSubmit" @cancel="onCancel">
<a-form-model
ref="ruleForm"
:model="form"
@ -9,25 +9,29 @@
<a-row>
<a-col :span="12">
<a-form-model-item ref="dictionaryName" label="词典名称" prop="dictionaryName">
<a-input v-model="form.dictionaryName"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item ref="dictionaryCode" label="词典标识" prop="dictionaryCode">
<a-input v-model="form.dictionaryCode"/>
<a-input v-if="operable" v-model="form.dictionaryName"/>
<span v-else>{{ form.dictionaryName }}</span>
</a-form-model-item>
</a-col>
</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>
<div class="draw-button-container align-center">
<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>
</a-drawer>
</a-modal></template>
</a-modal>
</template>
<script>
import { dictionaryAdd, dictionaryUpdate, dictionaryGet } from '@/api/sys/dictionary'
import { dictionaryAdd, dictionaryUpdate } from '@/api/sys/dictionary'
export default {
props: {
@ -40,19 +44,16 @@ export default {
return {
modalTitle: '新增',
visible: false,
operable: false,
labelCol: { span: 8 },
wrapperCol: { span: 16 },
form: {
dictionaryName: '',
dictionaryCode: ''
dictionaryName: ''
},
rules: {
dictionaryName: [
{ required: true, message: '请输入词典名称', trigger: 'blur' },
{ max: 25, message: '长度不能超过25', trigger: 'blur' }
],
dictionaryCode: [
{ required: true, message: '请输入词典标识', trigger: 'blur' }
]
}
}
@ -61,19 +62,25 @@ export default {
add () {
this.modalTitle = '新增'
this.visible = true
this.operable = true
this.form.id = undefined
},
edit (obj) {
this.modalTitle = '修改'
this.visible = true
dictionaryGet({ id: obj.id }).then(data => {
const form = data.data
this.form = form
})
this.operable = true
this.form = obj
},
detail (obj) {
this.modalTitle = '详情'
this.visible = true
this.operable = false
this.form = obj
},
onSubmit (e) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
console.log(this.form)
if (this.form.id) {
dictionaryUpdate(this.form).then(data => {
this.$emit('ok')
@ -91,12 +98,8 @@ export default {
})
},
onCancel () {
this.$refs.ruleForm.resetFields()
delete this.form.id
this.form = {}
this.visible = false
},
onReset () {
this.$refs.ruleForm.resetFields()
}
}
}

View File

@ -38,13 +38,12 @@
<a href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record.id)">详情</a>
<a href="javascript:;" @click="handleDetail(record)">详情</a>
<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>
</s-table>
<dictionary-form ref="modal" @ok="handleOk" />
<dictionary-detail ref="detail" />
</a-card>
</page-header-wrapper>
</template>
@ -53,18 +52,16 @@
import { dictionaryPage, dictionaryDel } from '@/api/sys/dictionary'
import { STable } from '@/components'
import DictionaryForm from './DictionaryForm'
import DictionaryDetail from './DictionaryDetail'
export default {
name: 'DictionaryList',
components: {
STable,
DictionaryForm,
DictionaryDetail
DictionaryForm
},
data () {
return {
queryParam: { dictionaryName: '', dictionaryCode: '' },
queryParam: { dictionaryName: null, dictionaryCode: null },
selectedRowKeys: [], // key
selectedRows: [], //
columns: [
@ -81,8 +78,7 @@ export default {
loadData: parameter => {
return dictionaryPage(Object.assign(parameter, this.queryParam))
.then(res => {
const data = res.data
return data
return res
})
}
}
@ -104,9 +100,13 @@ export default {
handleEdit (record) {
this.$refs.modal.edit(record)
},
//
handleDetail (record) {
this.$refs.modal.detail(record)
},
//
handleDelete (record) {
dictionaryDel({ id: record.id }).then(() => {
dictionaryDel({ ids: record.id, deleteReason: "" }).then(() => {
this.$refs.table.refresh()
})
},
@ -114,10 +114,6 @@ export default {
handleOk () {
this.$refs.table.refresh()
},
//
handleDetail (id) {
this.$refs.detail.show(id)
},
handleRefresh () {
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>
<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-row>
<a-col :span="12">
<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-col>
<a-col :span="12">
<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-col>
</a-row>
<a-row>
<a-col :span="12">
<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-col>
<a-col :span="12">
<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-col>
</a-row>
<a-row>
<a-col :span="24">
<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-col>
</a-row>
</a-form-model>
<div class="draw-button-container align-center">
<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>
</a-modal>
</template>
<script>
import { dictionaryItemAdd, dictionaryItemUpdate, dictionaryItemGet } from '@/api/sys/dictionaryItem'
import { dictionaryItemAdd, dictionaryItemUpdate } from '@/api/sys/dictionaryItem'
export default {
props: {
@ -54,10 +59,10 @@ export default {
return {
modalTitle: '新增',
visible: false,
operable: false,
labelCol: { span: 8 },
wrapperCol: { span: 16 },
form: {
dictionaryCode: this.$route.params.id,
name: '',
value: '',
parentid: 0,
@ -69,8 +74,7 @@ export default {
{ required: true, message: '请输入词典项名称', trigger: 'blur' }
],
value: [
{ required: true, message: '请输入词典项值', trigger: 'blur' },
{ max: 4, message: '长度不能超过4', trigger: 'blur' }
{ required: true, message: '请输入词典项值', trigger: 'blur' }
],
parentid: [
{ required: true, message: '请输入所属上级', trigger: 'blur' }
@ -83,21 +87,29 @@ export default {
},
methods: {
add () {
console.log(this.form)
this.modalTitle = '新增'
this.visible = true
this.operable = true
this.form.id = undefined
},
edit (obj) {
this.modalTitle = '修改'
this.visible = true
dictionaryItemGet({ id: obj.id }).then(data => {
const form = data.data
this.form = form
})
this.operable = true
this.form = obj
},
detail (obj) {
this.modalTitle = '详情'
this.visible = true
this.operable = false
this.form = obj
},
onSubmit (e) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.form.dictionaryCode = this.$route.params.id
console.log(this.form)
if (this.form.id) {
dictionaryItemUpdate(this.form).then(data => {
this.$emit('ok')
@ -115,12 +127,8 @@ export default {
})
},
onCancel () {
this.$refs.ruleForm.resetFields()
delete this.form.id
this.form = {}
this.visible = false
},
onReset () {
this.$refs.ruleForm.resetFields()
}
}
}

View File

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