jiangyy 4 years ago
parent
commit
d7829676b0
  1. 62
      src/components/parser/Parser.vue
  2. 2
      src/views/form/editor/RightPanel.vue
  3. 8
      src/views/form/index.vue
  4. 14
      src/views/form/publish/index.vue

62
src/components/parser/Parser.vue

@ -235,6 +235,7 @@ function switchPage(eventName, page) {
* radio checkbox 其他输入框值处理 * radio checkbox 其他输入框值处理
*/ */
function setOtherValueLabel (event, config) { function setOtherValueLabel (event, config) {
let value = this[this.formConf.formModel][config.__vModel__] let value = this[this.formConf.formModel][config.__vModel__]
// //
this.$nextTick(() => { this.$nextTick(() => {
@ -254,24 +255,57 @@ function setOtherValueLabel(event, config) {
* @param scheme * @param scheme
*/ */
function setValueLabel (event, config, scheme) { function setValueLabel (event, config, scheme) {
console.log(event)
console.log(config)
console.log(scheme)
// input // input
let tagOptionKey = processType[config.tag] let tagOptionKey = processType[config.tag]
if (tagOptionKey) { if (tagOptionKey) {
if (event instanceof Array) { if (event instanceof Array) {
// //
let labelArr = new Array()
if (!event.includes(0)) {
if (!event.includes(0) && config.tag != 'el-cascader') {
// other // other
this.$set(this[this.formConf.labelFormModel], `${scheme.__vModel__}other`, '') this.$set(this[this.formConf.labelFormModel], `${scheme.__vModel__}other`, '')
// //
document.querySelector('.' + config.tag).querySelector('.item-other-input').value = '' document.querySelector('.' + config.tag).querySelector('.item-other-input').value = ''
} }
// debugger
if (config.tag === 'el-cascader') {
let labelFormModelArray = []
if (scheme.props.props.multiple) {//
event.forEach(item => {
let itemObj = getCascaderData(item, tagOptionKey, scheme)
labelFormModelArray.push(itemObj)
})
} else {//
let itemObj = getCascaderData(event, tagOptionKey, scheme)
labelFormModelArray.push(itemObj)
}
this.$set(this[this.formConf.labelFormModel], scheme.__vModel__, labelFormModelArray)
} else {
let labelArr = new Array()
event.forEach(item => { event.forEach(item => {
// //
let { label } = getObject(_.get(scheme, tagOptionKey), 'value', item) let { label } = getObject(_.get(scheme, tagOptionKey), 'value', item)
labelArr.push(label) labelArr.push(label)
}) })
this.$set(this[this.formConf.labelFormModel], scheme.__vModel__, labelArr.join(',')) this.$set(this[this.formConf.labelFormModel], scheme.__vModel__, labelArr.join(','))
}
console.log('最终结果')
console.log(this[this.formConf.labelFormModel])
} else { } else {
// //
if (event == 0) { if (event == 0) {
@ -296,14 +330,38 @@ function setValueLabel(event, config, scheme) {
} }
} }
function getCascaderData (array, tagOptionKey, scheme) {
let labelArr = new Array()
array.forEach(item => {
//
let { label } = getObject(_.get(scheme, tagOptionKey), 'value', item)
labelArr.push(label)
})
const item = array[array.length - 1]
let itemObj = getObject(_.get(scheme, tagOptionKey), 'value', item)
itemObj.labels = labelArr
itemObj.pathName = labelArr.join(scheme.separator)
return itemObj
}
function getObject (array, key, value) { function getObject (array, key, value) {
let o let o
array.some(function iter (a) { array.some(function iter (a) {
if (a[key].isArray) {
this.getObject(a[key], key, value)
} else {
if (a[key] === value) { if (a[key] === value) {
o = a o = a
return true return true
} }
return Array.isArray(a.children) && a.children.some(iter) return Array.isArray(a.children) && a.children.some(iter)
}
}) })
return o return o
} }

2
src/views/form/editor/RightPanel.vue

@ -1256,7 +1256,7 @@ export default {
children.splice(index, 1); children.splice(index, 1);
}, },
addNode (data) { addNode (data) {
debugger
data.pid = this.currentPID data.pid = this.currentPID
this.currentNode.push(data); this.currentNode.push(data);
}, },

8
src/views/form/index.vue

@ -18,7 +18,7 @@
<el-menu :collapse="isCollapse" <el-menu :collapse="isCollapse"
:default-active="defaultActiveMenu" :default-active="defaultActiveMenu"
class="el-menu-vertical"> class="el-menu-vertical">
<el-menu-item v-for="menuItem in (publishStatus? menuItemList2:menuItemList)" <el-menu-item v-for="menuItem in (menuItemList)"
:key="menuItem.key" :key="menuItem.key"
:index="menuItem.route" :index="menuItem.route"
@click="menuSelectHandle(menuItem.route,menuItem.key)"> @click="menuSelectHandle(menuItem.route,menuItem.key)">
@ -121,6 +121,12 @@ export default {
icon: 'el-icon-data-line', icon: 'el-icon-data-line',
route: '/project/form/statistics' route: '/project/form/statistics'
}, },
{
key: 'publish',
title: '发布',
icon: 'el-icon-video-play',
route: '/project/form/publish'
},
{ {
key: 'preview', key: 'preview',
title: '预览', title: '预览',

14
src/views/form/publish/index.vue

@ -21,7 +21,7 @@
:props="props" :props="props"
:data="data" :data="data"
show-checkbox show-checkbox
:default-expand-all="true" /> :default-expand-all="false" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -186,7 +186,7 @@ export default {
agencyId: customerId agencyId: customerId
} }
this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => {
debugger this.data = res.data
}) })
}, },
@ -240,6 +240,16 @@ export default {
}) })
}, },
publishProject () { publishProject () {
this.resolveAgency()
if (this.selAgencyList.length === 0) {
this.$message(
{
message: "请选择发布范围",
type: 'warning'
}
)
return false
}
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, { key: this.projectKey }).then(() => { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, { key: this.projectKey }).then(() => {
this.publishStatus = true this.publishStatus = true

Loading…
Cancel
Save