Skip to content

Commit

Permalink
Merge pull request #900 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
merge develop to master 1.0.9
  • Loading branch information
ielgnaw authored May 9, 2023
2 parents 2a1ccdc + f4720e6 commit 420c828
Show file tree
Hide file tree
Showing 147 changed files with 5,148 additions and 609 deletions.
6 changes: 6 additions & 0 deletions .bk.development.env
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ BK_API_GATEWAY_ORIGIN =

// 静态资源前缀
BK_STATIC_URL =

// ai 白名单
BK_AI_WHITE_LIST =

// bk-data 授权码
BK_DATA_DATA_TOKEN =
2 changes: 0 additions & 2 deletions .bk.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ BK_APP_PORT = 5000
// 接口路径地址
BK_AJAX_URL_PREFIX = '/api'

// 请求用户接口路径
BK_USER_INFO_URL = '/user'
6 changes: 6 additions & 0 deletions .bk.production.env
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ BK_STATIC_URL = {{ BK_STATIC_URL }}

// itsm 地址
BK_ITSM_URL =

// bkvision 网关接口地址
BK_VISION_API_URL =

// 跳转到bkvision平台的链接
BK_VISION_WEB_URL =
2 changes: 1 addition & 1 deletion lib/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<head>
<link rel="icon" href="<%= process.env.BK_STATIC_URL %>/static/images/logo.png" type="image/x-icon" />
<link rel="shortcut icon" href="<%= process.env.BK_STATIC_URL %>/static/images/logo.png" type="image/x-icon" />

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<title>可视化开发平台 | 腾讯蓝鲸智云</title>
<script>
Expand Down
1 change: 1 addition & 0 deletions lib/client/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<link rel="icon" href="<%= process.env.BK_STATIC_URL %>/images/logo.png" type="image/x-icon" />
<link rel="shortcut icon" href="<%= process.env.BK_STATIC_URL %>/images/logo.png" type="image/x-icon" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>可视化开发平台 | 腾讯蓝鲸智云</title>
<style>
html, body, #app {
Expand Down
1 change: 1 addition & 0 deletions lib/client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
bus.$off('not-exist', this.notExistHold)
})
await this.$store.dispatch('checkIamNoResourcesPerm')
await this.$store.dispatch('ai/checkAiAvailable')
},

mounted () {
Expand Down
4 changes: 4 additions & 0 deletions lib/client/src/common/fully-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import renderHtml from '@/components/patch/render-html'
import widgetBkTable from '@/components/patch/widget-bk-table'
import widgetElTable from '@/components/patch/widget-el-table'
import widgetTableColumn from '@/components/patch/widget-table-column'
import widgetBkVision from '@/components/patch/widget-bk-vision'
import widgetDateTimePicker from '@/components/patch/widget-vant-date-time-picker'
import VueAwesomeSwiper from 'vue-awesome-swiper'

// import style
Expand All @@ -37,7 +39,9 @@ Vue.use(bkImage)
Vue.use(chart)
Vue.use(bkMagicVue)
Vue.use(bkCharts)
Vue.use(widgetBkVision)
Vue.use(renderHtml)
Vue.use(widgetBkTable)
Vue.use(widgetElTable)
Vue.use(widgetTableColumn)
Vue.use(widgetDateTimePicker)
8 changes: 4 additions & 4 deletions lib/client/src/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,14 @@ export const isValEmpty = (val) => {
}

/**
* px单位转为rpx单位
* px单位转为rpx单位, 转为为int, 因很多单位使用初仅支持整类型
* @param {*}
* value: number
*/
export function pxToRpx (value) {
const { width } = store.getters['page/pageSize']
const fullWidthRpx = 750
return (fullWidthRpx / width) * value
return parseInt((fullWidthRpx / width) * value)
}

export function autoStyle (node, styleName, pxNumber, isGet = false) {
Expand All @@ -897,7 +897,7 @@ export function autoStyle (node, styleName, pxNumber, isGet = false) {
throw Error('传入错误参数,无法进行单位自动转换')
}

/** rem转为px
/** rem转为px,转为为int, 因很多单位使用初仅支持整类型
* 项目rem 基准
* fullWidth: 750 / 20rem
* 详见 lib/shared
Expand All @@ -907,7 +907,7 @@ export function remToPx (value) {
const fullWidthRem = 20

const originValue = parseInt(value, 10)
return ((originValue / fullWidthRem) * width) + 'px'
return parseInt(((originValue / fullWidthRem) * width)) + 'px'
}

/** 自动转为px */
Expand Down
4 changes: 3 additions & 1 deletion lib/client/src/common/vant.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { Button,
Tabs,
Tab,
Tabbar,
TabbarItem } from 'vant'
TabbarItem,
Popup } from 'vant'
import 'vant/lib/index.css'

Vue.use(Button)
Expand Down Expand Up @@ -76,6 +77,7 @@ Vue.use(Tabs)
Vue.use(Tab)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(Popup)

// Vue.use(Calendar)
Vue.use(Lazyload)
20 changes: 20 additions & 0 deletions lib/client/src/components/changelog-version/changelog-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
export default [
{
date: '2023.04.18',
detailList: [
{
reviseTitle: '新增',
logMassage: [
'画布: 移动端新增日期选择器组件',
'流程&表单: 表单画布新增计算组件',
'流程&表单: 表单画布新增自动编号组件',
'数据源: 数据导入支持更新和去重',
'应用: 路由管理支持预览对应导航布局'
]
}, {
reviseTitle: '修复',
logMassage: [
'应用: 修复应用预览缓存问题'
]
}
]
},
{
date: '2023.03.08',
detailList: [
Expand Down
17 changes: 16 additions & 1 deletion lib/client/src/components/flow-form-comp/form/constants/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ export const FIELDS_TYPES = [
default: 0,
comp: 'Rate',
icon: 'icon bk-drag-icon bk-drag-rate'
},
{
type: 'COMPUTE',
name: '计算控件',
default: '--',
comp: 'Compute',
icon: 'icon bk-drag-icon bk-drag-fc-count'
},
{
type: 'SERIAL',
name: '自动编号',
default: '--',
comp: 'Serial',
icon: 'icon bk-drag-icon bk-drag-liebiao'
}
]

Expand All @@ -161,7 +175,8 @@ export const FIELDS_TYPES_MAPS = {
LINK: '链接',
DESC: '描述文本',
FORMULA: '计算控件',
DIVIDER: '分割线'
DIVIDER: '分割线',
SERIAL: '自动编号'
}

// 只支持全行展示的字段类型
Expand Down
10 changes: 7 additions & 3 deletions lib/client/src/components/flow-form-comp/form/fieldItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
import Upload from './fields/upload.vue'
import Divider from './fields/divider'
import Rate from './fields/rate'
import Compute from './fields/compute'
import Serial from './fields/serial.vue'
// 注册fields文件夹下所有字段类型组件
// function registerField() {
// const fields = require.context('./fields/', false, /\w+\.(vue)$/);
Expand Down Expand Up @@ -93,7 +95,9 @@
Tree: Tree,
Upload: Upload,
Divider: Divider,
Rate: Rate
Rate: Rate,
Compute,
Serial
},
props: {
field: {
Expand Down Expand Up @@ -125,7 +129,7 @@
},
// 默认规则设置为禁止填写 和 字段设置为禁止编辑的时候禁止编辑
isDisabled () {
return this.field.is_readonly
return this.field.is_readonly || this.disabled
},
needPagination () {
return this.$route.name !== 'editNocode'
Expand Down
18 changes: 18 additions & 0 deletions lib/client/src/components/flow-form-comp/form/fields/compute.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- 计算控件 -->
<template>
<div>
{{ value }}
</div>
</template>

<script>
export default {
name: 'BkLesscodeComput',
props: {
value: {
type: String,
default: '--'
}
}
}
</script>
22 changes: 22 additions & 0 deletions lib/client/src/components/flow-form-comp/form/fields/serial.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- 自动编号 -->
<template>
<div>
{{ value }}
</div>
</template>

<script>
export default {
name: 'BkLesscodeSerial',
props: {
value: {
type: String,
default: '--'
}
}
}
</script>

<style lang="scss" scoped>

</style>
69 changes: 67 additions & 2 deletions lib/client/src/components/flow-form-comp/form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<field-form-item
v-if="!field.isHide"
:key="field.key"
:disabled="disabled"
:field="field"
:use-fixed-data-source="useFixedDataSource"
:value="localValue[field.key]"
Expand All @@ -16,6 +17,7 @@
import { debounce, isEqual, cloneDeep } from 'lodash'
import dayjs from 'dayjs'
import conditionMixins from './condition-mixins'
import { computDateDiff, computeNumberResult } from './util/index.js'
import FieldFormItem from './fieldItem.vue'
export default {
Expand All @@ -40,12 +42,14 @@
value: {
type: Object,
default: () => ({})
}
},
disabled: Boolean
},
data () {
return {
fieldsCopy: cloneDeep(this.fields),
localValue: {}
localValue: {},
computeConfigFields: []
}
},
watch: {
Expand Down Expand Up @@ -73,6 +77,7 @@
initFormValue () {
const fieldsValue = {}
const fieldsWithRules = []
this.computeConfigFields = []
this.fields.forEach((item) => {
let value
if (item.key in this.value) {
Expand All @@ -90,6 +95,14 @@
if (item.meta.default_val_config) {
fieldsWithRules.push(item)
}
if (item.meta.compute_config_info) {
this.computeConfigFields.push(item)
}
// 隐藏自动编号字段
if (item.type === 'SERIAL') {
item.isHide = true
}
// 储存各个字段对应的初始值
fieldsValue[item.key] = value
})
Expand All @@ -115,6 +128,56 @@
})
this.$emit('change', this.localValue)
},
// 初始化计算组件数据
initComputeData (computeConfigFields) {
computeConfigFields.forEach((computeField) => {
this.localValue[computeField.key] = this.changeComputeDefalutValue(computeField)
})
},
// 修改计算控件的值
changeComputeDefalutValue (computeField) {
const { type, dateTime, numberComput } = computeField.meta.compute_config_info
if (type === 'dateTime') {
// 计算时间间隔
if (this.changeDateTime(dateTime)) {
return computDateDiff(computeField.meta.compute_config_info)
}
return computeField.default
} else {
this.setBindFieldValue(numberComput)
return computeNumberResult(numberComput)
}
},
// 修改日期计算组件的开始或结束日期的值
changeDateTime (dateTime) {
let isChange = false
// 日期计算
const dateKeys = ['creation_date', 'update_date', 'specify_date']
const dateTimeKeys = ['startDate', 'endDate']
dateTimeKeys.forEach((strItem) => {
const key = dateTime[strItem].key
if (!dateKeys.includes(key)) {
// 找到对应的日期字段的值
dateTime[strItem].value = this.localValue[key]
isChange = true
}
})
return isChange
},
// 设置绑定的字段值
setBindFieldValue (numberComput) {
let fieldsKey = 'computeFields'
if (numberComput.formula === 'customize') {
fieldsKey = 'customizeFormula'
}
numberComput[fieldsKey] = numberComput[fieldsKey].map((item) => {
const key = item.key || item
return {
key,
value: this.localValue[key]
}
})
},
// 解析是否有表单依赖变化的表单项,如果有则更新数据源配置,触发重新拉取数据逻辑
parseDataSourceRelation (key, val) {
this.fieldsCopy.forEach(field => {
Expand Down Expand Up @@ -166,6 +229,8 @@
}
}
})
this.initComputeData(this.computeConfigFields)
// this.initSerialDefaultValue()
},
// 获取关联规则中包含当前字段key的字段列表
getValAssociatedFields (key) {
Expand Down
Loading

0 comments on commit 420c828

Please sign in to comment.