|
@@ -5,11 +5,11 @@
|
|
|
</div>
|
|
|
<PublicPageDialog class="advancedNode" :dialog-title="dialogTitle" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedClose" @handleSubmit="advancedTable">
|
|
|
<template v-if="!tabFlag">
|
|
|
- <node-class />
|
|
|
+ <node-class ref="nodeClass" @changeSelect="changeSelect" @groupChange="groupChange" />
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <node-form />
|
|
|
- <node-table />
|
|
|
+ <node-form ref="nodeForm" :nodeForm="nodeForm" :algorithmtype="this.selectCode" />
|
|
|
+ <node-table ref="nodeTable" :query-id="tableId" :type="type" @tableChange="tableChange" />
|
|
|
</template>
|
|
|
</PublicPageDialog>
|
|
|
</div>
|
|
@@ -23,6 +23,7 @@ import nodeForm from './nodeForm.vue'
|
|
|
import nodeTable from './nodeTable.vue'
|
|
|
import { Query, newData, modifyData, moveData } from "@/api/webApi"
|
|
|
import { formatChange, getTableCols } from '@/utils/validate'
|
|
|
+import { getQueryData } from '../utils'
|
|
|
export default {
|
|
|
name: 'AccessPageNode',
|
|
|
components: { nodeBtn, PublicPageDialog, nodeClass, nodeForm, nodeTable },
|
|
@@ -47,6 +48,12 @@ export default {
|
|
|
advancedDrawer: false,
|
|
|
pageServiceId: 15,
|
|
|
pageTableId: 24,
|
|
|
+ groupId: '',
|
|
|
+ tableId: '',
|
|
|
+ algId: '',
|
|
|
+ selectCode: '',
|
|
|
+ nodeForm: {},
|
|
|
+ tasData: [],
|
|
|
type: 'add'
|
|
|
}
|
|
|
},
|
|
@@ -114,7 +121,7 @@ export default {
|
|
|
this.selectSource = [...returnData]
|
|
|
break
|
|
|
case 'datatable':
|
|
|
- this.tableData = [...returnData]
|
|
|
+ this.tasData = [...returnData]
|
|
|
break
|
|
|
case 'nodedata':
|
|
|
//executionorder
|
|
@@ -125,21 +132,35 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
+ changeSelect (code) {
|
|
|
+ this.selectCode = code
|
|
|
+ },
|
|
|
+ groupChange (val) {
|
|
|
+ this.tabFlag = true
|
|
|
+ this.groupId = val
|
|
|
+ this.tableId = val
|
|
|
+ },
|
|
|
+ tableChange (arr) {
|
|
|
+ // if (this.type == 'add' && arr?.length) {
|
|
|
+ // this.tableColumnData()
|
|
|
+ // }
|
|
|
+ },
|
|
|
//步骤新增
|
|
|
handleAdd (obj) {
|
|
|
this.type = 'add'
|
|
|
- this.advancedDrawer = obj.flag
|
|
|
- this.tableData = []
|
|
|
+ this.advancedDrawer = true
|
|
|
+ this.nodeForm = {}
|
|
|
},
|
|
|
//步骤编辑
|
|
|
handleEdit (item) {
|
|
|
+ this.type = 'edit'
|
|
|
const data = _.cloneDeep(item)
|
|
|
const { algorithmlibraryid } = data
|
|
|
if (!algorithmlibraryid) return
|
|
|
this.advancedDrawer = true
|
|
|
this.tabFlag = true
|
|
|
- this.tableForm = data
|
|
|
- this.getSelectData('datatable', 24, { algorithmlibraryid })
|
|
|
+ this.nodeForm = data
|
|
|
+ this.tableId = algorithmlibraryid
|
|
|
},
|
|
|
//步骤删除
|
|
|
handleDel (obj) {
|
|
@@ -165,13 +186,35 @@ export default {
|
|
|
},
|
|
|
//弹框确定
|
|
|
advancedTable () {
|
|
|
- return
|
|
|
- const data = _.cloneDeep(this.tableForm)
|
|
|
- data.serviceid = this.msgContent.serviceid
|
|
|
- data.algorithmtype = this.formInline.algorithmtype
|
|
|
- data.algorithmsourcelibraryid = this.radio3
|
|
|
+ const data = _.cloneDeep(this.$refs['nodeForm'].tableForm)
|
|
|
const event = this.type == 'add' ? 1 : this.type == 'edit' ? 2 : 3
|
|
|
- this.generalDataReception(event, this.formatDataNull(data))
|
|
|
+ data.serviceid = this.msgContent.serviceid
|
|
|
+ if (this.type == 'edit') {
|
|
|
+ const { algorithmtype, algorithmlibraryid } = this.nodeForm
|
|
|
+ data.algorithmtype = algorithmtype
|
|
|
+ data.algorithmsourcelibraryid = algorithmlibraryid
|
|
|
+ this.tableColumnData(event)
|
|
|
+ } else if (this.type == 'add') {
|
|
|
+ data.algorithmtype = this.selectCode
|
|
|
+ data.algorithmsourcelibraryid = this.groupId
|
|
|
+ }
|
|
|
+ this.generalDataReception(event, this.formatDataNull(data), 'algorithmlibraryid')
|
|
|
+ },
|
|
|
+ //新增数据时操作table
|
|
|
+ async addDataColTable () {
|
|
|
+ const data = _.cloneDeep(this.$refs['nodeForm'].tableForm)
|
|
|
+ if (!Object.keys(data).length) return
|
|
|
+ const { algorithmname } = data
|
|
|
+ const row = this.msgContent
|
|
|
+ const { passparameters } = row
|
|
|
+ const filterItem = this.formatDefault(passparameters, row)
|
|
|
+ if (!Object.keys(filterItem).length) return
|
|
|
+ const { returnData } = await getQueryData(this.pageServiceId, filterItem)
|
|
|
+ const item = returnData.filter(item => item.algorithmname == algorithmname)
|
|
|
+ if (!item.length) return
|
|
|
+ const { algorithmlibraryid } = item[0]
|
|
|
+ this.algId = algorithmlibraryid
|
|
|
+ this.tableColumnData(1)
|
|
|
},
|
|
|
//状态清除
|
|
|
clearState () {
|
|
@@ -191,6 +234,40 @@ export default {
|
|
|
}
|
|
|
return obj
|
|
|
},
|
|
|
+ async tableColumnData (event = 2, key = 'algorithmparametersid') {
|
|
|
+ const res = this.$refs['nodeTable'].tableData
|
|
|
+ if (!res.length) return
|
|
|
+ const items = _.cloneDeep(res)
|
|
|
+ const datas = []
|
|
|
+ items.map(item => {
|
|
|
+ const nobj = {
|
|
|
+ algorithmlibraryid: event == 1 ? this.algId : item.algorithmlibraryid,
|
|
|
+ parametername: event == 1 ? item.name : item.parametername,
|
|
|
+ subscriptionexpressions: event == 1 ? item.code : item.subscriptionexpressions,
|
|
|
+ datasource: item.datasource,
|
|
|
+ parametertype: event == 1 ? item.datatype : item.parametertype
|
|
|
+ }
|
|
|
+ const itemData = event == 1 ? formatChange(nobj, event, key) : formatChange(item, event, key)
|
|
|
+ const nitem = itemData[0] || {}
|
|
|
+ datas.push(nitem)
|
|
|
+ })
|
|
|
+ const params = {
|
|
|
+ serviceid: this.pageTableId,
|
|
|
+ datacontent: datas,
|
|
|
+ event: `${event}`
|
|
|
+ }
|
|
|
+ const { code } =
|
|
|
+ event == 1
|
|
|
+ ? await newData(params)
|
|
|
+ : event == 2
|
|
|
+ ? await modifyData(params)
|
|
|
+ : await moveData(params)
|
|
|
+ if (code == 0 && event == 1) {
|
|
|
+ this.$message.success("操作成功")
|
|
|
+ this.restTable()
|
|
|
+ this.clearState()
|
|
|
+ }
|
|
|
+ },
|
|
|
//表格-增/删/改
|
|
|
async generalDataReception (event, data, key) {
|
|
|
try {
|
|
@@ -206,9 +283,13 @@ export default {
|
|
|
? await modifyData(params)
|
|
|
: await moveData(params);
|
|
|
if (code == 0) {
|
|
|
- this.$message.success("操作成功")
|
|
|
- this.restTable()
|
|
|
- this.clearState()
|
|
|
+ if (this.type == 'add') {
|
|
|
+ this.addDataColTable()
|
|
|
+ } else {
|
|
|
+ this.$message.success("操作成功")
|
|
|
+ this.restTable()
|
|
|
+ this.clearState()
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message.error("操作失败")
|
|
|
this.clearState()
|