Commit ab7e061d by pangchong

feat: 全局组件优化

parent 2b2cf7f6
<template> <template>
<!-- 全局自定义navbar --> <!-- 全局自定义navbar -->
<view class="mocp-navbar"> <view class="mocp-navbar">
<up-navbar :title="title" :fixed="false" :bgColor="bgColor" :safeAreaInsetTop="false" <up-navbar :title="title" :fixed="false" :bgColor="bgColor" :safeAreaInsetTop="false" :titleStyle="getTitleStyle" :leftIconSize="0">
:titleStyle="getTitleStyle" :leftIconSize="0">
<template #left> <template #left>
<slot name="left"></slot> <slot name="left"></slot>
</template> </template>
...@@ -16,6 +15,7 @@ ...@@ -16,6 +15,7 @@
<script setup> <script setup>
import { computed } from 'vue' import { computed } from 'vue'
const es = defineEmits(['handleLeftClick', 'handleRightClick', 'handleFooterClick'])
const ps = defineProps({ const ps = defineProps({
title: { title: {
type: String, type: String,
...@@ -25,6 +25,14 @@ const ps = defineProps({ ...@@ -25,6 +25,14 @@ const ps = defineProps({
type: String, type: String,
default: '#f7f8fa' default: '#f7f8fa'
}, },
size: {
type: [String, Number],
default: 34
},
color: {
type: String,
default: '#4e5969'
},
titleStyle: { titleStyle: {
type: Object, type: Object,
default: () => { default: () => {
...@@ -38,8 +46,8 @@ const ps = defineProps({ ...@@ -38,8 +46,8 @@ const ps = defineProps({
}) })
const getTitleStyle = computed(() => { const getTitleStyle = computed(() => {
return { return {
color: '#4e5969', color: ps.color,
fontSize: '34rpx', fontSize: ps.size + 'rpx',
...ps.titleStyle ...ps.titleStyle
} }
}) })
......
...@@ -11,23 +11,21 @@ ...@@ -11,23 +11,21 @@
show-refresher-update-time show-refresher-update-time
v-if="firstLoaded || isCurrentPage" v-if="firstLoaded || isCurrentPage"
ref="paging" ref="paging"
v-model="dataList" v-model="getDataList"
@query="queryList" @query="queryList"
:fixed="false" :fixed="false"
> >
<template #empty v-if="!dataList.length && refresherEnabled"> <template #empty v-if="!getDataList.length">
<global-empty></global-empty> <global-empty></global-empty>
</template> </template>
<slot :dataList="dataList"> <slot :dataList="getDataList"></slot>
<up-skeleton v-if="showSkeleton" rows="100" :loading="true" :animate="true"
:title="false"></up-skeleton>
</slot>
</z-paging> </z-paging>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, watch } from 'vue' import { filterEmptyValues } from 'mocp/utils/tool'
import { computed, ref, watch } from 'vue'
const paging = ref() const paging = ref()
const dataList = ref([]) const dataList = ref([])
...@@ -35,7 +33,6 @@ const dataList = ref([]) ...@@ -35,7 +33,6 @@ const dataList = ref([])
const firstLoaded = ref(false) const firstLoaded = ref(false)
// 是否滚动到当前页 // 是否滚动到当前页
const isCurrentPage = ref(false) const isCurrentPage = ref(false)
const ps = defineProps({ const ps = defineProps({
//是否自动加载 //是否自动加载
auto: { auto: {
...@@ -59,6 +56,13 @@ const ps = defineProps({ ...@@ -59,6 +56,13 @@ const ps = defineProps({
type: String, type: String,
default: 'status' default: 'status'
}, },
//查询参数
params: {
type: Object,
default: () => {
return {}
}
},
//查询接口 //查询接口
api: { api: {
type: Function, type: Function,
...@@ -86,21 +90,22 @@ const ps = defineProps({ ...@@ -86,21 +90,22 @@ const ps = defineProps({
type: [Number, String], type: [Number, String],
default: '160rpx' default: '160rpx'
}, },
//是否本地分页
localPaging: { localPaging: {
type: Boolean, type: Boolean,
default: false default: false
}, },
localPagingCB: { //数据转换
transformData: {
type: Function, type: Function,
default: () => { default: null
}
}, },
//分页页码
pageSize: { pageSize: {
type: Number, type: Number,
default: 10 default: 10
} }
}) })
watch( watch(
() => ps.currentIndex, () => ps.currentIndex,
(newVal) => { (newVal) => {
...@@ -118,42 +123,52 @@ watch( ...@@ -118,42 +123,52 @@ watch(
immediate: true immediate: true
} }
) )
//是否显示骨架屏
const showSkeleton = ref(true)
const queryList = (pageIndex, pageSize) => { const queryList = (pageIndex, pageSize) => {
if (!dataList.value.length) {
paging.value?.complete(dataList.value)
}
const params = { const params = {
pageIndex, ...filterEmptyValues(ps.params)
pageSize }
//是否开启本地分页
if (!ps.localPaging) {
params['pageIndex'] = pageIndex
params['pageSize'] = pageSize
} }
if (ps.tabValue != null) { if (ps.tabValue != null) {
params[ps.tabValueField] = ps.tabValue params[ps.tabValueField] = ps.tabValue
} }
if (Object.prototype.toString.call(ps.api) == '[object Function]') { if (Object.prototype.toString.call(ps.api) == '[object Function]') {
ps.api(params, {loading: true}).then((res) => { ps.api(params, { loading: true })
.then((res) => {
if (res.code == 200 || res.list?.length) { if (res.code == 200 || res.list?.length) {
if (!ps.localPaging) { const data = res.list || res.data?.list || res?.data || []
paging.value?.complete(res.list || res.data?.list || res?.data || []) if (ps.localPaging) {
paging.value?.setLocalPaging(data)
} else { } else {
const data = res.data || [] paging.value?.complete(data)
paging.value?.setLocalPaging(ps.localPagingCB(data))
} }
firstLoaded.value = true
} else { } else {
uni.$mocpMessage.error(res.message) uni.$mocpMessage.error(res.message)
} }
}).catch(() => { })
showSkeleton.value = false .catch(() => {
paging.value?.complete(false) paging.value?.complete(false)
}) })
} else { } else {
showSkeleton.value = false
paging.value?.complete(false) paging.value?.complete(false)
} }
} }
//获取数据
const getDataList = computed({
get: () => {
if (ps.transformData) {
return ps.transformData(dataList.value)
} else {
return dataList.value
}
},
set: (value) => {
dataList.value = value
}
})
defineExpose({ defineExpose({
reload: () => { reload: () => {
paging.value?.reload() paging.value?.reload()
......
...@@ -3,11 +3,25 @@ ...@@ -3,11 +3,25 @@
<z-paging-swiper :swiper-style="getSwiperStyle"> <z-paging-swiper :swiper-style="getSwiperStyle">
<!-- 头部 --> <!-- 头部 -->
<template #top> <template #top>
<view :style="{ height: safeAreaInsets?.top + 'px' }" v-if="custom"></view> <view
style="position: relative; z-index: -2"
:style="{ height: safeAreaInsets?.top + 'px', background: navbgColor }"
v-if="custom"
></view>
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<global-navbar :title="title" v-if="showNavbar"> <global-navbar :title="title" v-if="showNavbar" :bgColor="navbgColor" :color="navColor">
<template #left> <template #left v-if="pages.length > 1 && showNavLeft">
<up-icon name="arrow-left" size="16" @tap="goBack"></up-icon> <up-icon v-if="navLeftType == 'icon'" :name="navLeftIcon" size="16" @tap="handleLeftClick" :color="navColor"></up-icon>
<view v-if="navLeftType == 'text'" class="cancel" @tap="handleLeftClick">{{ navLeftText }}</view>
</template>
<template #right v-if="showNavRight">
<global-button type="text" size="small" v-if="navRightType == 'text'" @tap="handleRightClick">
{{ navRightText }}
</global-button>
<global-button type="primary" size="small" v-if="navRightType == 'button'" style="padding: 0 32rpx" @tap="handleRightClick">
{{ navRightText }}
</global-button>
<global-icon v-if="navRightType == 'icon'" :icon="navRightIcon" @tap="handleRightClick"></global-icon>
</template> </template>
</global-navbar> </global-navbar>
<!-- tab切换 --> <!-- tab切换 -->
...@@ -40,14 +54,15 @@ ...@@ -40,14 +54,15 @@
:tabIndex="index" :tabIndex="index"
:tabValueField="tabValueField" :tabValueField="tabValueField"
:currentIndex="current" :currentIndex="current"
:params="params"
:api="api" :api="api"
:refresher-enabled="refresherEnabled" :refresher-enabled="refresherEnabled"
:refresher-threshold="refresherThreshold" :refresher-threshold="refresherThreshold"
:auto-show-back-to-top="autoShowBackToTop" :auto-show-back-to-top="autoShowBackToTop"
:loading-more-enabled="loadingMoreEnabled" :loading-more-enabled="loadingMoreEnabled"
:back-to-top-bottom="backToTopBottom" :back-to-top-bottom="backToTopBottom"
:localPaging="$attrs.localPaging" :localPaging="localPaging"
:localPagingCB="$attrs.localPagingCB" :transformData="transformData"
> >
<template #="{ dataList }"> <template #="{ dataList }">
<slot :dataList="dataList"></slot> <slot :dataList="dataList"></slot>
...@@ -55,6 +70,13 @@ ...@@ -55,6 +70,13 @@
</global-page-swiper-item> </global-page-swiper-item>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 底部 -->
<template #bottom>
<view class="footer-btn" v-if="showFooterBtn">
<global-button type="primary" size="large" @tap="handleFooterClick">{{ footerBtnText }}</global-button>
</view>
<slot name="bottom"></slot>
</template>
<!-- 消息提醒 --> <!-- 消息提醒 -->
<up-toast ref="uToastRef"></up-toast> <up-toast ref="uToastRef"></up-toast>
</z-paging-swiper> </z-paging-swiper>
...@@ -64,7 +86,8 @@ ...@@ -64,7 +86,8 @@
import { computed, nextTick, onUnmounted, ref } from 'vue' import { computed, nextTick, onUnmounted, ref } from 'vue'
// 获取屏幕边界到安全区域距离 // 获取屏幕边界到安全区域距离
const {safeAreaInsets} = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
const es = defineEmits(['handleLeftClick', 'handleRightClick', 'handleFooterClick'])
const ps = defineProps({ const ps = defineProps({
background: { background: {
type: String, type: String,
...@@ -113,6 +136,71 @@ const ps = defineProps({ ...@@ -113,6 +136,71 @@ const ps = defineProps({
type: Boolean, type: Boolean,
default: true default: true
}, },
//导航栏背景色
navbgColor: {
type: String,
default: '#f7f8fa'
},
//导航栏字体颜色
navColor: {
type: String,
default: '#4e5969'
},
//是否显示nav左边插槽
showNavLeft: {
type: Boolean,
default: true
},
//nav左边插槽类型:icon,text
navLeftType: {
type: String,
default: 'icon'
},
//nav左边插槽图标
navLeftIcon: {
type: String,
default: 'arrow-left'
},
//nav左边插槽文字
navLeftText: {
type: String,
default: '取消'
},
//点击nav左边插槽default,emit
navLeftClick: {
type: String,
default: 'default'
},
//是否显示nav右边插槽
showNavRight: {
type: Boolean,
default: false
},
//nav右边插槽类型:icon,text,button
navRightType: {
type: String,
default: 'text'
},
//nav右边插槽图标
navRightIcon: {
type: String,
default: 'navbarright'
},
//nav右边插槽文字
navRightText: {
type: String,
default: '编辑'
},
//是否显示底部按钮
showFooterBtn: {
type: Boolean,
default: false
},
//底部按钮文字内容
footerBtnText: {
type: String,
default: '保存'
},
//页面标题 //页面标题
title: { title: {
type: String, type: String,
...@@ -123,6 +211,13 @@ const ps = defineProps({ ...@@ -123,6 +211,13 @@ const ps = defineProps({
type: Boolean, type: Boolean,
default: true default: true
}, },
//查询参数
params: {
type: Object,
default: () => {
return {}
}
},
//查询接口 //查询接口
api: { api: {
type: Function, type: Function,
...@@ -153,6 +248,21 @@ const ps = defineProps({ ...@@ -153,6 +248,21 @@ const ps = defineProps({
tabsWidth: { tabsWidth: {
type: [Number, String], type: [Number, String],
default: '250' default: '250'
},
//是否本地分页
localPaging: {
type: Boolean,
default: false
},
//数据转换
transformData: {
type: Function,
default: null
},
//分页页码
pageSize: {
type: Number,
default: 10
} }
}) })
// z-swiper样式 // z-swiper样式
...@@ -173,10 +283,6 @@ const getStyle = computed(() => { ...@@ -173,10 +283,6 @@ const getStyle = computed(() => {
return style return style
}) })
const current = ref(ps.current) const current = ref(ps.current)
//返回
const goBack = () => {
uni.$mocpJump.navigateBack()
}
// tabs通知swiper切换 // tabs通知swiper切换
const tabsChange = (item) => { const tabsChange = (item) => {
current.value = item.index current.value = item.index
...@@ -198,6 +304,25 @@ uni.$on('useMessage', (params) => openToast(params)) ...@@ -198,6 +304,25 @@ uni.$on('useMessage', (params) => openToast(params))
onUnmounted(() => { onUnmounted(() => {
uni.$off('useMessage', openToast) uni.$off('useMessage', openToast)
}) })
//点击左边插槽
const handleLeftClick = () => {
if (ps.navLeftClick == 'default') {
uni.$mocpJump.navigateBack()
es('handleLeftClick')
} else {
es('handleLeftClick')
}
}
//点击右边插槽
const handleRightClick = () => {
es('handleRightClick')
}
//点击底部按钮
const handleFooterClick = () => {
es('handleFooterClick')
}
// 获取页面栈
const pages = getCurrentPages()
//获取列表刷新对象 //获取列表刷新对象
const pagingArr = ref([]) const pagingArr = ref([])
defineExpose({ defineExpose({
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!-- 全局page 不带tab切换--> <!-- 全局page 不带tab切换-->
<z-paging <z-paging
ref="paging" ref="paging"
v-model="dataList" v-model="getDataList"
:auto="auto" :auto="auto"
:fixed="fixed" :fixed="fixed"
:height="height" :height="height"
...@@ -18,37 +18,37 @@ ...@@ -18,37 +18,37 @@
:paging-style="getPagingStyle" :paging-style="getPagingStyle"
:default-page-size="pageSize" :default-page-size="pageSize"
> >
<template #empty v-if="refresherEnabled || loadingMoreEnabled"> <template #empty v-if="auto && !getDataList.length">
<global-empty></global-empty> <global-empty></global-empty>
</template> </template>
<!-- 头部 --> <!-- 头部 -->
<template #top> <template #top>
<view :style="{ height: safeAreaInsets?.top + 'px' }" v-if="custom"></view> <view
style="position: relative; z-index: -2"
:style="{ height: safeAreaInsets?.top + 'px', background: navbgColor }"
v-if="custom"
></view>
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<global-navbar :title="title" v-if="showNavbar" :bgColor="$attrs.navBarBackground" <global-navbar :title="title" v-if="showNavbar" :bgColor="navbgColor" :color="navColor">
:titleStyle="$attrs.titleStyle">
<template #left v-if="pages.length > 1 && showNavLeft"> <template #left v-if="pages.length > 1 && showNavLeft">
<up-icon v-if="navLeftType == 'icon'" :name="navLeftIcon" size="16" <up-icon v-if="navLeftType == 'icon'" :name="navLeftIcon" size="16" @tap="handleLeftClick" :color="navColor"></up-icon>
@tap="handleLeftClick"></up-icon>
<view v-if="navLeftType == 'text'" class="cancel" @tap="handleLeftClick">{{ navLeftText }}</view> <view v-if="navLeftType == 'text'" class="cancel" @tap="handleLeftClick">{{ navLeftText }}</view>
</template> </template>
<template #right v-if="showNavRight"> <template #right v-if="showNavRight">
<global-button type="text" size="small" v-if="navRightType == 'text'" @tap="handleRightClick"> <global-button type="text" size="small" v-if="navRightType == 'text'" @tap="handleRightClick">
{{ navRightText }} {{ navRightText }}
</global-button> </global-button>
<global-button type="primary" size="small" v-if="navRightType == 'button'" style="padding: 0 32rpx" <global-button type="primary" size="small" v-if="navRightType == 'button'" style="padding: 0 32rpx" @tap="handleRightClick">
@tap="handleRightClick">
{{ navRightText }} {{ navRightText }}
</global-button> </global-button>
<global-icon v-if="navRightType == 'icon'" :icon="navRightIcon" <global-icon v-if="navRightType == 'icon'" :icon="navRightIcon" @tap="handleRightClick"></global-icon>
@tap="handleRightClick"></global-icon>
</template> </template>
</global-navbar> </global-navbar>
<slot name="top"></slot> <slot name="top"></slot>
</template> </template>
<!-- 滚动内容 --> <!-- 滚动内容 -->
<view class="mocp-content" :style="getStyle"> <view class="mocp-content" :style="getStyle">
<slot :dataList="dataList" v-if="isDataList"></slot> <slot :dataList="getDataList" v-if="isDataList"></slot>
<slot></slot> <slot></slot>
</view> </view>
<!-- 底部 --> <!-- 底部 -->
...@@ -102,6 +102,16 @@ const ps = defineProps({ ...@@ -102,6 +102,16 @@ const ps = defineProps({
type: Boolean, type: Boolean,
default: true default: true
}, },
//导航栏背景色
navbgColor: {
type: String,
default: '#f7f8fa'
},
//导航栏字体颜色
navColor: {
type: String,
default: '#4e5969'
},
//是否显示nav左边插槽 //是否显示nav左边插槽
showNavLeft: { showNavLeft: {
type: Boolean, type: Boolean,
...@@ -206,15 +216,22 @@ const ps = defineProps({ ...@@ -206,15 +216,22 @@ const ps = defineProps({
type: [Number, String], type: [Number, String],
default: '160rpx' default: '160rpx'
}, },
//静态数据
localData: {
type: [Object, Array],
default: null
},
//是否本地分页
localPaging: { localPaging: {
type: Boolean, type: Boolean,
default: false default: false
}, },
localPagingCB: { //数据转换
transformData: {
type: Function, type: Function,
default: () => { default: null
}
}, },
//分页页码
pageSize: { pageSize: {
type: Number, type: Number,
default: 10 default: 10
...@@ -250,24 +267,27 @@ const scroll = () => { ...@@ -250,24 +267,27 @@ const scroll = () => {
// #endif // #endif
} }
// 获取屏幕边界到安全区域距离 // 获取屏幕边界到安全区域距离
const {safeAreaInsets} = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
//列表加载 //列表加载
const queryList = (pageIndex, pageSize) => { const queryList = (pageIndex, pageSize) => {
if (ps.isDataList) { if (ps.isDataList) {
const params = { const params = {
pageIndex,
pageSize,
...filterEmptyValues(ps.params) ...filterEmptyValues(ps.params)
} }
//是否开启本地分页
if (!ps.localPaging) {
params['pageIndex'] = pageIndex
params['pageSize'] = pageSize
}
if (Object.prototype.toString.call(ps.api) == '[object Function]') { if (Object.prototype.toString.call(ps.api) == '[object Function]') {
ps.api(params, {loading: true}) ps.api(params, { loading: true })
.then((res) => { .then((res) => {
if (res.code == 200 || res.list?.length) { if (res.code == 200 || res.list?.length) {
if (!ps.localPaging) { const data = res.list || res.data?.list || res?.data || []
paging.value?.complete(res.list || res.data?.list || res?.data || []) if (ps.localPaging) {
paging.value?.setLocalPaging(data)
} else { } else {
const data = res.data || [] paging.value?.complete(data)
paging.value?.setLocalPaging(ps.localPagingCB(data))
} }
} else { } else {
uni.$mocpMessage.error(res.message) uni.$mocpMessage.error(res.message)
...@@ -280,9 +300,29 @@ const queryList = (pageIndex, pageSize) => { ...@@ -280,9 +300,29 @@ const queryList = (pageIndex, pageSize) => {
paging.value?.complete(false) paging.value?.complete(false)
} }
} else { } else {
es('query', {pageIndex, pageSize}) if (ps.localData) {
if (Array.isArray(ps.localData)) {
paging.value?.complete(ps.localData)
} else {
paging.value?.complete([])
}
}
} }
es('query', { pageIndex, pageSize })
} }
//获取数据
const getDataList = computed({
get: () => {
if (ps.transformData) {
return ps.transformData(dataList.value)
} else {
return dataList.value
}
},
set: (value) => {
dataList.value = value
}
})
//点击左边插槽 //点击左边插槽
const handleLeftClick = () => { const handleLeftClick = () => {
if (ps.navLeftClick == 'default') { if (ps.navLeftClick == 'default') {
......
...@@ -26,6 +26,7 @@ const useAogStore = defineStore('aog', { ...@@ -26,6 +26,7 @@ const useAogStore = defineStore('aog', {
happenAddr: '', happenAddr: '',
faultDesc: '' faultDesc: ''
}, },
workbenchId: '',
details: undefined, details: undefined,
workBench: undefined, //工作台详情 workBench: undefined, //工作台详情
disposalPlan: [], //处置方案 disposalPlan: [], //处置方案
...@@ -41,7 +42,7 @@ const useAogStore = defineStore('aog', { ...@@ -41,7 +42,7 @@ const useAogStore = defineStore('aog', {
bbData: [], //施工情况 bbData: [], //施工情况
bbIndex: -1, //施工情况详情的下标 bbIndex: -1, //施工情况详情的下标
oData: undefined, //其他特殊保障 oData: [], //其他特殊保障
oIndex: -1 //其他特殊保障的下标 oIndex: -1 //其他特殊保障的下标
} }
}, },
...@@ -164,22 +165,22 @@ const useAogStore = defineStore('aog', { ...@@ -164,22 +165,22 @@ const useAogStore = defineStore('aog', {
} }
}, },
actions: { actions: {
async getWorkBenchList() { async getWorkBenchList(workbenchId) {
const res = await getWorkBenchListApi({ workbenchId: this.details?.workbenchId }) const res = await getWorkBenchListApi({ workbenchId })
if (res.code == 200) { if (res.code == 200) {
this.workBench = res.data?.list[0] this.workBench = res.data?.list[0]
} }
}, },
async getAogDisposalPlan() { async getAogDisposalPlan(workbenchId) {
const res = await getAogDisposalPlanApi({ workbenchId: this.details?.workbenchId }) const res = await getAogDisposalPlanApi({ workbenchId })
if (res.code == 200) { if (res.code == 200) {
this.disposalPlan = res.data this.disposalPlan = res.data
} else { } else {
this.disposalPlan = [] this.disposalPlan = []
} }
}, },
async getAogMaterialList(materialType) { async getAogMaterialList(workbenchId, materialType) {
const res = await getAogMaterialListApi({ workbenchId: this.details?.workbenchId, materialType }) const res = await getAogMaterialListApi({ workbenchId, materialType })
if (res.code == 200 && res.data.materialMap) { if (res.code == 200 && res.data.materialMap) {
if (materialType == 1) { if (materialType == 1) {
this.avData = Object.values(res.data.materialMap).flat() this.avData = Object.values(res.data.materialMap).flat()
...@@ -191,22 +192,22 @@ const useAogStore = defineStore('aog', { ...@@ -191,22 +192,22 @@ const useAogStore = defineStore('aog', {
this.toolData = [] this.toolData = []
} }
}, },
async getAogSupBase() { async getAogSupBase(workbenchId) {
const res = await getAogSupBaseApi({ workbenchId: this.details?.workbenchId }) const res = await getAogSupBaseApi({ workbenchId })
if (res.code == 200 && res.data.mapList) { if (res.code == 200 && res.data.mapList) {
this.pData = Object.values(res.data.mapList).flat() this.pData = Object.values(res.data.mapList).flat()
} else { } else {
this.pData = [] this.pData = []
} }
}, },
async getAogConstruction() { async getAogConstruction(workbenchId) {
const res = await getAogConstructionApi({ workbenchId: this.details?.workbenchId }) const res = await getAogConstructionApi({ workbenchId })
if (res.code == 200) { if (res.code == 200) {
this.bbData = res.data.constructionList || [] this.bbData = res.data.constructionList || []
} }
}, },
async getAogOtherSup() { async getAogOtherSup(workbenchId) {
const res = await getAogOtherSupApi({ workbenchId: this.details?.workbenchId }) const res = await getAogOtherSupApi({ workbenchId })
if (res.code == 200 && res.data) { if (res.code == 200 && res.data) {
this.oData = Object.entries(res.data).reduce((q, w) => { this.oData = Object.entries(res.data).reduce((q, w) => {
if (w[0] !== 'otherData') { if (w[0] !== 'otherData') {
......
import useUserStore from 'mocp/store/user' import useUserStore from 'mocp/store/user'
const baseURL = 'https://hna-platform.anyremote.cn' // const baseURL = 'https://hna-platform.anyremote.cn'
// const baseURL = 'https://moc.hnatechnic.com/api' const baseURL = 'https://moc.hnatechnic.com/api'
class ServiceLoading { class ServiceLoading {
open(loading) { open(loading) {
......
...@@ -81,6 +81,8 @@ const baseStore = useBaseStore() ...@@ -81,6 +81,8 @@ const baseStore = useBaseStore()
const aogStore = useAogStore() const aogStore = useAogStore()
const { getWorkBenchList, getAogDisposalPlan, getAogMaterialList, getAogSupBase, getAogConstruction, getAogOtherSup } = aogStore const { getWorkBenchList, getAogDisposalPlan, getAogMaterialList, getAogSupBase, getAogConstruction, getAogOtherSup } = aogStore
const { details, disposalPlan, workBench, materialType } = storeToRefs(aogStore) const { details, disposalPlan, workBench, materialType } = storeToRefs(aogStore)
const query = defineProps(['workbenchId'])
const workbenchId = query.workbenchId
onLoad(() => { onLoad(() => {
nextTick(async () => { nextTick(async () => {
uni.showLoading({ uni.showLoading({
...@@ -88,13 +90,13 @@ onLoad(() => { ...@@ -88,13 +90,13 @@ onLoad(() => {
mask: true mask: true
}) })
await Promise.all([ await Promise.all([
getWorkBenchList(), getWorkBenchList(workbenchId),
getAogDisposalPlan(), getAogDisposalPlan(workbenchId),
getAogMaterialList(1), getAogMaterialList(workbenchId, 1),
getAogMaterialList(2), getAogMaterialList(workbenchId, 2),
getAogSupBase(), getAogSupBase(workbenchId),
getAogConstruction(), getAogConstruction(workbenchId),
getAogOtherSup() getAogOtherSup(workbenchId)
]) ])
uni.hideLoading() uni.hideLoading()
}) })
...@@ -109,10 +111,10 @@ const goTo = (url, params) => { ...@@ -109,10 +111,10 @@ const goTo = (url, params) => {
} }
} }
uni.$on('updateMaterialData', () => { uni.$on('updateMaterialData', () => {
getAogMaterialList(materialType.value) getAogMaterialList(workbenchId, materialType.value)
}) })
uni.$on('updateBbData', () => { uni.$on('updateBbData', () => {
getAogConstruction() getAogConstruction(workbenchId)
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -56,7 +56,7 @@ const baseStore = useBaseStore() ...@@ -56,7 +56,7 @@ const baseStore = useBaseStore()
const aogStore = useAogStore() const aogStore = useAogStore()
const { searchData } = storeToRefs(aogStore) const { searchData } = storeToRefs(aogStore)
const goDetails = (data) => { const goDetails = (data) => {
uni.$mocpJump.navigateTo('/panel/aog/details', { id: data.id }).then(() => { uni.$mocpJump.navigateTo('/panel/aog/details', { workbenchId: data.workbenchId }).then(() => {
aogStore.setState('details', data) aogStore.setState('details', data)
}) })
} }
......
<template> <template>
<global-page :padding="24" :title="getTitle"> <global-page :padding="24" :title="getTitle" auto :localData="getMaterialData">
<template v-for="(item, index) in getMaterialData" :key="item.id"> <template v-for="(item, index) in getMaterialData" :key="item.id">
<global-card :title="item.pn" titleSuffix="查看详情" @handleTitleClick="goTo(index)"> <global-card :title="item.pn" titleSuffix="查看详情" @handleTitleClick="goTo(index)">
<global-text-status :value="item.actualArrivalTime ? '1' : '0'" dictkey="aogDetails_status"></global-text-status> <global-text-status :value="item.actualArrivalTime ? '1' : '0'" dictkey="aogDetails_status"></global-text-status>
</global-card> </global-card>
</template> </template>
<!-- <template #="{ dataList }">
<template v-for="(item, index) in dataList" :key="item.id">
<global-card :title="item.pn" titleSuffix="查看详情" @handleTitleClick="goTo(index)">
<global-text-status :value="item.actualArrivalTime ? '1' : '0'" dictkey="aogDetails_status"></global-text-status>
</global-card>
</template>
</template> -->
</global-page> </global-page>
</template> </template>
......
<template> <template>
<global-page title="航班详情" navBarBackground="#0e42d2" :titleStyle="{color: '#fff'}"> <global-page title="航班详情" navbgColor="#0e42d2" navColor="#fff">
<view class="flightSupportDetails"> <view class="flightSupportDetails">
<view class="details_header"> <view class="details_header">
<view class="header_no flex"> <view class="header_no flex">
<image <image class="flight-no-image" :src="HnaPic" mode="widthFix" />
class="flight-no-image"
:src="HnaPic"
mode="widthFix" />
<text>B9999</text> <text>B9999</text>
</view> </view>
...@@ -26,7 +23,8 @@ ...@@ -26,7 +23,8 @@
v-for="(item, index) of tabList" v-for="(item, index) of tabList"
:key="item" :key="item"
@click="tabCurrent = index" @click="tabCurrent = index"
class="f-flex-1 tabItem" :class="index == tabCurrent ? 'active' : ''" class="f-flex-1 tabItem"
:class="index == tabCurrent ? 'active' : ''"
> >
{{ item }}--{{ tabCurrent }} {{ item }}--{{ tabCurrent }}
</view> </view>
...@@ -34,11 +32,8 @@ ...@@ -34,11 +32,8 @@
<detailsFlightInfo v-if="tabCurrent === 0" /> <detailsFlightInfo v-if="tabCurrent === 0" />
<detailsOtherInfo v-else /> <detailsOtherInfo v-else />
</view> </view>
</view> </view>
</global-page> </global-page>
</template> </template>
...@@ -54,7 +49,6 @@ import detailsSwiper from '../components/DetailsSwiper.vue' ...@@ -54,7 +49,6 @@ import detailsSwiper from '../components/DetailsSwiper.vue'
import detailsFlightInfo from '../components/DetailsFlightInfo.vue' import detailsFlightInfo from '../components/DetailsFlightInfo.vue'
import detailsOtherInfo from '../components/DetailsOtherInfo.vue' import detailsOtherInfo from '../components/DetailsOtherInfo.vue'
const currentAllRelatedFlights = reactive([ const currentAllRelatedFlights = reactive([
{ {
flightNo: 'B7777', flightNo: 'B7777',
...@@ -80,9 +74,7 @@ const currentAllRelatedFlights = reactive([ ...@@ -80,9 +74,7 @@ const currentAllRelatedFlights = reactive([
]) ])
const tabList = ['航班信息', '其他信息'] const tabList = ['航班信息', '其他信息']
const tabCurrent = ref(0) const tabCurrent = ref(0)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../constants/details"; @import '../constants/details';
</style> </style>
...@@ -14,24 +14,17 @@ ...@@ -14,24 +14,17 @@
:api="getFlyToAppletsApi" :api="getFlyToAppletsApi"
localPaging localPaging
:pageSize="20" :pageSize="20"
:localPagingCB="localPagingCB" :transformData="transformData"
> >
<template #="{ dataList }"> <template #="{ dataList }">
<view <view v-for="item in dataList" :key="item.keyValue" class="inforDisclosureItem flex">
v-for="item in dataList"
:key="item.keyValue"
class="inforDisclosureItem flex">
<TableTow :itemMsg="item" /> <TableTow :itemMsg="item" />
</view> </view>
</template> </template>
<template v-slot:top> <template v-slot:top>
<view class="flex listTopTab text-center"> <view class="flex listTopTab text-center">
<view <view v-for="item of getSelectedList" :key="item.id" class="topTabItem" :style="{ flex: item.flex }">
v-for="item of getSelectedList"
:key="item.id"
class="topTabItem"
:style="{flex: item.flex}">
{{ item.label }} {{ item.label }}
</view> </view>
</view> </view>
...@@ -52,7 +45,6 @@ ...@@ -52,7 +45,6 @@
</view> </view>
</template> </template>
</global-page> </global-page>
</template> </template>
<script setup> <script setup>
...@@ -67,15 +59,17 @@ import { currentInBoundModeForFlightTablePage, allInBoundMode } from './utils/cu ...@@ -67,15 +59,17 @@ import { currentInBoundModeForFlightTablePage, allInBoundMode } from './utils/cu
const paging = ref(null) const paging = ref(null)
const flightSupportStore = useFlightSupportStore() const flightSupportStore = useFlightSupportStore()
const {searchData, getSearchData, listScreen, getSelectedList, listTab} = storeToRefs(flightSupportStore) const { searchData, getSearchData, listScreen, getSelectedList, listTab } = storeToRefs(flightSupportStore)
const handleRightClick = () => { const handleRightClick = () => {
uni.$mocpJump.navigateTo('/panel/flight-support/components/Screen') uni.$mocpJump.navigateTo('/panel/flight-support/components/Screen')
} }
const localPagingCB = (data) => { const transformData = (data) => {
const currentTime = Date.now() const currentTime = Date.now()
const listMsg = data?.reduce((q, w) => { const listMsg = data
?.reduce(
(q, w) => {
if (finishedStatus.includes(w.status)) { if (finishedStatus.includes(w.status)) {
w.isFinished = true w.isFinished = true
q[2].push(w) q[2].push(w)
...@@ -88,7 +82,9 @@ const localPagingCB = (data) => { ...@@ -88,7 +82,9 @@ const localPagingCB = (data) => {
} }
} }
return q return q
}, [[], [], []]) },
[[], [], []]
)
.map((q, w) => { .map((q, w) => {
if (w === 0) { if (w === 0) {
q.sort((a, s) => { q.sort((a, s) => {
...@@ -109,7 +105,7 @@ const subsectionChange = (e) => { ...@@ -109,7 +105,7 @@ const subsectionChange = (e) => {
if (searchData.value.isOut == e) return if (searchData.value.isOut == e) return
searchData.value.isOut = e searchData.value.isOut = e
currentInBoundModeForFlightTablePage.value = e currentInBoundModeForFlightTablePage.value = e
const ind = listTab.value.findIndex(item => item.label == '出发地' || item.label == '目的地') const ind = listTab.value.findIndex((item) => item.label == '出发地' || item.label == '目的地')
const isCurrentIn = currentInBoundModeForFlightTablePage.value + 1 == allInBoundMode.In const isCurrentIn = currentInBoundModeForFlightTablePage.value + 1 == allInBoundMode.In
if (ind > -1) { if (ind > -1) {
console.log(currentInBoundModeForFlightTablePage.value, allInBoundMode.In, ind) console.log(currentInBoundModeForFlightTablePage.value, allInBoundMode.In, ind)
...@@ -121,7 +117,6 @@ const subsectionChange = (e) => { ...@@ -121,7 +117,6 @@ const subsectionChange = (e) => {
uni.$on('screenReload', () => { uni.$on('screenReload', () => {
paging.value?.reload() paging.value?.reload()
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment