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.
 
 
 

263 lines
10 KiB

!(function () {
console.log("123");
BI.config("dec.constant.schedule.task.accessory", function (items) {
items.push({
value: 4096,
text: "图片"
})
return items;
});
var jsdjjedTextValueCombo = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-system-extensible-parameter",
labelWidth: 210,
editorWidth: 180,
value: {}
},
render: function () {
var t = this
, e = this.options
, i = e.value;
return {
type: "bi.vertical_adapt",
items: [{
type: "bi.label",
textAlign: "left",
cls: "dec-font-weight-bold",
text: BI.i18nText(i.name),
title: BI.i18nText(i.name),
width: e.labelWidth
}, {
type: "bi.text_value_combo",
$testId: "dec-system-normal-extensible-text-value-combo",
width: e.editorWidth,
value: i.value,
items: this._createItems(i),
ref: function (e) {
t.textValueCombo = e
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
t.fireEvent("EVENT_CHANGE", arguments)
}
}]
}, {
type: "dec.text.bubble.combo",
cls: "help-area",
invisible: !i.description,
text: i.description ? BI.i18nText(i.description) : "",
el: {
type: "bi.icon_button",
$point: "dec-system-normal-extensible",
cls: "detail-font",
width: 35,
height: 24
}
}]
}
},
_createItems: function (e) {
return BI.map(e.items || e.alternatives, function (e, t) {
return BI.extend(t, {
text: BI.isKey(t.text) ? t.text : BI.i18nText(t.key)
})
})
},
getValue: function () {
var e = this.textValueCombo.getValue();
return BI.isNotEmptyArray(e) ? e[0] : "";
},
setValue: function (e) {
this.textValueCombo.setValue(e);
},
populate: function (e) {
this.textValueCombo.populate(e);
}
});
jsdjjedTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("jsdjjed.text.value.combo", jsdjjedTextValueCombo);
var appMessagePushTerminalType = 64;
//debugger;
Dec.Plugin.OutPutActionProvider.items.push({
version: 1.0,
terminalType: appMessagePushTerminalType,
terminalText: BI.i18nText("飞书推送通知"),
getItem: function () {
var self = this;
return {
type: "bi.vertical",
//width: 540,
height: 100,
vgap: 0,
items: [{
type: "jsdjjed.text.value.combo",
labelWidth: 80,
value: {
name: "应用凭证",
value: "",
//description: BI.i18nText("Dec-System_Week_Begins_Tips"),
//items: BI.Constants.getConstant("dec.constant.system.normal.week.begins")
},
ref: function (e) {
self.appConfigIds = e
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
var configId = this.getValue();
//console.log(configId);
self._setChatGroupValue(configId);
}
}]
},
{
type: "jsdjjed.text.value.combo",
labelWidth: 80,
value: {
name: "飞书群",
value: "",
//description: BI.i18nText("Dec-System_Week_Begins_Tips"),
//items: BI.Constants.getConstant("dec.constant.system.normal.week.begins")
},
ref: function (e) {
self.chatGroup = e
}
},
{
type: "jsdjjed.text.value.combo",
labelWidth: 80,
value: {
name: "消息类型",
value: "text",
//description: BI.i18nText("Dec-System_Week_Begins_Tips"),
items: [{text: "文本", value: "text"}, {text: "富文本", value: "post"}]
},
ref: function (e) {
self.feishuMsgType = e
}
},
{
type: "jsdjjed.text.value.combo",
labelWidth: 80,
value: {
name: "发送类型",
value: "message",
//description: BI.i18nText("Dec-System_Week_Begins_Tips"),
items: [{text: "消息", value: "message"}, {text: "文件", value: "file"}, {
text: "消息与文件",
value: "message_file"
}]
},
ref: function (e) {
self.feishuSendType = e
}
}
]
}
},
_setChatGroupValue: function (configId) {
var self = this;
var id = configId || "";
Dec.jsdjjed.reqChatGroup({config_id: id}, function (e) {
var items = BI.map(Dec.jsdjjed.getValidItemsData(e), function (e, t) {
return {text: t.show, value: t.chatId};
});
items.unshift({text: "空", value: "empty_group"});
if (BI.isNotEmptyArray(items)) {
var currentChatGroupId = self._getCurrentChatGroupId();
var chatId = self._getItemContainValue(currentChatGroupId, items);
self.chatGroup.populate(items);
self.chatGroup.setValue(chatId);
}
})
},
setValue: function (v) {
//debugger;
if (v.terminal && v.terminal === appMessagePushTerminalType) {
if ((v.feishuMsgType == undefined) || (v.feishuMsgType == null) || (v.feishuMsgType.length <= 0)) {
v.feishuMsgType = "text";
}
if ((v.feishuSendType == undefined) || (v.feishuSendType == null) || (v.feishuSendType.length <= 0)) {
v.feishuSendType = "message";
}
this.value = v;
this.appConfigIds.setValue(v.configId);
this.chatGroup.setValue(v.chatGroupId);
this.feishuMsgType.setValue(v.feishuMsgType);
this.feishuSendType.setValue(v.feishuSendType);
}
},
getValue: function () {
var self = this;
// actionName最后一个点后面的类名要和这个return的json的字段名一致
return {
OutputAppMessagePush: BI.extend(self.value, {
"@class": "com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush",
actionName: "com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush",
terminal: appMessagePushTerminalType,
configId: self.appConfigIds.getValue(),
chatGroupId: self.chatGroup.getValue(),
feishuMsgType: self.feishuMsgType.getValue(),
feishuSendType: self.feishuSendType.getValue()
})
}
},
checkValid: function () {
return this.getValue() ? true : false;
},
fireEvent: function (v) {
var self = this;
if (v && v == true) {
Dec.jsdjjed.reqAppsByPage({page: 1}, function (e) {
var items = BI.map(Dec.jsdjjed.getValidItemsData(e), function (e, t) {
return {text: t.show, value: t.configId};
});
if (BI.isNotEmptyArray(items)) {
var currentConfigId = self._getCurrentConfigId();
var configId = self._getItemContainValue(currentConfigId, items);
self.appConfigIds.populate(items);
self.appConfigIds.setValue(configId);
self.appConfigIds.fireEvent("EVENT_CHANGE");
}
})
}
},
_getItemContainValue: function (currentValue, items) {
var tempValue = items[0].value;
if (BI.isEmpty(currentValue)) {
return tempValue;
}
for (var i = 0, max = items.length - 1; i <= max; i++) {
if (currentValue == items[i].value) {
return currentValue;
}
}
return tempValue;
},
_getCurrentConfigId() {
var self = this;
if (self.value && self.value.configId) {
return self.value.configId;
}
return "";
},
_getCurrentChatGroupId() {
var self = this;
if (self.value && self.value.chatGroupId) {
return self.value.chatGroupId;
}
return "";
}
});
})();