|
|
@ -34,7 +34,7 @@ |
|
|
|
<m-list-box> |
|
|
|
<m-list-box> |
|
|
|
<div slot="text">{{$t('Resources')}}</div> |
|
|
|
<div slot="text">{{$t('Resources')}}</div> |
|
|
|
<div slot="content"> |
|
|
|
<div slot="content"> |
|
|
|
<treeselect v-model="resourceList" :multiple="true" :options="options" :normalizer="normalizer" :placeholder="$t('Please select resources')"> |
|
|
|
<treeselect v-model="resourceList" :multiple="true" :options="options" :normalizer="normalizer" :value-consists-of="valueConsistsOf" :placeholder="$t('Please select resources')"> |
|
|
|
<div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div> |
|
|
|
<div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div> |
|
|
|
</treeselect> |
|
|
|
</treeselect> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -81,6 +81,7 @@ |
|
|
|
name: 'shell', |
|
|
|
name: 'shell', |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
valueConsistsOf: 'LEAF_PRIORITY', |
|
|
|
// script |
|
|
|
// script |
|
|
|
rawScript: '', |
|
|
|
rawScript: '', |
|
|
|
// Custom parameter |
|
|
|
// Custom parameter |
|
|
@ -95,7 +96,9 @@ |
|
|
|
return { |
|
|
|
return { |
|
|
|
label: node.name |
|
|
|
label: node.name |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
allNoResources: [], |
|
|
|
|
|
|
|
noRes: [] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mixins: [disabledState], |
|
|
|
mixins: [disabledState], |
|
|
@ -164,6 +167,11 @@ |
|
|
|
if (!this.$refs.refLocalParams._verifProp()) { |
|
|
|
if (!this.$refs.refLocalParams._verifProp()) { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// noRes |
|
|
|
|
|
|
|
if (this.noRes.length>0) { |
|
|
|
|
|
|
|
this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
// Process resourcelist |
|
|
|
// Process resourcelist |
|
|
|
let dataProcessing= _.map(this.resourceList, v => { |
|
|
|
let dataProcessing= _.map(this.resourceList, v => { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -205,8 +213,75 @@ |
|
|
|
diGuiTree(item) { // Recursive convenience tree structure |
|
|
|
diGuiTree(item) { // Recursive convenience tree structure |
|
|
|
item.forEach(item => { |
|
|
|
item.forEach(item => { |
|
|
|
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0? |
|
|
|
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0? |
|
|
|
delete item.children : this.diGuiTree(item.children); |
|
|
|
this.operationTree(item) : this.diGuiTree(item.children); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
operationTree(item) { |
|
|
|
|
|
|
|
if(item.dirctory) { |
|
|
|
|
|
|
|
item.isDisabled =true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
delete item.children |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
searchTree(element, id) { |
|
|
|
|
|
|
|
// 根据id查找节点 |
|
|
|
|
|
|
|
if (element.id == id) { |
|
|
|
|
|
|
|
return element; |
|
|
|
|
|
|
|
} else if (element.children != null) { |
|
|
|
|
|
|
|
var i; |
|
|
|
|
|
|
|
var result = null; |
|
|
|
|
|
|
|
for (i = 0; result == null && i < element.children.length; i++) { |
|
|
|
|
|
|
|
result = this.searchTree(element.children[i], id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
dataProcess(backResource) { |
|
|
|
|
|
|
|
let isResourceId = [] |
|
|
|
|
|
|
|
let resourceIdArr = [] |
|
|
|
|
|
|
|
if(this.resourceList.length>0) { |
|
|
|
|
|
|
|
this.resourceList.forEach(v=>{ |
|
|
|
|
|
|
|
this.options.forEach(v1=>{ |
|
|
|
|
|
|
|
if(this.searchTree(v1,v)) { |
|
|
|
|
|
|
|
isResourceId.push(this.searchTree(v1,v)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
resourceIdArr = isResourceId.map(item=>{ |
|
|
|
|
|
|
|
return item.id |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Array.prototype.diff = function(a) { |
|
|
|
|
|
|
|
return this.filter(function(i) {return a.indexOf(i) < 0;}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
let diffSet = this.resourceList.diff(resourceIdArr); |
|
|
|
|
|
|
|
let optionsCmp = [] |
|
|
|
|
|
|
|
if(diffSet.length>0) { |
|
|
|
|
|
|
|
diffSet.forEach(item=>{ |
|
|
|
|
|
|
|
backResource.forEach(item1=>{ |
|
|
|
|
|
|
|
if(item==item1.id || item==item1.res) { |
|
|
|
|
|
|
|
optionsCmp.push(item1) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let noResources = [{ |
|
|
|
|
|
|
|
id: -1, |
|
|
|
|
|
|
|
name: $t('No resources'), |
|
|
|
|
|
|
|
fullName: '/'+$t('No resources'), |
|
|
|
|
|
|
|
children: [] |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
if(optionsCmp.length>0) { |
|
|
|
|
|
|
|
this.allNoResources = optionsCmp |
|
|
|
|
|
|
|
optionsCmp = optionsCmp.map(item=>{ |
|
|
|
|
|
|
|
return {id: item.id,name: item.name,fullName: item.res} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
optionsCmp.forEach(item=>{ |
|
|
|
|
|
|
|
item.isNew = true |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
noResources[0].children = optionsCmp |
|
|
|
|
|
|
|
this.options = this.options.concat(noResources) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -217,10 +292,32 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
cacheParams () { |
|
|
|
cacheParams () { |
|
|
|
|
|
|
|
let isResourceId = [] |
|
|
|
|
|
|
|
let resourceIdArr = [] |
|
|
|
|
|
|
|
if(this.resourceList.length>0) { |
|
|
|
|
|
|
|
this.resourceList.forEach(v=>{ |
|
|
|
|
|
|
|
this.options.forEach(v1=>{ |
|
|
|
|
|
|
|
if(this.searchTree(v1,v)) { |
|
|
|
|
|
|
|
isResourceId.push(this.searchTree(v1,v)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
resourceIdArr = isResourceId.map(item=>{ |
|
|
|
|
|
|
|
return {id: item.id,name: item.name,res: item.fullName} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let result = [] |
|
|
|
|
|
|
|
resourceIdArr.forEach(item=>{ |
|
|
|
|
|
|
|
this.allNoResources.forEach(item1=>{ |
|
|
|
|
|
|
|
if(item.id==item1.id) { |
|
|
|
|
|
|
|
// resultBool = true |
|
|
|
|
|
|
|
result.push(item1) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.noRes = result |
|
|
|
return { |
|
|
|
return { |
|
|
|
resourceList: _.map(this.resourceList, v => { |
|
|
|
resourceList: resourceIdArr, |
|
|
|
return {id: v} |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
localParams: this.localParams |
|
|
|
localParams: this.localParams |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -230,29 +327,35 @@ |
|
|
|
this.diGuiTree(item) |
|
|
|
this.diGuiTree(item) |
|
|
|
this.options = item |
|
|
|
this.options = item |
|
|
|
let o = this.backfillItem |
|
|
|
let o = this.backfillItem |
|
|
|
|
|
|
|
|
|
|
|
// Non-null objects represent backfill |
|
|
|
// Non-null objects represent backfill |
|
|
|
if (!_.isEmpty(o)) { |
|
|
|
if (!_.isEmpty(o)) { |
|
|
|
this.rawScript = o.params.rawScript || '' |
|
|
|
this.rawScript = o.params.rawScript || '' |
|
|
|
|
|
|
|
|
|
|
|
// backfill resourceList |
|
|
|
// backfill resourceList |
|
|
|
|
|
|
|
let backResource = o.params.resourceList || [] |
|
|
|
let resourceList = o.params.resourceList || [] |
|
|
|
let resourceList = o.params.resourceList || [] |
|
|
|
if (resourceList.length) { |
|
|
|
if (resourceList.length) { |
|
|
|
_.map(resourceList, v => { |
|
|
|
_.map(resourceList, v => { |
|
|
|
if(v.res) { |
|
|
|
if(!v.id) { |
|
|
|
this.store.dispatch('dag/getResourceId',{ |
|
|
|
this.store.dispatch('dag/getResourceId',{ |
|
|
|
type: 'FILE', |
|
|
|
type: 'FILE', |
|
|
|
fullName: '/'+v.res |
|
|
|
fullName: '/'+v.res |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
this.resourceList.push(res.id) |
|
|
|
this.resourceList.push(res.id) |
|
|
|
|
|
|
|
this.dataProcess(backResource) |
|
|
|
}).catch(e => { |
|
|
|
}).catch(e => { |
|
|
|
this.$message.error(e.msg || '') |
|
|
|
this.resourceList.push(v.res) |
|
|
|
|
|
|
|
this.dataProcess(backResource) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.resourceList.push(v.id) |
|
|
|
this.resourceList.push(v.id) |
|
|
|
|
|
|
|
this.dataProcess(backResource) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.cacheResourceList = resourceList |
|
|
|
this.cacheResourceList = resourceList |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// backfill localParams |
|
|
|
// backfill localParams |
|
|
|
let localParams = o.params.localParams || [] |
|
|
|
let localParams = o.params.localParams || [] |
|
|
|
if (localParams.length) { |
|
|
|
if (localParams.length) { |
|
|
|