新增全部任务列表、任务详情等

This commit is contained in:
余菲 2022-12-12 16:08:10 +08:00
parent d2bc3ce2a4
commit 1c08d318ac
31 changed files with 1465 additions and 35 deletions

View File

@ -8,7 +8,18 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.9.21/skins/default/aliplayer-min.css" />
<script charset="utf-8" type="text/javascript"
src="https://g.alicdn.com/de/prismplayer/2.9.21/aliplayer-h5-min.js"></script>
<script src="/aliyun-upload-sdk/lib/es6-promise.min.js"></script>
<script src="/aliyun-upload-sdk/lib/aliyun-oss-sdk-6.13.0.min.js"></script>
<script src="/aliyun-upload-sdk/aliyun-upload-sdk-1.5.2.min.js"></script>
<title><%= title %></title>
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode: '3dd0aa9a29ef55cf6347cbe0ebf0de82'
}
</script>
</head>
<body>
<div id="app"></div>

View File

@ -9,6 +9,7 @@
"serve": "vite preview"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@tinymce/tinymce-vue": "^4.0.5",
"@vicons/antd": "^0.10.0",
"@vicons/ionicons5": "^0.10.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,114 @@
import { defAxios as request } from '@/utils/http'
/**
* @description: 分页查询任务列表
* @return {*}
*/
export function allTaskList(params) {
return request({
url: '/inspection/findList',
method: 'get',
params
})
}
/**
* @description: 查询飞行坐标数据
* @return {*}
*/
export function getCoordinate(id) {
return request({
url: `/flightdata/getFlightDataList?inspectionId=${id}`,
method: 'get'
})
}
/**
* @description: 创建任务
* @return {*}
*/
export function taskCreate(data) {
return request({
url: '/inspection/addThInspection',
method: 'post',
data
})
}
/**
* @description: 获取全部河流列表
* @return {*}
*/
export function allRivers() {
return request({
url: '/stream/getList',
method: 'get'
})
}
/**
* @description: 获取任务详情
* @return {*}
*/
export function taskDetail(id) {
return request({
url: `/inspection/findById?id=${id}`,
method: 'get'
})
}
/**
* @description: 更新任务信息
* @return {*}
*/
export function taskUpdate(data) {
return request({
url: '/inspection/updateById',
method: 'post',
data
})
}
/**
* @description: 删除任务
* @return {*}
*/
export function taskDelete(ids) {
return request({
url: `/inspection/deleteBatch/?idList=${ids} `,
method: 'delete'
})
}
/**
* @description: 生成巡河报告
* @return {*}
*/
export function createStreamReport(id) {
return request({
url: `/reportPatrol/generateReport?inspectionId=${id}`,
method: 'get'
})
}
/**
* @description: 生成巡检报告
* @return {*}
*/
export function createReport(id) {
return request({
url: `/report/generateReport?inspectionId=${id}`,
method: 'get'
})
}
/**
* @description: 审核任务
* @return {*}
*/
export function taskApprove(data) {
return request({
url: '/inspection/checkById',
method: 'post',
data
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

View File

@ -15,18 +15,19 @@ export function createPermissionGuard(router) {
const userStore = useUserStore()
const permissionStore = usePermissionStore()
router.beforeEach(async(to, from, next) => {
const oidcUser = await getUserInfo()
// const oidcUser = await getUserInfo()
const oidcUser = true
if (oidcUser) {
const hasRoutes = !!permissionStore.permissionRoutes.length
if (hasRoutes) {
next()
} else {
try {
const { clientRoleList } = oidcUser.profile
const { VITE_CLIENT_ID } = import.meta.env
const { roleId } = clientRoleList.find((item) => {
return item.clientId === VITE_CLIENT_ID
})
// const { clientRoleList } = oidcUser.profile
// const { VITE_CLIENT_ID } = import.meta.env
// const { roleId } = clientRoleList.find((item) => {
// return item.clientId === VITE_CLIENT_ID
// })
// await userStore.getUserInfo()
// const routes = await permissionStore.generateRoutes(roleId)
const routes = await permissionStore.generateRoutesMock()

View File

@ -1,3 +1,17 @@
export const TASK_STATUS = [
{ label: '任务待审核', value: 1 },
{ label: '任务待飞行', value: 5 },
{ label: '任务飞行中', value: 10 },
{ label: '任务飞行失败(机场)', value: 12 },
{ label: '任务飞行完成', value: 15 },
{ label: '审核未通过', value: 20 },
{ label: '问题待分派', value: 25 },
{ label: '问题待处理', value: 30 },
{ label: '问题处理中', value: 35 },
{ label: '报告待生成', value: 40 },
{ label: '报告已生成', value: 45 }
]
export const QUESTION_STATUS = [
{ label: '已确认', value: 1 },
{ label: '已忽略', value: 2 },

21
src/utils/filter.js Normal file
View File

@ -0,0 +1,21 @@
/**
*
* @param {*} obj 原数据的格式{label: 'label', value: 'value}
* @param {*} data 数据
* @param {*} value 用于匹配的值
*/
export const filterData = function(data, value, obj) {
if (obj) {
data.forEach(item => {
if (item[obj.value] === value) {
return item[obj.label]
}
})
} else {
data.forEach(item => {
if (item.value === value) {
return item.label
}
})
}
}

View File

@ -12,18 +12,19 @@ export function setupInterceptor(service) {
if (isWithoutToken(config)) {
return config
} else {
const userInfo = await getUserInfo()
if (userInfo) {
const { token_type, access_token } = userInfo
// config.headers.Authorization = `${token_type} ${access_token}`
config.headers.Authorization = '70aa58b4-dda7-446d-8cbf-8e6d6ab89a02'
const { VITE_CLIENT_ID } = import.meta.env
config.headers['Client-Id'] = VITE_CLIENT_ID
return config
} else {
signoutRedirect()
return Promise.reject({ response: { status: 401, message: '未登录' }})
}
// const userInfo = await getUserInfo()
// if (userInfo) {
// const { token_type, access_token } = userInfo
// // config.headers.Authorization = `${token_type} ${access_token}`
// config.headers.Authorization = '5d45f171-18fd-4e5e-9aac-f0936ac62e01'
config.headers.Authorization = '94e7d65e-1852-4fff-99de-dfe6bef52428'
// const { VITE_CLIENT_ID } = import.meta.env
// config.headers['Client-Id'] = VITE_CLIENT_ID
return config
// } else {
// signoutRedirect()
// return Promise.reject({ response: { status: 401, message: '未登录' }})
// }
}
},
(error) => Promise.reject(error)

View File

@ -0,0 +1,96 @@
<template>
<Modal
:options="getModalOptions"
:on-negative-click="handleClose"
:on-close="handleClose"
>
<template #Context>
<div class="history_list">
<div v-for="(item, index) in historyList" :key="index" class="history_item">
<div class="item_title">审核时间{{ item.checkTime }}</div>
<div class="item_body">
<div class="check_user">审核人{{ item.checkUserName }}</div>
<div class="check_status">审核状态{{ item.status == 1 ? '审核通过' : '审核不通过' }}</div>
<div class="check_note">备注{{ item.note }}</div>
</div>
</div>
</div>
</template>
</Modal>
</template>
<script>
import Modal from '@/components/Modal/index.vue'
import { defineComponent, computed, ref, reactive, toRefs, watch } from 'vue'
export default defineComponent({
name: 'TaskApprove',
components: { Modal },
props: {
visible: {
type: Boolean,
default: false
},
data: {
type: Array,
default: () => {}
}
},
emits: {
'update:visible': null,
'reload': null
},
setup(props, { emit }) {
const data = reactive({
historyList: props.data
})
const formRef = ref(null)
const getModalOptions = computed(() => {
return {
title: '历史记录',
show: props.visible,
negativeText: '关闭'
}
})
watch(() => props.visible, (value) => {
console.log(value)
})
/* 关闭弹窗 */
const handleClose = () => {
emit('update:visible', false)
}
return {
...toRefs(data),
formRef,
getModalOptions,
handleClose
}
}
})
</script>
<style scoped>
.history_list {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.history_item {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-content: flex-start;
}
.item_body {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
}
</style>

View File

@ -0,0 +1,107 @@
<template>
<Modal
:options="getModalOptions"
:on-positive-click="handleConfirm"
:on-negative-click="handleClose"
:on-close="handleClose"
>
<template #Context>
<n-form
ref="formRef"
:model="form"
:rules="rules"
:label-width="80"
label-placement="left"
require-mark-placement="left"
:disabled="disabled"
>
<n-form-item label="审核状态" path="status">
<n-select v-model:value="form.status" :options="statusOptions" placeholder="请选择审核状态" />
</n-form-item>
<n-form-item label="备注" path="note">
<n-input v-model:value="form.note" type="textarea" placeholder="请输入备注" />
</n-form-item>
</n-form>
</template>
</Modal>
</template>
<script>
import Modal from '@/components/Modal/index.vue'
import { defineComponent, computed, ref, reactive, toRefs, watch } from 'vue'
import { taskApprove } from '@/api/inspection/alltask.js'
export default defineComponent({
name: 'TaskApprove',
components: { Modal },
props: {
visible: {
type: Boolean,
default: false
},
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null,
'reload': null
},
setup(props, { emit }) {
const data = reactive({
form: { ...props.data },
rules: {
status: [{ required: true, message: '请选择审核状态', type: 'number', trigger: 'blur' }],
note: [{ required: true, message: '请输入备注', type: 'string', trigger: 'blur' }]
},
statusOptions: [
{ value: 5, label: '审核通过' },
{ value: 20, label: '审核不通过' }
]
})
const formRef = ref(null)
const getModalOptions = computed(() => {
return {
title: '审核',
show: props.visible,
negativeText: '取消',
positiveText: '确认'
}
})
watch(() => props.visible, (value) => {
console.log(value)
})
/* 关闭弹窗 */
const handleClose = () => {
emit('update:visible', false)
}
/* 提交表单 */
const handleConfirm = function() {
formRef.value?.validate((errors) => {
if (!errors) {
const params = { ...data.form }
taskApprove(params).then(res => {
if (res.code === 0) {
emit('reload')
handleClose()
}
})
} else {
$message.error('请完善必填信息')
}
})
}
return {
...toRefs(data),
formRef,
getModalOptions,
handleConfirm,
handleClose
}
}
})
</script>

View File

@ -0,0 +1,159 @@
<template>
<n-drawer v-bind="getDrawerOptions" @update:show="updateVisible">
<n-drawer-content closable title="飞行坐标">
<data-table
ref="tableRef"
:columns="columns"
:data="tableData"
:row-key="(row) => row.id"
:scroll-x="2200"
size="large"
/>
</n-drawer-content>
</n-drawer>
</template>
<script>
import { reactive, computed, toRefs, watch, ref } from 'vue'
import dataTable from '@/components/DataTable/index.vue'
import { getCoordinate } from '@/api/inspection/alltask.js'
export default {
name: 'TaskCoordinate',
components: { dataTable },
props: {
/* 可见 */
visible: {
type: Boolean,
default: false
},
/* 选中的数据 */
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null
},
setup(props, { emit }) {
const data = reactive({
columns: [
{
title: '序号',
key: 'key',
render: (_, index) => {
return `${index + 1}`
},
align: 'center',
minWidth: 50
},
{
title: '云盒SN号',
key: 'boxSn',
align: 'center',
minWidth: 100
},
{
title: '经度',
key: 'lng',
align: 'center',
minWidth: 100
},
{
title: '纬度',
key: 'lat',
align: 'center',
minWidth: 150
},
{
title: '海拔高度(米)',
key: 'altitude',
align: 'center',
minWidth: 100
},
{
title: '相对高度(米)',
key: 'ultrasonic',
align: 'center',
minWidth: 100
},
{
title: '俯仰角(度)',
key: 'pitch',
align: 'center',
minWidth: 150
},
{
title: '横滚角(度)',
key: 'roll',
align: 'center',
minWidth: 100
},
{
title: '航向角(度)',
key: 'yaw',
align: 'center',
minWidth: 100
},
{
title: '空速(米/秒)',
key: 'airspeed',
align: 'center',
minWidth: 150
},
{
title: '地速(米/秒)',
key: 'velocity',
align: 'center',
minWidth: 100
},
{
title: '时间戳',
key: 'ultrasonic',
align: 'center',
minWidth: 100
}
],
tableData: []
})
/* 获取抽屉的信息 */
const getDrawerOptions = computed(() => {
return {
show: props.visible,
width: '100%',
placement: 'right'
}
})
const tableRef = ref(null)
const loadDataTable = async function() {
const id = props.id
const res = await getCoordinate(id)
if (res.code === 0) {
data.tableData = res.data
}
}
watch(() => props.visible, (value) => {
if (value) {
loadDataTable()
}
})
const updateVisible = function() {
emit('update:visible', false)
}
return {
getDrawerOptions,
...toRefs(data),
tableRef,
loadDataTable,
updateVisible
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,245 @@
<template>
<n-drawer v-bind="getDrawerOptions" @update:show="updateVisible">
<n-drawer-content closable title="详情">
<div id="detail_container" class="card_box">
<div class="card_head">
<span>任务基本信息</span>
</div>
<n-divider />
<div class="message_box">
<div v-for="(item, index) in basicData" :key="index" class="message_item">
<span class="message_label">{{ item.name }}</span>
<div class="message_value">
<span v-for="($item, $index) in item.value" :key="$index">{{ $item === ',' ? ', ' : taskDetailList[$item] }}</span>
</div>
</div>
<div class="message_item">
<span class="message_label">进度状态</span>
<ul class="status_icons">
<li v-for="(item,index) in iconList" :key="index" class="status_item">
<img class="icon_img" :src="item.src" alt="">
<span class="status_text" :class="item.class">{{ item.text }}</span>
</li>
</ul>
</div>
</div>
<!-- 审核信息 -->
<div v-if="inspectionCheckList.length > 0" class="approve_container">
<div class="card_head">
<span>审核记录</span>
<n-button type="error" @click="openRecords">历史记录</n-button>
</div>
<n-divider />
<div class="message_box">
<div v-for="(item, index) in approveData" :key="index" class="message_item">
<span class="message_label">{{ item.name }}</span>
<div class="message_value">
<span v-for="($item, $index) in item.value" :key="$index">{{ aprroveCurrent[$item] }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- 打印以及退出 -->
<div class="detail_btns">
<n-button class="printer_btn" type="primary" @click="printPage">打印</n-button>
<n-button type="default" @click="updateVisible">关闭</n-button>
</div>
</n-drawer-content>
</n-drawer>
<iframe id="printf" src="" width="0" height="0" frameborder="0" />
</template>
<script>
import { reactive, computed, toRefs, watch } from 'vue'
import { taskDetail } from '@/api/inspection/alltask.js'
import { TASK_STATUS } from '@/utils/dictionary.js'
import { filterData } from '@/utils/filter.js'
import { statusList, taskMessage, approveMessage, resultsList } from '../tools/data.js'
export default {
name: 'TaskLive',
props: {
/* 可见 */
visible: {
type: Boolean,
default: false
},
/* 选中的数据 */
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null
},
setup(props, { emit }) {
const data = reactive({
showRecords: false,
taskStatusList: TASK_STATUS,
basicData: taskMessage,
approveData: approveMessage,
taskDetailList: {},
inspectionCheckList: [],
aprroveCurrent: {},
iconList: [],
statusObj: statusList,
resultList: resultsList
})
/* 获取抽屉的信息 */
const getDrawerOptions = computed(() => {
return {
show: props.visible,
width: '89%',
placement: 'right'
}
})
watch(() => props.visible, (value) => {
if (value) {
if (props.data) {
getTaskDetail(props.data.id)
}
}
})
/* 获取任务详情 */
const getTaskDetail = async function(id) {
const res = await taskDetail(id)
if (res.code === 0) {
data.taskDetailList = res.data
data.statusObj.forEach(item => {
if (item.status.includes(data.taskDetailList.status)) {
data.iconList = item.iconList
}
})
if (res.data.thInspectionCheckList.length) {
data.inspectionCheckList = res.data.thInspectionCheckList
data.aprroveCurrent = data.inspectionCheckList[0]
data.aprroveCurrent.createUserName = res.data.createUserName
data.aprroveCurrent.createTime = res.data.createTime
console.log(filterData)
data.aprroveCurrent.taskStatus = filterData(data.taskStatusList, res.data.status)
// data.aprroveCurrent.result = filterData(data.resultList, data.aprroveCurrent.status)
}
}
}
/* 打印 */
const printPage = function() {
// //
// const bodyHtml = window.document.body.innerHTML
// dom
const printPage = document.getElementById('detail_container').innerHTML
// //
// window.document.body.innerHTML = printPage
// //
// window.print();
// //
// window.document.body.innerHTML = bodyHtml
// window.location.reload()
var f = document.getElementById('printf')
f.contentDocument.documentElement.innerHTML = window.document.documentElement.innerHTML
f.contentDocument.body.innerHTML = printPage
f.contentDocument.close()
f.contentWindow.print()
}
const updateVisible = function() {
emit('update:visible', false)
}
//
const openRecords = function() {
data.showRecords = true
}
return {
getDrawerOptions,
...toRefs(data),
updateVisible,
printPage,
openRecords
}
}
}
</script>
<style scoped>
.card_box {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.card_head{
width: 100%;
display: flex;
justify-content:space-between;
align-items: flex-start;
color: #333;
font-size: 18px;
font-weight: 600;
}
.message_box {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
}
.message_item {
width: 50%;
margin-bottom: 20px;
display: flex;
justify-content: flex-start;
align-items: center;
}
.status_icons {
padding-left: 10px;
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: -10px;
}
.status_item {
margin-right: 15px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.icon_img {
width: 35px;
height: 35px;
}
.status_text {
font-size: 14px;
}
.approve_container {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
/* 按钮 */
.detail_btns {
width: 100%;
margin-top: 40px;
display: flex;
justify-content: center;
align-items: center;
}
.printer_btn {
margin-right: 30px;
}
</style>

View File

@ -0,0 +1,41 @@
<template>
<!-- <Modal
:options="getModalOptions"
:on-positive-click="handleConfirm"
:on-negative-click="handleClose"
:on-close="handleClose"
>
<template #Context>
huih
</template>
</Modal> -->
<div>daas</div>
</template>
<script>
import { reactive, toRefs } from 'vue'
export default {
name: 'TaskEdit',
props: {
/* 可见 */
visible: {
type: Boolean,
default: false
},
/* 选中的数据 */
data: {
type: Object,
default: () => {}
}
},
setup(props, { emit }) {
const data = reactive({
form: {}
})
return {
...toRefs(data)
}
}
}
</script>

View File

@ -0,0 +1,104 @@
<template>
<n-drawer v-bind="getDrawerOptions" @update:show="updateVisible">
<n-drawer-content closable title="直播">
<div class="video-container">
<div class="video-item">
<VideoPlayer ref="videoRef" :options="getVideoOptions" />
</div>
</div>
<div class="detail-btns">
<n-button
type="error"
@click="updateVisible(false)"
>关闭</n-button>
</div>
</n-drawer-content>
</n-drawer>
</template>
<script>
import VideoPlayer from '@/components/VideoPlayer/index.vue'
import { reactive, computed, toRefs, watch, ref } from 'vue'
export default {
name: 'TaskLive',
components: { VideoPlayer },
props: {
/* 可见 */
visible: {
type: Boolean,
default: false
},
/* 选中的数据 */
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null
},
setup(props, { emit }) {
const data = reactive({
aipull_url: ''
})
/* 获取抽屉的信息 */
const getDrawerOptions = computed(() => {
return {
show: props.visible,
width: '100%',
placement: 'right'
}
})
const videoRef = ref(null)
const getVideoOptions = computed(() => {
return {
id: 'video_ai',
width: '100%',
height: '600px',
source: props.data.aipullUrl,
isLive: true
}
})
watch(() => props.visible, (value) => {
if (!value) {
videoRef.value.disposeVideo()
}
})
const updateVisible = function() {
emit('update:visible', false)
}
return {
getDrawerOptions,
...toRefs(data),
videoRef,
getVideoOptions,
updateVisible
}
}
}
</script>
<style scoped>
.video-container {
margin: 50px 0;
height: 65vh;
width: 100%;
display: flex;
justify-content: space-between;
}
.video-item {
display: flex;
flex-direction: column;
width: 100%;
}
.detail-btns {
width: 100%;
display: flex;
margin-top: 50px;
justify-content: center;
align-items: center;
}
</style>

View File

@ -5,7 +5,7 @@
<data-table
ref="tableRef"
:columns="columns"
:request="loadDataTable"
:data="tableData"
:row-key="(row) => row.id"
:scroll-x="2200"
size="large"
@ -16,19 +16,75 @@
</data-table>
</n-card>
</div>
<!-- 直播 -->
<task-live v-model:visible="liveShow" :data="rowData" />
<!-- 飞行坐标 -->
<task-coordinate v-model:visible="coordinateShow" :data="rowData" />
<!-- 任务详情 -->
<task-detail v-model:visible="detailShow" :data="rowData" />
<!-- 审核 -->
<task-approve v-if="approveShow" v-model:visible="approveShow" :data="rowData" @reload="handleSearch" />
</template>
<script>
import headSearch from '@/components/Search/index.vue'
import dataTable from '@/components/DataTable/index.vue'
import { reactive } from '@vue/reactivity'
import TaskLive from './components/TaskLive.vue'
import TaskApprove from './components/TaskApprove.vue'
import TaskDetail from './components/TaskDetail.vue'
import TaskCoordinate from './components/TaskCoordinate.vue'
import { search, getRiverOptions } from './tools/search.js'
import table from './tools/table.js'
import { unref, toRefs, reactive, onUnmounted } from 'vue'
import { allTaskList } from '@/api/inspection/alltask.js'
export default {
name: 'AllTask',
components: { headSearch, dataTable },
components: { headSearch, dataTable, TaskLive, TaskApprove, TaskCoordinate, TaskDetail },
setup() {
getRiverOptions()
const data = reactive({
...toRefs(table),
tableData: [{
id: 706,
name: '常规巡河2',
code: 'XJRW20221206141645',
status: 5,
streamId: 126,
streamLength: '126',
streamName: '石臼湖',
inspectionTime: '2022-12-06 14:16:40',
note: 'pass',
patrolLocation: '江苏省南京市江宁区横溪街道西泉路',
endLatitude: '31.819663',
endLongitude: '118.804905' }],
search
})
const loadDataTable = async(res) => {
const _params = {
...unref(data.searchParams),
...res
}
return await allTaskList(_params)
}
//
function handleModal() {
data.rowData = null
data.modalType = 'create'
data.modalShow = true
}
onUnmounted(() => {
data.searchParams = null
})
return {
...toRefs(data),
loadDataTable,
handleModal
}
}
}

View File

@ -0,0 +1,190 @@
import runIcon from '@/assets/statusIcon/run.png'
import runIconH from '@/assets/statusIcon/run_h.png'
import approveIconH from '@/assets/statusIcon/approve_h.png'
import waitIcon from '@/assets/statusIcon/waiting.png'
import waitIconH from '@/assets/statusIcon/waiting_h.png'
import flyIcon from '@/assets/statusIcon/flying.png'
import flyIconH from '@/assets/statusIcon/flying_h.png'
import arrivedIcon from '@/assets/statusIcon/arrived.png'
import arrivedIconH from '@/assets/statusIcon/arrived_h.png'
export const statusList = [
{
status: [1],
iconList: [
{
src: approveIconH,
text: '待审核',
class: 'already'
},
{
src: runIcon,
text: ''
},
{
src: waitIcon,
text: '待起飞',
class: 'not'
},
{
src: runIcon,
text: ''
},
{
src: flyIcon,
text: '飞行中',
class: 'not'
},
{
src: runIcon,
text: ''
},
{
src: arrivedIcon,
text: '已完成',
class: 'not'
}
]
},
{
status: [5, 12],
iconList: [
{
src: approveIconH,
text: '待审核',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: waitIconH,
text: '待起飞',
class: 'already'
},
{
src: runIcon,
text: ''
},
{
src: flyIconH,
text: '飞行中',
class: 'not'
},
{
src: runIcon,
text: ''
},
{
src: arrivedIcon,
text: '已完成',
class: 'not'
}
]
},
{
status: [10],
iconList: [
{
src: approveIconH,
text: '待审核',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: waitIconH,
text: '待起飞',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: flyIconH,
text: '飞行中',
class: 'already'
},
{
src: runIcon,
text: ''
},
{
src: arrivedIcon,
text: '已完成'
}
]
},
{
status: [15, 25, 30, 35, 40, 45],
iconList: [
{
src: approveIconH,
text: '待审核',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: waitIconH,
text: '待起飞',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: flyIconH,
text: '飞行中',
class: 'already'
},
{
src: runIconH,
text: ''
},
{
src: arrivedIconH,
text: '已完成',
class: 'already'
}
]
}
]
// 任务信息
export const taskMessage = [
{ name: '任务编号:', value: ['code'] },
{ name: '期望巡检时间:', value: ['inspectionTime'] },
{ name: '任务名称:', value: ['name'] },
{ name: '巡检河道:', value: ['streamName'] },
{ name: '河道区域:', value: ['province', 'city', 'district', 'street', 'village'] },
{ name: '起止位置:', value: ['location'] },
{ name: '河道长度:', value: ['streamLength'] },
{ name: '巡检起点经纬度:', value: ['startLongitude', ',', 'startLatitude'] },
{ name: '是否直播:', value: ['isLive'] },
{ name: '巡检终点经纬度:', value: ['endLongitude', ',', 'endLatitude'] },
{ name: '云盒名称:', value: ['boxName'] },
{ name: '巡检机场:', value: ['airportName'] },
{ name: '巡检路线:', value: ['inspectionLineName'] },
{ name: '备注:', value: ['note'] }
]
// 审核信息
export const approveMessage = [
{ name: '申请人:', value: ['createUserName'] },
{ name: '申请日期:', value: ['createTime'] },
{ name: '审核人:', value: ['checkUserName'] },
{ name: '审核日期:', value: ['checkTime'] },
{ name: '任务状态:', value: ['taskStatus'] },
{ name: '审核结果:', value: ['result'] }
]
// 审核结果
export const resultsList = [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 2 }
]

View File

@ -0,0 +1,58 @@
import { reactive, ref } from 'vue'
import { TASK_STATUS } from '@/utils/dictionary.js'
import { allRivers } from '@/api/inspection/alltask.js'
import { dataToSelect } from '@/utils/handleData.js'
const riverOptions = ref([])
export const search = reactive([
{
label: '任务编码',
key: 'code',
props: {
placeholder: '请输入任务编码'
}
},
{
label: '任务名称',
key: 'name',
props: {
placeholder: '请输入任务名称'
}
},
{
label: '巡检河道',
type: 'select',
key: 'streamId',
props: {
placeholder: '请选择巡检河道',
options: riverOptions
}
},
{
label: '任务状态',
type: 'select',
key: 'status',
props: {
placeholder: '请选择任务状态',
options: TASK_STATUS
}
},
{
label: '巡检时间',
type: 'date',
key: 'inspectionTime',
props: {
placeholder: '请选择巡检时间',
type: 'date',
valueFormat: 'yyyy-MM-dd',
format: 'yyyy-MM-dd'
}
}
])
export const getRiverOptions = async function() {
const res = await allRivers()
riverOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
}

View File

@ -1,8 +1,8 @@
import { h, ref, reactive } from 'vue'
import TableImage from '@/components/DataTable/tools/Image.vue'
import TableTags from '@/components/DataTable/tools/Tags.vue'
import TableAction from '@/components/DataTable/tools/Action.vue'
import TableSwitch from '@/components/DataTable/tools/Switch.vue'
import { TASK_STATUS } from '@/utils/dictionary.js'
import { taskDelete } from '@/api/inspection/alltask.js'
/* 注册table */
const tableRef = ref()
const searchParams = ref()
@ -23,9 +23,61 @@ function getRowData(row, type) {
data.modalShow = true
}
/**
* 打开审核弹窗
* @param {*} row 单行数据
*/
function approve(row) {
data.rowData = row
data.approveShow = true
}
/**
* 飞行坐标
* @param {*} row 单行数据
*/
function coordinate(row) {
data.rowData = row
data.coordinateShow = true
}
/**
* 任务详情
* @param {*} row 单行数据
*/
function detail(row) {
data.rowData = row
data.detailShow = true
}
/**
* 直播
* @param {*} row 单行数据
*/
function live(row) {
data.rowData = row
data.liveShow = true
}
/**
* 巡河报告
* @param {*} row 单行数据
*/
function streamReport(row) {
data.rowData = row
data.streamShow = true
}
/**
* 处理结果
* @param {*} row 单行数据
*/
function handleResult(row) {
data.rowData = row
data.handleShow = true
}
// 删除方法
function deleteData(id) {
advertisingDelete(id)
taskDelete([id])
.then((res) => {
if (res.code === 0) {
handleSearch()
@ -39,9 +91,17 @@ function deleteData(id) {
const data = reactive({
tableRef,
searchParams,
deleteData,
handleSearch,
rowData: {},
modalType: 'create',
modalShow: false,
approveShow: false,
coordinateShow: false,
detailShow: false,
streamShow: false,
handleShow: false,
liveShow: false,
columns: [
{
title: '序号',
@ -50,25 +110,148 @@ const data = reactive({
return `${index + 1}`
},
align: 'center',
width: 50
minWidth: 50
},
{
title: '广告名称',
key: 'title',
title: '任务编码',
key: 'code',
align: 'center',
width: 200
minWidth: 100
},
{
title: '广告名称',
key: 'title',
title: '任务名称',
key: 'name',
align: 'center',
width: 200
minWidth: 100
},
{
title: '广告名称',
key: 'title',
title: '巡检河道',
key: 'streamName',
align: 'center',
width: 200
minWidth: 150
},
{
title: '河道长度(公里)',
key: 'streamLength',
align: 'center',
minWidth: 60
},
{
title: '状态',
key: 'status',
align: 'center',
width: 100,
render(row) {
return h(TableTags, {
data: row.status,
filters: TASK_STATUS,
tags: {
bordered: false
}
})
}
},
{
title: '巡检日期',
key: 'inspectionTime',
align: 'center',
minWidth: 100
},
{
title: '操作',
align: 'center',
minWidth: 100,
fixed: 'right',
render(row) {
return h(TableAction, {
actions: [
{
label: '详情',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: detail.bind(null, row)
},
auth: 'basic_list'
},
{
label: '审核',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: approve.bind(null, row)
},
auth: 'basic_list'
},
{
label: '修改',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: getRowData.bind(null, row, 'update')
},
auth: 'basic_list'
},
{
label: '飞行坐标',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: coordinate.bind(null, row)
},
auth: 'basic_list'
},
{
label: '直播',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: live.bind(null, row)
},
auth: 'basic_list'
},
{
label: '巡河报告',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: streamReport.bind(null, row)
},
auth: 'basic_list'
},
{
label: '巡检报告',
type: 'button',
props: {
type: 'primary',
text: true,
onClick: handleResult.bind(null, row)
},
auth: 'basic_list'
},
{
label: '删除',
type: 'popconfirm',
auth: 'basic_list',
tip: '确定删除这条数据吗?',
props: {
onPositiveClick: deleteData.bind(null, row.id)
},
ButtonProps: {
text: true,
type: 'primary'
}
}
],
align: 'center'
})
}
}
]
})