lw-cdp-ui 1.3.4 → 1.3.6

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.
@@ -179,11 +179,14 @@ export default {
179
179
  closeSelectedTag(tag, autoPushLatestView = true) {
180
180
  let item = this.menu[0]
181
181
  if (item.children) {
182
- item = item.children[0]
182
+ item = item.children[0]
183
183
  }
184
- if (this.tagList.length == 1 && item.path == this.$route.fullPath) {
185
- return false
184
+
185
+ // 兼容合并菜单
186
+ if (item.meta?.code) {
187
+ item.path = `/i/${item.name}`
186
188
  }
189
+
187
190
  this.$store.commit("removeViewTags", tag)
188
191
  this.$store.commit("removeIframeList", tag)
189
192
  this.$store.commit("removeKeepLive", tag.name)
@@ -193,7 +196,7 @@ export default {
193
196
  if (latestView) {
194
197
  this.$router.push(latestView)
195
198
  } else {
196
- this.$router.push('/')
199
+ this.$router.push({ path: item.path })
197
200
  }
198
201
  }
199
202
  },
@@ -199,7 +199,7 @@ export default {
199
199
  }
200
200
  },
201
201
  beforeCreate() {
202
- // 挂载菜单订阅
202
+ // 挂载自定义菜单订阅
203
203
  this.$bus.$on('setMenu', (menu) => {
204
204
  this.changeMenu = true
205
205
  this.menu = this.filterUrl(menu)
@@ -214,12 +214,6 @@ export default {
214
214
  this.$store.state.global.menuIsCollapse = !!isMenuIsCollapse
215
215
  },
216
216
  async created() {
217
- // 标识当前项目
218
- let isCombined = this.$tool.data.get("MENUCOMBINED")
219
- if (isCombined) {
220
- this.$tool.data.set("MENUCOMBINEDNMAE", this.$config.APP_NAME);
221
- }
222
-
223
217
  this.onLayoutResize();
224
218
  window.addEventListener('resize', this.onLayoutResize);
225
219
  this.getUserInfo();
@@ -261,10 +255,15 @@ export default {
261
255
  let application = [...new Set(user.userAuthInfo.menus.map(permission => permission.split('.')[0].split('_')[0]))]
262
256
  user.userAuthInfo.grantedApplications = user.userAuthInfo.grantedApplications.filter(x => application.includes(x.code))
263
257
 
258
+ let userAuthInfo = {
259
+ ...user.userAuthInfo,
260
+ combined: user.combined,
261
+ loginPage: user.loginPage,
262
+ menuContent: user.menuContent,
263
+ }
264
264
  this.$tool.data.set('tenantId', user.userAuthInfo.tenantId)
265
- this.$tool.data.set('userAuthInfo', user.userAuthInfo)
266
- this.$tool.data.set('MenuPath', user.userAuthInfo.grantedApplications)
267
- this.$store.state.user = user.userAuthInfo
265
+ this.$tool.data.set('userAuthInfo', userAuthInfo)
266
+ this.$store.state.user = userAuthInfo
268
267
  },
269
268
 
270
269
 
@@ -173,11 +173,6 @@ export default {
173
173
  type: Boolean,
174
174
  default: true
175
175
  },
176
- // 是否手动合并菜单到同一个项目
177
- isCombined: {
178
- type: Boolean,
179
- default: true
180
- },
181
176
  // 是否加密登录
182
177
  isEncryption: {
183
178
  type: Boolean,
@@ -304,6 +299,7 @@ export default {
304
299
  this.$store.commit("clearViewTags");
305
300
  this.$store.commit("clearKeepLive");
306
301
  this.$store.commit("clearIframeList")
302
+ this.$tool.data.remove("MENU_LIST")
307
303
  },
308
304
  methods: {
309
305
  // 加密
@@ -324,7 +320,7 @@ export default {
324
320
  username: this.ruleForm.user,
325
321
  password: this.ruleForm.password,
326
322
  };
327
-
323
+
328
324
  if (this.isEncryption) {
329
325
  const publicKey = await this.$api.auth.key()
330
326
  if (publicKey) {
@@ -356,14 +352,19 @@ export default {
356
352
  // 获取用户信息
357
353
  let user = await this.$api.auth.user()
358
354
  // 处理应用显示逻辑
359
- let application = [...new Set(user.userAuthInfo.menus.map(permission => permission.split('.')[0].split('_')[0]))]
355
+ let application = [...new Set(user.userAuthInfo.menus.map(permission => permission.split('.')[0].split('_')[0]))]
360
356
  user.userAuthInfo.grantedApplications = user.userAuthInfo.grantedApplications.filter(x => application.includes(x.code))
361
357
 
358
+ let userAuthInfo = {
359
+ ...user.userAuthInfo,
360
+ combined: user.combined,
361
+ loginPage: user.loginPage,
362
+ menuContent: user.menuContent,
363
+ }
362
364
  this.$tool.data.set('tenantId', user.userAuthInfo.tenantId)
363
- this.$tool.data.set('userAuthInfo', user.userAuthInfo)
365
+ this.$tool.data.set('userAuthInfo', userAuthInfo)
364
366
  // 用与应用菜单显示
365
- this.$tool.data.set('MenuPath', user.userAuthInfo.grantedApplications)
366
- this.$store.state.user = user.userAuthInfo
367
+ this.$store.state.user = userAuthInfo
367
368
 
368
369
 
369
370
  // 兼容旧项目设置信息
@@ -372,42 +373,8 @@ export default {
372
373
  sessionStorage.setItem('easyweb_session_passport_bu_list', JSON.stringify({ v: bu }))
373
374
  document.cookie = `Authorization=Bearer ${token}`;
374
375
 
375
- // 获取合并菜单信息 isCombined 这参数后期要加是否要合并菜单展示 现在默认tue
376
- /**
377
- * 此处进行 获取的数据路由router文件进行合并
378
- * 需要开发一个接口返回 权限与具体页面路径映射数据 (这个功能要开发)
379
- * 需要在 platform 菜单管理中 配置isCombined参数 用于标识是否合并项目菜单
380
- * 原有的数据要加两个配置项 icon path
381
- * 返回的数据是
382
- * [
383
- * {
384
- "id": "ma_menu.workplace",
385
- "tenantId": "connext",
386
- "name": "工作台",
387
- "type": "MENU",
388
- ...
389
- "applications": ["ma"],
390
- "icon": 'el-icon-discount', // icon
391
- "path": '/reach/flow-template/, // 菜单路径
392
- "authority": [
393
- "ma.marketing_center.locate",
394
- "ma.marketing_center_operation.locate",
395
- ]
396
- }
397
- * ]
398
- */
399
- if (user.combined || this.isCombined) {
400
- let menu = await this.$api.auth.menu();
401
- this.$tool.data.set("MENUCOMBINED", menu);
402
- // 注入 用于判断子项目 是否扁平化
403
- this.$tool.data.set("MENUCOMBINEDNMAE", this.$config.APP_NAME);
404
- } else {
405
- this.$tool.data.remove("MENUCOMBINED");
406
- this.$tool.data.remove("MENUCOMBINEDNMAE");
407
- }
408
376
 
409
377
  // 检验是否初始化
410
-
411
378
  if (this.isInitialized) {
412
379
  let initialized = await this.$api.auth.initialized()
413
380
  this.$tool.data.set('zoneInitialized', initialized)
@@ -162,46 +162,42 @@
162
162
  :preview-teleported="true" />
163
163
  </template>
164
164
 
165
- <!-- switch -->
166
- <template v-else-if="col.switch">
167
- <el-switch v-model="scope.row[col.dataIndex]"
168
- inline-prompt
169
- :active-text="col?.activeText || '是'"
170
- :inactive-text="col?.inactiveText || ''"
171
- :active-value="col?.activeValue || true"
172
- :inactive-value="col?.inactiveValue || false"
173
- @click="col.callback(scope.row[col.dataIndex], scope.row)"></el-switch>
174
- </template>
175
-
176
- <!-- 选项列 -->
177
- <template v-else-if="!col.switch && col.options?.length">
178
- <template v-if="scope.row.isEdit && col.canEdit">
179
- <el-select v-model="scope.row[col.editSource]"
180
- :value-key="col.editValue || 'code'"
181
- class="select-select number"
182
- placeholder=""
183
- allow-clear
184
- allow-search
185
- filter-option
186
- @change="val => col.callback(val, scope.row)">
187
- <el-option v-for="item in col.options"
188
- :key="item"
189
- :value="item">
190
- {{ col.editValue ? item[col.editValue] : item.name }}
191
- </el-option>
192
- </el-select>
165
+ <!-- 日期转换 -->
166
+ <template v-else-if="col.date">
167
+ <template v-if="Array.isArray(scope.row[col.dataIndex])">
168
+ {{ scope.row[col.dataIndex] ? dayjs(scope.row[col.dataIndex]).format('YYYY-MM-DD HH:mm:ss') : '--'}}
169
+
170
+ {{ scope.row[col.dataIndex] ? dayjs(scope.row[col.dataIndex][1]).format('YYYY-MM-DD HH:mm:ss') : '--'}}
193
171
  </template>
194
172
  <template v-else>
195
- <span v-for="(item, index) in col.options"
196
- :key="item + index">
197
- <span
198
- v-if="scope.row[col.dataIndex] == item[col.editValue || 'code']">
199
- <span v-if="item.statusColor"
200
- :style="`background-color: ${item.statusColor}; border-radius: 100%; padding: 4px; display: inline-block; margin-right: 5px;`" />
201
- {{ col.editValue ? item[col.editValue] : item.name }}
202
- </span>
203
- </span>
173
+ {{ dayjs(scope.row[col.dataIndex]).format('YYYY-MM-DD HH:mm:ss')}}
204
174
  </template>
175
+
176
+ </template>
177
+
178
+ <!-- 开关 -->
179
+ <template v-else-if="col.switch">
180
+ <el-switch :inline-prompt="true"
181
+ :active-text="col.activeText || '是'"
182
+ :inactive-text="col.inactiveText || '否'"
183
+ style="--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #c6c6c6"
184
+ v-model="scope.row[col.dataIndex]"
185
+ :active-value="col.activeValue ?? true"
186
+ :inactive-value="col.inactiveValue ?? false"
187
+ :disabled="col.disabled ? col.disabled(scope.row) : false"
188
+ @change="(v) => {col.clickFun(v, scope.row)}" />
189
+ </template>
190
+
191
+ <!-- 视频 -->
192
+ <template v-else-if="col.video">
193
+ <video width="40"
194
+ :src="scope.row[col.dataIndex]"
195
+ style="margin: 5px 0" />
196
+ </template>
197
+
198
+ <!-- 数组转string -->
199
+ <template v-else-if="col.array">
200
+ <span>{{ scope.row[col.dataIndex] ? scope.row[col.dataIndex].toString() : '' }}</span>
205
201
  </template>
206
202
 
207
203
  <!-- 自定义组件 -->
@@ -231,6 +227,7 @@
231
227
  </template>
232
228
 
233
229
  <script >
230
+ import dayjs from 'dayjs'
234
231
  export default {
235
232
  name: 'TableColumn',
236
233
  props: {
@@ -239,6 +236,11 @@ export default {
239
236
  default: () => []
240
237
  }
241
238
  },
239
+ data() {
240
+ return {
241
+ dayjs
242
+ }
243
+ },
242
244
  methods: {
243
245
  /**
244
246
  * 过滤列表操作按钮
@@ -19,7 +19,7 @@ export default {
19
19
  bordered: { type: Boolean, default: true }, // 是否显示边框
20
20
  stripe: { type: Boolean, default: false }, // 是否显示斑马纹
21
21
  hoverable: { type: Boolean, default: true }, // 是否启用鼠标悬停效果
22
- maxHeight: { type: String, default: 'calc(100vh - 270px)' }, // 表格最大高度
22
+ maxHeight: { type: String, default: '' }, // 表格最大高度
23
23
  height: { type: String, default: '' }, // 表格高度
24
24
 
25
25
  // 选择功能配置
@@ -117,9 +117,9 @@ export default {
117
117
  // 监听窗口大小变化
118
118
  window.addEventListener('resize', this.handleResize)
119
119
 
120
- this.$nextTick(() => {
121
- this.handleResize()
122
- })
120
+ this.$nextTick(() => {
121
+ this.handleResize()
122
+ })
123
123
  },
124
124
 
125
125
  beforeDestroy() {
@@ -249,12 +249,19 @@ export default {
249
249
  this.isFullscreen = false
250
250
  }
251
251
 
252
- // 自动计算稿表格高度
253
- const container = document.querySelector('.adminui-main > .el-container')
252
+ // 自动计算稿表格高度
253
+ const container = document.querySelector('.adminui-main > .el-container') || { clientHeight: 0 }
254
+ const btnContainer = document.querySelector('.table-block > .btn-container')
254
255
  const searchCard = document.querySelector('.lw-search-card')
255
- if (container && searchCard) {
256
- this.tableHeight = container.clientHeight - searchCard.clientHeight - 160
256
+ this.tableHeight = container.clientHeight
257
+ console.log(btnContainer, searchCard)
258
+ if (searchCard) {
259
+ this.tableHeight = this.tableHeight - searchCard.clientHeight
257
260
  }
261
+ if (btnContainer) {
262
+ this.tableHeight = this.tableHeight - btnContainer.clientHeight - 10
263
+ }
264
+ this.tableHeight = this.tableHeight - 110
258
265
  },
259
266
  // 拖动选中
260
267
  onSelect({ selected }) {
@@ -7,7 +7,7 @@
7
7
  :columns="tableHeaders"
8
8
  :data="tableData"
9
9
  :row-key="rowKey"
10
- :max-height="maxHeight"
10
+ :max-height="maxHeight || tableHeight"
11
11
  :height="height || tableHeight"
12
12
  :size="localTableSize"
13
13
  :stripe="stripe"