Commit 95999d5b by hanjixin

菜单类型启用与关闭

parent a4d27570
......@@ -136,7 +136,7 @@ export function typeUpdateTagInfo(tagId, tagName) {
* @param {*} typeMenuType
* 根据类型id修改状态
*/
export function typeUpdateType(typeMenuId, typeMenuType) {
export function typeUpdateType(typeMenuId, typeMenuType = 'OPEN') {
return request({
url: '/type/update/type',
method: 'post',
......
......@@ -340,7 +340,7 @@ export default {
if (id) {
getDetail(this.$route.query.templateId).then(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.templateProportion2 = tempData.templateProportion && tempData.templateProportion.split('/')[1]
this.temp = Object.assign(this.temp, tempData)
......@@ -406,6 +406,7 @@ export default {
duration: 2000
})
this.getTempalteDetail()
this.$router.back()
})
} else {
templateAdd(uploadTemp).then(() => {
......@@ -415,6 +416,7 @@ export default {
type: 'success',
duration: 2000
})
this.$router.back()
})
}
}
......
......@@ -90,14 +90,22 @@
>
删除
</el-button>
<!-- <el-button type="info"
<el-button
v-if="row.typeMenuType === 'OPEN'"
type="info"
size="mini"
@click="handleProhibit(row)">
@click="handleProhibit(row)"
>
禁用
</el-button> -->
<!-- <el-button type="info" size="mini" @click="handleUpdate(row)">
</el-button>
<el-button
v-else
type="info"
size="mini"
@click="handleProhibit(row)"
>
启用
</el-button> -->
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -186,7 +194,7 @@
<script>
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 Pagination from '@/components/Pagination' // secondary package based on el-pagination
......@@ -359,17 +367,19 @@ export default {
})
},
handleProhibit(row) {
this.$confirm('是否确认禁用?', '提示', {
const str = row.typeMenuType === 'OPEN' ? '禁用' : '启用'
this.$confirm(`是否确认${str}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
const index = this.list.indexOf(row)
this.list.splice(index, 1)
typeUpdateType(row.typeId, row.typeMenuType === 'OPEN' ? 'CLOSE' : 'OPEN').then(() => {
row.typeMenuType = (row.typeMenuType === 'OPEN' ? 'CLOSE' : 'OPEN')
this.$message({
type: 'success',
message: '已禁用!'
message: `已${str}!`
})
})
})
.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