Files
jnpf_app/components/Jnpf/OpenData/index.vue

54 lines
1.3 KiB
Vue
Raw Permalink Normal View History

2026-01-04 11:09:06 +08:00
<template>
<u-input input-align='right' :modelValue="modelValue" placeholder="系统自动生成" disabled />
</template>
<script>
export default {
name: 'jnpf-open-data',
props: {
modelValue: {
type: String,
default: ''
},
/**
* currUser - 当前用户
* currTime - 当前时间
* currOrganize - 所属组织
* currPosition - 所属岗位
*/
type: {
type: String,
default: ''
},
},
data() {
return {
innerValue: '',
userInfo: ''
}
},
created() {
this.userInfo = uni.getStorageSync('userInfo') || {}
this.setDefault()
},
methods: {
setDefault() {
if (this.type === 'currUser') {
this.innerValue = this.userInfo.userName + '/' + this.userInfo.userAccount
if (!this.userInfo.userName && !this.userInfo.userAccount) this.innerValue = ""
}
if (this.type === 'currTime') {
this.innerValue = this.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
}
if (this.type === 'currOrganize' && this.userInfo.organizeList?.length) {
const list = this.userInfo.organizeList.map((o) => o.treeName);
this.innerValue = list.join(',');
}
if (this.type === 'currPosition' && this.userInfo.positionList?.length) {
const list = this.userInfo.positionList.map((o) => o.treeName);
this.innerValue = list.join(',');
}
}
}
}
</script>