fix(oa): align mobile OA detail status labels with web
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d827f55bf0
commit
76dab57f4e
3 files changed
+32
-46
No files matched your search
@@ -35,34 +35,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { statusText, statusTone } from '../status-label.js'
|
||||
|
||||
defineProps({
|
||||
items: { type: Array, default: () => [] }
|
||||
})
|
||||
|
||||
function statusText(s) {
|
||||
const map = {
|
||||
pending: '待处理',
|
||||
running: '进行中',
|
||||
approved: '已同意',
|
||||
rejected: '已拒绝',
|
||||
completed: '已完成',
|
||||
cancelled: '已撤销',
|
||||
done: '已结束',
|
||||
submitted: '已提交',
|
||||
not_reached: '未到达',
|
||||
returned: '已打回',
|
||||
transferred: '已转交'
|
||||
}
|
||||
return map[s] || s || ''
|
||||
}
|
||||
|
||||
function statusTone(s) {
|
||||
if (s === 'pending' || s === 'running') return 'warn'
|
||||
if (s === 'approved' || s === 'completed' || s === 'done' || s === 'submitted') return 'ok'
|
||||
if (s === 'rejected' || s === 'cancelled' || s === 'returned') return 'danger'
|
||||
return 'mute'
|
||||
}
|
||||
|
||||
function dotClass(item) {
|
||||
return statusTone(item?.status)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* OA 实例/任务状态文案与色调(对齐 web-admin instances/detail.vue statusText/statusType)
|
||||
*/
|
||||
export const OA_STATUS_TEXT = {
|
||||
pending: '待处理',
|
||||
running: '进行中',
|
||||
approved: '已同意',
|
||||
rejected: '已拒绝',
|
||||
completed: '已完成',
|
||||
cancelled: '已撤销',
|
||||
done: '已结束',
|
||||
submitted: '已提交',
|
||||
not_reached: '未到达',
|
||||
returned: '已打回',
|
||||
transferred: '已转交'
|
||||
}
|
||||
|
||||
export function statusText(s) {
|
||||
return OA_STATUS_TEXT[s] || s || ''
|
||||
}
|
||||
|
||||
/** 映射到移动端 badge class:warn / ok / danger / mute(对应 web warning / success / danger / info) */
|
||||
export function statusTone(s) {
|
||||
if (s === 'pending' || s === 'running') return 'warn'
|
||||
if (s === 'approved' || s === 'completed' || s === 'done' || s === 'submitted') return 'ok'
|
||||
if (s === 'rejected' || s === 'cancelled' || s === 'returned') return 'danger'
|
||||
if (s === 'not_reached') return 'mute'
|
||||
return 'mute'
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import { useRoute } from 'vue-router'
|
||||
import { showToast } from 'vant'
|
||||
import { fetchOaInstanceDetail } from '../api/oa.js'
|
||||
import { prepareMobileFormSchema } from '../oa/schema-prep.js'
|
||||
import { statusText, statusTone } from '../oa/status-label.js'
|
||||
import OaProgressTimeline from '../oa/components/OaProgressTimeline.vue'
|
||||
import OaPulseLoading from '../oa/components/OaPulseLoading.vue'
|
||||
|
||||
@@ -73,28 +74,6 @@ const timelineItems = computed(() => {
|
||||
}))
|
||||
})
|
||||
|
||||
/** 实例状态文案(对齐任务说明) */
|
||||
function statusText(s) {
|
||||
const map = {
|
||||
running: '进行中',
|
||||
pending: '进行中',
|
||||
completed: '已完成',
|
||||
approved: '已完成',
|
||||
done: '已完成',
|
||||
rejected: '已拒绝',
|
||||
returned: '已打回',
|
||||
cancelled: '已撤销'
|
||||
}
|
||||
return map[s] || s || ''
|
||||
}
|
||||
|
||||
function statusTone(s) {
|
||||
if (s === 'pending' || s === 'running') return 'warn'
|
||||
if (s === 'approved' || s === 'completed' || s === 'done') return 'ok'
|
||||
if (s === 'rejected' || s === 'cancelled' || s === 'returned') return 'danger'
|
||||
return 'mute'
|
||||
}
|
||||
|
||||
/** 通知宿主关闭(对齐 OaStart closeToMini) */
|
||||
function closeToMini(payload) {
|
||||
const data = payload || { action: 'oa-detail-close' }
|
||||
|
||||
Reference in new issue
Block a user