| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <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>
|