agilebuilder-ui 1.0.79 → 1.0.80-tmp1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agilebuilder-ui",
3
- "version": "1.0.79",
3
+ "version": "1.0.80-tmp1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./lib/super-ui.js",
@@ -196,7 +196,7 @@ export default {
196
196
  }
197
197
  let lastValues = []
198
198
  if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
199
- if (this.value !== undefined && this.value !== null && this.value && Array.isArray(this.value)) {
199
+ if (this.value !== undefined && this.value !== null && Array.isArray(this.value)) {
200
200
  lastValues = JSON.parse(JSON.stringify(this.value))
201
201
  }
202
202
  }
@@ -296,7 +296,7 @@ export default {
296
296
  // })
297
297
  // }
298
298
  // 默认选中处理
299
- if (dynamicDataSourceDto.defaultSelect) {
299
+ if (dynamicDataSourceDto.defaultSelect && (this.value === undefined || this.value === null || this.value === '')) {
300
300
  // 多选处理
301
301
  /**
302
302
  if (this.baseProps.multiple) {
@@ -40,6 +40,19 @@
40
40
  >
41
41
  <div :id="fullscreenViewerId"/>
42
42
  </el-dialog>
43
+ <!--<el-image-->
44
+ <!-- ref="preview"-->
45
+ <!-- :src="imgList[0]"-->
46
+ <!-- :preview-src-list="imgList"-->
47
+ <!-- style="display: none"-->
48
+ <!--/>-->
49
+ <ElImageViewer
50
+ v-if="isLightBoxVisible"
51
+ hide-on-click-modal
52
+ :initial-index="0"
53
+ :url-list="imgList"
54
+ :on-close="() =>{isLightBoxVisible = false}"
55
+ />
43
56
  </div>
44
57
  </template>
45
58
 
@@ -92,11 +105,13 @@ import 'tinymce/plugins/visualchars' //
92
105
  import 'tinymce/plugins/wordcount' // 数字统计
93
106
  import 'tinymce/skins/ui/oxide/skin.css' // 编辑器皮肤样式
94
107
  import './tinymce/zh_CN.js'
108
+ import {ElImageViewer} from 'element-plus'
95
109
 
96
110
  export default {
97
111
  name: 'RichEditor',
98
112
  components: {
99
113
  Editor,
114
+ ElImageViewer
100
115
  },
101
116
  props: {
102
117
  entity: {
@@ -188,6 +203,18 @@ export default {
188
203
  }
189
204
  return url
190
205
  },
206
+ setup: (editor) => {
207
+ editor.on('click', (e) => {
208
+ const targetNode = e.target.nodeName
209
+ if (targetNode === 'IMG') {
210
+ // 这里可以实现自定义的图片预览逻辑
211
+ const imgSrc = e.target.src
212
+ this.imgList = []
213
+ this.imgList.push(imgSrc)
214
+ this.isLightBoxVisible = true
215
+ }
216
+ })
217
+ },
191
218
  images_upload_handler: (blobInfo, success, failure, progress) => {
192
219
  let file
193
220
  if (blobInfo.blob() instanceof File) {
@@ -223,6 +250,8 @@ export default {
223
250
  dialogVisible: false,
224
251
  fullscreenViewerId: 'editor_viewer_' + new Date().getTime(),
225
252
  ImageComponent: null,
253
+ imgList: [],
254
+ isLightBoxVisible: false
226
255
  }
227
256
  },
228
257
  watch: {
@@ -139,9 +139,9 @@ const apis = {
139
139
  const gridParams = store.get(listCode)
140
140
  const gridData = gridParams.gridData
141
141
  gridParams.superGrid.clearSort()
142
- // console.log('创建行记录的条件1', gridParams.lineEdit)
142
+ console.log('创建行记录的条件1', gridParams.lineEdit)
143
143
  // console.log('创建行记录的条件2', gridParams.lineEdit.editable)
144
- // console.log('创建行记录的条件3', gridParams.loaded)
144
+ console.log('创建行记录的条件3', gridParams.loaded)
145
145
  if (
146
146
  gridParams.lineEdit &&
147
147
  gridParams.lineEdit.editable &&
@@ -1590,15 +1590,19 @@ export default {
1590
1590
  isSaveAll = true
1591
1591
  }
1592
1592
  }
1593
- // console.log('multiselectChange2---this.innerValue=', this.innerValue)
1594
- if (this.innerValue && typeof this.innerValue !== 'number' && this.innerValue.indexOf('saveAll') !== -1) {
1595
- this.innerValue.splice(this.innerValue.indexOf('saveAll'), 1)
1596
- }
1597
- // console.log('multiselectChange3---this.innerValue=', this.innerValue)
1598
- if (isSaveAll) {
1599
- this.cellEvent('input', this.innerValue)
1593
+ if (this.type === 'multiselect') {
1594
+ // console.log('multiselectChange2---this.innerValue=', this.innerValue)
1595
+ if (this.innerValue && typeof this.innerValue !== 'number' && this.innerValue.indexOf('saveAll') !== -1) {
1596
+ this.innerValue.splice(this.innerValue.indexOf('saveAll'), 1)
1597
+ }
1598
+ // console.log('multiselectChange3---this.innerValue=', this.innerValue)
1599
+ const val = this.innerValue && this.innerValue.length > 0 ? this.innerValue.join(',') : null
1600
+ if (isSaveAll) {
1601
+ this.cellEvent('input', val)
1602
+ }
1603
+ this.cellEvent('change', val)
1604
+ this.setCellValue(this.column.prop, val, 'change')
1600
1605
  }
1601
- this.cellEvent('change', arr)
1602
1606
  },
1603
1607
  getDefaultValue(val) {
1604
1608
  // 表示当前字段的是空的,但是有默认值时,给当前字段设置值
@@ -1712,6 +1716,9 @@ export default {
1712
1716
  isInvalidValue(value) {
1713
1717
  return value === undefined || value === null || value === ''
1714
1718
  },
1719
+ refreshList() {
1720
+ this.$emit('refresh-list')
1721
+ },
1715
1722
  getSwitchConfig(switchProp) {
1716
1723
  if (this.valueSetOptions && this.valueSetOptions[switchProp]) {
1717
1724
  return this.valueSetOptions[switchProp]
@@ -20,6 +20,7 @@
20
20
  @refresPortsData="refresPortsData"
21
21
  @refresMainTableFields="refresMainTableFields"
22
22
  @prohibit-to-edit="prohibitToEdit"
23
+ @open-page="openPageDialog"
23
24
  />
24
25
  </template>
25
26
  <template v-else>
@@ -33,6 +34,7 @@
33
34
  :grid-data="gridData"
34
35
  :page-grid-data="gridData"
35
36
  @prohibit-to-edit="prohibitToEdit"
37
+ @open-page="openPageDialog"
36
38
  />
37
39
  </template>
38
40
  </el-table-column>
@@ -108,6 +110,9 @@ export default {
108
110
  },
109
111
  prohibitToEdit(entity) {
110
112
  this.$emit('prohibit-to-edit', entity)
113
+ },
114
+ openPageDialog(openPageParams) {
115
+ this.$emit('open-page', openPageParams)
111
116
  }
112
117
  }
113
118
  }
@@ -11,9 +11,17 @@
11
11
  :width="getColumnWidth()"
12
12
  >
13
13
  <template v-slot:header>
14
- <span :class="{ is_req: isFieldRequired() }"
15
- ><span :title="$escapeHtml(label)" class="cell--span required__label" v-html="$escapeHtml(label)"
16
- /></span>
14
+ <span v-if="!column.customHeader" :class="{is_req: isFieldRequired()}">
15
+ <span :title="$escapeHtml(label)" class="cell--span required__label" v-html="$escapeHtml(label)" />
16
+ </span>
17
+ <component
18
+ :is="column.customHeader"
19
+ v-else
20
+ :prop="column.prop"
21
+ :parent="parentFormData"
22
+ :grid-data="gridData"
23
+ :current-page="currentPage"
24
+ />
17
25
  <el-icon v-if="isShowAdd" style="font-size: 20px; color: #409eff" @click="createFormSubTableRow">
18
26
  <CirclePlus />
19
27
  </el-icon>
@@ -41,6 +49,7 @@
41
49
  @findIndex="findIndex(scope.$index)"
42
50
  @focus="onFocus(scope.$index)"
43
51
  @prohibit-to-edit="prohibitToEdit"
52
+ @refresh-list="refreshList"
44
53
  @refresData="refresData"
45
54
  @refresMainTableFields="refresMainTableFields"
46
55
  @refresPortData="refresPortData"
@@ -94,6 +103,8 @@
94
103
  :operation-index="operationIndex"
95
104
  :operation-setting="operation.props"
96
105
  :row-index="scope.$index"
106
+ :list-code="listCode"
107
+ :parent-form-data="parentFormData"
97
108
  />
98
109
  </span>
99
110
  </span>
@@ -147,6 +158,7 @@
147
158
  :component-id="componentId"
148
159
  :additional-settings="controlConfig"
149
160
  @prohibitToEdit="prohibitToEdit"
161
+ @refresh-list="refreshList"
150
162
  /></span>
151
163
  <span
152
164
  v-else-if="
@@ -1036,6 +1048,9 @@ export default {
1036
1048
  changeDisabled(state) {
1037
1049
  this.disabled = state
1038
1050
  },
1051
+ refreshList() {
1052
+ this.$emit('refresh-list')
1053
+ },
1039
1054
  getFilesFormatter() {
1040
1055
  if (this.column.formatter.options?.fileSet) {
1041
1056
  return JSON.parse(this.column.formatter.options.fileSet)
@@ -49,6 +49,7 @@
49
49
  import { mapGetters } from 'vuex'
50
50
  import customFormatter from './custom-formatter'
51
51
  import { analysisCondition } from '../../../src/utils/util'
52
+ import store from './store'
52
53
  export default {
53
54
  name: 'RowOperation',
54
55
  props: {
@@ -89,6 +90,14 @@ export default {
89
90
  type: Number,
90
91
  default: null,
91
92
  },
93
+ listCode: {
94
+ type: String,
95
+ default: null
96
+ },
97
+ parentFormData: {
98
+ type: Object,
99
+ default: null
100
+ }
92
101
  },
93
102
  data() {
94
103
  return {
@@ -152,6 +161,7 @@ export default {
152
161
  },
153
162
  isShowButton() {
154
163
  // const start = new Date().getTime()
164
+ const gridParams = store.get(this.listCode)
155
165
  const val = customFormatter.isShowButtonFun(
156
166
  this.entity,
157
167
  this.column,
@@ -162,16 +172,15 @@ export default {
162
172
  const displayJudgment = JSON.stringify(
163
173
  this.operationSetting.buttonDisplayConditionsList
164
174
  )
165
- return analysisCondition(
166
- displayJudgment,
167
- this.entity,
168
- {},
169
- {},
170
- true,
171
- null,
172
- null,
173
- null
174
- )
175
+ if (gridParams) {
176
+ let tableName = null
177
+ if (gridParams.basicInfo.tableName) {
178
+ tableName = gridParams.basicInfo.tableName
179
+ }
180
+ return analysisCondition(displayJudgment, this.entity, gridParams.additionalParamMap, gridParams.contextParameter, true, tableName, this.parentFormData)
181
+ } else {
182
+ return analysisCondition(displayJudgment, this.entity, {}, {}, true, null, null)
183
+ }
175
184
  }
176
185
 
177
186
  if (val) {
@@ -203,6 +203,7 @@ const superGridService = {
203
203
  configureObj: this.configureObj
204
204
  })
205
205
  }
206
+ console.log('fetchData-----this.options.initSearch=', this.options.initSearch,'gridParams.basicInfo.initializationQuery=', gridParams.basicInfo.initializationQuery, '0000000')
206
207
  if (canFetchData === undefined || canFetchData === true) {
207
208
  // 表示初始化时查询记录
208
209
  if (this.options.isPageInfo) {
@@ -213,6 +214,7 @@ const superGridService = {
213
214
  'undefined' ||
214
215
  gridParams.basicInfo.initializationQuery
215
216
  ) {
217
+ console.log('fetchData-----this.loadCompleteQuery=', this.loadCompleteQuery, '1111111')
216
218
  // 判断是否初始化完查询条件后再查询数据
217
219
  if (this.loadCompleteQuery) {
218
220
  this.isLoading = false
@@ -220,7 +222,7 @@ const superGridService = {
220
222
  this.fetchData()
221
223
  }
222
224
  }
223
- } else if (this.options.initSearch !== false) {
225
+ } else if (this.options.initSearch) {
224
226
  // 判断是否初始化完查询条件后再查询数据
225
227
  if (this.loadCompleteQuery) {
226
228
  this.isLoading = false
@@ -308,6 +310,7 @@ const superGridService = {
308
310
  if (queryParameterSize > 0) {
309
311
  this.loadCompleteQuery = true
310
312
  }
313
+ console.log('isLoadCompleteQuery-----this.loadCompleteQuery=', this.loadCompleteQuery)
311
314
  }
312
315
  },
313
316
  packageColumnOptionMap(gridParams) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div :style="subTableStyle">
3
3
  <search-form
4
4
  v-if="
5
5
  !isFormSubTable &&
@@ -102,6 +102,7 @@
102
102
  :page-grid-data="
103
103
  isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
104
104
  "
105
+ @refresh-list="refreshList"
105
106
  @open-page="openPageDialog"
106
107
  @refresPortData="refresPortData"
107
108
  @refresPortsData="refresPortsData"
@@ -135,6 +136,7 @@
135
136
  "
136
137
  @open-page="openPageDialog"
137
138
  @refresData="refresData"
139
+ @refresh-list="refreshList"
138
140
  @refresPortData="refresPortData"
139
141
  @refresPortsData="refresPortsData"
140
142
  @refresMainTableFields="refresMainTableFields"
@@ -458,7 +460,8 @@ export default {
458
460
  pageContext, // 页面配置上下文
459
461
  configureObj, // 表格配置信息
460
462
  isMobile, // 是否是移动端
461
- isShowMobileSearch: false // 是否显示移动端查询区域
463
+ isShowMobileSearch: false, // 是否显示移动端查询区域
464
+ subTableStyle: {}
462
465
  }
463
466
  },
464
467
  computed: {
@@ -785,11 +788,21 @@ export default {
785
788
  pageGridData: this.isSubTableShowPage
786
789
  ? this.gridData
787
790
  : null,
791
+ listCode: this.code,
788
792
  additionalParamMap: gridParams.additionalParamMap,
789
793
  pageContext: this.pageContext,
790
794
  configureObj: this.configureObj
791
795
  })
792
796
  }
797
+ this.$emit('gridComplete', {
798
+ gridData: this.isSubTableShowPage ? this.subTableData : this.gridData,
799
+ columns: gridParams.columns,
800
+ superGrid: this.$refs.superGrid,
801
+ isMobile: false,
802
+ listCode: this.code,
803
+ pageGridData: this.isSubTableShowPage ? this.gridData : null,
804
+ additionalParamMap: gridParams.additionalParamMap
805
+ })
793
806
  })
794
807
  }
795
808
  },
@@ -1256,6 +1269,7 @@ export default {
1256
1269
  gridParams.options.isFormSubTable === true
1257
1270
  ) {
1258
1271
  this.isFormSubTable = true
1272
+ this.subTableStyle = { width: '100%' }
1259
1273
  }
1260
1274
  },
1261
1275
  /**
@@ -1651,13 +1665,14 @@ export default {
1651
1665
 
1652
1666
  this.isLoading = true
1653
1667
  this.hasLoadData = false
1668
+ console.log('fetchData--isSearch--', isSearch)
1654
1669
  if (isSearch === undefined || isSearch === false) {
1655
1670
  // 如果不是查询时才需要从缓存中获得结果
1656
1671
  // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
1657
1672
  const isRefreshList = window.sessionStorage.getItem(
1658
1673
  'refreshList-' + this.code
1659
1674
  )
1660
- // console.log('fetchData--isRefreshList--', isRefreshList)
1675
+ console.log('fetchData--isRefreshList--', isRefreshList)
1661
1676
  if (isRefreshList !== undefined && isRefreshList === 'true') {
1662
1677
  const searchParamJson = window.sessionStorage.getItem(
1663
1678
  'searchParam-' + this.code
@@ -1743,11 +1758,13 @@ export default {
1743
1758
  configureObj: this.configureObj
1744
1759
  })
1745
1760
  }
1761
+ console.log('fetchData--canFetchData--', canFetchData, 'requestUrl=', requestUrl)
1746
1762
  return new Promise((resolve, reject) => {
1747
1763
  if(isPromise(canFetchData)){
1748
1764
  canFetchData.then((result)=>{
1749
1765
  if(result === undefined || result) {
1750
1766
  if(!requestUrl){
1767
+ gridParams.loaded = true
1751
1768
  resolve()
1752
1769
  } else {
1753
1770
  this.doRequest(requestUrl, param, parentRowIds, gridParams, resove).then(()=>{
@@ -1758,24 +1775,30 @@ export default {
1758
1775
  }
1759
1776
  } else {
1760
1777
  console.error('beforeRequest result is false!!')
1778
+ gridParams.loaded = true
1761
1779
  resolve()
1762
1780
  }
1763
1781
  }).catch((error)=>{
1782
+ gridParams.loaded = true
1764
1783
  reject(error)
1765
1784
  })
1766
1785
  } else {
1767
1786
  if (canFetchData === undefined || canFetchData === true) {
1768
1787
  if(!requestUrl){
1788
+ gridParams.loaded = true
1769
1789
  resolve()
1770
1790
  } else {
1771
1791
  this.doRequest(requestUrl, param, parentRowIds, gridParams, resove).then(()=>{
1792
+ gridParams.loaded = true
1772
1793
  resolve()
1773
1794
  }).catch((error)=>{
1795
+ gridParams.loaded = true
1774
1796
  reject(error)
1775
1797
  })
1776
1798
  }
1777
1799
  } else {
1778
1800
  console.error('beforeRequest result is false!!')
1801
+ gridParams.loaded = true
1779
1802
  resolve()
1780
1803
  }
1781
1804
  }
@@ -1886,6 +1909,7 @@ export default {
1886
1909
  this.hasLoadData = true
1887
1910
  } else {
1888
1911
  // 对数据做序列化,比如:处理xss攻击
1912
+ gridParams.loaded = true
1889
1913
  if (isHasOptionFunction('gridDataLoaded', this.code)) {
1890
1914
  gridParams.options.gridDataLoaded.call(this, {
1891
1915
  gridData: data,
@@ -2902,7 +2926,7 @@ export default {
2902
2926
  if (index < 0) {
2903
2927
  index = 0
2904
2928
  }
2905
- this.editRow(index)
2929
+ this.editRow(index, this.code)
2906
2930
  }
2907
2931
  }
2908
2932
  }
@@ -3115,6 +3139,9 @@ export default {
3115
3139
  store.set(this.code, gridParams)
3116
3140
  this['subTableData'] = data
3117
3141
  },
3142
+ refreshList() {
3143
+ this.fetchData(this.getSearchParam())
3144
+ },
3118
3145
  // 选择记录
3119
3146
  selectRecord(selection, row){
3120
3147
  let selectRecordEventResult = true
@@ -577,6 +577,8 @@ export default {
577
577
  },
578
578
  fetchData(searchParam, isSearch) {
579
579
  return new Promise((resolve, reject) => {
580
+ // 刷新页面数据时,把选中集合清空
581
+ this.clearSelections()
580
582
  // 获得各属性对应的字段配置
581
583
  this.getPropColumns()
582
584
  this.isLoading = true
@@ -18,7 +18,7 @@
18
18
  :key="buttonIndex"
19
19
  v-permission="button.permission"
20
20
  :class="button.code ? button.code : ''"
21
- :disabled="preventReclick"
21
+ :disabled="disabled?disabled:preventReclick"
22
22
  :type="button.type"
23
23
 
24
24
  @click="button.clickFun"
@@ -60,6 +60,11 @@ export default {
60
60
  type: String,
61
61
  default: null,
62
62
  },
63
+ // 是否禁用按钮组所有按钮
64
+ disabled: {
65
+ type: Boolean,
66
+ default: false
67
+ },
63
68
  },
64
69
  data() {
65
70
  const buttonsPermission = this.getButtonsPermission()
package/src/permission.js CHANGED
@@ -8,7 +8,8 @@ import { ElMessage as Message } from 'element-plus'
8
8
  import * as Vue from 'vue'
9
9
  import authApi from './utils/auth-api'
10
10
 
11
- import { cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil } from './utils/common-util'
11
+ import { cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil, isPlateSys } from './utils/common-util'
12
+ import { getSystemCode } from './utils/permissionAuth'
12
13
 
13
14
  // 首次加载业务系统时,获得用户的语言
14
15
  function initUserLanguage() {
@@ -148,7 +149,9 @@ router.beforeEach((to, from, next) => {
148
149
  .then((user) => {
149
150
  console.log('router.beforeEach-getCurrentUser')
150
151
  const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
151
- if (!isDevp && devpRoleCodes) {
152
+ const systemCode = getSystemCode()
153
+ // console.log('router.beforeEach-getCurrentUser----systemCode=', systemCode, 'isPlateSys(systemCode)=', isPlateSys(systemCode))
154
+ if (!isDevp && devpRoleCodes && systemCode && isPlateSys(systemCode)) {
152
155
  // 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
153
156
  // console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
154
157
  return store.dispatch('getDevPlatformPermissions', devpRoleCodes)
@@ -3,6 +3,20 @@ import { getAbstractUserFactoryWf } from './calculator-factory-wf'
3
3
  import { getPropValue, getEntityFieldValue } from '../util'
4
4
  export function executeExpression(leftValue, operator, rightValue, dataType) {
5
5
  const Calculator = getAbstractUserFactory(dataType)
6
+ if (dataType === 'DATE' || dataType === 'TIME') {
7
+ return executeDateExpression(leftValue, operator, rightValue, Calculator)
8
+ }
9
+ const calculatorObj = new Calculator(leftValue, operator, rightValue)
10
+ return calculatorObj.result
11
+ }
12
+
13
+ function executeDateExpression(leftValue, operator, rightValue, Calculator) {
14
+ if (rightValue && typeof (rightValue) === 'string') {
15
+ rightValue = new Date(rightValue).getTime()
16
+ }
17
+ if (leftValue && typeof (leftValue) === 'string') {
18
+ leftValue = new Date(leftValue).getTime()
19
+ }
6
20
  const calculatorObj = new Calculator(leftValue, operator, rightValue)
7
21
  return calculatorObj.result
8
22
  }
@@ -1,5 +1,5 @@
1
1
  import 'nprogress/nprogress.css' // Progress 进度条样式
2
- import { getTotalPermissions } from './permissionAuth'
2
+ import { getTotalPermissions, isDevpAccess } from './permissionAuth'
3
3
 
4
4
  /**
5
5
  * @param {String} permission 多个资源编码以逗号隔开
@@ -7,6 +7,12 @@ import { getTotalPermissions } from './permissionAuth'
7
7
  */
8
8
  export default function checkPermission(permission) {
9
9
  if (permission) {
10
+ // 是否是预览项目时开发平台用户
11
+ const isDevpPermission= isDevpAccess()
12
+ // console.log('checkPermission---------permission=', permission, 'isDevpPermission=', isDevpPermission)
13
+ if(isDevpPermission){
14
+ return true
15
+ }
10
16
  let hasPermission = false
11
17
  const storeCurrentUserPermissions = getTotalPermissions()
12
18
  if (
@@ -1,5 +1,5 @@
1
1
  import * as Vue from 'vue'
2
- import {getSessionCache, getRunInfoKey} from './auth'
2
+ import {getSessionCache, getRunInfoKey, getUsername, getRunCurrentRole} from './auth'
3
3
  import { isMobileBrowser } from './common-util'
4
4
 
5
5
  const permissionKey = 'PERMISSION-'
@@ -196,4 +196,50 @@ export function removeAllSystemPermissions() {
196
196
  localStorage.removeItem(key)
197
197
  })
198
198
  removePermissionSystemKey()
199
+ }
200
+ // 开发平台项目负责人角色编码
201
+ const DEV_ROLE_PROJECT_ADMIN_CODE = "PROJECT_ADMIN"
202
+ // 开发平台项目开发者角色编码
203
+ const DEV_ROLE_PROJECT_DEVELOPER_CODE = "PROJECT_DEVELOPER"
204
+ // 开发平台项目观察者角色编码
205
+ const DEV_ROLE_PROJECT_VIEWER_CODE = "PROJECT_VIEWER"
206
+
207
+ /**
208
+ * 预览项目时查询应用权限使用。
209
+ * 负责人岗位和观察者岗位
210
+ * @return
211
+ */
212
+ export function isDevpAccess() {
213
+ const username = getUsername()
214
+ // console.log("isDevpAccess-----username=",username);
215
+ const DEVP_APP_ID = "0bba9791-d4f1-47ca-b5e6-1fc840b54f3a"
216
+ if(username && username === DEVP_APP_ID){
217
+ // 开发环境的角色编码,运行环境中是岗位
218
+ const postManagementCodes = getPostManagementCodes()
219
+ // console.log("isDevAccess----postManagementCodes=",postManagementCodes);
220
+ if(postManagementCodes && postManagementCodes.indexOf(DEV_ROLE_PROJECT_ADMIN_CODE) >= 0 ||
221
+ postManagementCodes.contains(DEV_ROLE_PROJECT_VIEWER_CODE) >= 0){
222
+ // 表示是项目负责人岗位或观察者岗位或平台管理员,且当前登录用户是 devp的应用id
223
+ return true
224
+ }
225
+ }
226
+ return false
227
+ }
228
+
229
+ function getPostManagementCodes() {
230
+ const devpPostManagements = getRunCurrentRole()
231
+ if(devpPostManagements){
232
+ let postCodes = [];
233
+ const devpCodes = devpPostManagements.split(",");
234
+ devpCodes.forEach(code=>{
235
+ let roleCode = code
236
+ if(code === DEV_ROLE_PROJECT_ADMIN_CODE || code === DEV_ROLE_PROJECT_DEVELOPER_CODE ){
237
+ roleCode = DEV_ROLE_PROJECT_ADMIN_CODE
238
+ }
239
+ if(postCodes.indexOf(roleCode) < 0) {
240
+ postCodes.push(roleCode)
241
+ }
242
+ })
243
+ return postCodes
244
+ }
199
245
  }