修改BUG

This commit is contained in:
a0049873 2022-06-24 10:04:30 +08:00
parent 01112ccd23
commit 608094dc5a
3 changed files with 23 additions and 455 deletions

View File

@ -117,7 +117,7 @@
</template> </template>
</div> </div>
<searchResultList <searchResultList
v-show="resourceList.data?.length > 0" v-show="resourceList.data && resourceList.data.length > 0"
:key="listKey2" :key="listKey2"
:resourceList="resourceList" :resourceList="resourceList"
:resourceTotal="resourceTotal" :resourceTotal="resourceTotal"
@ -125,7 +125,7 @@
/> />
<div class="pagination"> <div class="pagination">
<a-pagination <a-pagination
v-if="resourceList.data?.length > 0" v-if="resourceList.data && resourceList.data.length > 0"
v-model:current="currentPage" v-model:current="currentPage"
v-model:pageSize="currentPageSize" v-model:pageSize="currentPageSize"
show-size-changer show-size-changer
@ -137,7 +137,10 @@
@showSizeChange="onShowSizeChange" @showSizeChange="onShowSizeChange"
/> />
</div> </div>
<div v-if="resourceList.data?.length <= 0" style="margin-top: 2rem"> <div
v-if="resourceList.data && resourceList.data.length <= 0"
style="margin-top: 2rem"
>
<a-empty /> <a-empty />
</div> </div>
</div> </div>
@ -309,7 +312,7 @@
</div> </div>
<!-- 中心内容 --> <!-- 中心内容 -->
<searchResultList <searchResultList
v-show="resourceList.data?.length > 0" v-show="resourceList.data && resourceList.data.length > 0"
:key="listKey2" :key="listKey2"
:resourceList="resourceList" :resourceList="resourceList"
:resourceTotal="resourceTotal" :resourceTotal="resourceTotal"
@ -318,7 +321,7 @@
<!-- 分页 --> <!-- 分页 -->
<div class="pagination"> <div class="pagination">
<a-pagination <a-pagination
v-if="resourceList.data?.length > 0" v-if="resourceList.data && resourceList.data.length > 0"
v-model:current="currentPage" v-model:current="currentPage"
v-model:pageSize="currentPageSize" v-model:pageSize="currentPageSize"
show-size-changer show-size-changer
@ -330,7 +333,10 @@
@showSizeChange="onShowSizeChange" @showSizeChange="onShowSizeChange"
/> />
</div> </div>
<div v-if="resourceList.data?.length <= 0" style="margin-top: 200px"> <div
v-if="resourceList.data && resourceList.data.length <= 0"
style="margin-top: 200px"
>
<a-empty /> <a-empty />
</div> </div>
</div> </div>
@ -501,7 +507,7 @@
</template> </template>
</div> </div>
<searchResultList <searchResultList
v-show="resourceList.data?.length" v-show="resourceList.data && resourceList.data.length"
:key="listKey2" :key="listKey2"
:resourceList="resourceList" :resourceList="resourceList"
:resourceTotal="resourceTotal" :resourceTotal="resourceTotal"
@ -509,7 +515,7 @@
/> />
<div class="pagination"> <div class="pagination">
<a-pagination <a-pagination
v-if="resourceList.data?.length > 0" v-if="resourceList.data && resourceList.data.length > 0"
v-model:current="currentPage" v-model:current="currentPage"
v-model:pageSize="currentPageSize" v-model:pageSize="currentPageSize"
show-size-changer show-size-changer
@ -544,7 +550,10 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="resourceList.data?.length <= 0" style="margin-top: 2rem"> <div
v-if="resourceList.data && resourceList.data.length <= 0"
style="margin-top: 2rem"
>
<a-empty v-if="!(Cardsname == '数据资源')" /> <a-empty v-if="!(Cardsname == '数据资源')" />
</div> </div>
</div> </div>
@ -645,7 +654,7 @@
import detailsPageconetentTree from '@/views/home/detailsPageconetentTree.vue' import detailsPageconetentTree from '@/views/home/detailsPageconetentTree.vue'
import searchResultList from '@/views/home/components/searchResultList.vue' import searchResultList from '@/views/home/components/searchResultList.vue'
import KnowledgeBase from '@/views/home/components/KnowledgeBase.vue' import KnowledgeBase from '@/views/home/components/KnowledgeBase.vue'
import VideoSurveillance from '@/views/home/videoSurveillance' // import VideoSurveillance from '@/views/home/videoSurveillance'
// //
import DetailsPageResource from '@/views/home/components/DetailsPageResource.vue' import DetailsPageResource from '@/views/home/components/DetailsPageResource.vue'
export default defineComponent({ export default defineComponent({
@ -986,7 +995,7 @@
// debugger // debugger
tecHnosphere = router.currentRoute.value.query.tecHnosphere tecHnosphere = router.currentRoute.value.query.tecHnosphere
appLiCation = router.currentRoute.value.query.appLiCation appLiCation = router.currentRoute.value.query.appLiCation
if (val.typeList?.length > 6) { if (val.typeList && val.typeList.length > 6) {
val.showShrink = true val.showShrink = true
val.shrinkFlag = true val.shrinkFlag = true
} }
@ -1283,7 +1292,7 @@
DownOutlined, DownOutlined,
KnowledgeBase, KnowledgeBase,
// VideoCameraOutlined, // VideoCameraOutlined,
VideoSurveillance, // VideoSurveillance,
DetailsPageResource, DetailsPageResource,
}, },
beforeUnmount() { beforeUnmount() {

View File

@ -1,441 +0,0 @@
<template>
<div class="top">
<a-button series="primary" @click="showAdd(props.showItem.id)">
新增
</a-button>
<a-popconfirm
title="是否删除选中字段?"
ok-text="删除"
cancel-text="取消"
@confirm="confirm"
@cancel="cancel"
>
<a-button series="primary">批量删除</a-button>
</a-popconfirm>
</div>
<a-table
:columns="columns"
:data-source="dataSource"
:row-selection="rowSelection"
class="management-pop"
:key="showKey"
>
<template #bodyCell="{ column, text, record, index }">
<!--
'isLinkToDic',
'linkValue',
'isFilterCriteria', -->
<template v-if="column.dataIndex === 'name'">
<div class="text">
<a-input
v-if="editableData[record.id]"
v-model:value="editableData[record.id][column.dataIndex]"
style="margin: -5px 0; width: 80%"
/>
<template v-else>
{{ text }}
</template>
</div>
</template>
<template v-else-if="column.dataIndex === 'isLinkToDic'">
<div>
<!-- {{ dataSource[record.id] }} -->
<a-switch
:checked="editableData[record.id][column.dataIndex]"
v-if="editableData[record.id] && !dataSource[index]?.children"
@click="changeisLinkToDic(record.id)"
/>
<template v-else>
<a-switch :checked="text" />
</template>
</div>
</template>
<template v-else-if="column.dataIndex === 'linkValue'">
<div>
<a-select
ref="select"
:value="editableData[record.id][column.dataIndex]"
style="width: 120px"
@focus="focus"
@change="handleChange"
v-if="editableData[record.id] && !dataSource[index]?.children"
:disabled="editableData[record.id]['isLinkToDic'] ? false : true"
>
<a-select-option
:value="dic.type"
:key="dic.type"
v-for="dic in sysDic"
>
{{ dic.typeName }}
</a-select-option>
</a-select>
<template v-else>
<a-select
ref="select"
:value="text"
style="width: 120px"
@focus="focus"
@change="handleChange"
disabled
>
<a-select-option
:value="dic.type"
:key="dic.type"
v-for="dic in sysDic"
>
{{ dic.typeName }}
</a-select-option>
</a-select>
</template>
</div>
</template>
<template v-else-if="column.dataIndex === 'isFilterCriteria'">
<div>
<!-- {{ dataSource[record.id] }} -->
<a-switch
:checked="editableData[record.id][column.dataIndex]"
v-if="editableData[record.id] && !dataSource[index]?.children"
@click="changeisFilterCriteria(record.id)"
/>
<template v-else>
<a-switch :checked="text" />
</template>
</div>
</template>
<template v-else-if="column.dataIndex === 'operation'">
<div class="editable-row-operations">
<span v-if="editableData[record.id]">
<a-typography-link @click="save(record.id)">保存</a-typography-link>
<a-popconfirm title="是否取消编辑?" @confirm="cancel(record.id)">
<a>取消</a>
</a-popconfirm>
</span>
<span v-else>
<a
@click="showAdd(record.id, record.series)"
v-if="record.series == 0 && !record.isLinkToDic"
>
新增
</a>
<a @click="edit(record.id)">编辑</a>
<a-popconfirm
title="是否删除选中字段?"
ok-text="删除"
cancel-text="取消"
@confirm="confirm2(record.id)"
@cancel="cancel"
>
<a v-if="!record?.children">删除</a>
</a-popconfirm>
</span>
</div>
</template>
</template>
</a-table>
<a-modal
v-model:visible="visible"
style="margin-top: 200px"
title="新增编目"
@ok="handleOk"
>
字段名
<a-input
v-model:value="value"
style="width: 80%"
placeholder="请输入字段名"
/>
</a-modal>
</template>
<script setup>
import { message } from 'ant-design-vue'
import { cloneDeep } from 'lodash-es'
import { ref, reactive, defineProps } from 'vue'
import {
BianmuselectALlByRootId,
Bianmuinsert,
BianmudeleteById,
Bianmuupdate,
selectRootSysDic,
} from '@/api/index.js'
const columns = [
{
title: '字段',
dataIndex: 'name',
key: 'name',
width: '30%',
},
{
title: '是否关联字典表',
dataIndex: 'isLinkToDic',
key: 'isLinkToDic',
width: '15%',
},
{
title: '字典名称',
dataIndex: 'linkValue',
key: 'linkValue',
width: '20%',
},
{
title: '是否加入筛选条件',
dataIndex: 'isFilterCriteria',
key: 'isFilterCriteria',
width: '17%',
},
{
title: '操作栏',
dataIndex: 'operation',
key: 'operation',
width: '18%',
},
]
const data = []
//
let delList = []
const rowSelection = ref({
checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => {
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
'selectedRows: ',
selectedRows
)
delList = []
if (selectedRows) {
selectedRows.forEach((val) => {
delList.push(val.id)
})
}
},
onSelect: (record, selected, selectedRows) => {
console.log('onSelect', record, selected, selectedRows)
},
onSelectAll: (selected, selectedRows, changeRows) => {
console.log('onSelectAll', selected, selectedRows, changeRows)
},
})
console.log(columns, data, rowSelection.value)
const showKey = ref(0)
const props = defineProps({ showItem: { type: Object, default: null } })
//
const selectRoot = () => {
console.log(props.showItem)
BianmuselectALlByRootId({
id: props.showItem.id,
}).then((res) => {
console.log(res.data.data)
dataSource.value = []
res.data.data.forEach((val) => {
let obj = {}
Object.assign(obj, val)
if (obj.isLinkToDic == 'true') {
obj.isLinkToDic = true
} else if (obj.isLinkToDic == 'false') {
obj.isLinkToDic = false
}
if (obj.isFilterCriteria == 'true') {
obj.isFilterCriteria = true
} else if (obj.isFilterCriteria == 'false') {
obj.isFilterCriteria = false
}
obj.key = obj.id
if (obj.children) {
obj.children.forEach((item) => {
if (item.isLinkToDic == 'true') {
item.isLinkToDic = true
} else if (item.isLinkToDic == 'false') {
item.isLinkToDic = false
}
if (item.isFilterCriteria == 'true') {
item.isFilterCriteria = true
} else if (item.isFilterCriteria == 'false') {
item.isFilterCriteria = false
}
item.key = item.id
})
}
dataSource.value.push(obj)
})
console.log('dataSource==================>', dataSource.value)
showKey.value++
})
}
//
const sysDic = ref({})
selectRootSysDic().then((res) => {
sysDic.value = res.data.data
console.log(res.data.data, sysDic)
})
//
const init = () => {
selectRoot()
}
init()
const dataSource = ref(data)
const editableData = reactive({})
//
const edit = (id) => {
dataSource.value.forEach((val) => {
if (val.id === id) {
editableData[id] = cloneDeep(val)
} else {
if (val.children) {
val.children.forEach((item) => {
if (item.id === id) {
editableData[id] = cloneDeep(item)
}
})
}
}
})
console.log(editableData)
}
//
const save = (id) => {
Bianmuupdate(editableData[id]).then((res) => {
console.log(res)
if (res.data.code == 200) {
message.success('修改成功')
} else {
message.error('修改失败')
}
delete editableData[id]
init()
})
}
//
const cancel = (id) => {
delete editableData[id]
}
const focus = () => {
console.log('focus')
}
//
const changeisLinkToDic = (changeid) => {
// editableDataisLinkToDic isFilterCriteriaisLinkToDic
Object.keys(editableData).forEach((id) => {
if (id == changeid) {
editableData[id].isLinkToDic = !editableData[id].isLinkToDic
if (!editableData[id].isLinkToDic) {
editableData[id].isFilterCriteria = false
editableData[id].linkValue = ''
console.log(editableData[id])
}
}
})
}
//
const handleChange = (value) => {
console.log(`selected ${value}`)
// editableData
Object.keys(editableData).forEach((id) => {
editableData[id].linkValue = value
})
}
//
const changeisFilterCriteria = (changeid) => {
// editableDataisLinkToDic isFilterCriteria
Object.keys(editableData).forEach((id) => {
if (id == changeid) {
if (editableData[id].isLinkToDic) {
editableData[id].isFilterCriteria = !editableData[id].isFilterCriteria
} else {
message.error('请先选择加入字典')
}
}
})
}
const visible = ref(false)
const value = ref('')
const addType = ref({
pid: '',
series: '',
})
const showAdd = (pid, series) => {
visible.value = true
value.value = ''
addType.value.pid = pid
addType.value.series = series
}
const handleOk = () => {
if (addType.value.series != '1') {
const obj = {
pid: addType.value.pid,
// pid: 'D8A1C31B-6764-4827-821F-9249919E9E1F',
name: value.value,
isAttr: false,
isLinkToDic: false,
linkValue: '',
isFilterCriteria: false,
}
Bianmuinsert(obj).then((res) => {
if (res.data.code == 200) {
message.success('新增成功')
} else {
message.error('新增失败')
}
init()
visible.value = false
})
}
}
//
const del = (id) => {
delList = [id]
pDel()
}
//
const pDel = () => {
console.log(delList)
BianmudeleteById({ ids: delList }).then((res) => {
console.log(res.data)
init()
})
}
const confirm = () => {
pDel()
}
const confirm2 = (id) => {
del(id)
}
</script>
<style lang="less" scoped>
.top {
display: flex;
justify-content: flex-end;
button {
margin-left: 10px;
margin-bottom: 10px;
}
}
:deep(.ant-table) {
height: 500px;
overflow-y: scroll;
}
:deep(.ant-table::-webkit-scrollbar) {
width: 0 !important;
}
.editable-row-operations a {
margin-right: 8px;
}
.text {
padding-left: 25px;
}
:deep(.ant-table-row-level-1 .ant-table-selection-column) {
padding-left: 50px;
}
</style>

View File

@ -89,7 +89,7 @@
width="1000px" width="1000px"
:key="showKey" :key="showKey"
> >
<ManagementPop :showItem="showItem"></ManagementPop> <!-- <ManagementPop :showItem="showItem"></ManagementPop> -->
</a-modal> </a-modal>
<!-- 卡片覆盖层--> <!-- 卡片覆盖层-->
@ -108,7 +108,7 @@
Bianmuupdate, Bianmuupdate,
} from '@/api/index.js' } from '@/api/index.js'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import ManagementPop from './ManagementPop' // import ManagementPop from './ManagementPop'
import { ref } from 'vue' import { ref } from 'vue'
// import { nextTick } from 'process'; // import { nextTick } from 'process';
let topicCoverZIndex = ref(1000) // zIndex let topicCoverZIndex = ref(1000) // zIndex