|
|
@ -22,7 +22,7 @@ |
|
|
|
</x-option> |
|
|
|
</x-option> |
|
|
|
</x-select> |
|
|
|
</x-select> |
|
|
|
<x-select filterable :style="{width:isInstance ? '450px' : '450px'}" :disabled="isDetails" v-model="el.definitionId" @on-change="_onChangeDefinitionId"> |
|
|
|
<x-select filterable :style="{width:isInstance ? '450px' : '450px'}" :disabled="isDetails" v-model="el.definitionId" @on-change="_onChangeDefinitionId"> |
|
|
|
<x-option v-for="item in el.definitionList || []" :key="item.id" :value="item.id" :label="item.name"> |
|
|
|
<x-option v-for="item in definitionList" :key="item.value" :value="item.value" :label="item.label"> |
|
|
|
</x-option> |
|
|
|
</x-option> |
|
|
|
</x-select> |
|
|
|
</x-select> |
|
|
|
<x-select filterable :style="{width:isInstance ? '450px' : '450px'}" :disabled="isDetails" v-model="el.depTasks"> |
|
|
|
<x-select filterable :style="{width:isInstance ? '450px' : '450px'}" :disabled="isDetails" v-model="el.depTasks"> |
|
|
@ -56,9 +56,9 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import _ from 'lodash'; |
|
|
|
import _ from 'lodash' |
|
|
|
import { cycleList, dateValueList } from './commcon'; |
|
|
|
import { cycleList, dateValueList } from './commcon' |
|
|
|
import disabledState from '@/module/mixin/disabledState'; |
|
|
|
import disabledState from '@/module/mixin/disabledState' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'dep-list', |
|
|
|
name: 'dep-list', |
|
|
|
data () { |
|
|
|
data () { |
|
|
@ -69,7 +69,7 @@ |
|
|
|
cycleList: cycleList, |
|
|
|
cycleList: cycleList, |
|
|
|
isInstance: false, |
|
|
|
isInstance: false, |
|
|
|
itemIndex: null |
|
|
|
itemIndex: null |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mixins: [disabledState], |
|
|
|
mixins: [disabledState], |
|
|
|
props: { |
|
|
|
props: { |
|
|
@ -87,58 +87,59 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_add () { |
|
|
|
_add () { |
|
|
|
// btn loading |
|
|
|
// btn loading |
|
|
|
this.isLoading = true; |
|
|
|
this.isLoading = true |
|
|
|
// dependItemList index |
|
|
|
// dependItemList index |
|
|
|
let is = value => _.some(this.dependItemList, { definitionId: value }); |
|
|
|
let is = (value) => _.some(this.dependItemList, { definitionId: value }) |
|
|
|
let val = this.definitionList[0].value; |
|
|
|
let noArr = _.filter(this.definitionList, v => !is(v.value)) |
|
|
|
|
|
|
|
let value = noArr[0] && noArr[0].value || null |
|
|
|
|
|
|
|
let val = value || this.definitionList[0].value |
|
|
|
// add task list |
|
|
|
// add task list |
|
|
|
let projectId = this.projectList[0].value; |
|
|
|
let projectId = this.projectList[0].value |
|
|
|
this._getDependItemList(val).then(depTasksList => { |
|
|
|
this._getDependItemList(val).then(depTasksList => { |
|
|
|
this._getProcessByProjectId(projectId).then(definitionList => { |
|
|
|
|
|
|
|
val = definitionList[0].id; |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$emit( |
|
|
|
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(val, depTasksList,projectId))) |
|
|
|
'dependItemListEvent', |
|
|
|
}) |
|
|
|
_.concat( |
|
|
|
}) |
|
|
|
this.dependItemList, |
|
|
|
|
|
|
|
this._rtNewParams(val, depTasksList, projectId, definitionList) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// remove tooltip |
|
|
|
// remove tooltip |
|
|
|
this._removeTip(); |
|
|
|
this._removeTip() |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* remove task |
|
|
|
* remove task |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_remove (i) { |
|
|
|
_remove (i) { |
|
|
|
this.dependTaskList[this.index].dependItemList.splice(i, 1); |
|
|
|
this.dependTaskList[this.index].dependItemList.splice(i,1) |
|
|
|
// this.$emit('getDependTaskList', dependTaskList) |
|
|
|
this._removeTip() |
|
|
|
// this.dependItemList.splice(i, 1) |
|
|
|
|
|
|
|
this._removeTip(); |
|
|
|
|
|
|
|
if (!this.dependItemList.length || this.dependItemList.length === 0) { |
|
|
|
if (!this.dependItemList.length || this.dependItemList.length === 0) { |
|
|
|
this.$emit('on-delete-all', { |
|
|
|
this.$emit('on-delete-all', { |
|
|
|
index: this.index |
|
|
|
index: this.index |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
_getProjectList () { |
|
|
|
_getProjectList () { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.projectList = _.map(_.cloneDeep(this.store.state.dag.projectAll), v => { |
|
|
|
this.projectList = _.map(_.cloneDeep(this.store.state.dag.projectListS), v => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
value: v.id, |
|
|
|
value: v.id, |
|
|
|
label: v.name |
|
|
|
label: v.name |
|
|
|
}; |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
resolve(); |
|
|
|
resolve() |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* get processlist |
|
|
|
* get processlist |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
_getProcessList () { |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
this.definitionList = _.map(_.cloneDeep(this.store.state.dag.processListS), v => { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
value: v.id, |
|
|
|
|
|
|
|
label: v.name |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
resolve() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
_getProcessByProjectId (id) { |
|
|
|
_getProcessByProjectId (id) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { |
|
|
|
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { |
|
|
@ -146,11 +147,11 @@ |
|
|
|
return { |
|
|
|
return { |
|
|
|
value: v.id, |
|
|
|
value: v.id, |
|
|
|
label: v.name |
|
|
|
label: v.name |
|
|
|
}; |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
resolve(res); |
|
|
|
resolve(res) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* get dependItemList |
|
|
|
* get dependItemList |
|
|
@ -159,16 +160,14 @@ |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (is) { |
|
|
|
if (is) { |
|
|
|
this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { |
|
|
|
this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { |
|
|
|
resolve(['ALL'].concat(_.map(res, v => v.name))); |
|
|
|
resolve(['ALL'].concat(_.map(res, v => v.name))) |
|
|
|
}); |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.store |
|
|
|
this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionIdList: ids }).then(res => { |
|
|
|
.dispatch('dag/getTaskListDefIdAll', { processDefinitionIdList: ids }) |
|
|
|
resolve(res) |
|
|
|
.then(res => { |
|
|
|
}) |
|
|
|
resolve(res); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* change process get dependItemList |
|
|
|
* change process get dependItemList |
|
|
@ -176,53 +175,32 @@ |
|
|
|
_onChangeProjectId ({ value }) { |
|
|
|
_onChangeProjectId ({ value }) { |
|
|
|
this._getProcessByProjectId(value).then(definitionList => { |
|
|
|
this._getProcessByProjectId(value).then(definitionList => { |
|
|
|
/*this.$set(this.dependItemList, this.itemIndex, this._dlOldParams(value, definitionList, item))*/ |
|
|
|
/*this.$set(this.dependItemList, this.itemIndex, this._dlOldParams(value, definitionList, item))*/ |
|
|
|
let definitionId = definitionList[0].id; |
|
|
|
let definitionId = definitionList[0].id |
|
|
|
this._getDependItemList(definitionId).then(depTasksList => { |
|
|
|
this._getDependItemList(definitionId).then(depTasksList => { |
|
|
|
let item = this.dependItemList[this.itemIndex]; |
|
|
|
let item = this.dependItemList[this.itemIndex] |
|
|
|
// init set depTasks All |
|
|
|
// init set depTasks All |
|
|
|
item.depTasks = 'ALL'; |
|
|
|
item.depTasks = 'ALL' |
|
|
|
// set dependItemList item data |
|
|
|
// set dependItemList item data |
|
|
|
this.$set( |
|
|
|
this.$set(this.dependItemList, this.itemIndex, this._cpOldParams(value,definitionId, definitionList,depTasksList, item)) |
|
|
|
this.dependItemList, |
|
|
|
}) |
|
|
|
this.itemIndex, |
|
|
|
}) |
|
|
|
this._cpOldParams(value, definitionId, definitionList, depTasksList, item) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
_onChangeDefinitionId ({ value }) { |
|
|
|
_onChangeDefinitionId ({ value }) { |
|
|
|
// get depItem list data |
|
|
|
// get depItem list data |
|
|
|
this._getDependItemList(value).then(depTasksList => { |
|
|
|
this._getDependItemList(value).then(depTasksList => { |
|
|
|
let item = this.dependItemList[this.itemIndex]; |
|
|
|
let item = this.dependItemList[this.itemIndex] |
|
|
|
// init set depTasks All |
|
|
|
// init set depTasks All |
|
|
|
item.depTasks = 'ALL'; |
|
|
|
item.depTasks = 'ALL' |
|
|
|
// set dependItemList item data |
|
|
|
// set dependItemList item data |
|
|
|
this.$set( |
|
|
|
this.$set(this.dependItemList, this.itemIndex, this._rtOldParams(value, depTasksList, item)) |
|
|
|
this.dependItemList, |
|
|
|
}) |
|
|
|
this.itemIndex, |
|
|
|
|
|
|
|
this._rtOldParams(value, depTasksList, item) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
_onChangeCycle ({ value }) { |
|
|
|
_onChangeCycle ({ value }) { |
|
|
|
let list = _.cloneDeep(dateValueList[value]); |
|
|
|
let list = _.cloneDeep(dateValueList[value]) |
|
|
|
this.$set(this.dependItemList[this.itemIndex], 'dateValue', list[0].value); |
|
|
|
this.$set(this.dependItemList[this.itemIndex], 'dateValue', list[0].value) |
|
|
|
this.$set(this.dependItemList[this.itemIndex], 'dateValueList', list); |
|
|
|
this.$set(this.dependItemList[this.itemIndex], 'dateValueList', list) |
|
|
|
}, |
|
|
|
|
|
|
|
_rtNewParams(value, depTasksList, projectId, definitionList) { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
projectId: projectId, |
|
|
|
|
|
|
|
definitionId: value, |
|
|
|
|
|
|
|
depTasks: 'ALL', |
|
|
|
|
|
|
|
definitionList, |
|
|
|
|
|
|
|
depTasksList: depTasksList, |
|
|
|
|
|
|
|
cycle: 'day', |
|
|
|
|
|
|
|
dateValue: 'today', |
|
|
|
|
|
|
|
dateValueList: _.cloneDeep(dateValueList['day']), |
|
|
|
|
|
|
|
state: '' |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
_cpNewParams(value, depTasksList, projectId) { |
|
|
|
_rtNewParams (value, depTasksList,projectId) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
projectId: projectId, |
|
|
|
projectId: projectId, |
|
|
|
definitionId: value, |
|
|
|
definitionId: value, |
|
|
@ -232,20 +210,19 @@ |
|
|
|
dateValue: 'today', |
|
|
|
dateValue: 'today', |
|
|
|
dateValueList: _.cloneDeep(dateValueList['day']), |
|
|
|
dateValueList: _.cloneDeep(dateValueList['day']), |
|
|
|
state: '' |
|
|
|
state: '' |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
_rtOldParams (value,depTasksList, item) { |
|
|
|
_rtOldParams (value,depTasksList, item) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
projectId: item.projectId, |
|
|
|
projectId: item.projectId, |
|
|
|
definitionId: value, |
|
|
|
definitionId: value, |
|
|
|
definitionList: item.definitionList, |
|
|
|
|
|
|
|
depTasks: item.depTasks || 'ALL', |
|
|
|
depTasks: item.depTasks || 'ALL', |
|
|
|
depTasksList: depTasksList, |
|
|
|
depTasksList: depTasksList, |
|
|
|
cycle: item.cycle, |
|
|
|
cycle: item.cycle, |
|
|
|
dateValue: item.dateValue, |
|
|
|
dateValue: item.dateValue, |
|
|
|
dateValueList: _.cloneDeep(dateValueList[item.cycle]), |
|
|
|
dateValueList: _.cloneDeep(dateValueList[item.cycle]), |
|
|
|
state: item.state |
|
|
|
state: item.state |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_cpOldParams (value,definitionId, definitionList,depTasksList, item) { |
|
|
|
_cpOldParams (value,definitionId, definitionList,depTasksList, item) { |
|
|
@ -259,71 +236,50 @@ |
|
|
|
dateValue: item.dateValue, |
|
|
|
dateValue: item.dateValue, |
|
|
|
dateValueList: _.cloneDeep(dateValueList[item.cycle]), |
|
|
|
dateValueList: _.cloneDeep(dateValueList[item.cycle]), |
|
|
|
state: item.state |
|
|
|
state: item.state |
|
|
|
}; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* remove tip |
|
|
|
* remove tip |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_removeTip () { |
|
|
|
_removeTip () { |
|
|
|
$('body') |
|
|
|
$('body').find('.tooltip.fade.top.in').remove() |
|
|
|
.find('.tooltip.fade.top.in') |
|
|
|
|
|
|
|
.remove(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: {}, |
|
|
|
watch: { |
|
|
|
beforeCreate() {}, |
|
|
|
}, |
|
|
|
|
|
|
|
beforeCreate () { |
|
|
|
|
|
|
|
}, |
|
|
|
created () { |
|
|
|
created () { |
|
|
|
// is type projects-instance-details |
|
|
|
// is type projects-instance-details |
|
|
|
this.isInstance = this.router.history.current.name === 'projects-instance-details'; |
|
|
|
this.isInstance = this.router.history.current.name === 'projects-instance-details' |
|
|
|
// get processlist |
|
|
|
// get processlist |
|
|
|
this._getProjectList().then(() => { |
|
|
|
this._getProjectList().then(() => { |
|
|
|
let projectId = this.projectList[0].value; |
|
|
|
let projectId = this.projectList[0].value |
|
|
|
if (!this.dependItemList.length) { |
|
|
|
if (!this.dependItemList.length) { |
|
|
|
this._getProcessByProjectId(projectId).then(definitionList => { |
|
|
|
this._getProcessByProjectId(projectId).then(definitionList => { |
|
|
|
console.log(definitionList); |
|
|
|
let value = this.definitionList[0].value |
|
|
|
if (definitionList.length > 0) { |
|
|
|
|
|
|
|
let value = this.definitionList[0].value; |
|
|
|
|
|
|
|
this._getDependItemList(value).then(depTasksList => { |
|
|
|
this._getDependItemList(value).then(depTasksList => { |
|
|
|
this.$emit( |
|
|
|
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(value, depTasksList,projectId))) |
|
|
|
'dependItemListEvent', |
|
|
|
}) |
|
|
|
_.concat( |
|
|
|
}) |
|
|
|
this.dependItemList, |
|
|
|
|
|
|
|
this._rtNewParams(value, depTasksList, projectId, definitionList) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// get definitionId ids |
|
|
|
// get definitionId ids |
|
|
|
let ids = _.map(this.dependItemList, v => v.definitionId).join(','); |
|
|
|
let ids = _.map(this.dependItemList, v => v.definitionId).join(',') |
|
|
|
// get item list |
|
|
|
// get item list |
|
|
|
this._getProjectList().then(() => { |
|
|
|
|
|
|
|
this._getDependItemList(ids, false).then(res => { |
|
|
|
this._getDependItemList(ids, false).then(res => { |
|
|
|
_.map(this.dependItemList, (v, i) => { |
|
|
|
_.map(this.dependItemList, (v, i) => { |
|
|
|
this._getProcessByProjectId(v.projectId).then(definitionList => { |
|
|
|
this._getProcessByProjectId(v.projectId).then(definitionList => { |
|
|
|
v.definitionList = Object.values(definitionList); |
|
|
|
this.$set(this.dependItemList, i, this._rtOldParams(v.definitionId, ['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), v)) |
|
|
|
v.depTasksList = Object.values(res)[0]; |
|
|
|
}) |
|
|
|
console.log(v); |
|
|
|
}) |
|
|
|
this.$set( |
|
|
|
}) |
|
|
|
this.dependItemList, |
|
|
|
|
|
|
|
i, |
|
|
|
|
|
|
|
this._rtOldParams( |
|
|
|
|
|
|
|
v.definitionId, |
|
|
|
|
|
|
|
['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), |
|
|
|
|
|
|
|
v |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mounted () { |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
|
|
|
|
components: {} |
|
|
|
components: {} |
|
|
|
}; |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss"> |
|
|
|
<style lang="scss" rel="stylesheet/scss"> |
|
|
@ -363,7 +319,7 @@ |
|
|
|
color: #888888; |
|
|
|
color: #888888; |
|
|
|
} |
|
|
|
} |
|
|
|
&.icon-FAILED { |
|
|
|
&.icon-FAILED { |
|
|
|
color: #f31322; |
|
|
|
color: #F31322; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|