mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
fix: Run process SB record selection. (#588)
* fix: Run process SB record selection. * Update package.json Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
a7d2b63d44
commit
b41ec22883
@ -50,19 +50,30 @@ const getters = {
|
|||||||
* selectionValues: [{ columnName, value }]
|
* selectionValues: [{ columnName, value }]
|
||||||
* }]
|
* }]
|
||||||
*/
|
*/
|
||||||
getSelectionToServer: (state, getters, rootState, rootGetters) => ({ containerUuid, selection = [] }) => {
|
getSelectionToServer: (state, getters, rootState, rootGetters) => ({
|
||||||
|
containerUuid,
|
||||||
|
selection = []
|
||||||
|
}) => {
|
||||||
const selectionToServer = []
|
const selectionToServer = []
|
||||||
const withOut = ['isEdit', 'isSendToServer']
|
const withOut = ['isEdit', 'isSendToServer']
|
||||||
|
|
||||||
if (selection.length <= 0) {
|
if (isEmptyValue(selection)) {
|
||||||
selection = getters.getDataRecordSelection(containerUuid)
|
selection = getters.getDataRecordSelection(containerUuid)
|
||||||
}
|
}
|
||||||
if (selection.length) {
|
|
||||||
|
if (isEmptyValue(selection)) {
|
||||||
|
return selectionToServer
|
||||||
|
}
|
||||||
|
|
||||||
const { fieldsList, keyColumn } = rootGetters.getPanel(containerUuid)
|
const { fieldsList, keyColumn } = rootGetters.getPanel(containerUuid)
|
||||||
// reduce list
|
// reduce list
|
||||||
const fieldsListSelection = fieldsList.filter(itemField => {
|
const fieldsListSelection = fieldsList
|
||||||
|
.filter(itemField => {
|
||||||
return itemField.isIdentifier || itemField.isUpdateable
|
return itemField.isIdentifier || itemField.isUpdateable
|
||||||
})
|
})
|
||||||
|
.map(itemField => {
|
||||||
|
return itemField.columnName
|
||||||
|
})
|
||||||
|
|
||||||
selection.forEach(itemRow => {
|
selection.forEach(itemRow => {
|
||||||
const records = []
|
const records = []
|
||||||
@ -70,8 +81,7 @@ const getters = {
|
|||||||
Object.keys(itemRow).forEach(key => {
|
Object.keys(itemRow).forEach(key => {
|
||||||
if (!key.includes('DisplayColumn') && !withOut.includes(key)) {
|
if (!key.includes('DisplayColumn') && !withOut.includes(key)) {
|
||||||
// evaluate metadata attributes before to convert
|
// evaluate metadata attributes before to convert
|
||||||
const field = fieldsListSelection.find(itemField => itemField.columnName === key)
|
if (fieldsListSelection.includes(key)) {
|
||||||
if (field) {
|
|
||||||
records.push({
|
records.push({
|
||||||
columnName: key,
|
columnName: key,
|
||||||
value: itemRow[key]
|
value: itemRow[key]
|
||||||
@ -85,7 +95,7 @@ const getters = {
|
|||||||
selectionValues: records
|
selectionValues: records
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
|
||||||
return selectionToServer
|
return selectionToServer
|
||||||
},
|
},
|
||||||
getContextInfoField: (state) => (contextInfoUuid, sqlStatement) => {
|
getContextInfoField: (state) => (contextInfoUuid, sqlStatement) => {
|
||||||
|
@ -47,17 +47,17 @@ export default {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// additional attributes to send server, selection to browser, or table name and record id to window
|
// additional attributes to send server, selection to browser, or table name and record id to window
|
||||||
let selection = []
|
let selectionsList = []
|
||||||
let allData = {}
|
let allData = {}
|
||||||
let tab, tableName, recordId
|
let tab, tableName, recordId
|
||||||
if (panelType) {
|
if (panelType) {
|
||||||
if (panelType === 'browser') {
|
if (panelType === 'browser') {
|
||||||
allData = getters.getDataRecordAndSelection(containerUuid)
|
allData = getters.getDataRecordAndSelection(containerUuid)
|
||||||
selection = rootGetters.getSelectionToServer({
|
selectionsList = rootGetters.getSelectionToServer({
|
||||||
containerUuid,
|
containerUuid,
|
||||||
selection: allData.selection
|
selection: allData.selection
|
||||||
})
|
})
|
||||||
if (selection.length < 1) {
|
if (isEmptyValue(selectionsList)) {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: language.t('data.selectionRequired'),
|
title: language.t('data.selectionRequired'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
@ -89,7 +89,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get info metadata process
|
// get info metadata process
|
||||||
const processDefinition = !isEmptyValue(isActionDocument) ? action : rootGetters.getProcess(action.uuid)
|
const processDefinition = !isEmptyValue(isActionDocument)
|
||||||
|
? action
|
||||||
|
: rootGetters.getProcess(action.uuid)
|
||||||
|
|
||||||
let reportType = reportFormat
|
let reportType = reportFormat
|
||||||
|
|
||||||
if (isEmptyValue(parametersList)) {
|
if (isEmptyValue(parametersList)) {
|
||||||
@ -193,22 +196,22 @@ export default {
|
|||||||
}
|
}
|
||||||
if (isProcessTableSelection) {
|
if (isProcessTableSelection) {
|
||||||
const windowSelectionProcess = getters.getProcessSelect
|
const windowSelectionProcess = getters.getProcessSelect
|
||||||
windowSelectionProcess.selection.forEach(selection => {
|
windowSelectionProcess.selection.forEach(selectionWindow => {
|
||||||
Object.assign(processResult, {
|
Object.assign(processResult, {
|
||||||
selection: selection.UUID,
|
selection: selectionWindow.UUID,
|
||||||
record: selection[windowSelectionProcess.tableName]
|
record: selectionWindow[windowSelectionProcess.tableName]
|
||||||
})
|
})
|
||||||
const countRequest = state.totalRequest + 1
|
const countRequest = state.totalRequest + 1
|
||||||
commit('setTotalRequest', countRequest)
|
commit('setTotalRequest', countRequest)
|
||||||
if (!windowSelectionProcess.finish) {
|
if (!windowSelectionProcess.finish) {
|
||||||
|
// TODO: Add backend support to selectionsList records in window
|
||||||
requestRunProcess({
|
requestRunProcess({
|
||||||
uuid: processDefinition.uuid,
|
uuid: processDefinition.uuid,
|
||||||
id: processDefinition.id,
|
id: processDefinition.id,
|
||||||
reportType,
|
reportType,
|
||||||
parametersList,
|
parametersList,
|
||||||
selectionsList: selection,
|
|
||||||
tableName: windowSelectionProcess.tableName,
|
tableName: windowSelectionProcess.tableName,
|
||||||
recordId: selection[windowSelectionProcess.tableName]
|
recordId: selectionWindow[windowSelectionProcess.tableName]
|
||||||
})
|
})
|
||||||
.then(runProcessResponse => {
|
.then(runProcessResponse => {
|
||||||
const { instanceUuid, output } = runProcessResponse
|
const { instanceUuid, output } = runProcessResponse
|
||||||
@ -394,7 +397,7 @@ export default {
|
|||||||
id: processDefinition.id,
|
id: processDefinition.id,
|
||||||
reportType,
|
reportType,
|
||||||
parametersList,
|
parametersList,
|
||||||
selectionsList: selection,
|
selectionsList,
|
||||||
tableName,
|
tableName,
|
||||||
recordId
|
recordId
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user