西海岸--单兵设备和无人机:列表/申请接口联调

This commit is contained in:
guoyue 2022-09-21 15:43:55 +08:00
parent b3b35d21b3
commit 11f4c3fe25
3 changed files with 1835 additions and 1975 deletions

View File

@ -444,3 +444,19 @@ export function selectAppList(params) {
params, params,
}) })
} }
// 西-
export function getSoldierList(params) {
return request({
url: '/device/page',
method: 'get',
params,
})
}
// 西-
export function soldierApply(data) {
return request({
url: '/deviceApply',
method: 'post',
data,
})
}

View File

@ -126,7 +126,7 @@ import mybus from '@/myplugins/mybus'
import { sgcDel, getApplyForm } from '@/api/personalCenter' import { sgcDel, getApplyForm } from '@/api/personalCenter'
import { pageWithAttrs, updateIntegrationServices } from '@/api/home' import { pageWithAttrs, updateIntegrationServices } from '@/api/home'
import { DETAIL_PAGE_CONTENT_DEFAULT_TAB } from '@/global/GlobalConfig.js' import { DETAIL_PAGE_CONTENT_DEFAULT_TAB } from '@/global/GlobalConfig.js'
import { getIntegrationDetail } from '@/api/home' import { getIntegrationDetail, soldierApply } from '@/api/home'
export default { export default {
name: '', name: '',
@ -140,7 +140,6 @@ export default {
const disabled = ref(false) const disabled = ref(false)
const flag = ref(false) const flag = ref(false)
const list = ref(JSON.parse(localStorage.getItem('applyList'))) const list = ref(JSON.parse(localStorage.getItem('applyList')))
const deptNameAll = ref([]) // const deptNameAll = ref([]) //
const deptFlage = ref(true) // const deptFlage = ref(true) //
const applyAll = router.currentRoute.value.query.applyAll; const applyAll = router.currentRoute.value.query.applyAll;
@ -148,17 +147,15 @@ export default {
const integrationServicesId = router.currentRoute.value.query.integrationServicesId; const integrationServicesId = router.currentRoute.value.query.integrationServicesId;
// //
const integrationServicesItemInfo = ref(null) const integrationServicesItemInfo = ref(null)
const num = ref(0) const num = ref(0)
if (!applyAll) { if (!applyAll) {
list.value.map((item) => { list.value.map((item) => {
item.arr.map((val) => { item.arr.map((val) => {
console.log(item, '组件===========================')
let obj = item.children let obj = item.children
? item.children.filter((type) => type.id == val.id)[0] ? item.children.filter((type) => type.id == val.id)[0]
: val.type !== '应用资源' : val.type !== '应用资源'
if (obj) { if (obj) {
console.log('11111111111111111111111111111', obj, flag.value)
if (obj.type !== '应用资源') { if (obj.type !== '应用资源') {
flag.value = true flag.value = true
} }
@ -174,11 +171,13 @@ export default {
const baseURL = window.SITE_CONFIG.apiURL const baseURL = window.SITE_CONFIG.apiURL
let record = ref('1') let record = ref('1')
const text = ref('') const text = ref('')
// 西- todo
let wrjAndDbText = ['单兵设备', '无人机']
const formName = reactive({ const formName = reactive({
title: applyAll title: applyAll
? '全部应用资源申请' ? '全部应用资源申请'
: list.value[0].arr && list.value[0].arr[0].type == '单兵设备' : wrjAndDbText.includes(list.value[0].arr && list.value[0].arr[0] && list.value[0].arr[0].type)
? '单兵设备申请' ? list.value[0].arr[0].type + '申请'
: list.value[0].children : list.value[0].children
? '申请' + ? '申请' +
list.value[0].children list.value[0].children
@ -262,9 +261,7 @@ export default {
label: val.dictLabel, label: val.dictLabel,
}) })
}) })
// console.log('========>', applicationSceneOpthion.value)
}) })
// console.log(formName.system)
const formRef = ref() const formRef = ref()
const applySuccess = ref(true) const applySuccess = ref(true)
const dataForm = { const dataForm = {
@ -293,6 +290,7 @@ export default {
}) })
} }
//
const processStartHandle = () => { const processStartHandle = () => {
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
if (!formUrl) { if (!formUrl) {
@ -301,6 +299,7 @@ export default {
if (!formName) { if (!formName) {
return message.error('请设置表单名称') return message.error('请设置表单名称')
} }
if (id) { if (id) {
endProcess({ instanceId: taskId }).then((end) => { endProcess({ instanceId: taskId }).then((end) => {
if (end.data.code == 0) { if (end.data.code == 0) {
@ -421,125 +420,119 @@ export default {
}) })
} else { } else {
if (!applyAll) { if (!applyAll) {
console.log(list.value[0].arr[0]) let ids = []
// let falgNum = 0
if (list.value[0].arr[0].type == '单兵设备') { let sxt = true
message.success('单兵设备申请提交成功!') formName.system = []
jumpToDetailsPageconetent() console.log('list==================', list.value)
} else { list.value.map((val) => {
let ids = [] val.arr.map((item) => {
let falgNum = 0 if (item.type !== '基础设施') {
let sxt = true falgNum++
formName.system = []
console.log('list==================', list.value)
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
falgNum++
}
})
})
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
formName.system.push({
resourceId: item.resourceId,
resourceName: item.resourceName,
})
falgNum++
console.log(item.id)
if (item.id) {
ids.push(item.id)
}
} else {
let obj = {}
Object.assign(obj, formName)
console.log('摄像头===============>', obj, item)
obj.system = []
item.note1 = JSON.parse(item.note1)
item.note1.map((sxt) => {
obj.system.push({
resourceId: sxt.idtCameraChannel + '',
resourceName: sxt.channelName,
cameraId: sxt.channelId, //
channelCode: sxt.channelCode,
channelId: sxt.channelId,
channelName: sxt.channelName,
checkStatus: sxt.checkStatus + '',
gpsX: sxt.gpsX,
gpsY: sxt.gpsY,
idtCameraChannel: sxt.idtCameraChannel + '',
nodeName: sxt.nodeName,
parentId: sxt.parentId,
status: sxt.status + '',
})
})
submitApply(obj).then((res) => {
// applySuccess.value = false
console.log('摄像头申请================>', res)
if (item.id) {
sgcDel({ ids: [item.id] }).then((res1) => {
if (res1.data.msg === 'success') {
if (falgNum == 0 && sxt) {
message.success(
'申请提交成功,请到消息中心查看!'
)
sxt = false
}
mybus.emit('getSgcNum')
jumpToDetailsPageconetent()
}
})
} else {
if (
res.data.msg === 'success' &&
falgNum == 0 &&
sxt
) {
message.success('申请提交成功,请到消息中心查看!')
sxt = false
}
jumpToDetailsPageconetent()
}
})
}
})
})
console.log(
'提交数据==========================>',
formName,
ids
)
if (formName.system.length !== 0) {
if (formName.applicationSystem.length == 0) {
formName.applicationSystem = ''
} }
submitApply(formName).then((res) => { })
// applySuccess.value = false })
message.success('申请提交成功,请到消息中心查看!') list.value.map((val) => {
console.log('能力申请================>', res) val.arr.map((item) => {
if (res.data.code == 0) { if (item.type !== '基础设施') {
if (ids && ids.length > 0) { formName.system.push({
sgcDel({ ids: ids }).then((res) => { resourceId: item.resourceId,
if (res.data.msg === 'success') { resourceName: item.resourceName,
})
falgNum++
console.log(item.id)
if (item.id) {
ids.push(item.id)
}
} else {
let obj = {}
Object.assign(obj, formName)
console.log('摄像头===============>', obj, item)
obj.system = []
item.note1 = JSON.parse(item.note1)
item.note1.map((sxt) => {
obj.system.push({
resourceId: sxt.idtCameraChannel + '',
resourceName: sxt.channelName,
cameraId: sxt.channelId, //
channelCode: sxt.channelCode,
channelId: sxt.channelId,
channelName: sxt.channelName,
checkStatus: sxt.checkStatus + '',
gpsX: sxt.gpsX,
gpsY: sxt.gpsY,
idtCameraChannel: sxt.idtCameraChannel + '',
nodeName: sxt.nodeName,
parentId: sxt.parentId,
status: sxt.status + '',
})
})
submitApply(obj).then((res) => {
// applySuccess.value = false
console.log('摄像头申请================>', res)
if (item.id) {
sgcDel({ ids: [item.id] }).then((res1) => {
if (res1.data.msg === 'success') {
if (falgNum == 0 && sxt) {
message.success(
'申请提交成功,请到消息中心查看!'
)
sxt = false
}
mybus.emit('getSgcNum') mybus.emit('getSgcNum')
jumpToDetailsPageconetent() jumpToDetailsPageconetent()
} }
}) })
} else { } else {
// if (
if (integrationServicesId) { res.data.msg === 'success' &&
getIntegrationServicesDeatil(integrationServicesId).then(res => { falgNum == 0 &&
updateIntegrationServiceAction() sxt
}) ) {
message.success('申请提交成功,请到消息中心查看!')
sxt = false
} }
jumpToDetailsPageconetent() jumpToDetailsPageconetent()
} }
} else { })
message.error('申请失败!') }
} })
}) })
console.log('formName--ids-提交数据--------->', formName, ids);
if (formName.system.length !== 0) {
if (formName.applicationSystem.length == 0) {
formName.applicationSystem = ''
} }
// todo 西
if (wrjAndDbText.includes(list.value[0].arr[0].type)) {
handleWrjApply(formName)
return;
}
submitApply(formName).then((res) => {
// applySuccess.value = false
message.success('申请提交成功,请到消息中心查看!')
console.log('能力申请================>', res)
if (res.data.code == 0) {
if (ids && ids.length > 0) {
sgcDel({ ids: ids }).then((res) => {
if (res.data.msg === 'success') {
mybus.emit('getSgcNum')
jumpToDetailsPageconetent()
}
})
} else {
//
if (integrationServicesId) {
getIntegrationServicesDeatil(integrationServicesId).then(res => {
updateIntegrationServiceAction()
})
}
jumpToDetailsPageconetent()
}
} else {
message.error('申请失败!')
}
})
} }
} else { } else {
formName.applicationSystem = '' formName.applicationSystem = ''
@ -737,7 +730,32 @@ export default {
} }
) )
}) })
}
// 西 todo
const handleWrjApply = (formName) => {
let _data = {
deviceId: formName.system && formName.system[0] && formName.system[0].resourceId,
title: formName.title,
name: formName.user,
phone: formName.phone,
dept: formName.unit, //
system: formName.applicationSystem, //
area: formName.applicationScene, //
demand: formName.applicationBackground, //
}
console.log('_data-----提交申请------->', _data);
soldierApply(_data).then(res => {
console.log('res----提交申请-------->', res);
if (res.data.code == 0) {
message.success(res.data.msg)
jumpToDetailsPageconetent()
} else {
message.error('申请失败!')
}
}).catch(err => {
message.error(err)
})
} }
return { return {

File diff suppressed because it is too large Load Diff