Ver código fonte

Merge branch 'zhangtao' of gitadmin/tuoheng_lc_web into develop

tags/v1.0.0^2
zhangtao 2 anos atrás
pai
commit
e1788e38da
6 arquivos alterados com 42 adições e 5 exclusões
  1. +2
    -0
      src/components/DataTable/tools/props.js
  2. +5
    -2
      src/components/DataTable/tools/useDataSource.js
  3. +4
    -1
      src/components/DataTable/tools/usePagination.js
  4. +28
    -1
      src/views/question-manage/question-list/components/PreviewModal.vue
  5. +2
    -0
      src/views/task-manage/all-task/components/LiveDrawer.vue
  6. +1
    -1
      src/views/task-manage/all-task/components/TaskModal.vue

+ 2
- 0
src/components/DataTable/tools/props.js Ver arquivo

@@ -29,6 +29,8 @@ export const tableProps = {
pageField: 'page',
// 每页数量字段名
sizeField: 'limit',
// 接口返回的字段名
listPageField: 'current',
// 接口返回的数据字段名
listField: 'records',
// 接口返回总页数字段名

+ 5
- 2
src/components/DataTable/tools/useDataSource.js Ver arquivo

@@ -14,6 +14,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
if (!request) return
/* 获取分页信息 */
const pageField = paginationSetting.pageField
const listPageField = paginationSetting.listPageField
const sizeField = paginationSetting.sizeField
const totalField = paginationSetting.totalField
const listField = paginationSetting.listField
@@ -34,7 +35,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
const response = await request(params)
const res = noPagination ? response : response.data
const resultTotal = res[totalField] || 0
const currentPage = res[pageField]
const currentPage = res[listPageField]
// 如果数据异常,需获取正确的页码再次执行
if (resultTotal) {
if (page > Math.ceil(resultTotal / pageSize)) {
@@ -47,9 +48,11 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL
// 处理数据结构
const resultInfo = res[listField] ? res[listField] : res
dataSourceRef.value = dataType === 'tree' ? dealTree(resultInfo.data) : resultInfo
console.log('currentPage', currentPage)
setPagination({
[pageField]: currentPage,
[totalField]: Math.ceil(resultTotal / pageSize)
[totalField]: Math.ceil(resultTotal / pageSize),
itemCount: resultTotal
})
/* 更新页码数据 */
if (opt && opt[pageField]) {

+ 4
- 1
src/components/DataTable/tools/usePagination.js Ver arquivo

@@ -17,7 +17,10 @@ export function usePagination(refProps) {
showQuickJumper: paginationSetting.showQuickJumper,
...(isBoolean(pagination) ? {} : pagination),
...unref(configRef),
pageCount: unref(configRef)[paginationSetting.totalField]
pageCount: unref(configRef)[paginationSetting.totalField],
prefix({ itemCount }) {
return `共 ${itemCount} 条`
}
}
})


+ 28
- 1
src/views/question-manage/question-list/components/PreviewModal.vue Ver arquivo

@@ -4,11 +4,16 @@
:on-close="handleClose"
>
<template #Context>
<div class="modal-form">
<label>问题类型</label>
{{ getQuestionType }}
</div>
<div class="carousel__flex">
<n-icon size="26" color="#8A8A8A">
<LeftOutlined @click="handleCarousel('prev')" />
</n-icon>
<div class="carousel__container">
<label>问题描述</label>
<n-carousel ref="carouselRef" :default-index="selectIndex" :show-dots="false">
<img
v-for="item in getCarouselInfo"
@@ -27,6 +32,7 @@
</template>

<script>
import { QUESTION_TYPE } from '@/utils/dictionary.js'
import { LeftOutlined, RightOutlined } from '@vicons/antd'
import Modal from '@/components/Modal/index.vue'
import { defineComponent, computed, ref, reactive, toRefs } from 'vue'
@@ -61,7 +67,7 @@ export default defineComponent({
const getModalOptions = computed(() => {
return {
show: props.visible,
title: '问题详情',
title: '图片详情',
width: 700
}
})
@@ -70,6 +76,11 @@ export default defineComponent({
return props.data
})

const getQuestionType = computed(() => {
const row = QUESTION_TYPE.find((item) => { return item.value === data.selectRow.type })
return row?.label || '-'
})

const carouselRef = ref(null)

function handleCarousel(type) {
@@ -101,6 +112,7 @@ export default defineComponent({
...toRefs(data),
formRef,
getModalOptions,
getQuestionType,
getCarouselInfo,
carouselRef,
handleCarousel,
@@ -119,6 +131,7 @@ export default defineComponent({
.carousel__container{
width: calc(100% - 100px);
display: flex;
margin-right: 40px;
label{
width: 70px;
flex-shrink: 0;
@@ -133,4 +146,18 @@ export default defineComponent({
object-fit: cover
}
}

.modal-form{
width: calc(100% - 60px);
display: flex;
align-items: center;
margin: 20px auto 20px;
label{
width: 70px;
flex-shrink: 0;
}
.n-select{
width: 300px;
}
}
</style>

+ 2
- 0
src/views/task-manage/all-task/components/LiveDrawer.vue Ver arquivo

@@ -141,6 +141,7 @@ export default defineComponent({
width: '400px',
height: '324px',
source: props.data.playUrl,
autoplay: true,
isLive: true
}
originRef.value?.init(origin)
@@ -157,6 +158,7 @@ export default defineComponent({
width: '400px',
height: '324px',
source: props.data.aiplayUrl,
autoplay: true,
isLive: true
}
analyseRef.value?.init(analyse)

+ 1
- 1
src/views/task-manage/all-task/components/TaskModal.vue Ver arquivo

@@ -61,7 +61,7 @@ export default defineComponent({
if (props.data.status !== 1) {
formItem.value = [
{ type: 'input', key: 'droneName', label: '无人机' },
{ type: 'date', key: 'flyTime', label: '飞行时间', props: { type: 'datetime', valueFormat: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss' }}
{ type: 'input', key: 'flyTime', label: '飞行时间' }
]
} else {
formItem.value = []

Carregando…
Cancelar
Salvar