add bookmark_type delete function
This commit is contained in:
@@ -39,7 +39,8 @@
|
||||
</div>
|
||||
<div class="c_section">
|
||||
<div class="title_style">
|
||||
<el-input v-model="((blogTypes.get(checkedBlogIndex) as BlogType).blogs.get(checkedIndex) as Blog).title">
|
||||
<el-input v-model="((blogTypes.get(checkedBlogIndex) as BlogType).blogs.get(checkedIndex) as Blog).title"
|
||||
@keyup.enter.native="saveTitle" @blur="saveTitle">
|
||||
</el-input>
|
||||
<div style="width: 60px;">
|
||||
<span v-if="!updated">已保存</span>
|
||||
@@ -98,9 +99,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, watch } from 'vue'
|
||||
import $moment from "moment";
|
||||
import $moment from "moment"
|
||||
import MdEditor from 'md-editor-v3'
|
||||
import { Edit } from "@element-plus/icons-vue";
|
||||
import { Edit } from "@element-plus/icons-vue"
|
||||
import 'md-editor-v3/lib/style.css'
|
||||
import { updateBtName, updateContent, listAll, putBlogType, removeBlogType, getContent, putBlog, deleteContent } from '../../api/blog'
|
||||
|
||||
@@ -177,8 +178,6 @@ const getTestData = async () => {
|
||||
startTime = current // 更新开始时间为当前 09:00:00 09:00:00.500
|
||||
setTimeout(() => {
|
||||
if ($moment(current).diff($moment(tmp), 'seconds') >= 1) {
|
||||
console.log(current)
|
||||
console.log(startTime)
|
||||
saveContent()
|
||||
}
|
||||
}, 1000)
|
||||
@@ -188,17 +187,17 @@ const getTestData = async () => {
|
||||
|
||||
/**
|
||||
* BlogTypeを選べる
|
||||
* @param key
|
||||
* @param key
|
||||
*/
|
||||
const onclickTypeTab = (key: string) => {
|
||||
const bid = <string>blogTypes.get(key)?.blogs.values().next().value.bid
|
||||
const bid = blogTypes.get(key)?.blogs.values().next().value.bid
|
||||
getContent(bid).then(response => {
|
||||
((blogTypes.get(key) as BlogType).blogs.get(bid) as Blog).content = response.data.content
|
||||
checkedBlogIndex.value = key
|
||||
checkedIndex.value = bid
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const onclickBlogTab = (key: string) => {
|
||||
checkedIndex.value = key
|
||||
getContent(key).then(response => {
|
||||
@@ -206,6 +205,7 @@ const onclickBlogTab = (key: string) => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const handleEditBtName = (bt: BlogType) => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@@ -225,10 +225,11 @@ const saveContent = () => {
|
||||
updateContent(query).then(response => {
|
||||
if (response.status == 200) {
|
||||
updated.value = false
|
||||
// blogTypes.get(checkedBlogIndex.value)?.blogs.get(checkedIndex.value)?.content =
|
||||
// blogTypes.get(checkedBlogIndex.value)?.blogs.get(checkedIndex.value)?.content =
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Blogタイプ名称修正
|
||||
*/
|
||||
@@ -242,6 +243,7 @@ const saveType = () => {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Blogタイトル修正
|
||||
*/
|
||||
@@ -258,6 +260,7 @@ const saveTitle = () => {
|
||||
updated.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ブログ新規作成
|
||||
*/
|
||||
@@ -282,8 +285,9 @@ const insertBlog = () => {
|
||||
isclicked.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ブログ削除
|
||||
* ブログ削除
|
||||
*/
|
||||
const deleteBlog = () => {
|
||||
if (btName.value == "删除") {
|
||||
@@ -297,7 +301,6 @@ const deleteBlog = () => {
|
||||
})
|
||||
btName.value = ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Blogタイプ新規作成用、作成後、リセットする
|
||||
@@ -351,8 +354,6 @@ const deleteBlogType = () => {
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Created 段階の関数呼び出す処理
|
||||
@@ -361,7 +362,7 @@ getTestData()
|
||||
|
||||
// サイズ調整部分
|
||||
type WholeStyle = {
|
||||
width: string
|
||||
width: string,
|
||||
height: string
|
||||
}
|
||||
let innerHeight = ref("")
|
||||
@@ -377,9 +378,9 @@ const cWholeStyle = reactive<WholeStyle>({} as WholeStyle)
|
||||
let contentWidth = 0.67 * window.innerWidth
|
||||
cWholeStyle.width = contentWidth + 'px'
|
||||
innerHeight.value = (window.innerHeight - 50) + 'px'
|
||||
onMounted(() => {
|
||||
// onMounted(() => {
|
||||
|
||||
})
|
||||
// })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%">
|
||||
<el-table-column type="index" label="index" width="80" />
|
||||
<el-table-column prop="bk_type_name" label="分类名" width="100" />
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="修改">
|
||||
<template #default="scope">
|
||||
<el-button class="click-icon" size="small" @click="handleEditType(scope.$index, scope.row)">编辑
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class="click-icon" prop="删除" label="url">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="danger" @click="handleDeleteType(scope.$index, scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<el-form :model="dialog_form">
|
||||
<el-form-item label="分类" :label-width="formLabelWidth">
|
||||
<el-select v-model="dialog_form.bk_type_id" placeholder>
|
||||
<el-option
|
||||
v-for="(item) in types"
|
||||
:key="item.bk_type_id"
|
||||
:value="item.bk_type_id"
|
||||
:label="item.bk_type_name"
|
||||
/>
|
||||
<el-option v-for="(item) in types" :key="item.bk_type_id" :value="item.bk_type_id"
|
||||
:label="item.bk_type_name" />
|
||||
</el-select>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth">
|
||||
<el-input v-model="dialog_form.comment" autocomplete="off" />
|
||||
@@ -24,15 +40,75 @@
|
||||
<el-button type="primary" @click="submit">提交</el-button>
|
||||
</span>
|
||||
<!-- </template> -->
|
||||
|
||||
<el-dialog v-model="deleteDialogVisible">
|
||||
<delete_dialog :delete_id="currentDialogData.bookmark_type_id" @on-submit="doDeleteType"></delete_dialog>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="deleteDialogVisible">
|
||||
<delete_dialog :delete_id="currentDialogData.bookmark_type_id" @on-submit="doEditType"></delete_dialog>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { update_bookmark, put_bookmark } from '../../api/bookmark'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { delete_bookmark_type, post_bookmark_type, get_bookmark_type } from '../../api/bookmark_type'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
const formLabelWidth = '140px'
|
||||
|
||||
// 定义书签格式
|
||||
type BookmarkType = {
|
||||
bookmark_type_id: string,
|
||||
bookmark_type_name: string,
|
||||
visiable: boolean,
|
||||
}
|
||||
|
||||
const tableData = reactive<BookmarkType[]>([])
|
||||
const currentDialogData = reactive<BookmarkType>({
|
||||
bookmark_type_id: '',
|
||||
bookmark_type_name: '',
|
||||
visiable: false,
|
||||
})
|
||||
|
||||
const deleteDialogVisible = ref<Boolean>(false)
|
||||
const editDialogVisible = ref<Boolean>(false)
|
||||
|
||||
const handleDeleteType = (index: number, bookmarkType: BookmarkType) => {
|
||||
Object.assign(currentDialogData, bookmarkType)
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleEditType = (index: number, bookmarkType: BookmarkType) => {
|
||||
Object.assign(currentDialogData, bookmarkType)
|
||||
editDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleSelectionChange = () => {
|
||||
|
||||
}
|
||||
|
||||
const doDeleteType = () => {
|
||||
delete_bookmark_type(currentDialogData.bookmark_type_id).then(response => {
|
||||
deleteDialogVisible.value = false
|
||||
doSearchType()
|
||||
})
|
||||
}
|
||||
|
||||
const doEditType = () => {
|
||||
post_bookmark_type(currentDialogData.bookmark_type_id).then(response => {
|
||||
deleteDialogVisible.value = false
|
||||
doSearchType()
|
||||
})
|
||||
}
|
||||
|
||||
const doSearchType = () => {
|
||||
get_bookmark_type().then(response => {
|
||||
deleteDialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
type Props = {
|
||||
types: any[],
|
||||
dialog_form: any,
|
||||
@@ -51,33 +127,23 @@ const submit = () => {
|
||||
comment: props.dialog_form.comment,
|
||||
url: props.dialog_form.url,
|
||||
}
|
||||
|
||||
if (props.operate_code == '0') {
|
||||
put_bookmark(params).then(response => {
|
||||
emit('on-submit')
|
||||
})
|
||||
} else if (props.operate_code == '1') {
|
||||
update_bookmark(params).then(response => {
|
||||
emit('on-submit')
|
||||
})
|
||||
} else if (props.operate_code == '2') {
|
||||
update_bookmark(params).then(response => {
|
||||
emit('on-submit')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doSearchType()
|
||||
</script>
|
||||
<style scoped>.el-button--text {
|
||||
<style scoped>
|
||||
.el-button--text {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.el-input {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.dialog-footer button:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<el-input v-model="bookmark_type_name" placeholder="Please input" />
|
||||
<!-- <template #footer> -->
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="submit">提交</el-button>
|
||||
</span>
|
||||
<!-- </template> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { put_bookmark_type } from '../../api/bookmark_type'
|
||||
|
||||
const bookmark_type_name = ref<String>('')
|
||||
|
||||
const emit = defineEmits(['on-update'])
|
||||
const submit = () => {
|
||||
const params = {
|
||||
bookmark_type_name: bookmark_type_name.value
|
||||
}
|
||||
|
||||
put_bookmark_type(params).then(response => {
|
||||
emit('on-update')
|
||||
bookmark_type_name.value = ''
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-button--text {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.el-input {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.dialog-footer button:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
+45
-23
@@ -14,6 +14,7 @@
|
||||
<div class="tag_list">
|
||||
<el-tag class="ml-2 click-icon" :type="item.clicked ? 'danger' : 'info'" v-for="(item) in bookmark_types"
|
||||
@click="handleTags(item)">{{ item.bk_type_name }}</el-tag>
|
||||
<el-button type="primary" @click="handleAddType" v-show="Tenant.account">增加</el-button>
|
||||
<el-button type="primary" @click="handleManageType" v-show="Tenant.account">自定义</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
@@ -60,7 +61,11 @@
|
||||
<delete_dialog :delete_id="currentDialogData.bk_id" @on-submit="doDelete"></delete_dialog>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-dialog v-model="TypeDialogVisible">
|
||||
<el-dialog v-model="createTypeDialogVisible">
|
||||
<createType_dialog @on-update="doUpdate"></createType_dialog>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-dialog v-model="typeDialogVisible">
|
||||
<bookmarkType_dialog :delete_id="currentDialogData.bk_id" @on-submit="doDelete"></bookmarkType_dialog>
|
||||
</el-dialog> -->
|
||||
</div>
|
||||
@@ -69,9 +74,10 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { search_bookmark, delete_bookmark } from '../../api/bookmark'
|
||||
import { bookmark_type } from '../../api/master'
|
||||
import { get_bookmark_type } from '../../api/bookmark_type'
|
||||
import bookmark_dialog from './dialog.vue'
|
||||
import bookmarkType_dialog from './Typedialog.vue'
|
||||
import createType_dialog from './createTypedialog.vue'
|
||||
import delete_dialog from '../../components/operate/deleteDialog.vue'
|
||||
import type { ElTable } from 'element-plus'
|
||||
import { CopyDocument } from "@element-plus/icons-vue";
|
||||
@@ -82,19 +88,6 @@ import { useTenantStore } from '../../store/tenant'
|
||||
// obtain user infomation
|
||||
const Tenant = useTenantStore()
|
||||
|
||||
const bookmark_types = reactive<any[]>([])
|
||||
bookmark_type().then(response => {
|
||||
response.data.forEach((element: String) => {
|
||||
const item = element.split("|")
|
||||
const row = {
|
||||
bk_type_id: Number(item[0]),
|
||||
bk_type_name: item[1],
|
||||
clicked: false
|
||||
}
|
||||
bookmark_types.push(row)
|
||||
})
|
||||
})
|
||||
|
||||
// 定义书签格式
|
||||
type Bookmark = {
|
||||
bk_id: string,
|
||||
@@ -140,16 +133,45 @@ const toggleSelection = (rows?: Bookmark[]) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleManageType = () => {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// dialog表示flag
|
||||
let dialogFormVisible = ref(false)
|
||||
let dialogVisible = ref(false)
|
||||
let TypeDialogVisible = ref(false)
|
||||
let typeDialogVisible = ref(false)
|
||||
let createTypeDialogVisible = ref(false)
|
||||
|
||||
/* click 自定义 */
|
||||
const handleManageType = () => {
|
||||
typeDialogVisible.value = true
|
||||
}
|
||||
|
||||
/* click 增加 */
|
||||
const handleAddType = () => {
|
||||
createTypeDialogVisible.value = true
|
||||
}
|
||||
|
||||
/* callback after we add bookmark_type */
|
||||
const doUpdate = () => {
|
||||
createTypeDialogVisible.value = false
|
||||
doSearch()
|
||||
dearchBookmarkType()
|
||||
}
|
||||
|
||||
const bookmark_types = reactive<any[]>([])
|
||||
const dearchBookmarkType = () => {
|
||||
get_bookmark_type().then(response => {
|
||||
bookmark_types.splice(0, bookmark_types.length)
|
||||
response.data.forEach((element: String) => {
|
||||
const item = element.split("|")
|
||||
const row = {
|
||||
bk_type_id: Number(item[0]),
|
||||
bk_type_name: item[1],
|
||||
clicked: false
|
||||
}
|
||||
bookmark_types.push(row)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 操作-》添加
|
||||
const handleInsert = () => {
|
||||
@@ -223,7 +245,6 @@ const doDelete = (delete_id: any) => {
|
||||
dialogVisible.value = false
|
||||
doSearch()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const closeDialog = () => {
|
||||
@@ -242,6 +263,7 @@ const copyNumber = (record: Bookmark) => {
|
||||
})
|
||||
}
|
||||
doSearch()
|
||||
dearchBookmarkType()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user