Commit e4690ef6 by pangchong

feat: AOG开发

parent 853ceb29
......@@ -14,6 +14,7 @@ declare module 'vue' {
GlobalAlbum: typeof import('./src/mocp/components/global-album/global-album.vue')['default']
GlobalButton: typeof import('./src/mocp/components/global-button/global-button.vue')['default']
GlobalCalendar: typeof import('./src/mocp/components/global-calendar/global-calendar.vue')['default']
GlobalCard: typeof import('./src/mocp/components/global-card/global-card.vue')['default']
GlobalCheckbox: typeof import('./src/mocp/components/global-checkbox/global-checkbox.vue')['default']
GlobalDate: typeof import('./src/mocp/components/global-date/global-date.vue')['default']
GlobalEmpty: typeof import('./src/mocp/components/global-empty/global-empty.vue')['default']
......
......@@ -37,6 +37,11 @@ export function createApp() {
activeColor: '#165dff',
labelColor: '#1D2129',
labelSize: 16
},
cell: {
titleStyle: {
color: '#1D2129'
}
}
}
})
......
......@@ -8,3 +8,66 @@ export const getAogListApi = (data, config) => {
config
})
}
export const getWorkBenchListApi = (data, config) => {
return http({
method: 'POST',
url: '/workbench/getWorkBenchList',
data,
config
})
}
export const getAogDisposalPlanApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getAogDisposalPlan',
data,
config
})
}
export const getAogMaterialListApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getAogMaterialList',
data,
config
})
}
export const getAogSupBaseApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getAogSupBase',
data,
config
})
}
export const getAogConstructionApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getAogConstruction',
data,
config
})
}
export const getAogOtherSupApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/getAogOtherSup',
data,
config
})
}
export const updateAogMaterialApi = (data, config) => {
return http({
method: 'POST',
url: '/technical-support/updateAogMaterial',
data,
config
})
}
<template>
<view class="global-card" :class="class" :style="style">
<view class="global-card-title">
<view class="left">
<view class="txt">{{ title }}</view>
</view>
<view class="right" @tap="handleTitleClick">
<view class="txt">{{ titleSuffix }}</view>
<up-icon name="arrow-right" size="16"></up-icon>
</view>
</view>
<view class="global-card-content">
<slot></slot>
</view>
</view>
</template>
<script setup>
const es = defineEmits(['handleTitleClick'])
const ps = defineProps({
class: {
type: String,
default: ''
},
style: {
type: Object,
default: () => {
return {}
}
},
title: {
type: String,
default: ''
},
titleSuffix: {
type: String,
default: ''
}
})
const handleTitleClick = () => {
es('handleTitleClick')
}
</script>
<style lang="scss" scoped>
.global-card {
background: #fff;
border-radius: 12rpx;
padding: 24rpx;
margin-top: 16rpx;
&-title {
padding-bottom: 16rpx;
border-bottom: 2rpx solid #f4f4f4;
display: flex;
align-items: center;
justify-content: space-between;
.left {
font-size: 34rpx;
.txt {
color: $mocp-text-5;
}
}
.right {
display: flex;
align-items: center;
.txt {
color: $mocp-text-4;
margin-right: 16rpx;
}
}
}
&-content {
padding-top: 16rpx;
line-height: 40rpx;
color: $mocp-text-4;
}
}
</style>
import { defineStore } from 'pinia'
import {
getAogConstructionApi,
getAogDisposalPlanApi,
getAogMaterialListApi,
getAogOtherSupApi,
getAogSupBaseApi,
getWorkBenchListApi
} from 'mocp/api/aog'
const useAogStore = defineStore('aog', {
state: () => {
......@@ -18,11 +26,151 @@ const useAogStore = defineStore('aog', {
happenAddr: '',
faultDesc: ''
},
details: undefined
details: undefined,
workBench: undefined, //工作台详情
disposalPlan: [], //处置方案
avData: [], //航材
toolData: [], //工具
materialIndex: -1, //航材(或工具)详情的下标
materialType: 1, //1-航材,2-工具
pData: [], //人员
bbData: [], //施工情况
oData: [] //其他特殊保障
}
},
getters: {
getAvStatus(state) {
let avStatus = 3
if (state.avData && state.avData.length) {
if (state.avData.every((a) => a.actualArrivalTime)) {
avStatus = 2
} else if (state.avData.some((a) => a.actualArrivalTime)) {
avStatus = 1
} else {
avStatus = 0
}
}
return avStatus
},
getToolStatus(state) {
let toolStatus = 3
if (state.toolData && state.toolData.length) {
if (state.toolData.every((a) => a.actualArrivalTime)) {
toolStatus = 2
} else if (state.toolData.some((a) => a.actualArrivalTime)) {
toolStatus = 1
} else {
toolStatus = 0
}
}
return toolStatus
},
getPersonnelStatus(state) {
let personnelStatus = 3
if (state.pData && state.pData.length) {
if (state.pData.every((a) => a.realityCompleteTime)) {
personnelStatus = 2
} else if (state.pData.some((a) => a.realityCompleteTime)) {
personnelStatus = 1
} else {
personnelStatus = 0
}
}
return personnelStatus
},
getBbStatus(state) {
let bbStatus = 3
if (state.bbData && state.bbData.length) {
if (state.bbData.every((a) => a.realityCompleteTime)) {
bbStatus = 2
} else if (state.bbData.some((a) => a.realityCompleteTime)) {
bbStatus = 1
} else {
bbStatus = 0
}
}
return bbStatus
},
getOtherStatus(state) {
let otherStatus = 3
if (state.oData.every((a) => a === null || !a.id)) {
otherStatus = 3
} else {
if (state.oData.every((a) => a.realityCompleteTime)) {
otherStatus = 2
} else if (state.oData.some((a) => a.realityCompleteTime)) {
otherStatus = 1
} else {
otherStatus = 0
}
}
return otherStatus
},
getMaterialData(state) {
if (state.materialType == 1) {
return state.avData
} else {
return state.toolData
}
},
getMaterialDetails(state) {
if (state.materialIndex >= 0) {
if (state.materialType == 1) {
return state.avData[state.materialIndex]
} else {
return state.toolData[state.materialIndex]
}
} else {
return undefined
}
}
},
getters: {},
actions: {
async getWorkBenchList() {
const res = await getWorkBenchListApi({ workbenchId: this.details.workbenchId })
if (res.code == 200) {
this.workBench = res.data?.list[0]
}
},
async getAogDisposalPlan() {
const res = await getAogDisposalPlanApi({ workbenchId: this.details.workbenchId })
if (res.code == 200) {
this.disposalPlan = res.data
}
},
async getAogMaterialList(materialType) {
const res = await getAogMaterialListApi({ workbenchId: this.details.workbenchId, materialType })
if (res.code == 200) {
if (materialType == 1) {
this.avData = Object.values(res.data.materialMap).flat()
} else if (materialType == 2) {
this.toolData = Object.values(res.data.materialMap).flat()
}
}
},
async getAogSupBase() {
const res = await getAogSupBaseApi({ workbenchId: this.details.workbenchId })
if (res.code == 200) {
this.pData = Object.values(res.data.mapList).flat()
}
},
async getAogConstruction() {
const res = await getAogConstructionApi({ workbenchId: this.details.workbenchId })
if (res.code == 200) {
this.bbData = res.data.constructionList
}
},
async getAogOtherSup() {
const res = await getAogOtherSupApi({ workbenchId: this.details.workbenchId })
if (res.code == 200) {
this.oData = Object.entries(res.data).reduce((q, w) => {
if (w[0] !== 'otherData') {
q.push(w[1])
}
return q
}, [])
}
},
resetForm() {
this.searchData = {
state: '1',
......
......@@ -50,8 +50,12 @@ const useAssignWorkStore = defineStore('assignWork', {
//是否回复人
isReplyUser(state) {
const userStore = useUserStore()
if (state.details.reply) {
const replyIds = JSON.parse(state.details.reply)[this.getArrangeWorkExtendIndex].map((item) => item.userId)
return replyIds.includes(userStore.userInfo.id)
} else {
return false
}
},
//是否领导
isPresenterUser(state) {
......
......@@ -259,6 +259,18 @@
"style": {
"navigationBarTitleText": "AOG详情"
}
},
{
"path": "pages/modules/mocp/panel/aog/material-list",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/modules/mocp/panel/aog/material-details",
"style": {
"navigationBarTitleText": " "
}
}
],
"globalStyle": {
......
<template>
<text :class="getStatus.class">{{ getStatus.text }}</text>
</template>
<script setup>
import { computed } from 'vue'
const ps = defineProps({
//0-未到位,1-部分到位,2-全部到位,3-无
status: {
type: Number,
default: 3
}
})
const getStatus = computed(function () {
if (ps.status === 1) {
return {
text: '部分到位',
class: 'mocp-color-primary-6'
}
}
if (ps.status === 2) {
return {
text: '全部到位',
class: 'mocp-color-success-6'
}
}
if (ps.status === 3) {
return {
text: '无',
class: 'mocp-color-text-4'
}
}
return {
text: '未到位',
class: 'mocp-color-warning-6'
}
})
</script>
<style lang="scss" scoped></style>
......@@ -3,4 +3,74 @@
border-radius: 12rpx;
background: #ffffff;
color: $mocp-text-4;
&-header {
padding-bottom: 16rpx;
&-top {
display: flex;
align-items: center;
.right {
.txt {
margin-left: 16rpx;
font-size: 32rpx;
}
}
}
&-footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 16rpx;
.label {
display: flex;
align-items: center;
.txt {
margin-left: 16rpx;
}
}
.left {
color: $mocp-primary-6;
display: flex;
align-items: center;
justify-content: space-between;
.txt {
color: $mocp-text-5;
font-size: 28rpx;
margin-left: 16rpx;
&:first-child {
margin-left: 0;
}
}
}
}
}
&-body {
border-top: 2rpx solid #f4f4f4;
border-bottom: 2rpx solid #f4f4f4;
padding: 16rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
}
&-footer {
padding-top: 16rpx;
display: flex;
align-items: center;
.txt {
margin-left: 16rpx;
color: $mocp-text-4;
}
}
}
.card-details {
color: $mocp-text-4;
&-item {
margin-bottom: 16rpx;
.msg {
margin-top: 8rpx;
font-size: 30rpx;
}
&:last-child {
margin-bottom: 0;
}
}
}
<template>
<global-page :padding="24" title="AOG详情"></global-page>
<global-page :padding="24" title="AOG详情">
<template v-if="details">
<view class="details">
<view class="details-header">
<view class="details-header-top">
<view class="left">
<custom-state :value="useGetDictByValue('aog_state', details.state)" :size="32"></custom-state>
</view>
<view class="right">
<text class="txt mocp-color-text-5">{{ details.aogNum }}</text>
</view>
</view>
<view class="details-header-footer">
<view class="left">
<text class="txt u-line-1" v-if="details.machineNumber">{{ details.machineNumber }}</text>
<text class="txt u-line-1" v-if="details.model">{{ details.model }}</text>
<text class="txt u-line-1" v-if="details.aviation">
{{ useGetDictByValue('', details.aviation, { data: baseStore.getAirlineSelect }) }}
</text>
</view>
<view class="right">
<text class="txt u-line-1" v-if="details.terminal">{{ details.terminal }}</text>
</view>
</view>
</view>
<view class="details-body">
<global-field label="发动机型号:" :value="workBench?.apuModel || '-'"></global-field>
<global-field label="APU型号:" :value="workBench?.engineModel || '-'"></global-field>
</view>
<view class="details-footer">
<global-icon icon="calendar" color="#1D2129"></global-icon>
<view class="txt">{{ timeStampFormat(workBench?.createdTime, { format: 'YYYY/MM/DD' }) }}</view>
</view>
</view>
<global-card title="信息通报">
<view class="card-details">
<view class="card-details-item">
<view class="title">故障描述:</view>
<view class="msg">
{{ details.faultDesc || '无' }}
</view>
</view>
<view class="card-details-item" v-for="(item, index) in disposalPlan" :key="item.id">
<view class="title">{{ `处置方案${index + 1}` }}</view>
<view class="msg">
{{ item.planDesc || '无' }}
</view>
</view>
</view>
</global-card>
<global-card title="航材" titleSuffix="查看物流" @handleTitleClick="goTo('/panel/aog/material-list', { materialType: 1 })">
<text-status :status="aogStore.getAvStatus"></text-status>
</global-card>
<global-card title="工具" titleSuffix="查看物流" @handleTitleClick="goTo('/panel/aog/material-list', { materialType: 2 })">
<text-status :status="aogStore.getToolStatus"></text-status>
</global-card>
<global-card title="人员" titleSuffix="查看物流">
<text-status :status="aogStore.getPersonnelStatus"></text-status>
</global-card>
<global-card title="施工情况">
<text-status :status="aogStore.getBbStatus"></text-status>
</global-card>
<global-card title="其他特殊保障">
<text-status :status="aogStore.getOtherStatus"></text-status>
</global-card>
</template>
</global-page>
</template>
<script setup>
import { storeToRefs } from 'pinia'
import { timeStampFormat } from 'mocp/utils/tool'
import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import { ref } from 'vue'
import useAogStore from 'mocp/store/aog'
import useBaseStore from 'mocp/store/base'
import { onLoad } from '@dcloudio/uni-app'
import TextStatus from './components/text-status.vue'
const baseStore = useBaseStore()
const aogStore = useAogStore()
const { details } = storeToRefs(aogStore)
const { getWorkBenchList, getAogDisposalPlan, getAogMaterialList, getAogSupBase, getAogConstruction, getAogOtherSup } = aogStore
const { details, disposalPlan, workBench, materialType } = storeToRefs(aogStore)
onLoad(async () => {
uni.showLoading({
title: '加载中',
mask: true
})
await Promise.all([
getWorkBenchList(),
getAogDisposalPlan(),
getAogMaterialList(1),
getAogMaterialList(2),
getAogSupBase(),
getAogConstruction(),
getAogOtherSup()
])
uni.hideLoading()
})
const goTo = (url, params) => {
if (params) {
uni.$mocpJump.navigateTo(url, params).then(() => {
aogStore.setState('materialType', params.materialType)
})
} else {
uni.$mocpJump.navigateTo(url)
}
}
uni.$on('updateMaterialData', () => {
getAogMaterialList(materialType.value)
})
</script>
<style lang="scss" scoped>
@import './constants/details.scss';
......
<template>
<global-page
title="航材进展详情"
showFooterBtn
@handleFooterClick="handleFooterClick"
:footerBtnText="getMaterialDetails?.actualArrivalTime ? '取消到位' : '到位'"
>
<view class="mocp-cell">
<up-cell-group v-if="getMaterialDetails">
<up-cell title="件号" :value="getMaterialDetails.pn"></up-cell>
<up-cell title="名称" :value="getMaterialDetails.name"></up-cell>
<up-cell title="需求数量" :value="getMaterialDetails.quantity"></up-cell>
<up-cell title="属性" :value="getMaterialDetails.aviationAttribute === '0' ? '周转件' : '消耗件'"></up-cell>
<up-cell title="备注" :value="getMaterialDetails.remake"></up-cell>
<up-cell title="需求提出时间" :value="getMaterialDetails.proposeDate || '-'"></up-cell>
<up-cell title="预计到位时间" :value="getMaterialDetails.arrivalTime || '-'"></up-cell>
<up-cell title="总库存" :value="getMaterialDetails.totalInventory"></up-cell>
<up-cell title="实际到位时间" :value="getMaterialDetails.actualArrivalTime || '-'"></up-cell>
</up-cell-group>
</view>
</global-page>
</template>
<script setup>
import { storeToRefs } from 'pinia'
import useAogStore from 'mocp/store/aog'
import { updateAogMaterialApi } from 'mocp/api/aog'
const aogStore = useAogStore()
const { getMaterialDetails } = storeToRefs(aogStore)
const handleFooterClick = async () => {
const params = {
id: getMaterialDetails.value.id,
actualArrivalTime: getMaterialDetails.value.actualArrivalTime ? 0 : Date.now()
}
const res = await updateAogMaterialApi(params, { loading: true })
if (res.code == 200) {
uni.$mocpJump.navigateBack()
uni.$mocpMessage.success(res.message)
uni.$emit('updateMaterialData')
} else {
uni.$mocpMessage.error(res.message)
}
}
</script>
<style lang="scss" scoped>
.mocp-cell {
background: #fff;
}
</style>
<template>
<global-page :padding="24" :title="getTitle">
<template v-for="(item, index) in getMaterialData" :key="item.id">
<global-card :title="item.pn" titleSuffix="查看详情" @handleTitleClick="goTo(index)">
{{ item.actualArrivalTime ? '已到位' : '未到位' }}
</global-card>
</template>
</global-page>
</template>
<script setup>
import { storeToRefs } from 'pinia'
import useAogStore from 'mocp/store/aog'
import { computed } from 'vue'
const aogStore = useAogStore()
const { getMaterialData, materialType } = storeToRefs(aogStore)
const goTo = (index) => {
uni.$mocpJump.navigateTo('/panel/aog/material-details').then(() => {
aogStore.setState('materialIndex', index)
})
}
const getTitle = computed(() => {
if (materialType.value == 1) {
return '航材进展列表'
} else {
return '工具进展列表'
}
})
</script>
<style lang="scss" scoped></style>
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