Skip to content

Commit 7b25825

Browse files
author
shizhong
committed
2 parents 09beb16 + 7b18dba commit 7b25825

File tree

5 files changed

+41
-8
lines changed

5 files changed

+41
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yudao-ui-admin",
3-
"version": "1.6.3-snapshot",
3+
"version": "1.6.4-snapshot",
44
"description": "芋道管理系统",
55
"author": "芋道",
66
"license": "MIT",

src/assets/styles/ruoyi.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@
7171
padding: 10px 20px 0;
7272
}
7373

74+
.el-dialog{
75+
display: flex;
76+
flex-direction: column;
77+
max-width: calc(100% - 30px);
78+
max-height: calc(100% - 70px);
79+
.el-dialog__body {
80+
overflow: auto;
81+
}
82+
}
83+
7484
.el-table {
7585
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
7686
th {

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ console.log(request)
7070
Vue.prototype.$axios = request
7171
import '@/styles/index.scss'
7272

73+
// 默认点击背景不关闭弹窗
74+
import ElementUI from 'element-ui'
75+
ElementUI.Dialog.props.closeOnClickModal.default = false
76+
7377
/**
7478
* If you don't want to use mock-server
7579
* you want to use MockJs for mock api

src/utils/formGenerator.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
/**
22
* 将服务端返回的 fields 字符串数组,解析成 JSON 数组
3+
* 如果指定了 variables 参数可对表单进行初始化
34
*
45
* @param fields JSON 字符串数组
6+
* @param variables Object 表单初始值
57
* @returns {*[]} JSON 数组
68
*/
7-
export function decodeFields(fields) {
8-
const drawingList = []
9-
fields.forEach(item => {
10-
drawingList.push(JSON.parse(item))
9+
export function decodeFields(fields, variables) {
10+
const drawingList = (fields || []).map(json => {
11+
const item = JSON.parse(json)
12+
13+
if (typeof variables === 'undefined' ) return item
14+
15+
const setDefault = (item, variables) => {
16+
if (typeof variables[item.__vModel__] !== 'undefined') {
17+
item.__config__.defaultValue = variables[item.__vModel__]
18+
}
19+
if (item.__config__.children && item.__config__.children.length) {
20+
item.__config__.children.forEach(child => {
21+
setDefault(child, variables)
22+
})
23+
}
24+
}
25+
26+
setDefault(item, variables)
27+
28+
return item
1129
})
30+
1231
return drawingList
1332
}

src/views/infra/build/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ import {
133133
inputComponents, selectComponents, layoutComponents, formConf
134134
} from '@/components/generator/config'
135135
import {
136-
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone, isObjectObject
136+
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone
137137
} from '@/utils/index'
138138
import {
139139
makeUpHtml, vueTemplate, vueScript, cssStyle
@@ -272,7 +272,7 @@ export default {
272272
arr.reduce((pre, item, i) => {
273273
if (arr.length === i + 1) {
274274
pre[item] = data
275-
} else if (!isObjectObject(pre[item])) {
275+
} else if (pre[item]===undefined) {
276276
pre[item] = {}
277277
}
278278
return pre[item]
@@ -300,7 +300,7 @@ export default {
300300
url
301301
}).then(resp => {
302302
this.setLoading(component, false)
303-
this.setRespData(component, resp.data)
303+
this.setRespData(component, resp)
304304
})
305305
}
306306
},

0 commit comments

Comments
 (0)