新申购车

This commit is contained in:
a0049873 2022-06-28 21:49:50 +08:00
parent 107be0c3f4
commit c53e96d0c3
4 changed files with 627 additions and 357 deletions

View File

@ -189,3 +189,19 @@ export function getCategoryTreePage(params) {
params,
})
}
//
export function selectResourceCarGroupByDept(params) {
return request({
url: '/resourcecar/selectResourceCarGroupByDept',
method: 'get',
params,
})
}
//
export function selectResourceListByDept(params) {
return request({
url: '/resourcecar/selectResourceListByDept',
method: 'get',
params,
})
}

View File

@ -10,12 +10,16 @@
<span></span>
{{ item.deptName }}
</div>
<template v-for="val in item.children" :key="val.resourceId">
<div class="item">
<div class="name">
<span>{{ item.name }}</span>
<span>{{ item.type }}</span>
<span>{{ val.resourceName }}</span>
<span>{{ val.type }}</span>
</div>
<div class="description">{{ item.description }}</div>
<div class="remove" @click="removeFunction(item)"></div>
<div class="description">{{ val.description || '--' }}</div>
<div class="remove" @click="removeFunction(val)"></div>
</div>
</template>
</div>
</div>
</template>
@ -28,6 +32,7 @@
dataList: { type: Array, default: null },
})
let dataForm = ref([])
// eslint-disable-next-line vue/no-setup-props-destructure
dataForm.value = props.dataList
const router = useRouter()
const arr =
@ -66,9 +71,9 @@
margin-bottom: 0.2rem;
}
.ability-to-apply-for-content {
margin-bottom: 0.3rem;
border-bottom: 0.01rem #dddee1 solid;
padding-bottom: 0.3rem;
// margin-bottom: 0.3rem;
// border-bottom: 0.01rem #dddee1 solid;
// padding-bottom: 0.3rem;
padding-right: 0.5rem;
position: relative;
.dep-name {
@ -87,6 +92,12 @@
margin-right: 0.05rem;
}
}
.item {
padding-bottom: 0.1rem;
margin-bottom: 0.1rem;
border-bottom: 1px solid #dddee1;
position: relative;
}
.name {
margin-bottom: 0.2rem;
span:first-child {
@ -103,6 +114,7 @@
}
}
.description {
width: 10rem;
color: rgba(0, 0, 0, 0.45);
}
.remove {

View File

@ -7,7 +7,7 @@
</aside> -->
<article>
<div class="from-card" v-if="applySuccess">
<AbilityToApplyFor :dataList="dataList"></AbilityToApplyFor>
<AbilityToApplyFor :dataList="list"></AbilityToApplyFor>
</div>
<div class="form-container">
<div v-if="applySuccess">
@ -280,23 +280,29 @@
formName.unit = res.data.data.deptName
})
})
console.log(
'router传参==================>',
router.currentRoute.value.query.name
)
let arr =
router.currentRoute.value.query.name instanceof Array
? router.currentRoute.value.query.name
: [router.currentRoute.value.query.name]
console.log(router.currentRoute.value.query.ids)
const ids = router.currentRoute.value.query.ids
let dataResourceId = router.currentRoute.value.query.resourceId
dataResourceId.map((item) => {
selectOne(item).then((res) => {
dataList.value.push(res.data.data)
console.log('dataResourceId', dataList.value)
})
})
const list = ref(JSON.parse(localStorage.getItem('applyList')))
console.log('本地存储====================》', list.value)
// console.log(
// 'router==================>',
// router.currentRoute.value.query.name
// )
// let arr =
// router.currentRoute.value.query.name instanceof Array
// ? router.currentRoute.value.query.name
// : [router.currentRoute.value.query.name]
// const ids = router.currentRoute.value.query.ids
// console.log(
// 'ids==========================>',
// ids,
// router.currentRoute.value.query.ids
// )
// let dataResourceId = router.currentRoute.value.query.resourceId
// dataResourceId.map((item) => {
// selectOne(item).then((res) => {
// dataList.value.push(res.data.data)
// console.log('dataResourceId', dataList.value)
// })
// })
const businessKey = ref(router.currentRoute.value.query.id)
const taskId = ref(router.currentRoute.value.query.taskId)
if (businessKey.value) {
@ -365,65 +371,65 @@
if (!formName) {
return message.error('请设置表单名称')
}
if (arr && arr.length !== 0) {
console.log('提交')
const obj = ref({})
for (const key in formName) {
if (key !== 'formNameSystem') {
obj.value[key] = formName[key]
}
}
submitApply(obj.value).then((res) => {
applySuccess.value = false
message.success('操作成功!')
console.log('能力申请================>', res)
if (ids) {
sgcDel({ ids: ids }).then((res) => {
if (res.data.msg === 'success') {
mybus.emit('getSgcNum')
}
})
}
})
} else {
lastestPage({
key: dataForm.processDefinitionKey,
})
.then(({ data: res }) => {
if (res.code !== 0) {
return message.error(res.msg)
}
if (!res.data.list || res.data.list.length <= 0) {
return message.error('没有查询到流程,请先设计流程')
}
// proxy.$http['post'](formUrl, rootObj[formName])
tabilityapplication(formName)
.then(({ data: res }) => {
if (res.code !== 0) {
message.error(res.msg)
if (callbacks.formSaveErrorCallback) {
callbacks.formSaveErrorCallback(res)
}
}
if (callbacks.formSaveSuccessCallback) {
callbacks.formSaveSuccessCallback(res)
}
if (!res.data.businessKey) {
return message.error('业务KEY为空无法启动流程')
// startProcess(dataForm.processDefinitionKey, null, rootObj[formName])
} else {
startProcess(
dataForm.processDefinitionKey,
res.data.businessKey
// rootObj[formName]
)
}
})
.catch(() => {})
})
.catch(() => {})
// if (arr && arr.length !== 0) {
// console.log('')
// const obj = ref({})
// for (const key in formName) {
// if (key !== 'formNameSystem') {
// obj.value[key] = formName[key]
// }
// }
// submitApply(obj.value).then((res) => {
// applySuccess.value = false
// message.success('')
// console.log('================>', res)
// if (ids) {
// sgcDel({ ids: ids }).then((res) => {
// if (res.data.msg === 'success') {
// mybus.emit('getSgcNum')
// }
// })
}
// }
// })
// } else {
// lastestPage({
// key: dataForm.processDefinitionKey,
// })
// .then(({ data: res }) => {
// if (res.code !== 0) {
// return message.error(res.msg)
// }
// if (!res.data.list || res.data.list.length <= 0) {
// return message.error('')
// }
// // proxy.$http['post'](formUrl, rootObj[formName])
// tabilityapplication(formName)
// .then(({ data: res }) => {
// if (res.code !== 0) {
// message.error(res.msg)
// if (callbacks.formSaveErrorCallback) {
// callbacks.formSaveErrorCallback(res)
// }
// }
// if (callbacks.formSaveSuccessCallback) {
// callbacks.formSaveSuccessCallback(res)
// }
// if (!res.data.businessKey) {
// return message.error('KEY')
// // startProcess(dataForm.processDefinitionKey, null, rootObj[formName])
// } else {
// startProcess(
// dataForm.processDefinitionKey,
// res.data.businessKey
// // rootObj[formName]
// )
// }
// })
// .catch(() => {})
// })
// .catch(() => {})
// // })
// }
})
}
}
@ -528,31 +534,31 @@
}
const fileList = ref([])
//arr
mybus.on('reomveOldData', (item) => {
debugger
arr = []
formName.system = []
record.value = record.value + '1'
arr = item.Name
dataResourceId = item.depID
if (arr && arr.length !== 0) {
disabled.value = true
let str = ''
arr.forEach((val, index) => {
str += val
if (index < arr.length - 1) {
str += '、'
}
})
formName.formNameSystem = str
}
arr.forEach((val, index) => {
formName.system.push({
resourceName: val,
resourceId: dataResourceId[index],
})
})
})
// mybus.on('reomveOldData', (item) => {
// debugger
// arr = []
// formName.system = []
// record.value = record.value + '1'
// arr = item.Name
// // dataResourceId = item.depID
// if (arr && arr.length !== 0) {
// disabled.value = true
// let str = ''
// arr.forEach((val, index) => {
// str += val
// if (index < arr.length - 1) {
// str += ''
// }
// })
// formName.formNameSystem = str
// }
// arr.forEach((val, index) => {
// formName.system.push({
// resourceName: val,
// // resourceId: dataResourceId[index],
// })
// })
// })
onBeforeUnmount(() => {
mybus.off('reomveOldData')
})
@ -566,6 +572,7 @@
startProcess,
options,
fileList,
list,
headers: {
authorization: 'authorization-text',
},
@ -585,7 +592,7 @@
// background-color: #f5f8fc;
height: 100%;
width: 100%;
margin: 130px auto 0;
margin: 0.8rem auto 0;
display: flex;
justify-content: space-between;
aside {

View File

@ -1,18 +1,13 @@
<template>
<div class="bottom">
<div class="top">
<div class="left">
<a-checkbox v-model:checked="checkAll" @change="onCheckAllChange">
全选
</a-checkbox>
<a-checkbox
v-model:checked="reverseSelectionFalg"
@change="reverseSelection"
>
反选
</a-checkbox>
<div @click="reverseSelection" class="reverseSelection">反选</div>
<p>
已选
<span class="num">{{ checkedList.length }}</span>
<span class="num">{{ checkedListAbility.length || 0 }}</span>
</p>
</div>
<div class="right">
@ -22,8 +17,7 @@
placeholder="请输入关键词"
enter-button="搜索"
size="large"
@change="onSearch"
@search="getList"
@search="getList('init')"
/>
</div>
<a-popconfirm
@ -74,40 +68,46 @@
</a-button>
</div>
</div>
<!-- <div class="tab">
<span>筛选</span>
<div
:class="tabIndex == index ? 'tabclass' : ' '"
@click="changeTab(index)"
v-for="(item, index) in tabList"
:key="index"
>
{{ item }}
<div class="items">
<div class="item" v-for="val in list" :key="val.id">
<div class="item-top" @click="showBottom(val)">
<div>
<a-checkbox
:checked="val.checked"
@click.stop="checkedDept(val)"
></a-checkbox>
<span style="margin-left: 0.2rem">
{{ val.deptName + '(' + val.count + ')' }}
</span>
</div>
</div> -->
<DownOutlined v-show="!val.show" />
<UpOutlined v-show="val.show" />
</div>
<div class="item-bottom" v-show="val.show">
<a-list
class="demo-loadmore-list"
:loading="initLoading"
:loading="val.initLoading"
item-layout="horizontal"
:data-source="list"
:data-source="val.children"
:key="showKey"
>
<template #renderItem="{ item }">
<a-list-item>
<a-skeleton avatar :title="false" :loading="!!item.loading" active>
<a-skeleton avatar :title="false" :loading="item.loading" active>
<a-list-item-meta
:description="item.description || '--'"
style="position: relative"
>
<template #title>
<span
@click="showItem(item.resourceId, item.type, item.delFlag)"
@click="
showItem(item.resourceId, item.type, item.delFlag)
"
style="cursor: pointer"
class="name"
>
{{ item.name }}
{{ item.resourceName }}
</span>
<!-- <span class="time">加购时间{{ item.updateDate }}</span> -->
<span class="type">{{ item.type }}</span>
<svg
t="1652233950228"
@ -151,8 +151,7 @@
<template #avatar>
<a-checkbox
:checked="item.checked"
@click.stop="checkedItem(item)"
@change="checkedItem(item)"
@click.stop="checkedItem(val, item)"
></a-checkbox>
</template>
</a-list-item-meta>
@ -160,52 +159,64 @@
</a-list-item>
</template>
</a-list>
<a-pagination
<!-- <a-pagination
v-model:current="val.pageNum"
v-model:page-size="val.pageSize"
:total="val.count"
@change="pageChange2(val)"
:key="showKey"
:hideOnSinglePage="true"
></a-pagination> -->
</div>
</div>
</div>
<!-- <a-pagination
v-model:current="pageNum"
v-model:page-size="pageSize"
:page-size-options="pageSizeOptions"
:total="total"
show-size-changer
@showSizeChange="onShowSizeChange"
@change="pageChange"
:key="showKey"
>
<template #buildOptionText="props">
<span>{{ props.value }}/</span>
</template>
</a-pagination>
</a-pagination> -->
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import mybus from '@/myplugins/mybus'
import {
getSgcList,
sgcDel,
getTopCategory,
scInsert,
selectResourceCarGroupByDept,
selectResourceListByDept,
} from '@/api/personalCenter'
const router = useRouter()
//
const pageNum = ref('1')
const pageSize = ref('5')
const pageSizeOptions = ref(['5', '10', '20'])
const pageSize = ref('99999')
// const pageSizeOptions = ref(['5', '10', '20'])
const total = ref(0)
const load = ref(0)
//
const checkedList = ref([])
const checkedListAll = ref([])
const checkedListAbility = ref([])
const checkAll = ref(false)
const initLoading = ref(true)
const checkNum = ref(0)
const showKey = ref(0)
//
const name = ref('')
const type = ref('')
const list = ref([])
const tabList = ref([])
//
onMounted(() => {
getList()
getCategory()
getList('init')
})
//
const collection = () => {
@ -220,7 +231,7 @@
message.error('请选择需要收藏的数据')
} else {
list.value.forEach((val) => {
if (checkedList.value.indexOf(val.id) !== -1) {
if (checkedList.value.indexOf(val.deptId) !== -1) {
if (val.delFlag == 0) {
scArr.push({ resourceId: val.resourceId })
}
@ -238,44 +249,59 @@
}
}
}
//
const getCategory = () => {
getTopCategory().then((res) => {
console.log('编目一级=============>', res.data)
res.data.data.forEach((val) => {
if (val.name == '应用资源' || val.name == '组件服务') {
tabList.value.push(val.name)
}
})
})
}
//
const onCheckAllChange = () => {
// console.log(checkedList)
if (checkAll.value) {
// checkedList.value = []
list.value.forEach((val) => {
console.log(val)
if (checkedList.value.indexOf(val.id) != -1) {
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
if (checkedList.value.indexOf(val.deptId) == -1) {
checkedList.value.push(val.deptId)
checkedListAll.value.push(val.deptId)
}
if (val.children.length > 0) {
val.children.map((item) => {
if (checkedListAbility.value.indexOf(item.resourceId) == -1) {
checkedListAbility.value.push(item.resourceId)
val.checkedList.push(item.resourceId)
checkNum.value++
}
item.checked = true
})
} else {
getListByDeptId(val)
}
val.checked = true
checkedList.value.push(val.id)
dataResourceId.value.push(val.resourceId)
arr.value.push(val.name)
})
// console.log(checkAll.value)
console.log(checkAll.value, checkedList.value)
} else {
list.value.forEach((val) => {
val.checked = false
if (checkedList.value.indexOf(val.id) != -1) {
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
checkNum.value -= Number(val.count)
if (checkedList.value.indexOf(val.deptId) != -1) {
checkedList.value.splice(checkedList.value.indexOf(val.deptId), 1)
checkedListAll.value.splice(
checkedListAll.value.indexOf(val.deptId),
1
)
handleChild(val)
}
})
console.log(checkAll.value, checkedList.value)
}
}
// child
const handleChild = (val) => {
if (val.children.length > 0) {
val.children.map((item) => {
console.log('child=============>', checkedListAbility.value, item)
if (checkedListAbility.value.indexOf(item.resourceId) > -1) {
item.checked = false
checkedListAbility.value.splice(
checkedListAbility.value.indexOf(item.resourceId),
1
)
val.checkedList.splice(val.checkedList.indexOf(item.resourceId), 1)
}
})
// checkedList.value = []
dataResourceId.value = []
arr.value = []
console.log(checkAll.value)
}
}
//
@ -291,21 +317,42 @@
if (checkAll.value) {
checkAll.value = false
list.value.map((val) => {
if (checkedList.value.indexOf(val.id) > -1) {
checkNum.value -= Number(val.count)
if (checkedList.value.indexOf(val.deptId) > -1) {
val.checked = false
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
checkedList.value.splice(checkedList.value.indexOf(val.deptId), 1)
checkedListAll.value.splice(
checkedListAll.value.indexOf(val.deptId),
1
)
handleChild(val)
}
})
} else {
const arr = []
list.value.map((val) => {
if (val.checked) {
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
} else {
checkedList.value.push(val.id)
arr.push(val.id)
}
val.checked = !val.checked
if (val.checked) {
checkNum.value += Number(val.count)
checkedList.value.push(val.deptId)
checkedListAll.value.push(val.deptId)
if (val.children.length > 0) {
val.children.map((item) => {
item.checked = true
checkedListAbility.value.push(item.resourceId)
val.checkedList.push(item.resourceId)
})
}
arr.push(val.deptId)
} else {
checkNum.value -= Number(val.count)
checkedList.value.splice(checkedList.value.indexOf(val.deptId), 1)
checkedListAll.value.splice(
checkedListAll.value.indexOf(val.deptId),
1
)
handleChild(val)
}
if (arr.length == list.value.length) {
checkAll.value = true
}
@ -318,109 +365,262 @@
name.value = ''
type.value = ''
pageNum.value = '1'
pageSize.value = '5'
pageSize.value = '99999'
checkedList.value = []
checkedListAll.value = []
checkAll.value = false
showKey.value++
getList()
}
//
const getList = () => {
getSgcList({
const getList = (type) => {
if (type == 'init') {
pageNum.value = 1
pageSize.value = 99999
}
selectResourceCarGroupByDept({
pageNum: pageNum.value,
pageSize: pageSize.value,
name: name.value,
type: type.value,
}).then((res) => {
console.log('申购车列表================>', res.data.data.records)
checkAll.value = true
initLoading.value = false
list.value = []
total.value = res.data.data.total
res.data.data.records.forEach((val) => {
const obj = {
loading: false,
name: val.resourceDTO.name,
id: val.id,
checked: false,
type: val.resourceDTO.type,
resourceId: val.resourceId,
updateDate: val.updateDate,
description: val.resourceDTO.description,
delFlag: val.resourceDTO.delFlag,
}
if (checkedList.value.indexOf(val.id) == -1) {
checkAll.value = false
let statistics = 0
res.data.data.list.map((val) => {
val.initLoading = true
val.show = false
if (checkedList.value.indexOf(val.deptId) > -1) {
val.checked = true
statistics++
} else {
obj.checked = true
val.checked = false
}
list.value.push(obj)
val.checkedList = []
val.children = []
val.pageNum = '1'
val.pageSize = '99999'
})
if (statistics == res.data.data.list.length) {
checkAll.value = true
}
if (list.value.length == 0) {
load.value = 1
}
if (load.value < Number(pageNum.value)) {
load.value = Number(pageNum.value)
}
console.log('整体页面加载次数===============>', load.value)
list.value = res.data.data.list
total.value = res.data.data.deptCount
showKey.value++
if (type == 'init' || type == 'changePage') {
getListByDeptId(list.value[0])
}
})
}
const onShowSizeChange = (current, pageSize) => {
console.log(current, pageSize)
// pageNum.value = current
// pageSize.value = pageSize
// getList()
// deptid
const getListByDeptId = (item) => {
if (item.children.length == 0) {
selectResourceListByDept({
pageNum: item.pageNum,
pageSize: item.pageSize,
deptId: item.deptId,
}).then((res) => {
console.log(
'根据部门查询=============>',
item,
checkedListAbility.value
)
res.data.data.map((val) => {
if (
(!item.load || item.load < Number(item.pageNum)) &&
load.value <= Number(pageNum.value)
) {
if (
item.checkAll == true ||
checkedList.value.indexOf(item.deptId) > -1
) {
if (checkedListAbility.value.indexOf(val.resourceId) == -1) {
checkedListAbility.value.push(val.resourceId)
item.checkedList.push(val.resourceId)
}
val.checked = true
checkNum.value++
} else if (checkedListAbility.value.indexOf(val.resourceId) == -1) {
val.checked = false
}
} else {
console.log(
'第二次加载++++++++++++++',
checkedListAbility.value,
val.resourceId
)
if (
checkedListAbility.value.indexOf(val.resourceId) > -1 ||
(item.load < Number(item.pageNum) &&
checkedListAll.value.indexOf(item.deptId) > -1)
) {
val.checked = true
} else {
val.checked = false
}
}
val.loading = false
})
if (item.children.length == 0) {
item.load = 1
}
if (item.load < Number(item.pageNum)) {
item.load = Number(item.pageNum)
}
console.log('加载次数==============>>', item.load)
item.children = res.data.data
item.show = true
item.initLoading = false
})
}
}
//
const showBottom = (item) => {
item.show = !item.show
if (item.show) {
getListByDeptId(item)
}
}
//
const pageChange = (val) => {
checkAll.value = false
pageNum.value = val
pageNum.value = val
// checkedList.value = []
getList()
getList('changePage')
}
//
// const onSearch = (name) => {
// name.value = name
// console.log(name.value)
// }
//id
const dataResourceId = ref([])
const arr = ref([])
//
const checkedItem = (item) => {
//
const pageChange2 = (item) => {
getListByDeptId(item)
}
//
const checkedDept = (item) => {
console.log(
'点击部门多选框==================>',
item,
checkedList.value,
checkAll.value
)
item.checked = !item.checked
if (item.checked) {
if (item.children.length > 0) {
item.children.map((val) => {
if (checkedListAbility.value.indexOf(val.resourceId) == -1) {
checkedListAbility.value.push(val.resourceId)
item.checkedList.push(val.resourceId)
}
val.checked = true
})
}
item.checkAll = true
checkedList.value.push(item.deptId)
checkedListAll.value.push(item.deptId)
judgeAll(item)
checkNum.value += Number(item.count)
if (checkedList.value.length == list.value.length) {
checkAll.value = true
list.value.forEach((val) => {
if (val.id === item.id) {
console.log(val)
val.checked = !val.checked
if (val.checked) {
checkedList.value.push(val.id)
dataResourceId.value.push(val.resourceId)
arr.value.push(val.name)
}
} else {
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
dataResourceId.value.splice(
checkedList.value.indexOf(val.resourceId),
if (item.children.length > 0) {
item.children.map((val) => {
if (checkedListAbility.value.indexOf(val.resourceId) > -1) {
checkedListAbility.value.splice(
checkedListAbility.value.indexOf(val.resourceId),
1
)
arr.value.splice(arr.value.indexOf(val.name), 1)
}
}
if (checkedList.value.indexOf(val.id) == -1) {
checkAll.value = false
item.checkedList.splice(item.checkedList.indexOf(val.resourceId), 1)
val.checked = false
}
})
console.log(checkedList.value)
showKey.value++
}
//
// const tabIndex = ref(-1)
// const changeTab = (index) => {
// console.log('tabIndex', tabIndex.value, index, tabList)
// if (tabIndex.value == index) {
// tabIndex.value = -1
// type.value = ''
// } else {
// tabIndex.value = index
// type.value = tabList.value[index]
// }
// getList()
// }
item.checkAll = false
checkedList.value.splice(checkedList.value.indexOf(item.deptId), 1)
checkedListAll.value.splice(checkedListAll.value.indexOf(item.deptId), 1)
judgeAll(item)
if (checkedList.value.length !== list.value.length) {
checkAll.value = false
}
checkNum.value -= Number(item.count)
}
}
//
const judgeAll = (item, val) => {
console.log(
'判断是否全选============>',
item,
val,
list.value,
checkedList.value
)
if (!val) {
let all = true
list.value.map((val) => {
if (val.checkedList.length !== val.children.length) {
all = false
}
})
if (all) {
checkAll.value = true
} else {
checkAll.value = false
}
} else {
let all = true
item.children.map((child) => {
if (checkedListAbility.value.indexOf(child.resourceId) == -1) {
all = false
}
})
if (all) {
item.checked = true
} else {
item.checked = false
}
}
}
//
const checkedItem = (val, item) => {
console.log('点击能力===========>', val, item, checkedListAbility.value)
item.checked = !item.checked
if (item.checked) {
checkNum.value++
if (checkedListAbility.value.indexOf(item.resourceId) == -1) {
checkedListAbility.value.push(item.resourceId)
val.checkedList.push(item.resourceId)
}
} else {
checkNum.value--
checkedListAbility.value.splice(
checkedListAbility.value.indexOf(item.resourceId),
1
)
val.checkedList.splice(val.checkedList.indexOf(item.resourceId), 1)
}
console.log('判断是否全选===============>', val, checkedListAll.value)
if (val.checkedList.length == val.count) {
val.checked = true
checkedList.value.push(val.deptId)
checkedListAll.value.push(val.deptId)
console.log(
'全选===========================>',
checkedList.value,
list.value
)
if (checkedList.value.length == list.value.length) {
checkAll.value = true
}
} else {
val.checked = false
if (checkedList.value.indexOf(val.deptId) > -1) {
checkedList.value.splice(checkedList.value.indexOf(val.deptId), 1)
}
if (checkedList.value.length !== list.value.length) {
checkAll.value = false
}
}
}
//
const delList = () => {
if (checkedList.value.length == 0) {
@ -456,39 +656,32 @@
}
//
const apply = () => {
list.value.forEach((val) => {
if (checkedList.value.indexOf(val.id) !== -1) {
if (val.delFlag != 0) {
checkedList.value.splice(checkedList.value.indexOf(val.id), 1)
console.log('已下架======================>', arr)
arr.value.splice(arr.value.indexOf(val.name), 1)
val.checked = false
message.error('已下架的能力无法申请!')
}
}
})
// list.value.forEach((val) => {
// if (checkedList.value.indexOf(val.deptId) !== -1) {
// if (val.delFlag != 0) {
// checkedList.value.splice(checkedList.value.indexOf(val.deptId), 1)
// val.checked = false
// message.error('')
// }
// }
// })
if (checkedList.value.length == 0) {
message.error('请先选择需要申请的数据!')
} else {
console.log('一键申请===================>', arr)
console.log('一键申请===================>', list.value)
localStorage.setItem('applyList', JSON.stringify(list.value))
router.push({
path: '/apply',
query: {
name: arr.value,
ids: checkedList.value,
resourceId: dataResourceId.value,
},
})
}
}
</script>
<style lang="less" scoped>
.ant-list {
height: 7.23rem;
overflow-y: scroll;
// max-height: 5.3rem;
.ant-list-item {
width: 10.5rem;
padding: 0.24rem 0;
width: 100%;
padding: 0.24rem 0.2rem;
.ant-list-item-meta {
align-items: center;
:deep(.ant-list-item-meta-avatar) {
@ -508,7 +701,7 @@
}
:deep(.ant-list-item-meta-description) {
margin-top: 0.1rem;
max-height: 0.44rem;
max-height: 0.22rem;
margin-right: 0.1rem;
overflow: hidden;
text-overflow: ellipsis;
@ -522,7 +715,7 @@
.ant-list::-webkit-scrollbar {
width: 0 !important;
}
.bottom {
.top {
margin: 0.1rem;
display: flex;
justify-content: space-between;
@ -538,6 +731,13 @@
margin-bottom: 0;
border-left: 1px solid #212121;
}
.reverseSelection {
margin-right: 0.1rem;
cursor: pointer;
}
.reverseSelection:hover {
color: #0058e1;
}
span {
margin-left: 0.1rem;
}
@ -555,7 +755,7 @@
margin-bottom: 0.1rem;
}
.sousuokuang {
width: 3.2rem;
width: 3.25rem;
margin: 0.1rem 0rem 0.21rem 0.2rem;
.ant-input-search {
max-width: 3rem;
@ -571,7 +771,7 @@
display: inline-block;
margin-left: 0.1rem;
.ant-input-search-button {
width: 0.6rem;
width: 0.65rem;
height: 0.36rem;
border-radius: 2px;
font-size: 0.14rem;
@ -613,4 +813,39 @@
.name:hover {
color: #0087ff;
}
.items {
height: 7.25rem;
padding: 0 0.3rem;
overflow-y: scroll;
.item {
.item-top {
width: 100%;
height: 0.6rem;
font-size: 20px;
font-weight: 600;
background: rgba(0, 135, 225, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0.1rem;
margin-top: 0.08rem;
}
.item-top:hover {
cursor: pointer;
// 0058e1 0.5
background: rgba(0, 88, 225, 0.8);
color: white;
:deep(.anticon) {
color: white;
}
}
.item-bottom {
padding: 0 0.2rem;
border: 1px solid rgba(0, 135, 225, 0.1);
}
}
}
.ant-pagination {
margin-bottom: 0.2rem;
}
</style>