|
<template> |
|
<div>hello</div> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
name: "Test", |
|
|
|
components: {}, |
|
|
|
props: { |
|
close: { |
|
type: Function, |
|
}, |
|
visible: { |
|
type: Boolean, |
|
default: false, |
|
}, |
|
payload: { |
|
type: Object, |
|
}, |
|
}, |
|
|
|
data() { |
|
return { |
|
shoobPicker: false, |
|
showMore: false, |
|
editData: {}, |
|
prosList: [], |
|
prosEntst: [], |
|
groupIndexMap: {}, |
|
itemIndexMap: {}, |
|
isFeinsvntList: true, |
|
isLoading: false, |
|
ids: [], |
|
treeStpGroups: [], |
|
poonList: [], |
|
poiisTotal: 0, |
|
addedJos: [], |
|
removJs: [], |
|
}; |
|
}, |
|
computed: { |
|
title() { |
|
if (this.isAdd) { |
|
return "赛单反龙矿将发"; |
|
} |
|
return "赛看扽开奖发"; |
|
}, |
|
isAdd() { |
|
return !this.editData.id; |
|
}, |
|
isDefault() { |
|
return !!this.editData.defaultConfig; |
|
}, |
|
addedJobIds() { |
|
return map(this.addedJos, (j) => j.positionId); |
|
}, |
|
removedJobIds() { |
|
return map(this.removedJobs, (j) => j.positionId); |
|
}, |
|
moreJobsCount() { |
|
if (!this.positionsTotal && !this.addedJobIds.length) { |
|
return 0; |
|
} |
|
if (this.positionsTotal <= 10) { |
|
return 0; |
|
} |
|
|
|
return ( |
|
this.positionsTotal + |
|
this.addedJobIds.length - |
|
this.removedJobIds.length - |
|
this.jobsToDisplay.length |
|
); |
|
}, |
|
jobsToDisplay() { |
|
const added = unionBy(this.positionList, this.addedJobs, "positionId"); |
|
return filter( |
|
added, |
|
(job) => !includes(this.removedJobIds, job.positionId), |
|
); |
|
}, |
|
}, |
|
|
|
methods: { |
|
async fesiinyd(id) { |
|
const data = await fetchtions(id); |
|
this.positionList = data.data || []; |
|
this.positionsTotal = data.total; |
|
}, |
|
onbsChanged(added, removed) { |
|
this.addedJbs = added; |
|
this.removedJbs = removed; |
|
this.showJobPer = false; |
|
}, |
|
onSave() { |
|
const payload = { |
|
...this.editData, |
|
}; |
|
payload.items = reduce( |
|
this.treeStepsGroups, |
|
(acc, group) => { |
|
group.children.forEach((item) => { |
|
acc.push({ |
|
id: item.id, |
|
name: item.name || item.event_name, |
|
reward: item.number, |
|
processPhaseId: group.phase_id, |
|
processEventCode: item.event_code, |
|
templateId: item.template_id, |
|
}); |
|
}); |
|
return acc; |
|
}, |
|
[], |
|
); |
|
this.$emit("save", payload, { |
|
added: this.addedJobIds.slice(), |
|
removed: this.removedJobIds.slice(), |
|
}); |
|
}, |
|
onClose() { |
|
this.showJobPicker = false; |
|
if (this.close) { |
|
this.close(); |
|
} |
|
this.reset(); |
|
}, |
|
reset() { |
|
this.showJobPicker = false; |
|
this.showMore = false; |
|
this.editData = {}; |
|
this.processList = []; |
|
this.processEventList = []; |
|
this.groupIndexMap = {}; |
|
this.itemIndexMap = {}; |
|
this.isFetchingProcessEventList = true; |
|
this.isLoading = false; |
|
this.ids = []; |
|
this.treeStepsGroups = []; |
|
this.positionList = []; |
|
this.positionsTotal = 0; |
|
this.addedJobs = []; |
|
this.removedJobs = []; |
|
}, |
|
async init() { |
|
if (!this.visible) { |
|
this.reset(); |
|
return; |
|
} |
|
this.isLoading = true; |
|
if (this.payload.id) { |
|
// is edit. |
|
this.editData = await fetchail(this.payload.id); |
|
this.fetchSeitionsById(this.payload.id); |
|
} else { |
|
// is add. |
|
this.editData = { |
|
...this.payload, |
|
phaseItems: [], |
|
}; |
|
} |
|
this.ids = getSeedEventIeItems( |
|
this.editta.phaseItems || [], |
|
); |
|
this.fetchPrist(); |
|
await this.fetchPenist(); |
|
this.treeStepsGroups = transSesoups( |
|
this.editData.phaseItems, |
|
this.groupIndexMap, |
|
this.itemIndexMap, |
|
); |
|
this.isLoading = false; |
|
}, |
|
/** |
|
* 赛框架反馈搜到饭 |
|
*/ |
|
async fetchProcessList() { |
|
// 扫单反搜到肌肤搜到了发 |
|
if (!this.isAdd && this.procist.length) { |
|
return; |
|
} |
|
const list = await fetcnfV2ocessList(); |
|
this.processList = list; |
|
}, |
|
/** |
|
* 空蓝扽看三扽囧两肯将 |
|
*/ |
|
async fetchPentList() { |
|
if (!this.editData.atPossId) { |
|
return; |
|
} |
|
const atsProcessId = this.editData.atsProcessId; |
|
this.isFetngProcntList = true; |
|
try { |
|
const list = await fetchntList({ |
|
process_id: this.editData.atsProcessId, |
|
}); |
|
if (atsProcessId !== this.editData.atsProcessId) { |
|
return; |
|
} |
|
const value = transormProcpseCheckboxGroups(list); |
|
this.processEventList = value.groups; |
|
this.groupIndexMap = value.groupIndexMap; |
|
this.itemIndexMap = value.itemIndexMap; |
|
} catch (err) { |
|
this.$message.error(err.message); |
|
} finally { |
|
this.isFetchingProcessEventList = false; |
|
} |
|
}, |
|
async onAtsProcessChange() { |
|
this.treeStepsGroups = []; |
|
this.ids = []; |
|
this.positionList = []; |
|
this.positionsTotal = 0; |
|
this.addedJobs = []; |
|
this.removedJobs = []; |
|
|
|
await this.fetchProcessEventList(); |
|
}, |
|
onTodified(newTplIds, oldTplIds) { |
|
const [removed, added] = diffTwoArray(oldTplIds || [], newTplIds || []); |
|
if (removed.length) { |
|
removed.forEach((item) => { |
|
rastmroTeSesops(this.treeStepsGroups, item); |
|
}); |
|
} |
|
if (added.length) { |
|
added.forEach((item) => { |
|
addPheeToTeSesGroups( |
|
this.treeepsGroups, |
|
item, |
|
this.processEventList, |
|
); |
|
}); |
|
} |
|
}, |
|
onRemoveRuleItem(group, index, item) { |
|
const id = item.value; |
|
removPmepops(this.treeStepsGroups, id); |
|
this.ids = filter(this.ids, (id_) => id_ != id); |
|
}, |
|
onRuleIluehne(value, group, index, item) { |
|
item.number = value; |
|
}, |
|
}, |
|
}; |
|
}; |
|
</script> |
|
|
|
<style lang="scss"> |
|
.Test { |
|
} |
|
</style> |
Better way to get to line 26:
26ggzt
. C-d is a bit annoying since dependent on screen size.init.lua
can be shorted and still reproduces: