评论调整

This commit is contained in:
aixianling
2022-06-06 09:16:39 +08:00
parent c353a19fe5
commit eda3252c95
2 changed files with 163 additions and 161 deletions

View File

@@ -27,7 +27,7 @@
</el-form-item> </el-form-item>
<el-form-item label="是否可评论" style="width: 100%;" prop="isComment" :rules="[{required: true, message: '请选择是否可评论'}]"> <el-form-item label="是否可评论" style="width: 100%;" prop="isComment" :rules="[{required: true, message: '请选择是否可评论'}]">
<el-radio-group v-model="form.isComment"> <el-radio-group v-model="form.isComment">
<el-radio v-for="op in dict.getDict('yseOrNo')" :key="op.dictValue" :label="op.dictValue">{{ op.dictName }}</el-radio> <el-radio v-for="op in dict.getDict('yesOrNo')" :key="op.dictValue" :label="op.dictValue">{{ op.dictName }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@@ -10,13 +10,13 @@
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-table <ai-table
:tableData="tableData" :tableData="tableData"
:col-configs="colConfigs" :col-configs="colConfigs"
:total="total" :total="total" :dict="dict"
style="margin-top: 6px;" style="margin-top: 6px;"
:current.sync="search.current" :current.sync="search.current"
:size.sync="search.size" :size.sync="search.size"
@getList="getList"> @getList="getList">
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center"> <el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="table-options"> <div class="table-options">
@@ -28,33 +28,33 @@
</el-table-column> </el-table-column>
</ai-table> </ai-table>
<ai-dialog <ai-dialog
:visible.sync="isShowAdd" :visible.sync="isShowAdd"
width="880px" width="880px"
height="580px" height="580px"
title="文章分类" title="文章分类"
@close="onClose" @close="onClose"
@onConfirm="onConfirm(false)"> @onConfirm="onConfirm(false)">
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right"> <el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="分类名称" style="width: 500px;" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]"> <el-form-item label="分类名称" style="width: 500px;" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]">
<div class="catewrapper"> <div class="catewrapper">
<el-input size="small" style="width: 300px;" placeholder="请输入分类名称" v-model="form.categoryName"> <el-input size="small" style="width: 300px;" placeholder="请输入分类名称" v-model="form.categoryName">
</el-input> </el-input>
<el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" v-if="!id" @click="onConfirm(true)">添加</el-button> <el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" v-if="!id" @click="onConfirm(true)">添加</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<ai-table <ai-table
v-if="!id" v-if="!id"
class="detail-table__table" class="detail-table__table"
:border="true" :border="true"
tableSize="small" tableSize="small"
:total="cateTotal" :total="cateTotal"
:tableData="cateList" :tableData="cateList"
:col-configs="cateColConfigs" :col-configs="cateColConfigs"
:current.sync="cateSearch.current" :current.sync="cateSearch.current"
:size.sync="cateSearch.size" :size.sync="cateSearch.size"
:stripe="false" :stripe="false"
@getList="getCateList"> @getList="getCateList">
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center"> <el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="table-options"> <div class="table-options">
@@ -70,158 +70,160 @@
</template> </template>
<script> <script>
export default { export default {
name: 'List', name: 'List',
props: { props: {
instance: Function, instance: Function,
dict: Object dict: Object
}, },
data() { data() {
return { return {
search: { search: {
current: 1, current: 1,
size: 10, size: 10,
title: '' title: ''
}, },
moduleId: '',
cateSearch: {
current: 1,
size: 10
},
total: 10,
cateList: [],
colConfigs: [
{prop: 'moduleName', label: '模块名称', align: 'left', width: '200px'},
{prop: 'menuName', label: '关联菜单', align: 'center'},
{prop: 'categoryStr', label: '文章分类', align: 'center'},
{prop: 'needExamine', label: '是否审核', align: 'center', dict: 'yesOrNo'},
{prop: 'isComment', label: '是否可以评论', align: 'center', dict: 'yesOrNo'}
],
cateColConfigs: [
{prop: 'showIndex', label: '排序', align: 'center', width: 80},
{prop: 'categoryName', label: '分类名称', align: 'center'}
],
form: {
categoryName: '',
moduleId: '', moduleId: '',
cateSearch: { showIndex: 1
current: 1, },
size: 10 cateTotal: 0,
}, isShowAdd: false,
total: 10, id: '',
cateList: [], tableData: []
colConfigs: [ }
{ prop: 'moduleName', label: '模块名称', align: 'left', width: '200px' }, },
{ prop: 'menuName', label: '关联菜单', align: 'center' },
{ prop: 'categoryStr', label: '文章分类', align: 'center' }, mounted() {
{ prop: 'needExamine', label: '是否审核', align: 'center', formart: v => v === '0' ? '否' : '是' } this.getList()
], },
cateColConfigs: [
{prop: 'categoryName', label: '分类名称', align: 'center'} methods: {
], getList() {
form: { this.instance.post(`/app/appcontentmoduleinfo/list`, null, {
categoryName: '', params: {
moduleId: '', ...this.search
showIndex: 1 }
}, }).then(res => {
cateTotal: 0, if (res.code == 0) {
isShowAdd: false, this.tableData = res.data.records
id: '', this.total = res.data.total
tableData: [] }
})
},
getCateList() {
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {
...this.cateSearch,
moduleId: this.moduleId
}
}).then(res => {
if (res.code == 0) {
this.cateList = res.data.records
this.cateTotal = res.data.total
}
})
},
removeCate(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmodulecategory/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
this.getCateList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmoduleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
onConfirm(flag) {
if (!flag && !this.id) {
this.isShowAdd = false
return false
} }
},
mounted() { this.$refs.form.validate((valid) => {
this.getList() if (valid) {
}, this.instance.post(`/app/appcontentmodulecategory/addOrUpdate`, {
...this.form,
methods: { id: this.id || ''
getList() { }).then(res => {
this.instance.post(`/app/appcontentmoduleinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getCateList () {
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {
...this.cateSearch,
moduleId: this.moduleId
}
}).then(res => {
if (res.code == 0) {
this.cateList = res.data.records
this.cateTotal = res.data.total
}
})
},
removeCate(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmodulecategory/delete?ids=${id}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message.success('删除成功') this.$message.success('提交成功')
this.getList() this.getList()
this.getCateList() this.getCateList()
} this.form.categoryName = ''
})
})
},
remove(id) { if (this.id) {
this.$confirm('确定删除该数据?').then(() => { this.id = ''
this.instance.post(`/app/appcontentmoduleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
onConfirm (flag) { return false
if (!flag && !this.id) {
this.isShowAdd = false
return false
}
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcontentmodulecategory/addOrUpdate`, {
...this.form,
id: this.id || ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
this.getList()
this.getCateList()
this.form.categoryName = ''
if (this.id) {
this.id = ''
return false
}
} }
}) }
} })
}) }
}, })
},
onClose () { onClose() {
this.id = '' this.id = ''
this.moduleId = '' this.moduleId = ''
this.form.categoryName = '' this.form.categoryName = ''
this.form.moduleId = '' this.form.moduleId = ''
}, },
toAdd(id) { toAdd(id) {
this.$emit('change', { this.$emit('change', {
type: 'Add', type: 'Add',
params: { params: {
id: id || '' id: id || ''
} }
}) })
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.notice { .notice {
.catewrapper { .catewrapper {
display: flex; display: flex;
align-items: center; align-items: center;
}
} }
}
</style> </style>