提交 b38b1c02 编写于 作者: K keyinghao

提交

上级 9c990dd7
......@@ -149,11 +149,8 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.map = {
id: id
}
this.ctrl.loading = true
apis.navBarDelete(this.map).then(res => {
apis.navBarDelete({ id: id }).then(res => {
this.ctrl.loading = false
if (res.code === 200 && res.data > 0) {
this.$message({
......
<template>
<!--弹窗-->
<el-dialog
width="35%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form :model="formData" :rules="rules" ref="formData" label-width="100px">
<el-form-item label="链接地址:" prop="linkUrl">
<el-input v-model="formData.linkUrl" placeholder="请输入链接地址"></el-input>
</el-form-item>
<el-form-item label="链接名称:" prop="linkName">
<el-input v-model="formData.linkName" placeholder="请输入链接名称"></el-input>
</el-form-item>
<el-form-item label="打开方式:" width="200">
<template>
<el-radio v-model="formData.linkTarget" label="_blank">新窗口打开</el-radio>
<el-radio v-model="formData.linkTarget" label="_self">同窗口打开</el-radio>
</template>
</el-form-item>
</el-form>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as api from '@/api/system'
export default {
name: 'Edit',
data() {
return {
ctrl: {
dialogVisible: true
},
formData: {
linkTarget: '_blank'
},
rules: {
linkUrl: [
{ required: true, message: '请输入链接地址', trigger: 'blur', autocomplete: 'on' }
],
linkName: [
{ required: true, message: '请输入链接名称', trigger: 'blur' }
]
}
}
},
props: {
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
}
},
methods: {
handleClose(done) {
this.formData = {}
this.$emit('close-callback')
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (!this.formData.linkUrl) {
this.$message({
type: 'error',
message: '请输入链接地址'
});
return false
}
if (!this.formData.linkName) {
this.$message({
type: 'error',
message: '请输入链接名称'
});
return false
}
if (valid) {
this.loading.show()
api.websiteLinkSave(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
}).catch(() => {
this.loading.hide()
this.$message({
type: 'error',
message: "提交失败"
});
})
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
})
}
}
}
</script>
<template>
<!--弹窗-->
<el-dialog
width="35%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form :model="formData" :rules="rules" ref="formData">
<el-form :model="formData" :rules="rules" ref="formData" label-width="100px">
<el-form-item label="链接地址" prop="linkUrl">
<el-input v-model="formData.linkUrl"></el-input>
</el-form-item>
......@@ -18,19 +18,19 @@
<el-radio v-model="formData.linkTarget" label="_self">同窗口打开</el-radio>
</template>
</el-form-item>
<el-form-item label="排序" prop="sort" >
<el-input v-model="formData.sort" ></el-input>
<el-form-item label="排序:">
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1" :max="10000"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="submitForm('formData')">确 定</el-button>
</div>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as apis from '@/api/system'
import * as api from '@/api/system'
export default {
name: 'Edit',
data() {
......@@ -68,40 +68,56 @@ import * as apis from '@/api/system'
}
},
methods: {
handleChange(value) {
this.formData.sort = value
},
handleClose(done) {
this.$emit('close-callback')
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (!this.formData.linkUrl) {
this.$message({
type: 'error',
message: '请输入链接地址'
});
return false
}
if (!this.formData.linkName) {
this.$message({
type: 'error',
message: '请输入链接名称'
});
return false
}
if (valid) {
this.handleConfirm()
this.loading.show()
api.websiteLinkUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
}).catch(() => {
this.loading.hide()
this.$message({
type: 'error',
message: "提交失败"
});
})
} else {
console.log('error submit!!');
return false;
this.$message({
type: 'error',
message: "提交失败"
});
}
});
},
async handleConfirm() {
this.loading.show()
let res = {}
if (this.formData.id === undefined) {
res = await apis.websiteLinkSave(this.formData)
} else {
// 编辑
res = await apis.websiteLinkUpdate(this.formData)
}
this.loading.hide()
if (res.code === 200) {
// 提交成功, 关闭窗口, 刷新列表
this.$emit('close-callback')
} else {
this.$alert(res.msg || '提交失败')
}
})
}
}
}
</script>
<style scoped>
</style>
......@@ -2,30 +2,23 @@
<div class="pad20">
<div>
<el-form :inline="true" size="mini">
<el-form-item>
<el-button class="filter-item" type="success" @click="handleAddRow">
新增
</el-button>
</el-form-item>
<el-form-item label="链接名称">
<el-input v-model="map.linkName"></el-input>
</el-form-item>
<el-form-item label="状态">
<template>
<el-select v-model="map.statusId" placeholder="全部">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-form-item>
<el-form-item label="状态:" >
<el-select v-model="map.statusId" class="auto-width" clearable filterable placeholder="状态" style="width: 85px">
<el-option
v-for="item in opts.statusIdList"
:key="item.code"
:label="item.desc"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="ctrl.loading" @click="handleCheck">查询</el-button>
<el-button class="filter-item" @click="handleReset">重置
</el-button>
<el-button icon='el-icon-search' type="primary" @click="handleCheck">查询</el-button>
<el-button icon='el-icon-refresh' class="filter-item" @click="handleReset">重置</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAddRow()">添加</el-button>
</el-form-item>
</el-form>
</div>
......@@ -34,23 +27,25 @@
<el-table-column type="index" label="序号" width="40">
</el-table-column>
<el-table-column prop="linkName,linkUrl" label="链接名称/链接地址">
<template slot-scope="scope">{{scope.row.linkName}}{{scope.row.linkUrl}}</template>
<template slot-scope="scope"><el-link type="primary" @click="jumpUrl(scope.row.linkUrl)" target="_blank">{{scope.row.linkName}}</el-link>{{scope.row.linkUrl}}</template>
</el-table-column>
<el-table-column prop="sort" label="排序">
</el-table-column>
<el-table-column
label="状态"
width="170"
prop="statusId"
align="center"
width="200">
label="状态"
align="center">
<template slot-scope="scope">
<el-switch
@change="handleChangeStatus(scope.$index, scope.row, $event)"
v-model="scope.row.statusId"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="禁用">
@change="handleChangeStatus(scope.row.id, scope.row.statusId)"
:active-value="0"
:inactive-value="1"
active-color="#ff4949"
inactive-color="#13ce66"
active-text="禁用"
inactive-text="正常">
</el-switch>
</template>
</el-table-column>
......@@ -61,8 +56,8 @@
<template slot-scope="scope">
<ul class="list-item-actions">
<li>
<el-button type="primary" @click="handleUpdateRow(scope.row)" size="mini">修改</el-button>
<el-button type="danger" @click="handleDelRow(scope.row)" size="mini">删除</el-button>
<el-button type="danger" @click="handleDelRow(scope.row.id)" size="mini">删除</el-button>
<el-button type="success" @click="handleUpdateRow(scope.row)" size="mini">修改</el-button>
</li>
</ul>
</template>
......@@ -79,157 +74,169 @@
</el-pagination>
</div>
</div>
<edit :visible="ctrl.dialogVisible" :formData="formdata" :title="ctrl.dialogTitle" @close-callback="closeCallback"></edit>
<edit :visible="ctrl.dialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCallback"></edit>
<add :visible="ctrl.addDialogVisible" :title="ctrl.dialogTitle" @close-callback="closeCallback"></add>
</div>
</template>
<script>
import * as systemApi from '@/api/system'
import * as api from '@/api/system'
import Edit from './edit'
import Add from './add'
export default {
components: { Edit },
components: { Edit, Add },
data() {
return {
//状态
options: [{
value: '1',
label: '启用'
}, {
value: '0',
label: '禁用'
}],
// 条件筛选参数
map: {
id: undefined,
linkName: undefined,
statusId: undefined
opts: {
statusIdList: []
},
// 页面控制数据,例如形式弹窗,显示加载中等
ctrl: {
loading: false,
remoteAuthorLoading: false,
addDialogVisible: false,
dialogVisible: false
},
// 表单数据, 例如新增编辑子项,页面表单
formdata: {},
tableData: [],
// 条件筛选参数
map: {},
formData: {},
list: [],
page: {
beginPageIndex: 1,
currentPage: 1,
pageCurrent: 1,
endPageIndex: 8,
numPerPage: 20,
pageSize: 20,
totalCount: 0,
totalPage: 0,
list: []
totalPage: 0
}
}
},
mounted() {
this.$store.dispatch('GetOpts', { enumName: "StatusIdEnum", type: 'arr' }).then(res => {
this.opts.statusIdList = res
})
this.getList()
},
methods: {
getList() {
this.ctrl.load = true
systemApi.websiteLinkList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.ctrl.load = false
this.list = res.data.list
this.page.pageSize = res.data.pageSize
this.page.totalCount = res.data.totalCount
}).catch(() => {
this.ctrl.load = false
})
// 友情链接跳转
jumpUrl(url) {
window.open(url)
},
// 关闭编辑弹窗回调
closeCallback() {
this.ctrl.dialogVisible = false;
this.ctrl.addDialogVisible = false
this.reload()
},
reload() {
this.getList(this.currentPage)
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.map.pageSize = val
this.getList()
},
handleCurrentChange(val) {
this.map.pageCurrent = val
this.getList()
// console.log(`当前页: ${val}`)
},
handleCheck() {
this.map.pageNum = 1
this.getList()
},
// 重置查询条件
handleReset() {
this.map = { }
this.getList()
},
//新增
handleAddRow() {
this.formdata = {}
this.ctrl.dialogTitle = '新增'
this.ctrl.dialogVisible = true
this.ctrl.addDialogVisible = true
},
//编辑
handleUpdateRow(data) {
this.formdata = data
this.ctrl.dialogTitle = '编辑权限'
this.formData = data
this.ctrl.dialogTitle = data.linkName + '——编辑'
this.ctrl.dialogVisible = true
},
handleChangeStatus(index, row, command) {
console.log('handleCommand ------>> ', index, row, command)
const txt = { 1: '启用', 0: '禁用' }
this.$confirm(`确定${txt[command]}友情链接:${row.linkName}?`, txt[command] + '此项', {
handleChangeStatus(id, statusId) {
const title = { 0: '禁用', 1: '启用' }
this.$confirm(`确定要${title[statusId]}吗?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.changeStatus(row.id, command)
this.ctrl.loading = true
this.changeStatus(id, statusId)
}).catch(() => {
this.reload()
})
},
//改变状态
changeStatus(id, statusId) {
systemApi.websiteLinkUpdate({ id, statusId }).then(res => {
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
message: msg[statusId]
});
this.reload()
api.websiteLinkUpdate({ id, statusId }).then(res => {
this.ctrl.loading = false
if (res.code === 200 && res.data > 0) {
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
message: msg[statusId]
});
this.reload()
} else {
const msg = { 0: '禁用失败', 1: '启用失败' }
this.$message({
type: 'error',
message: msg[statusId]
});
this.reload()
}
}).catch(() => {
this.ctrl.loading = false
})
},
//删除
handleDelRow(data) {
console.log('handleCommand ------>> ', data)
handleDelRow(id) {
this.$confirm(`确定删除这条数据?`, '我要删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.map = {
id: data.id
}
this.loading.show()
systemApi.websiteLinkDelete(this.map).then(res => {
console.log(res)
if (res.code === 200) {
this.ctrl.loading = true
api.websiteLinkDelete({ id: id }).then(res => {
this.ctrl.loading = false
if (res.code === 200 && res.data > 0) {
this.$message({
type: 'success',
message: '删除成功'
});
//刪除成功后刷新列表
this.closeCallback()
this.reload()
} else {
this.$alert(res.msg)
this.$message({
type: 'error',
message: "删除失败"
});
this.reload()
}
this.loading.hide()
})
}).catch(() => {
this.ctrl.loading = false
})
},
// 查询条件
handleCheck() {
this.page.pageCurrent = 1
this.getList()
},
// 重置查询条件
handleReset() {
this.reload()
},
// 刷新当前页面
reload() {
this.formData = {}
this.map = {}
this.getList()
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
this.getList()
},
handleCurrentChange(val) {
this.page.pageCurrent = val
this.getList()
// console.log(`当前页: ${val}`)
},
getList() {
this.ctrl.loading = true
api.websiteLinkList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.ctrl.loading = false
this.list = res.data.list
this.page.pageSize = res.data.pageSize
this.page.totalCount = res.data.totalCount
}).catch(() => {
this.ctrl.loading = false
})
}
}
......
<template>
<!--弹窗-->
<el-dialog
width="30%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form :model="formData" :rules="rules" ref="formData">
<el-form-item label="名称" prop="navName">
<el-input v-model="formData.navName"></el-input>
<el-form :model="formData" :rules="rules" ref="formData" label-width="100px">
<el-form-item label="导航名称:" prop="navName">
<el-input v-model="formData.navName" placeholder="请输入导航名称"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="submitForm('formData')">确 定</el-button>
</div>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as apis from '@/api/system'
import * as api from '@/api/system'
export default {
name: 'NavTitle',
name: 'Add',
data() {
return {
ctrl: {
......@@ -53,33 +54,34 @@
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (!this.formData.navName) {
this.$message({
type: 'error',
message: '请输入导航名称'
});
return false
}
if (valid) {
this.handleConfirm()
this.loading.show()
api.websiteNavSave(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
})
} else {
console.log('error submit!!');
return false;
this.$message({
type: 'error',
message: "提交失败"
});
}
});
},
async handleConfirm() {
this.loading.show()
let res = {}
if (this.addMap.id === undefined) {
//新增底部导航栏,给父ID赋值
this.formData.parentId = 0
res = await apis.websiteNavSave(this.formData)
} else {
this.parentId
// 编辑
res = await apis.websiteNavUpate(this.formData)
}
this.loading.hide()
if (res.code === 200) {
// 提交成功, 关闭窗口, 刷新列表
this.$emit('close-callback')
} else {
this.$alert(res.msg || '提交失败')
}
}
}
}
......
<template>
<!--弹窗-->
<el-dialog
width="30%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form :model="formData" :rules="rules" ref="formData">
<el-form-item label="名称" prop="navName">
<el-input v-model="formData.navName"></el-input>
<el-form :model="formData" :rules="rules" ref="formData" label-width="100px">
<el-form-item label="导航名称" prop="navName">
<el-input v-model="formData.navName" placeholder="请输入导航名称"></el-input>
</el-form-item>
<el-form-item label="排序:">
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1" :max="10000"></el-input-number>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="submitForm('formData')">确 定</el-button>
</div>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as apis from '@/api/system'
import * as api from '@/api/system'
export default {
name: 'Edit',
data() {
......@@ -49,37 +52,49 @@ export default {
}
},
methods: {
handleChange(value) {
this.formData.sort = value
},
handleClose(done) {
this.$emit('close-callback')
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (!this.formData.navName) {
this.$message({
type: 'error',
message: '请输入导航名称'
});
return false
}
if (valid) {
this.handleConfirm()
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: 'id不能为空'
});
return false
}
this.loading.show()
api.websiteNavUpate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
})
} else {
console.log('error submit!!');
return false;
this.$message({
type: 'error',
message: "提交失败"
});
}
});
},
async handleConfirm() {
this.loading.show()
let res = {}
if (this.formData.id === undefined) {
//新增底部导航栏,给父ID赋值
this.formData.parentId = 0
res = await apis.websiteNavSave(this.formData)
} else {
// 编辑
res = await apis.websiteNavUpate(this.formData)
}
this.loading.hide()
if (res.code === 200) {
// 提交成功, 关闭窗口, 刷新列表
this.$emit('close-callback')
} else {
this.$alert(res.msg || '提交失败')
}
})
}
}
}
......
......@@ -2,11 +2,6 @@
<div class="pad20">
<div>
<el-form :inline="true" size="mini">
<el-form-item>
<el-button class="filter-item" type="success" @click="handleAddRow">
新增
</el-button>
</el-form-item>
<el-form-item label="分类名称">
<el-input v-model="map.navName"></el-input>
</el-form-item>
......@@ -23,7 +18,7 @@
<el-form-item>
<el-button icon='el-icon-search' type="primary" @click="handleCheck">查询</el-button>
<el-button icon='el-icon-refresh' class="filter-item" @click="handleReset">重置</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAddSubclass(scope.row)">添加</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAddSubclass(0)">添加</el-button>
</el-form-item>
</el-form>
</div>
......@@ -34,7 +29,7 @@
v-loading="ctrl.loading"
border
row-key="id"
:default-expand-all="false">
:default-expand-all="true">
<el-table-column type="index" label="序号" width="40">
</el-table-column>
<el-table-column prop="navName" label="导航名称">
......@@ -68,7 +63,7 @@
<li>
<el-button type="danger" @click="handleDelRow(scope.row.id)" size="mini">删除</el-button>
<el-button type="primary" @click="handleUpdateRow(scope.row)" size="mini">修改</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAddSubclass(scope.row)">添加</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" v-if="scope.row.parentId == 0" @click="handleAddSubclass(scope.row.id)">添加</el-button>
</li>
</ul>
</template>
......@@ -88,30 +83,30 @@
</div>
</div>
<edit :visible="ctrl.dialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCallback"></edit>
<nav-title :visible="ctrl.navTitleVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCallback"></nav-title>
<add :visible="ctrl.addDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCallback"></add>
</div>
</template>
<script>
import * as api from '@/api/system'
import Edit from './edit'
import NavTitle from './navTitle'
import Add from './add'
export default {
components: { Edit, NavTitle },
components: { Edit, Add },
data() {
return {
opts: {
statusIdList: []
},
// 条件筛选参数
map: {},
// 页面控制数据,例如形式弹窗,显示加载中等
ctrl: {
loading: false,
remoteAuthorLoading: false,
dialogVisible: false,
navTitleVisible: false
addDialogVisible: false
},
// 表单数据, 例如新增编辑子项,页面表单
// 条件筛选参数
map: {},
formData: {},
tableData: [],
list: [],
......@@ -126,33 +121,30 @@
}
},
mounted() {
this.$store.dispatch('GetOpts', { enumName: "StatusIdEnum", type: 'arr' }).then(res => {
this.opts.statusIdList = res
})
this.getList()
},
methods: {
//跳转到底部导航文章添加页面
handleAddSubclass(data) {
this.formData = data
//新增
handleAddSubclass(id) {
this.formData.parentId = id
this.ctrl.dialogTitle = '添加'
this.ctrl.navTitleVisible = true
this.ctrl.addDialogVisible = true
},
//编辑
handleUpdateRow(data) {
this.formdata = data
this.ctrl.dialogTitle = '编辑权限'
this.formData = data
this.ctrl.dialogTitle = data.navName + '——编辑'
this.ctrl.dialogVisible = true
},
// 关闭编辑弹窗回调
closeCallback() {
this.ctrl.dialogVisible = false
this.ctrl.navTitleVisible = false
this.ctrl.addDialogVisible = false
this.reload()
},
//新增
handleAddRow() {
this.formData = {}
this.ctrl.dialogTitle = '添加'
this.ctrl.dialogVisible = true
},
//删除
handleDelRow(id) {
this.$confirm(`确定删除这条数据?`, '我要删除', {
......@@ -161,20 +153,22 @@
type: 'warning'
}).then(() => {
this.map.id = id
this.loading.show()
this.ctrl.load = true
api.websiteNavDelete(this.map).then(res => {
console.log(res)
this.ctrl.load = false
if (res.code === 200) {
this.$message({
type: 'success',
message: '删除成功'
});
//刪除成功后刷新列表
this.closeCallback()
this.reload()
} else {
this.$alert(res.msg)
this.$message({
type: 'error',
message: '删除失败'
});
}
this.loading.hide()
})
}).catch(() => {
})
......@@ -189,19 +183,30 @@
this.ctrl.loading = true
this.changeStatus(id, statusId)
}).catch(() => {
this.reload()
this.ctrl.loading = false
})
},
//改变状态
changeStatus(id, statusId) {
api.websiteNavUpate({ id, statusId }).then(res => {
this.ctrl.loading = false
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
message: msg[statusId]
});
this.reload()
if (res.code === 200 && res.data > 0) {
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
message: msg[statusId]
});
this.reload()
} else {
const msg = { 0: '禁用失败', 1: '启用失败' }
this.$message({
type: 'error',
message: msg[statusId]
});
this.reload()
}
}).catch(() => {
this.ctrl.loading = false
})
},
// 查询条件
......@@ -216,7 +221,7 @@
// 刷新当前页面
reload() {
this.map = {}
this.gmtCreate = ''
this.formData = {}
this.getList()
},
handleSizeChange(val) {
......
......@@ -41,7 +41,7 @@ public class PcApiWebsiteLinkBiz {
WebsiteLinkExample example = new WebsiteLinkExample();
Criteria c = example.createCriteria();
if (StringUtils.hasText(req.getLinkName())) {
c.andLinkNameLike(PageUtil.rightLike(req.getLinkName()));
c.andLinkNameLike(PageUtil.like(req.getLinkName()));
}
if (req.getStatusId() != null) {
c.andStatusIdEqualTo(req.getStatusId());
......
......@@ -50,7 +50,7 @@ public class PcApiWebsiteNavBiz {
WebsiteNavExample example = new WebsiteNavExample();
Criteria c = example.createCriteria();
if (StringUtils.isNotEmpty(req.getNavName())) {
c.andNavNameLike(PageUtil.rightLike(req.getNavName()));
c.andNavNameLike(PageUtil.like(req.getNavName()));
} else {
c.andParentIdEqualTo(Long.valueOf(0));
}
......@@ -89,6 +89,15 @@ public class PcApiWebsiteNavBiz {
}
public Result<Integer> save(WebsiteNavSaveREQ req) {
if (StringUtils.isEmpty(req.getNavName())) {
return Result.error("ID不能为空");
}
if (req.getParentId() != null && !req.getParentId().equals(0L)) {
WebsiteNav websiteNav = dao.getById(req.getParentId());
if (ObjectUtil.isNull(websiteNav)) {
return Result.error("找不到父级导航信息");
}
}
WebsiteNav record = BeanUtil.copyProperties(req, WebsiteNav.class);
int results = dao.save(record);
if (results > 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册