agilebuilder-ui 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+
2
+ <template>
3
+ <el-drawer v-model="isShowForm" direction="btt" size="80%" class="organization-tree">
4
+ <template #header>
5
+ <div style="text-align: center;">
6
+ {{$t('departmentTreeInline.selectResultTitle')}}
7
+ </div>
8
+ </template>
9
+ <template #default>
10
+ <el-tree
11
+ v-if="isShowForm"
12
+ ref="orgResultTreeRef"
13
+ :data="selectUsers"
14
+ node-key="nodeId"
15
+ >
16
+ <template #default="{ node, data }">
17
+ <div class="item-row">
18
+ <div class="item-label">{{ data.showName }}
19
+ <span v-if="data.nodeType && data.nodeType ==='USER'" style="color:#999">({{ data.loginName }}{{ getUserMainDeptName(data) ? '/'+getUserMainDeptName(data): ''}})</span>
20
+ <span v-if="data.parentNodeId !== '-1' && getDeptNamePath(data)" style="color:#999">({{ getDeptNamePath(data) }})</span>
21
+ </div>
22
+ <div class="item-side" @click="removeDept(data)">
23
+ <el-icon><DeleteFilled /></el-icon>
24
+ </div>
25
+ </div>
26
+ </template>
27
+ </el-tree>
28
+ </template>
29
+ </el-drawer>
30
+ </template>
31
+ <script setup lang="ts">
32
+ import {
33
+ DeleteFilled
34
+ } from '@element-plus/icons-vue'
35
+ import { reactive,ref,onMounted, defineEmits } from 'vue'
36
+ import { getUserMainDeptName, getDeptNamePath} from '../../utils/organization.ts'
37
+ const props = defineProps({
38
+ selectUsers: {
39
+ type: Array<any>,
40
+ default: null
41
+ }
42
+ })
43
+ let isShowForm = ref(false)
44
+ // onMounted(()=>{
45
+ // treeData.value = props.selectUsers.concat(props.selectDepts)
46
+ // })
47
+ const emits = defineEmits(['removeResult'])
48
+ function removeDept (item) {
49
+ emits('removeResult', item )
50
+ }
51
+
52
+ function showResult() {
53
+ isShowForm.value = true
54
+ }
55
+
56
+ defineExpose({showResult})
57
+
58
+ </script>
package/packages/index.js CHANGED
@@ -33,6 +33,10 @@ import MultipartUpload from './multipart-upload'
33
33
  import RichEditor from './rich-editor'
34
34
  import SecretInfo from './secret-info'
35
35
  import IntervalSelection from './IntervalSelection'
36
+ import DepartmentTreeMobile from './department-tree-mobile'
37
+ import DepartmentUserTreeMobile from './department-user-tree-mobile'
38
+ import SuperIcon from './super-icon'
39
+ import * as ElementPlusIconsVue from "@element-plus/icons-vue"
36
40
  // 将所有组件都存储起来,方便后续统一注册
37
41
  const components = [
38
42
  Breadcrumb,
@@ -65,6 +69,9 @@ const components = [
65
69
  RichEditor,
66
70
  SecretInfo,
67
71
  IntervalSelection,
72
+ DepartmentTreeMobile,
73
+ DepartmentUserTreeMobile,
74
+ SuperIcon
68
75
  ]
69
76
 
70
77
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
@@ -79,6 +86,10 @@ const install = function (Vue) {
79
86
  })
80
87
  // 将弹出页面方法注册到window对象上
81
88
  window['$plateform_openPage'] = openPage
89
+ // 注册Element UI所有图标
90
+ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
91
+ Vue.component(key, component)
92
+ }
82
93
  }
83
94
 
84
95
  // 判断是否是直接引入vue的js文件,即全局引用可自动安装所有组件
@@ -115,6 +126,9 @@ export {
115
126
  MultipartUpload,
116
127
  RichEditor,
117
128
  SecretInfo,
129
+ DepartmentTreeMobile,
130
+ DepartmentUserTreeMobile,
131
+ SuperIcon
118
132
  }
119
133
 
120
134
  export default {
@@ -0,0 +1,6 @@
1
+ import SuperIcon from './src/index.vue'
2
+ SuperIcon.install = function (Vue) {
3
+ Vue.component('SuperIcon', SuperIcon)
4
+ }
5
+
6
+ export default SuperIcon
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <span>
3
+ <template v-if="iconType === 'ElementUI'">
4
+ <el-icon><component
5
+ :is="iconValue"
6
+ ></component></el-icon>
7
+ </template>
8
+ <template v-else>
9
+ <i v-if="iconValue.indexOf('fa-')===0" :class="'fa '+iconValue"></i>
10
+ <img v-if="iconValue.indexOf('svg-')===0" :src="defaultShowImageAction+iconValue.substring(iconValue.indexOf('-')+1)"/>
11
+ </template>
12
+ </span>
13
+ </template>
14
+ <script lang="ts">
15
+ export default {
16
+ name: 'SuperIcon'
17
+ }
18
+ </script>
19
+
20
+ <script setup lang="ts">
21
+ import { ref } from 'vue'
22
+ const props = defineProps({
23
+ // 值为:ElementUI、custom
24
+ iconType: {
25
+ type: String,
26
+ default: 'custom'
27
+ },
28
+ iconValue: {
29
+ type: String,
30
+ required: true,
31
+ default: '',
32
+ }
33
+ })
34
+ const defaultShowImageAction = ref(window.$vueApp.config.globalProperties.baseAPI + '/component/super-form/show-image?serverPath=')
35
+
36
+ </script>
37
+
@@ -0,0 +1,157 @@
1
+ // 将选中的部门节点添加到结果集合中
2
+ export function addSelectedUserInfo (selectNodeInfo, userData, containBranch) {
3
+ if (selectNodeInfo.userIds.indexOf(userData.id) < 0) {
4
+ // 表示集合中不存在该用户
5
+ selectNodeInfo.userIds.push(userData.id)
6
+ selectNodeInfo.loginNames.push(userData.loginName)
7
+ if (userData.email && userData.email !== '') {
8
+ selectNodeInfo.emails.push(userData.email)
9
+ }
10
+ if (userData.telephone && userData.telephone !== '') {
11
+ selectNodeInfo.telephones.push(userData.telephone)
12
+ }
13
+ if (userData.user) {
14
+ selectNodeInfo.users.push(userData.user)
15
+ } else {
16
+ selectNodeInfo.users.push(userData)
17
+ }
18
+ var name = userData.name
19
+ if (userData.enName && userData.enName !== '') {
20
+ name = name + '(' + userData.enName + ')'
21
+ }
22
+ // if (containBranch && userData.subCompanyName) {
23
+ // // 如果包含分支机构,则拼接分支机构名称
24
+ // name = name + '(' + userData.subCompanyName + ')'
25
+ // }
26
+ selectNodeInfo.userNames.push(name)
27
+ selectNodeInfo.userZhNames.push(userData.name)
28
+ selectNodeInfo.userEnNames.push(userData.enName ? userData.enName : '')
29
+ }
30
+ }
31
+ export function packageSelectResult (user, containBranch) {
32
+ let name = user.name
33
+ if (user.enName && user.enName.trim() !== '') {
34
+ name = name + '(' + user.enName + ')'
35
+ }
36
+ // if (containBranch && user.subCompanyName) {
37
+ // // 如果包含分支机构,则拼接分支机构名称
38
+ // // name = name + '(' + user.subCompanyName + ')'
39
+ // }
40
+ const selectNodeInfo = {
41
+ id: user.id,
42
+ name: name,
43
+ zhName: user.name,
44
+ loginName: user.loginName,
45
+ email: user.email,
46
+ telephone: user.telephone,
47
+ containBranch: containBranch,
48
+ user: user,
49
+ enName: user.enName ? user.enName : '',
50
+ subCompanyName: user.subCompanyName
51
+ }
52
+ // 表示是勾选单选按钮或 选中树节点
53
+ return selectNodeInfo
54
+ }
55
+ // 根据指定用户信息获得用户集合
56
+ function getSelectUsers (searchField, selectUserInfo, separator) {
57
+ return new Promise((resolve, reject) => {
58
+ if (!searchField) {
59
+ resolve([])
60
+ } else if (!selectUserInfo) {
61
+ resolve([])
62
+ } else {
63
+ window['$vueApp'].config.globalProperties.$http.get(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/select-users-mobile?searchField=' + searchField + '&selectUserInfo=' + selectUserInfo + '&separator=' + separator).then(users => {
64
+ resolve(users)
65
+ }).catch(error => {
66
+ reject(error)
67
+ })
68
+ }
69
+ })
70
+ }
71
+ // 部门人员树选中了组织结构树的根节点
72
+ function packageAllUser () {
73
+ // 表示集合中不存在该用户,则封装该用户
74
+ const tenantNodeId = -1
75
+ var allUser = {
76
+ id: tenantNodeId,
77
+ name: '所有用户'
78
+ }
79
+ return allUser
80
+ }
81
+ // 工作组人员树选中了组织结构树的根节点
82
+ function packageAllWgUser () {
83
+ // 表示集合中不存在该用户,则封装该用户
84
+ const tenantNodeId = -1
85
+ var allUser = {
86
+ id: tenantNodeId,
87
+ name: '所有工作组人员'
88
+ }
89
+ return allUser
90
+ }
91
+ export function initSelectUsers (searchField, selectUserInfo, separator) {
92
+ return new Promise((resolve, reject) => {
93
+ const selectDepts = []
94
+ if (selectUserInfo) {
95
+ if (selectUserInfo === '所有用户') {
96
+ // 表示已选择所有用户
97
+ selectDepts.push(packageAllUser())
98
+ resolve(selectDepts)
99
+ } else if (selectUserInfo === '所有工作组人员') {
100
+ selectDepts.push(packageAllWgUser())
101
+ resolve(selectDepts)
102
+ } else {
103
+ // 表示不是选择的所有用户
104
+ getSelectUsers(searchField, selectUserInfo, separator).then(users => {
105
+ resolve(users)
106
+ }).catch(error => {
107
+ reject(error)
108
+ })
109
+ }
110
+ } else {
111
+ resolve(selectDepts)
112
+ }
113
+ })
114
+ }
115
+
116
+
117
+ // import {getLanguageWithLocale} from '../../../src/utils/util'
118
+ export function resizeScrollTargetHeightUtil () {
119
+ const pagePadding = 16
120
+ let height = window.innerHeight - pagePadding
121
+ const header = document.querySelector('.el-page-header')
122
+ const footer = document.querySelector('.mobile-tab')
123
+ if (header) {
124
+ height = height - 50
125
+ }
126
+ if (footer) {
127
+ height = height - 56
128
+ }
129
+ return height
130
+ }
131
+
132
+
133
+ export function getUserMainDeptName (user) {
134
+ let deptShowName = ''
135
+ if (user && user.data) {
136
+ const userData = JSON.parse(user.data)
137
+ if (userData.mainDepartmentEnName && userData.mainDepartmentEnName !== '' && window['$locale'] && window['$locale'] !== 'cn') {
138
+ deptShowName = userData.mainDepartmentEnName
139
+ } else {
140
+ if (userData.mainDepartmentName && userData.mainDepartmentName !== '') {
141
+ deptShowName = userData.mainDepartmentName
142
+ }
143
+ }
144
+ }
145
+ return deptShowName
146
+ }
147
+
148
+
149
+
150
+ export function getDeptNamePath (dept) {
151
+ let deptShowName = ''
152
+ if (dept && dept.data) {
153
+ const deptData = JSON.parse(dept.data)
154
+ deptShowName = deptData.namePath
155
+ }
156
+ return deptShowName
157
+ }
@@ -133,6 +133,11 @@ const cn = {
133
133
  removeDepartment: '移除部门',
134
134
  selectedDept: '已选部门',
135
135
  namePath: '名称路径',
136
+ allCheck: '全选',
137
+ pleaseInputNameOrCode: '请输入名称/编码',
138
+ selectResultInfoHasSelect: '已选择:',
139
+ selectResultInfo: '{num}个部门(含子部门)',
140
+ selectResultTitle: '已选择信息'
136
141
  },
137
142
  // 用户树
138
143
  departmentUserTree: {
@@ -144,6 +149,8 @@ const cn = {
144
149
  searchFieldTelephone: '手机号',
145
150
  searchFieldJobNumber: '工号',
146
151
  searchFieldHonorificName: '尊称',
152
+ selectUserResultInfo: '{userNum}个用户',
153
+ selectDeptResultInfo: '{deptNum}个部门(含子部门)'
147
154
  },
148
155
  // 嵌入用户树
149
156
  departmentUserTreeInline: {
@@ -135,6 +135,11 @@ const en = {
135
135
  removeDepartment: 'Remove Department',
136
136
  selectedDept: 'Selected Departments',
137
137
  namePath: 'Name Path',
138
+ allCheck: 'Check All',
139
+ pleaseInputNameOrCode: 'Please Input Name Or Code',
140
+ selectResultInfoHasSelect: 'Has select:',
141
+ selectResultInfo: '{num} departments (including sub departments)',
142
+ selectResultTitle: 'Has Select Result'
138
143
  },
139
144
  // 用户树
140
145
  departmentUserTree: {
@@ -146,6 +151,8 @@ const en = {
146
151
  searchFieldTelephone: 'Telephone',
147
152
  searchFieldJobNumber: 'Job Number',
148
153
  searchFieldHonorificName: 'Honorific',
154
+ selectUserResultInfo: '{useNum} Users',
155
+ selectDeptResultInfo: '{num} departments(including sub departments)'
149
156
  },
150
157
  // 嵌入用户树
151
158
  departmentUserTreeInline: {