customformDetailCtrl.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. var appFormly = angular.module('formlyDetail', ['formlyExample']);
  2. app.requires.push('formlyDetail');
  3. appFormly.controller('CustomformDetailCtrl', ['$scope', 'i18nService', '$rootScope', '$parse', '$injector', '$http', '$q', '$state', '$stateParams', '$modal', '$timeout', '$interval', 'SweetAlert', 'FileUploader', 'Restangular', 'BpmRestangular', 'api_configure_form', 'api_bpm_domain', 'api_bpm_data', 'api_user_data',
  4. function($scope, i18nService, $rootScope, $parse, $injector, $http, $q, $state, $stateParams, $modal, $timeout, $interval, SweetAlert, FileUploader, Restangular, BpmRestangular, api_configure_form, api_bpm_domain, api_bpm_data, api_user_data) {
  5. //console.log($parse('Restangular')($scope));
  6. //console.log($injector.get('Restangular'));
  7. var vm = this;
  8. vm.options = {
  9. formState: {
  10. horizontalLabelClass: 'col-sm-5',
  11. horizontalFieldClass: 'col-sm-5',
  12. readOnly: true
  13. }
  14. };
  15. vm.exampleTitle = ['expressionProperties', 'model property'];
  16. vm.fields = [];
  17. vm.model = {};
  18. $scope.langs = i18nService.getAllLangs();
  19. $scope.lang = 'zh-cn';
  20. i18nService.setCurrentLang($scope.lang);
  21. $scope.backFunction = function(data) {
  22. $state.go('app.incident', {});
  23. };
  24. var that = $injector;
  25. var parse = $parse;
  26. var formKey = "";
  27. var pdKey = "";
  28. if (angular.isDefined($state.current.pdKey) && $state.current.pdKey != "") {
  29. pdKey = $state.current.pdKey;
  30. // console.log("pdKey::"+$state.current.pdKey);
  31. } else if ($stateParams.pdKey) {
  32. pdKey = $stateParams.pdKey;
  33. };
  34. if (angular.isDefined($stateParams.formKey) && $stateParams.formKey != "") {
  35. formKey = $stateParams.formKey;
  36. // console.log("formKey::"+$stateParams.formKey);
  37. }
  38. //用户测试数据,后续从header的auth中获取
  39. var userId = 2;
  40. //==============处理表单设计数据 开始====================
  41. //处理组件加载后台数据选项的方法
  42. function refreshSelectOptions(searchVal, field) {
  43. if (field.templateOptions.optionsUrl) {
  44. var process = BpmRestangular.all("");
  45. process.customPOST({ "assignee": 2, "idx": 0, "sum": 1000 }, field.templateOptions.optionsUrl).then(function(result) {
  46. if (!field.templateOptions.options) {
  47. field.templateOptions.options = [];
  48. }
  49. if (field.templateOptions.optionsDataKey) {
  50. field.templateOptions.options = result[field.templateOptions.optionsDataKey];
  51. } else {
  52. field.templateOptions.options = result;
  53. }
  54. });
  55. }
  56. }
  57. //解析自定义表单设计数据
  58. function decodeVMForm(vmForm, mdata) {
  59. var result = { model: {}, fields: [] };
  60. //设置模型实体数据 begin
  61. // var mdata = vmForm.model;
  62. //解析数据实体
  63. //console.log("mdata="+JSON.stringify(mdata));
  64. var mdata = angular.fromJson(vmForm.model);
  65. angular.extend(result.model, mdata);
  66. //设置模型实体数据 end
  67. //解析设计数据生成表单项 begin
  68. var fields = [];
  69. //处理修改设计数据中展示设置
  70. angular.forEach(vmForm.fields, function(field) {
  71. if (field.key == "") {
  72. delete field.key;
  73. }
  74. if (angular.isDefined(field.extjson)) {
  75. var extObj = angular.fromJson(field.extjson); //JSON.parse(field.extjson);
  76. angular.extend(field.templateOptions, extObj.templateOptions);
  77. delete extObj.templateOptions;
  78. for (var prop in extObj) {
  79. if (new RegExp("Expression").test(prop)) {
  80. //var obj = $scope.$eval(extObj[prop]);
  81. //extObj[prop] = $scope.$eval(extObj[prop]);
  82. if (extObj[prop] != null) {
  83. if (new RegExp("function").test(extObj[prop])) {
  84. var propValue = eval(extObj[prop]);
  85. extObj[prop] = propValue;
  86. } else {
  87. // console.log(extObj[prop]);
  88. var obj = $scope.$eval(extObj[prop]);
  89. extObj[prop] = obj;
  90. // console.log(obj);
  91. }
  92. }
  93. } else if (new RegExp("expressionProperties").test(prop)) {
  94. for (var p in extObj[prop]) {
  95. if (new RegExp("function").test(extObj[prop][p])) {
  96. var propValue = eval(extObj[prop][p]);
  97. extObj[prop][p] = propValue;
  98. } else {
  99. if (p.indexOf("'") >= 0) {
  100. var obj = $scope.$eval(extObj[prop][p]);
  101. extObj[prop][$scope.$eval(p)] = obj;
  102. }
  103. }
  104. }
  105. } else if ("watcher" == prop) {
  106. if (angular.isArray(extObj[prop])) {
  107. angular.forEach(extObj[prop], function(item, index) {
  108. for (var p in item) {
  109. if (new RegExp("function").test(item[p])) {
  110. var propValue = eval(item[p]);
  111. extObj[prop][index][p] = propValue;
  112. }
  113. }
  114. });
  115. } else if (angular.isObject(extObj[prop])) {
  116. for (var p in extObj[prop]) {
  117. if (new RegExp("function").test(extObj[prop][p])) {
  118. var propValue = eval(extObj[prop][p]);
  119. extObj[prop][p] = propValue;
  120. }
  121. }
  122. }
  123. }
  124. }
  125. angular.extend(field, extObj);
  126. delete field.extjson;
  127. }
  128. if (angular.isDefined(field.templateOptions)) {
  129. var templateOs = field.templateOptions;
  130. for (var property in templateOs) {
  131. // console.log(property);
  132. if (angular.isString(templateOs[property]) && (!(new RegExp("[\u4e00-\u9fa5]").test(templateOs[property])) || new RegExp("function").test(templateOs[property]))) {
  133. if (new RegExp("function").test(templateOs[property])) {
  134. var propValue = eval(templateOs[property]);
  135. field.templateOptions[property] = propValue;
  136. } else {
  137. if (that.has(templateOs[property])) {
  138. field.templateOptions[property] = that.get(templateOs[property]);
  139. } else {
  140. field.templateOptions[property] = templateOs[property];
  141. }
  142. }
  143. } else if (templateOs[property] == null) {
  144. //delete field.templateOptions[property];
  145. } else {
  146. }
  147. }
  148. }
  149. // console.log(field);
  150. if (angular.isDefined(field.templateOptions) && angular.isDefined(field.templateOptions.extjson)) {
  151. var extObj = angular.fromJson(field.templateOptions.extjson); //JSON.parse(field.extjson);
  152. angular.extend(field.templateOptions, extObj);
  153. delete field.templateOptions.extjson;
  154. }
  155. //...
  156. if (field.templateOptions) {
  157. //处理远程获取数据控件方法调用
  158. if (field.templateOptions.optionsUrl) {
  159. field.templateOptions.refresh = refreshSelectOptions;
  160. }
  161. //处理嵌套属性数据绑定/
  162. if (field.templateOptions.pkey) {
  163. var pmodel, i = 0;
  164. angular.forEach(field.templateOptions.pkey.split("."), function(p) {
  165. if (i == 0) {
  166. if (result.model[p] == null) {
  167. result.model[p] = {};
  168. }
  169. pmodel = result.model[p];
  170. i++;
  171. } else {
  172. if (pmodel[p] == null) {
  173. pmodel[p] = {};
  174. }
  175. pmodel = pmodel[p];
  176. }
  177. });
  178. if (pmodel != null) {
  179. field.model = pmodel;
  180. if (pmodel[field.key] == null) {
  181. pmodel[field.key] = null;
  182. }
  183. }
  184. } else {
  185. if (result.model[field.key] == null) {
  186. result.model[field.key] = null;
  187. }
  188. }
  189. //处理弹出框组件初始化
  190. if (field.type == "ui-input-selectmodal") {
  191. field.templateOptions.modal = $modal;
  192. //field.templateOptions.Restangular = Restangular;
  193. } else if (field.type == "ui-userselect") {
  194. field.templateOptions.modal = $modal;
  195. //field.templateOptions.Restangular = Restangular;
  196. } else if (field.type == "ui-multiuserselect") {
  197. field.templateOptions.modal = $modal;
  198. } else if (field.type == "ui-modelselect") {
  199. field.templateOptions.modal = $modal;
  200. //field.templateOptions.Restangular = Restangular;
  201. } else if (field.type == "ui-dropfile") {
  202. field.templateOptions.fileUploader = new FileUploader({
  203. url: '/uploader'
  204. });
  205. field.templateOptions.taskId = $stateParams.taskId;
  206. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  207. field.templateOptions.userId = $rootScope.user.id;
  208. //field.ApiService=api_bpm_domain;
  209. } else if (field.type == "ui-dropfiletable") {
  210. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  211. }
  212. }
  213. // console.log(field);
  214. result.fields.push(field);
  215. });
  216. angular.extend($scope.vm.fields, result.fields);
  217. angular.extend($scope.vm.model, result.model);
  218. $scope.formData = vmForm;
  219. //console.log($scope.vm);
  220. //解析设计数据生成表单项 end
  221. return result;
  222. }
  223. //======================处理表单设计数据 结束========================
  224. $scope.closeModel = function() {
  225. console.log("pdKey=" + pdKey);
  226. // if ($stateParams.pdKey) {
  227. // pdKey = $stateParams.pdKey;
  228. // }
  229. if (pdKey == "incident") {
  230. $state.go('app.incidentMobile.incidentListMobile', {});
  231. } else if (pdKey == "change") {
  232. $state.go('app.change.list', {});
  233. } else if (pdKey == "problem") {
  234. $state.go('app.problem.list', {});
  235. } else if (pdKey == "release") {
  236. $state.go('app.release.list', {});
  237. } else if (pdKey == "schedule") {
  238. $state.go('app.scheduling.list', {});
  239. } else if (pdKey == "configure") {
  240. $state.go('app.cmdb.plist', {});
  241. } else if (pdKey == "serviceCatalogueProcessActual") {
  242. $state.go('app.reService.manager', {});
  243. } else if (pdKey == "inspectionListForm") {
  244. $state.go('app.inspection.inspectList', {});
  245. } else if (pdKey == "bpm_inspection") {
  246. $state.go('app.inspection.inspectList', {});
  247. } else if (pdKey == "bpm_service_request") {
  248. $state.go('app.reService.manager', {});
  249. };
  250. event.preventDefault();
  251. };
  252. vm.submit = function(data, style) {
  253. };
  254. $scope.vm = vm;
  255. var dataId = $stateParams.dataId;
  256. var pdKey = $stateParams.pdKey;
  257. var detailFormKey = $stateParams.formKey;
  258. var processInstanceId = $stateParams.processInstanceId;
  259. if (angular.isDefined(detailFormKey) && detailFormKey != "") {
  260. var dataId = parseInt(dataId);
  261. if (angular.isDefined(processInstanceId) && processInstanceId != "") {
  262. api_configure_form.renderForm(detailFormKey, '00000', processInstanceId).then(function(responseData) {
  263. if (responseData) {
  264. var vmForm = Restangular.stripRestangular(responseData);
  265. if (vmForm) {
  266. var modelData = {};
  267. modelData[pdKey] = vmForm.model;
  268. decodeVMForm(vmForm, modelData);
  269. }
  270. }
  271. });
  272. } else if (angular.isDefined(dataId) && dataId != "") {
  273. api_bpm_data.fetchData(pdKey, dataId).then(function(response) {
  274. if (response) {
  275. var myData = Restangular.stripRestangular(response);
  276. var processInstanceId = myData.data.processInstanceId;
  277. //$scope.vm.model[pdKey]=myData.data;
  278. api_configure_form.renderForm(detailFormKey, '00000', processInstanceId).then(function(responseData) {
  279. if (responseData) {
  280. // console.log("responseData>>>");console.log(responseData);
  281. var vmForm = Restangular.stripRestangular(responseData);
  282. if (vmForm) {
  283. //console.log("vmForm>>>");console.log(vmForm);
  284. var modelData = {};
  285. modelData[pdKey] = vmForm.model;
  286. decodeVMForm(vmForm, modelData);
  287. }
  288. }
  289. });
  290. }
  291. })
  292. }
  293. } else {
  294. // create process instance
  295. if (pdKey != "") { //for process
  296. api_bpm_domain.startformkey(pdKey).then(function(response) {
  297. if (response) {
  298. var myData = Restangular.stripRestangular(response);
  299. api_configure_form.renderForm(myData.data).then(function(responseData) {
  300. if (responseData) {
  301. var vmForm = Restangular.stripRestangular(responseData);
  302. if (vmForm) {
  303. decodeVMForm(vmForm);
  304. console.log($scope);
  305. }
  306. }
  307. });
  308. }
  309. });
  310. } else { //for form
  311. //TODO
  312. //测试数据 开始
  313. var testJson = {
  314. fields: [{
  315. key: 'formtitle',
  316. type: 'ui-title',
  317. noFormControl: true,
  318. templateOptions: {
  319. label: 'title is ',
  320. placeholder: 'Formly is terrific!'
  321. }
  322. },
  323. {
  324. key: 'a',
  325. type: 'ui-input',
  326. className: 'col-xs-4',
  327. templateOptions: {
  328. type: 'input',
  329. label: 'input a',
  330. placeholder: 'search a...',
  331. lBtn: {
  332. label: 'input',
  333. onClick: function(val, opt, el, ev, model) { alert(val); }
  334. },
  335. rAddon: '@111.cc'
  336. }
  337. },
  338. {
  339. key: 'b',
  340. type: 'ui-input',
  341. className: 'col-xs-4',
  342. templateOptions: {
  343. type: 'input',
  344. label: 'input a',
  345. placeholder: 'search a...',
  346. rBtn: {
  347. icon: 'glyphicon-search',
  348. onClick: function(val, opt, el, ev, model) { alert(val); }
  349. },
  350. lAddon: '@'
  351. }
  352. },
  353. {
  354. key: 'first',
  355. type: 'ui-input',
  356. className: 'col-xs-2',
  357. templateOptions: {
  358. type: 'input',
  359. label: 'first name',
  360. pkey: 'name'
  361. }
  362. },
  363. {
  364. key: 'last',
  365. type: 'ui-input',
  366. className: 'col-xs-2',
  367. templateOptions: { type: 'input', label: 'last name', pkey: 'name' }
  368. },
  369. {
  370. key: 'username',
  371. type: 'ui-input',
  372. className: 'col-xs-6',
  373. templateOptions: {
  374. type: 'input',
  375. label: 'User Name',
  376. placeholder: 'Enter name',
  377. required: true,
  378. maxLength: 10
  379. }
  380. },
  381. {
  382. key: 'password',
  383. type: 'ui-input',
  384. className: 'col-xs-6',
  385. templateOptions: {
  386. type: 'password',
  387. label: 'Password',
  388. placeholder: 'Password',
  389. required: true
  390. },
  391. expressionProperties: {
  392. 'templateOptions.disabled': '!model.username'
  393. }
  394. },
  395. {
  396. key: 'selectmodal',
  397. type: 'ui-input-selectmodal',
  398. className: 'col-xs-6',
  399. templateOptions: {
  400. label: 'selectmodal',
  401. btnLabel: 'search',
  402. btnClassName: 'btn-o',
  403. modalParam: {
  404. items: function() {
  405. return ['a', 'b', 'c', 'd'];
  406. },
  407. title: function() {
  408. return '测试标题';
  409. }
  410. }
  411. }
  412. },
  413. {
  414. key: 'email',
  415. type: 'ui-input',
  416. className: 'col-xs-6',
  417. templateOptions: {
  418. type: 'email',
  419. maxlength: 10,
  420. minlength: 6,
  421. label: 'EMail'
  422. }
  423. },
  424. {
  425. key: 'date',
  426. type: 'ui-datepicker',
  427. className: 'col-xs-6',
  428. templateOptions: {
  429. label: 'Date',
  430. type: 'text',
  431. datepickerPopup: 'yyyy-MM-dd hh:mm:ss',
  432. initDate: function() {
  433. return new Date();
  434. }
  435. }
  436. },
  437. {
  438. key: 'multiselectItem',
  439. type: 'ui-multi-select-tree',
  440. className: 'col-xs-6',
  441. templateOptions: {
  442. label: 'multiSelect',
  443. placeholder: '请选择...',
  444. isMultiSelect: false,
  445. selLeafs: false, //只选叶子节点
  446. refreshData: function(APIService) {
  447. return APIService.fetchDataList('changeclassify', { 'idx': 0, 'sum': 100 });
  448. },
  449. APIService: api_bpm_data,
  450. optionsDataKey: 'list',
  451. refreshDelay: 1000,
  452. onDataCallback: function(item, selectItems, options, field, model) {
  453. model[options.key] = { id: item.id };
  454. }
  455. }
  456. },
  457. {
  458. key: 'selectItem',
  459. type: 'ui-select',
  460. className: 'col-xs-4',
  461. templateOptions: {
  462. label: 'ui-select',
  463. valueProp: 'code', //对应value
  464. labelProp: 'source', //对应key
  465. optionsUrl: 'data/fetchDataList/incidentsource', //对应后台地址,api/之前的部分省略
  466. optionsDataKey: 'list', //对应返回数组数据的键值,
  467. required: true,
  468. onChange: function(val, options, field, event, model) {
  469. model.start_code = val;
  470. }
  471. }
  472. },
  473. {
  474. key: 'multiselectItem',
  475. type: 'ui-multiselect',
  476. className: 'col-xs-4',
  477. templateOptions: {
  478. label: 'multi-select',
  479. valueProp: 'code', //对应value
  480. labelProp: 'source', //对应key
  481. optionsUrl: 'data/fetchDataList/incidentsource', //对应后台地址,api/之前的部分省略
  482. optionsDataKey: 'list', //对应返回数组数据的键值,
  483. required: true,
  484. onChange: function(val, options, field, event, model) {
  485. console.log(val);
  486. console.log(model);
  487. //model.start_code = val;
  488. }
  489. }
  490. },
  491. {
  492. key: 'checklistItem',
  493. type: 'ui-checklist',
  494. className: 'col-xs-4',
  495. templateOptions: {
  496. label: 'checklistItem',
  497. options: [
  498. { name: 'Iron Man', value: 'iron_man' },
  499. { name: 'Captain America', value: 'captain_america' },
  500. { name: 'Black Widow', value: 'black_widow' },
  501. { name: 'Hulk', value: 'hulk' },
  502. { name: 'Captain Marvel', value: 'captain_marvel' }
  503. ]
  504. }
  505. },
  506. {
  507. key: 'radioItem',
  508. type: 'ui-radio',
  509. className: 'col-xs-4',
  510. templateOptions: {
  511. label: 'radioItem',
  512. options: [
  513. { name: 'Iron Man', value: 'iron_man' },
  514. { name: 'Captain America', value: 'captain_america' },
  515. { name: 'Black Widow', value: 'black_widow' },
  516. { name: 'Hulk', value: 'hulk' },
  517. { name: 'Captain Marvel', value: 'captain_marvel' }
  518. ],
  519. type: 'number'
  520. }
  521. },
  522. {
  523. key: 'selectUser',
  524. type: 'ui-userselect',
  525. className: 'col-xs-12',
  526. templateOptions: {
  527. label: '请求人信息',
  528. modalTitle: '请求人列表',
  529. fetchItems: function(filterData, APIService) {
  530. return APIService.fetchDataList('user', filterData);
  531. },
  532. Restangular: Restangular,
  533. ApiService: api_user_data,
  534. onClick: function(val, options, field, event, model) {
  535. //model.start_code++;
  536. console.log(options);
  537. }
  538. }
  539. },
  540. {
  541. key: 'cabUser',
  542. type: 'ui-multiuserselect',
  543. className: 'col-xs-12',
  544. templateOptions: {
  545. label: 'CAB评审成员',
  546. modalTitle: 'CAB成员列表',
  547. fetchItems: function(filterData, APIService) {
  548. return APIService.fetchDataList('user', filterData);
  549. },
  550. Restangular: Restangular,
  551. ApiService: api_user_data,
  552. onClick: function(val, options, field, event, model) {
  553. console.log(model);
  554. }
  555. }
  556. },
  557. {
  558. key: 'incident',
  559. type: 'ui-modelselect',
  560. className: 'col-xs-3',
  561. templateOptions: {
  562. label: '关联事件工单',
  563. modalTitle: '事件列表',
  564. fetchItems: function(filterData, APIService) {
  565. return APIService.fetchDataList('incident', filterData);
  566. },
  567. Restangular: "Restangular",
  568. ApiService: "api_bpm_data",
  569. columnDefs: [
  570. { name: 'id', width: 80, enableFiltering: false },
  571. { name: 'title', displayName: '事件主题', width: 140 },
  572. { name: 'type.name', displayName: '事件类型', width: 140 },
  573. { name: 'emergency.name', displayName: '紧急度', width: 80 },
  574. { name: 'state.name', displayName: '状态', width: 100 },
  575. { name: 'emergency.name', displayName: '紧急度', width: 80 },
  576. { name: 'influence.name', displayName: '影响度', width: 80 },
  577. { name: 'priority.name', displayName: '优先级', width: 80 },
  578. { name: 'handlerUser.name', displayName: '当前处理人', width: 100 },
  579. { name: 'acceptDate', displayName: '创建时间', width: 100 }
  580. ],
  581. displayName: 'title',
  582. onClick: function(val, options, field, event, model) {
  583. //model.start_code++;
  584. console.log(options);
  585. }
  586. }
  587. },
  588. {
  589. key: 'worknumber',
  590. type: 'ui-workernumber',
  591. className: 'col-xs-3',
  592. templateOptions: {
  593. label: 'work number',
  594. Restangular: Restangular,
  595. ApiService: api_bpm_domain,
  596. getWorkernumber: function(APIService) {
  597. return APIService.workernumber('bg');
  598. }
  599. }
  600. },
  601. {
  602. key: 'chkme',
  603. type: 'ui-checkbox',
  604. className: 'col-xs-3',
  605. templateOptions: {
  606. label: 'Check me out'
  607. }
  608. },
  609. {
  610. key: 'droplink',
  611. type: 'ui-link',
  612. className: 'col-xs-3',
  613. templateOptions: {
  614. label: '添加附件',
  615. onClick: function(val, options, field, event, model) {
  616. if (angular.isUndefined(field.form.dropState)) {
  617. field.form.dropState = false;
  618. }
  619. field.form.dropState = !field.form.dropState;
  620. console.log(field);
  621. }
  622. }
  623. },
  624. {
  625. key: 'dropfile',
  626. type: 'ui-dropfile',
  627. className: 'col-xs-12',
  628. templateOptions: {
  629. label: '附件',
  630. uploadUrl: 'http://127.0.0.1:9008/saveAttachments'
  631. }
  632. },
  633. {
  634. key: 'droplist',
  635. type: 'ui-dropfiletable',
  636. className: 'col-xs-12',
  637. templateOptions: {
  638. label: '附件下载列表',
  639. Restangular: Restangular,
  640. ApiService: api_bpm_domain
  641. }
  642. },
  643. {
  644. key: 'start_code',
  645. className: 'col-xs-6',
  646. type: 'ui-hidden'
  647. },
  648. {
  649. key: 'remark',
  650. type: 'ui-textarea',
  651. className: 'col-xs-12',
  652. templateOptions: {
  653. label: 'remark is ',
  654. rows: 3
  655. }
  656. },
  657. {
  658. key: 'setStartCode',
  659. type: 'ui-button',
  660. className: 'col-xs-4',
  661. templateOptions: {
  662. label: 'customButton',
  663. onClick: function(val, options, field, event, model) {
  664. model.start_code++;
  665. console.log(options);
  666. }
  667. }
  668. }
  669. ],
  670. model: {
  671. username: "robin lau",
  672. password: "123456",
  673. chkme: false,
  674. start_code: 0,
  675. formtitle: "Hey!I am title value!",
  676. name: {
  677. first: "robin",
  678. last: "lau"
  679. },
  680. multiselectItem: []
  681. //date:"2015-09-15 00:00:00"
  682. }
  683. };
  684. setTimeout(function() {
  685. decodeVMForm(testJson);
  686. $scope.$apply();
  687. }, 500);
  688. //测试数据结束
  689. }
  690. }
  691. }
  692. ]);