Commit 0d2b38da by pangchong

feat: 非计划管理调整

parent 7c83fdcb
......@@ -18,14 +18,6 @@ export const addUnplanWarningApi = (data, config) => {
})
}
export const checkPakgeNoApi = (data, config) => {
return http({
method: 'POST',
url: '/workbench/unplanWarning/checkPakgeNo',
data,
config
})
}
export const getUnplanWarningApi = (data, config) => {
return http({
method: 'POST',
......
......@@ -39,14 +39,14 @@ const ps = defineProps({
},
activeValue: {
type: [Boolean, String, Number],
default: 1
default: '1'
},
inactiveValue: {
type: [Boolean, String, Number],
default: 0
default: '0'
}
})
const switchValue = ref(0)
const switchValue = ref('0')
watch(
() => ps.modelValue,
(value) => {
......
......@@ -24,6 +24,7 @@ const useUnplanApplyStore = defineStore('unplanApply', {
getters: {},
actions: {
async getDetails() {
this.details = undefined
const res = await getUnplanApplyApi({ id: this.id }, { loading: true })
if (res.code == 200) {
this.details = res.data
......
......@@ -23,6 +23,7 @@ const useUnplanWarningStore = defineStore('unplanWarning', {
getters: {},
actions: {
async getDetails() {
this.details = undefined
const res = await getUnplanWarningApi({ id: this.id }, { loading: true })
if (res.code == 200) {
this.details = res.data
......
......@@ -38,7 +38,7 @@
size="22"
style="margin-left: 10rpx"
v-if="index + 1 == materialPns.length"
@tap="materialPns.push('')"
@tap="addMaterialPns"
></up-icon>
</view>
</view>
......@@ -56,12 +56,16 @@
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { formData, formRef, materialPns, rules } from './constants/add.compositions'
import { handleSubmit, checkPakgeNo } from './constants/add.functionals'
import { handleSubmit, checkPakgeNo, addMaterialPns, resetData } from './constants/add.functionals'
const handleFooterClick = () => {
handleSubmit()
}
onLoad(() => {
resetData()
})
</script>
<style lang="scss" scoped>
.mocp-form {
......
import { addUnplanApplyApi, checkPakgeNoApi } from 'mocp/api/unplanApply'
import { formData, formRef, materialPns } from './add.compositions'
export const resetData = () => {
materialPns.value = ['']
Object.assign(formData, {
packageNo: '',
delayDay: '',
approver: '',
warningReason: '',
materialDelay: 0,
materialPns: '',
reason: '',
delayDay: null
})
}
//验证包号
export const checkPakgeNo = async (packageNo) => {
if (!packageNo) return
......@@ -12,6 +26,11 @@ export const checkPakgeNo = async (packageNo) => {
}
}
export const addMaterialPns = () => {
if (materialPns.value.length >= 10) return uni.$mocpMessage.warning('缺件航材最多填写10个')
materialPns.value.push('')
}
//提交表单
export const handleSubmit = async () => {
await formRef.value?.validate()
......
import { changeStatusApi } from 'mocp/api/unplanApply'
import { changeExemptStatusApi, changeStatusApi } from 'mocp/api/unplanApply'
import { formData, formRef } from './details.compositions'
export const handleSelect = async (value, id) => {
......@@ -19,3 +19,13 @@ export const handleSelect = async (value, id) => {
uni.$mocpMessage.error(res.message)
}
}
export const changeExemptStatus = async (id, status, callBack) => {
const res = await changeExemptStatusApi({ id, status }, { loading: '修改中...' })
if (res.code == 200) {
uni.$mocpMessage.success(res.message)
callBack()
} else {
uni.$mocpMessage.error(res.message)
}
}
<template>
<global-page title="非计划申请详情" showFooterBtn :footerBtnText="isCreateUser ? '撤销' : '审核'" @handleFooterClick="handleFooterClick">
<global-page
title="非计划申请详情"
:showFooterBtn="showFooterBtn"
:footerBtnText="isCreateUser ? '撤销' : '审核'"
@handleFooterClick="handleFooterClick"
>
<view class="mocp-cell">
<up-cell-group v-if="details">
<up-cell title="是否豁免">
<template #value>
<global-switch v-model="details.exemptStatus" switchAlign="right" @change="changeExempt"></global-switch>
</template>
</up-cell>
<up-cell title="审核状态">
<template #value>
<global-text-status :value="details.applyStatus" dictkey="unPlan_applyStatus"></global-text-status>
......@@ -13,7 +23,11 @@
<up-cell title="计划开始时间" :value="timeStampFormat(details.startTime) || '-'"></up-cell>
<up-cell title="计划结束时间" :value="timeStampFormat(details.endTime) || '-'"></up-cell>
<up-cell title="延期天数" :value="details.delayDay || '-'"></up-cell>
<up-cell title="申请原因" :value="getParamNameByValue('WarningReason', details.warningReason) || '-'"></up-cell>
<up-cell title="申请原因">
<template #label>
{{ getParamNameByValue('WarningReason', details.warningReason, { isArray: true }) || '-' }}
</template>
</up-cell>
<up-cell title="缺件航材">
<template #label>
<template v-if="details.materialPns && details.materialDelay == '1'">
......@@ -27,10 +41,14 @@
</up-cell>
<up-cell title="申请人" :value="details.createUserName || '-'"></up-cell>
<up-cell title="申请时间" :value="timeStampFormat(details.createTime) || '-'"></up-cell>
<template v-if="details.applyStatus != '0'">
<up-cell title="审核人" :value="details.approverName"></up-cell>
<template v-if="['1', '2'].includes(details.applyStatus)">
<up-cell title="审核人" :value="details.approverName || '-'"></up-cell>
<up-cell title="审核时间" :value="timeStampFormat(details.updateTime) || '-'"></up-cell>
<up-cell title="审核说明">
<template #label>{{ details.examineReason || '-' }}</template>
</up-cell>
</template>
<view class="mocp-form">
<view class="mocp-form" v-if="isApprover && details.applyStatus == '0'">
<up-form labelPosition="left" labelWidth="auto" :model="formData" :rules="rules" ref="formRef">
<up-form-item label="审核说明" prop="examineReason" :borderBottom="true" required>
<up-input v-model="formData.examineReason" border="none" inputAlign="right" placeholder="请输入" clearable></up-input>
......@@ -68,7 +86,7 @@ import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import { getParamNameByValue } from 'mocp/hooks/use-params/useParams'
import { onLoad } from '@dcloudio/uni-app'
import { timeStampFormat } from 'mocp/utils/tool'
import { handleSelect } from './constants/details.functionals'
import { changeExemptStatus, handleSelect } from './constants/details.functionals'
import { formData, rules, formRef, showAction, showConfirm } from './constants/details.compositions'
import { computed } from 'vue'
import useUserStore from 'mocp/store/user'
......@@ -81,7 +99,20 @@ const userStore = useUserStore()
const isCreateUser = computed(() => {
return userStore.userInfo.id == details.value?.createUser
})
const isApprover = computed(() => {
return userStore.userInfo.id == details.value?.approver
})
const showFooterBtn = computed(() => {
return details.value?.applyStatus == '0' && (isCreateUser.value || isApprover.value)
})
//是否豁免
const changeExempt = (status) => {
changeExemptStatus(details.value?.id, status, () => {
unplanApplyStore.getDetails()
})
}
onLoad(() => {
showConfirm.value = false
unplanApplyStore.setState('id', query.id)
unplanApplyStore.getDetails()
formData.examineReason = ''
......
......@@ -29,7 +29,7 @@
</view>
</view>
<view class="item-content">
<view class="u-line-3">预警原因:{{ getParamNameByValue('WarningReason', item.warningReason) || '无' }}</view>
<view class="u-line-3">预警原因:{{ getParamNameByValue('WarningReason', item.warningReason, { isArray: true }) || '无' }}</view>
<view class="u-line-3">具体原因:{{ item.reason || '无' }}</view>
</view>
<view class="item-footer">
......@@ -57,12 +57,18 @@ import { getParamNameByValue } from 'mocp/hooks/use-params/useParams'
import { timeStampFormat } from 'mocp/utils/tool'
import { unplanApplyListApi } from 'mocp/api/unplanApply'
import useUnplanApplyStore from 'mocp/store/unplanApply'
import useUserStore from 'mocp/store/user'
const userStore = useUserStore()
//跳转
const unplanApplyStore = useUnplanApplyStore()
const { searchData } = storeToRefs(unplanApplyStore)
const goDetails = (data) => {
uni.$mocpJump.navigateTo('/panel/unplanApply/details', { id: data.id })
if (data.applyStatus == '0' && !(userStore.userInfo.id == data.createUser || userStore.userInfo.id == data.approver)) {
return uni.$mocpMessage.warning('没有权限查看。!')
} else {
uni.$mocpJump.navigateTo('/panel/unplanApply/details', { id: data.id })
}
}
//筛选
const handleRightClick = () => {
......
......@@ -35,7 +35,7 @@
size="22"
style="margin-left: 10rpx"
v-if="index + 1 == materialPns.length"
@tap="materialPns.push('')"
@tap="addMaterialPns"
></up-icon>
</view>
</view>
......@@ -53,12 +53,16 @@
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { formData, formRef, materialPns, rules } from './constants/add.compositions'
import { handleSubmit, checkPakgeNo } from './constants/add.functionals'
import { handleSubmit, checkPakgeNo, addMaterialPns, resetData } from './constants/add.functionals'
const handleFooterClick = () => {
handleSubmit()
}
onLoad(() => {
resetData()
})
</script>
<style lang="scss" scoped>
.mocp-form {
......
import { addUnplanWarningApi, checkPakgeNoApi } from 'mocp/api/unplanWarning'
import { addUnplanWarningApi } from 'mocp/api/unplanWarning'
import { formData, formRef, materialPns } from './add.compositions'
import { checkPakgeNoApi } from 'mocp/api/unplanApply'
export const resetData = () => {
materialPns.value = ['']
Object.assign(formData, {
packageNo: '',
delayDay: '',
approver: '',
warningReason: '',
materialDelay: 0,
materialPns: '',
reason: ''
})
}
//验证包号
export const checkPakgeNo = async (packageNo) => {
if (!packageNo) return
......@@ -12,6 +25,11 @@ export const checkPakgeNo = async (packageNo) => {
}
}
export const addMaterialPns = () => {
if (materialPns.value.length >= 10) return uni.$mocpMessage.warning('缺件航材最多填写10个')
materialPns.value.push('')
}
//提交表单
export const handleSubmit = async () => {
await formRef.value?.validate()
......
<template>
<global-page title="非计划预警详情" showFooterBtn :footerBtnText="isCreateUser ? '撤销' : '审核'" @handleFooterClick="handleFooterClick">
<global-page
title="非计划预警详情"
:showFooterBtn="showFooterBtn"
:footerBtnText="isCreateUser ? '撤销' : '审核'"
@handleFooterClick="handleFooterClick"
>
<view class="mocp-cell">
<up-cell-group v-if="details">
<up-cell title="审核状态">
......@@ -12,7 +17,11 @@
<up-cell title="工作包名称" :value="details.packageName || '-'"></up-cell>
<up-cell title="计划开始时间" :value="timeStampFormat(details.startTime) || '-'"></up-cell>
<up-cell title="计划结束时间" :value="timeStampFormat(details.endTime) || '-'"></up-cell>
<up-cell title="申请原因" :value="getParamNameByValue('WarningReason', details.warningReason) || '-'"></up-cell>
<up-cell title="申请原因">
<template #label>
{{ getParamNameByValue('WarningReason', details.warningReason, { isArray: true }) || '-' }}
</template>
</up-cell>
<up-cell title="缺件航材">
<template #label>
<template v-if="details.materialPns && details.materialDelay == '1'">
......@@ -26,10 +35,14 @@
</up-cell>
<up-cell title="申请人" :value="details.createUserName || '-'"></up-cell>
<up-cell title="申请时间" :value="timeStampFormat(details.createTime) || '-'"></up-cell>
<template v-if="details.applyStatus != '0'">
<up-cell title="审核人" :value="details.approverName"></up-cell>
<template v-if="['1', '2'].includes(details.applyStatus)">
<up-cell title="审核人" :value="details.approverName || '-'"></up-cell>
<up-cell title="审核时间" :value="timeStampFormat(details.updateTime) || '-'"></up-cell>
<up-cell title="审核说明">
<template #label>{{ details.examineReason || '-' }}</template>
</up-cell>
</template>
<view class="mocp-form" v-if="!isCreateUser">
<view class="mocp-form" v-if="isApprover && details.applyStatus == '0'">
<up-form labelPosition="left" labelWidth="auto" :model="formData" :rules="rules" ref="formRef">
<up-form-item label="审核说明" prop="examineReason" :borderBottom="true" required>
<up-input v-model="formData.examineReason" border="none" inputAlign="right" placeholder="请输入" clearable></up-input>
......@@ -41,7 +54,7 @@
<global-action-sheet
v-model="showAction"
title="审核"
description="审核本条非计划申请"
description="审核本条非计划预警"
:options="[
{ label: '审核驳回', value: '2' },
{ label: '审核通过', value: '1' }
......@@ -80,7 +93,14 @@ const userStore = useUserStore()
const isCreateUser = computed(() => {
return userStore.userInfo.id == details.value?.createUser
})
const isApprover = computed(() => {
return userStore.userInfo.id == details.value?.approver
})
const showFooterBtn = computed(() => {
return details.value?.applyStatus == '0' && (isCreateUser.value || isApprover.value)
})
onLoad(() => {
showConfirm.value = false
unplanWarningStore.setState('id', query.id)
unplanWarningStore.getDetails()
formData.examineReason = ''
......
......@@ -29,7 +29,7 @@
</view>
</view>
<view class="item-content">
<view class="u-line-3">预警原因:{{ getParamNameByValue('WarningReason', item.warningReason) || '无' }}</view>
<view class="u-line-3">预警原因:{{ getParamNameByValue('WarningReason', item.warningReason, { isArray: true }) || '无' }}</view>
<view class="u-line-3">具体原因:{{ item.reason || '无' }}</view>
</view>
<view class="item-footer">
......@@ -57,12 +57,18 @@ import { unplanWarningListApi } from 'mocp/api/unplanWarning'
import useUnplanWarningStore from 'mocp/store/unplanWarning'
import { getParamNameByValue } from 'mocp/hooks/use-params/useParams'
import { timeStampFormat } from 'mocp/utils/tool'
import useUserStore from 'mocp/store/user'
const userStore = useUserStore()
//跳转
const unplanWarningStore = useUnplanWarningStore()
const { searchData } = storeToRefs(unplanWarningStore)
const goDetails = (data) => {
uni.$mocpJump.navigateTo('/panel/unplanWarning/details', { id: data.id })
if (data.applyStatus == '0' && !(userStore.userInfo.id == data.createUser || userStore.userInfo.id == data.approver)) {
return uni.$mocpMessage.warning('没有权限查看。!')
} else {
uni.$mocpJump.navigateTo('/panel/unplanWarning/details', { id: data.id })
}
}
//筛选
const handleRightClick = () => {
......
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