123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- define(function (require) {
- return function (context) {
- var $dlg, $form, $comb;
- var sysId = 0;
- //获取平台列表
- function getSysList() {
- var _datas = [];
- $.yvan.ajax({
- url: api('/sys/system/query'),
- data: {status: 1},
- method: 'post',
- async: false,
- success: function (data) {
- if (data.data != null && data.data != undefined) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].sysId,
- "text": data.data[i].sysName
- })
- }
- }
- }
- });
- return _datas;
- }
- //获取角色列表
- function getRoleList() {
- var _datas = [];
- _datas.push({
- "id": "0",
- "text": "-选择-",
- "selected": true
- });
- if ($form) {
- sysId = $form.formGet().sysId;
- }
- if (sysId == 0 || sysId == undefined) {
- sysId = context.sysId;
- }
- if (sysId == 0 || sysId == undefined) {
- return _datas;
- }
- $.yvan.ajax({
- url: api('/sys/sysRole/query'),
- data: {},
- method: 'get',
- async: false,
- success: function (data) {
- if (data.data != null && data.data != undefined) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].roleId,
- "text": data.data[i].roleName
- })
- }
- }
- }
- });
- return _datas;
- }
-
- return {
- xtype: 'dialog',
- dialogId: 'dialogWfTask',
- title: '流程任务信息',
- width: 620,
- height: 350,
- onOpen: function () {
- $dlg = $(this);
- if (context.isEdit) {
- $.yvan.ajax({
- loadingMask: false,
- url: api('/sys/wfTask/getById'),
- type: 'GET',
- data: {
- taskType: context.taskType
- },
- success: function (data) {
- $dlg.find('form');
- $form.formSet(data.data);
- sysId = data.data.sysId;
- }
- });
- } else {
- $form.formSet({
- status: '1',
- sysId: context.sysId
- });
- }
- },
- center: {
- items: {
- xtype: 'formgroup',
- onRender: function () {
- $form = $(this);
- },
- items: [
- [
- {
- name: 'sysId',
- label: '所属平台',
- xtype: 'yvselect',
- required: true,
- disabled: context.isEdit ? "disabled" : "",
- data: getSysList(),
- onChange: function () {
- $comb.yvselect({'data': getRoleList()});
- }
- },
- {
- name: 'taskRole',
- label: '对应角色',
- xtype: 'yvselect',
- panelHeight: 220,
- onRender: function () {
- $comb = $(this);
- }
- }
- ],
- [
- {name: 'taskType', xtype: 'hidden'},
- {name: 'taskName', label: '任务名称', required: true},
- {name: 'taskCode', label: '任务编码', required: true}
- ],
- [
- {
- name: 'taskTable', label: '对应表格'
- },
- {
- name: 'status',
- label: '启用状态',
- xtype: 'yvselect',
- required: true,
- data: $.yvan.sysDict('status').combo()
- }
- ],
- [
- {
- name: 'taskDesp', label: '任务说明', width: '560px', height: '90px', multiline: true
- }
- ]
- ]
- }
- },
- buttons: [
- {
- text: "提交", iconCls: "fa fa-save", onClick: function () {
- $.yvan.postForm($form, {
- url: (context.isEdit ? api('/sys/wfTask/update') : api('/sys/wfTask/insert')),
- success: function () {
- $.yvan.msg('操作成功');
- if (context.isEdit) {
- $dlg.window('close');
- }
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- },
- error: function (data) {
- }
- });
- }
- }, {
- text: "关闭", iconCls: "fa fa-times", onClick: function () {
- $dlg.dialog('close');
- }
- }
- ]
- };
- };
- });
|