forked from ezreal/BI-FR-MIX-FRONT
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.2 KiB
61 lines
2.2 KiB
;!(function () { |
|
var store = BI.inherit(Fix.Model, { |
|
state: function () { |
|
// const {params} = BI.Router.$router.history.current; |
|
return { |
|
id: this.options.id, |
|
name: this.options.name, |
|
reportType: this.options.reportType, |
|
report: this.options.report |
|
} |
|
}, |
|
context: ['subjectInfo', 'tables', 'resourceOperationInfo'], |
|
childContext: [], |
|
computed: { |
|
reportItems: function () { |
|
var self = this; |
|
var reportItems = []; |
|
if (self.model.reportType === "cpt") { |
|
reportItems = self.model.subjectInfo.cptItems.availableReports |
|
} else if (self.model.reportType === "frm") { |
|
reportItems = self.model.subjectInfo.frmItems.availableReports |
|
} |
|
return reportItems; |
|
}, |
|
namesMap: function () { |
|
var self = this; |
|
var namesMap = {}; |
|
BI.each(self.model.reportItems, function (index, item) { |
|
if (item.id != self.model.id) { |
|
namesMap[item.name] = item.id; |
|
} |
|
}) |
|
return namesMap; |
|
} |
|
}, |
|
actions: { |
|
initData: function (callback) { |
|
var self = this; |
|
BI.isFunction(callback) && callback() |
|
}, |
|
reNameReport: function (newName) { |
|
var self = this; |
|
var oldName = self.model.name; |
|
self.model.name = newName; |
|
BI.CLI.template.rename(self.model.subjectInfo.id, |
|
{ |
|
id: self.model.id, |
|
name: newName |
|
}, function (res) { |
|
if (res.errorCode) { |
|
BI.Msg.toast(res.errorMsg, {level: "error"}); |
|
self.model.name = oldName; |
|
return |
|
} |
|
self.model.report.name = newName; |
|
}) |
|
} |
|
} |
|
}); |
|
BI.model("bi.subject.tab.extend.report.item.model", store); |
|
})(); |