Commit 95999d5b by hanjixin

菜单类型启用与关闭

parent a4d27570
...@@ -136,7 +136,7 @@ export function typeUpdateTagInfo(tagId, tagName) { ...@@ -136,7 +136,7 @@ export function typeUpdateTagInfo(tagId, tagName) {
* @param {*} typeMenuType * @param {*} typeMenuType
* 根据类型id修改状态 * 根据类型id修改状态
*/ */
export function typeUpdateType(typeMenuId, typeMenuType) { export function typeUpdateType(typeMenuId, typeMenuType = 'OPEN') {
return request({ return request({
url: '/type/update/type', url: '/type/update/type',
method: 'post', method: 'post',
......
...@@ -340,7 +340,7 @@ export default { ...@@ -340,7 +340,7 @@ export default {
if (id) { if (id) {
getDetail(this.$route.query.templateId).then(response => { getDetail(this.$route.query.templateId).then(response => {
const tempData = JSON.parse(JSON.stringify(response)) const tempData = JSON.parse(JSON.stringify(response))
tempData.templateShow = tempData.templateShow.toUpperCase() tempData.templateShow = tempData.templateShow && tempData.templateShow.toUpperCase()
tempData.templateProportion1 = tempData.templateProportion && tempData.templateProportion.split('/')[0] tempData.templateProportion1 = tempData.templateProportion && tempData.templateProportion.split('/')[0]
tempData.templateProportion2 = tempData.templateProportion && tempData.templateProportion.split('/')[1] tempData.templateProportion2 = tempData.templateProportion && tempData.templateProportion.split('/')[1]
this.temp = Object.assign(this.temp, tempData) this.temp = Object.assign(this.temp, tempData)
...@@ -406,6 +406,7 @@ export default { ...@@ -406,6 +406,7 @@ export default {
duration: 2000 duration: 2000
}) })
this.getTempalteDetail() this.getTempalteDetail()
this.$router.back()
}) })
} else { } else {
templateAdd(uploadTemp).then(() => { templateAdd(uploadTemp).then(() => {
...@@ -415,6 +416,7 @@ export default { ...@@ -415,6 +416,7 @@ export default {
type: 'success', type: 'success',
duration: 2000 duration: 2000
}) })
this.$router.back()
}) })
} }
} }
......
...@@ -90,14 +90,22 @@ ...@@ -90,14 +90,22 @@
> >
删除 删除
</el-button> </el-button>
<!-- <el-button type="info" <el-button
v-if="row.typeMenuType === 'OPEN'"
type="info"
size="mini" size="mini"
@click="handleProhibit(row)"> @click="handleProhibit(row)"
>
禁用 禁用
</el-button> --> </el-button>
<!-- <el-button type="info" size="mini" @click="handleUpdate(row)"> <el-button
v-else
type="info"
size="mini"
@click="handleProhibit(row)"
>
启用 启用
</el-button> --> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -186,7 +194,7 @@ ...@@ -186,7 +194,7 @@
<script> <script>
import { fetchPv, updateArticle } from '@/api/article' import { fetchPv, updateArticle } from '@/api/article'
import { getTypeList, typeAdd, typeDel } from '@/api/menu' import { getTypeList, typeAdd, typeDel, typeUpdateType } from '@/api/menu'
import waves from '@/directive/waves' // waves directive import waves from '@/directive/waves' // waves directive
import Pagination from '@/components/Pagination' // secondary package based on el-pagination import Pagination from '@/components/Pagination' // secondary package based on el-pagination
...@@ -359,17 +367,19 @@ export default { ...@@ -359,17 +367,19 @@ export default {
}) })
}, },
handleProhibit(row) { handleProhibit(row) {
this.$confirm('是否确认禁用?', '提示', { const str = row.typeMenuType === 'OPEN' ? '禁用' : '启用'
this.$confirm(`是否确认${str}?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
const index = this.list.indexOf(row) typeUpdateType(row.typeId, row.typeMenuType === 'OPEN' ? 'CLOSE' : 'OPEN').then(() => {
this.list.splice(index, 1) row.typeMenuType = (row.typeMenuType === 'OPEN' ? 'CLOSE' : 'OPEN')
this.$message({ this.$message({
type: 'success', type: 'success',
message: '已禁用!' message: `已${str}!`
})
}) })
}) })
.catch(() => {}) .catch(() => {})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment