inspectForm.js 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
  1. var sysFormly = angular.module('formlySystem', [
  2. 'formly', 'formlyBootstrap', 'ui.bootstrap',
  3. 'ngSanitize', 'ui.select', 'ui.grid'
  4. ]);
  5. app.requires.push('formlySystem');
  6. // var appFormly = angular.module('formlyExample', [
  7. // 'formly', 'formlyBootstrap','ui.bootstrap',
  8. // 'ngSanitize','ui.select','ui.grid'],
  9. sysFormly.config(
  10. function config(formlyConfigProvider) {
  11. //格式转换方法 XXX-XXX转驼峰命名
  12. });
  13. sysFormly.controller('SystemformCtrl', ['$rootScope', '$scope', '$parse', '$filter', '$injector', '$http', '$q', '$state', '$stateParams', '$modal', '$timeout', '$interval', 'SweetAlert', 'FileUploader', 'i18nService', 'moment', 'Restangular', 'UserRestangular', 'WechatRestangular', 'BpmRestangular', 'api_configure_form', 'api_bpm_domain', 'api_bpm_data', 'api_user_data',
  14. function($rootScope, $scope, $parse, $filter, $injector, $http, $q, $state, $stateParams, $modal, $timeout, $interval, SweetAlert, FileUploader, i18nService, moment, Restangular, UserRestangular, WechatRestangular, BpmRestangular, api_configure_form, api_bpm_domain, api_bpm_data, api_user_data) {
  15. //console.log($stateParams);
  16. var vm = this;
  17. vm.options = {};
  18. vm.exampleTitle = ['expressionProperties', 'model property'];
  19. vm.fields = [];
  20. vm.model = {};
  21. $scope.langs = i18nService.getAllLangs();
  22. $scope.lang = 'zh-cn';
  23. //alert($rootScope.user.id,null,2);
  24. // vm.model["loginUser"] = $rootScope.user;
  25. var that = $injector;
  26. var parse = $parse;
  27. var modelWatch = "";
  28. var fieldsWatch = [];
  29. var serviceWatch = null;
  30. var formWatch = {};
  31. if (angular.isDefined($stateParams.model) && $stateParams.model != "") {
  32. modelWatch = JSON.parse($stateParams.model);
  33. // console.log("modelWatch:"+ JSON.stringify(modelWatch));
  34. }
  35. if (angular.isDefined($stateParams.fields) && $stateParams.fields != "") {
  36. fieldsWatch = JSON.parse($stateParams.fields);
  37. }
  38. if (angular.isDefined($stateParams.extjson) && $stateParams.extjson != "") {
  39. formWatch.extjson = JSON.parse($stateParams.extjson);
  40. }
  41. if (angular.isDefined($stateParams.cancelUrl) && $stateParams.cancelUrl != "") {
  42. formWatch.cancelUrl = $stateParams.cancelUrl;
  43. }
  44. if (angular.isDefined($stateParams.url) && $stateParams.url != "") {
  45. formWatch.url = $stateParams.url;
  46. }
  47. if (angular.isDefined($stateParams.service) && $stateParams.service != "") {
  48. if (that.has($stateParams.service)) {
  49. serviceWatch = that.get($stateParams.service);
  50. } else {
  51. serviceWatch = $stateParams.service;
  52. }
  53. }
  54. //用户测试数据,后续从header的auth中获取
  55. var userId = 2;
  56. userId = $rootScope.user.id;
  57. //==============处理表单设计数据 开始====================
  58. //处理组件加载后台数据选项的方法
  59. function refreshSelectOptions(searchVal, field) {
  60. //todo
  61. console.log(field);
  62. var filedata = {};
  63. if (field.key == 'id' && field.templateOptions.pkey == 'change.source') {
  64. field.templateOptions.options = [{ "id": 1, "name": "事件", "code": 1 }, { "id": 2, "name": "问题", "code": 2 }, { "id": 3, "name": "配置", "code": 3 }, { "id": 4, "name": "服务级别", "code": 4 }, { "id": 5, "name": "内部需求", "code": 5 }];
  65. } else if (field.templateOptions.optionsUrl) {
  66. var process = BpmRestangular.all("");
  67. filedata = { "idx": 0, "sum": 100 }
  68. if (field.templateOptions.ApiService) {
  69. process = UserRestangular.all("");
  70. filedata = { 'user': { 'roledata': { 'rolecode': 'inspectman' } }, "idx": 0, "sum": 1000 }
  71. }
  72. if (field.templateOptions.Apicommon) {
  73. process = WechatRestangular.all("");
  74. }
  75. var datakey = { "idx": 0, "sum": 1000 };
  76. if (field.templateOptions.modelreasondata) {
  77. datakey = field.templateOptions.modelreasondata
  78. }
  79. if (field.templateOptions.Apicommon) {
  80. process.customPOST(datakey, field.templateOptions.optionsUrl).then(function(result) {
  81. if (!field.templateOptions.options) {
  82. field.templateOptions.options = [];
  83. }
  84. if (field.templateOptions.optionsDataKey) {
  85. field.templateOptions.options = result[field.templateOptions.optionsDataKey];
  86. } else {
  87. field.templateOptions.options = result;
  88. }
  89. });
  90. } else {
  91. process.customPOST(filedata, field.templateOptions.optionsUrl).then(function(result) {
  92. if (!field.templateOptions.options) {
  93. field.templateOptions.options = [];
  94. }
  95. if (field.templateOptions.optionsDataKey) {
  96. field.templateOptions.options = result[field.templateOptions.optionsDataKey];
  97. } else {
  98. field.templateOptions.options = result;
  99. }
  100. });
  101. }
  102. }
  103. }
  104. //解析自定义表单设计数据
  105. function decodeVMForm(vmForm) {
  106. var result = { model: {}, fields: [] };
  107. //设置模型实体数据 begin
  108. // var mdata = vmForm.model;
  109. //解析数据实体
  110. var mdata = angular.fromJson(vmForm.model); //JSON.parse(field.extjson);
  111. angular.extend(result.model, mdata);
  112. if (modelWatch != null && modelWatch != '') {
  113. //angular.extend(result.model.incident,modelWatch.incident);
  114. //result.model.alarmType = modelWatch.alarmType;
  115. // vmForm.cancelUrl = modelWatch.cancelUrl;
  116. for (var index in modelWatch.model) {
  117. console.log(JSON.stringify(index + " " + JSON.stringify(modelWatch.model[index])));
  118. if (result.model[index] != null) {
  119. angular.extend(result.model[index], modelWatch.model[index]);
  120. } else {
  121. result.model[index] = modelWatch.model[index];
  122. }
  123. }
  124. }
  125. //设置模型实体数据 end
  126. //解析设计数据生成表单项 begin
  127. var fields = [];
  128. //处理修改设计数据中展示设置
  129. angular.forEach(vmForm.fields, function(field) {
  130. if (field.key == "") {
  131. delete field.key;
  132. }
  133. if (angular.isDefined(field.extjson)) {
  134. var extObj = angular.fromJson(field.extjson); //JSON.parse(field.extjson);
  135. angular.extend(field.templateOptions, extObj.templateOptions);
  136. delete extObj.templateOptions;
  137. for (var prop in extObj) {
  138. if (new RegExp("Expression").test(prop)) {
  139. //var obj = $scope.$eval(extObj[prop]);
  140. //extObj[prop] = $scope.$eval(extObj[prop]);
  141. if (extObj[prop] != null) {
  142. if (new RegExp("function").test(extObj[prop])) {
  143. var propValue = eval(extObj[prop]);
  144. extObj[prop] = propValue;
  145. } else {
  146. //console.log(extObj[prop]);
  147. var obj = $scope.$eval(extObj[prop]);
  148. extObj[prop] = obj;
  149. //console.log(obj);
  150. }
  151. }
  152. } else if (new RegExp("expressionProperties").test(prop)) {
  153. for (var p in extObj[prop]) {
  154. if (new RegExp("function").test(extObj[prop][p])) {
  155. var propValue = eval(extObj[prop][p]);
  156. extObj[prop][p] = propValue;
  157. } else {
  158. }
  159. }
  160. } else if ("watcher" == prop) {
  161. if (angular.isArray(extObj[prop])) {
  162. angular.forEach(extObj[prop], function(item, index) {
  163. for (var p in item) {
  164. if (new RegExp("function").test(item[p])) {
  165. var propValue = eval(item[p]);
  166. extObj[prop][index][p] = propValue;
  167. }
  168. }
  169. });
  170. } else if (angular.isObject(extObj[prop])) {
  171. for (var p in extObj[prop]) {
  172. if (new RegExp("function").test(extObj[prop][p])) {
  173. var propValue = eval(extObj[prop][p]);
  174. extObj[prop][p] = propValue;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. angular.extend(field, extObj);
  181. delete field.extjson;
  182. }
  183. if (angular.isDefined(field.templateOptions)) {
  184. var templateOs = field.templateOptions;
  185. for (var property in templateOs) {
  186. //console.log(property);
  187. if (angular.isString(templateOs[property]) && !(new RegExp("[\u4e00-\u9fa5]").test(templateOs[property]))) {
  188. if (new RegExp("function").test(templateOs[property])) {
  189. var propValue = eval(templateOs[property]);
  190. field.templateOptions[property] = propValue;
  191. } else {
  192. if (that.has(templateOs[property])) {
  193. field.templateOptions[property] = that.get(templateOs[property]);
  194. } else {
  195. field.templateOptions[property] = templateOs[property];
  196. }
  197. }
  198. } else if (templateOs[property] == null) {
  199. //delete field.templateOptions[property];
  200. } else {}
  201. }
  202. }
  203. //console.log(field);
  204. if (angular.isDefined(field.templateOptions) && angular.isDefined(field.templateOptions.extjson)) {
  205. var extObj = angular.fromJson(field.templateOptions.extjson); //JSON.parse(field.extjson);
  206. angular.extend(field.templateOptions, extObj);
  207. delete field.templateOptions.extjson;
  208. }
  209. //...
  210. if (field.templateOptions) {
  211. //处理远程获取数据控件方法调用
  212. if (field.templateOptions.optionsUrl) {
  213. field.templateOptions.refresh = refreshSelectOptions;
  214. }
  215. //处理嵌套属性数据绑定/
  216. if (field.templateOptions.pkey) {
  217. var pmodel, i = 0;
  218. angular.forEach(field.templateOptions.pkey.split("."), function(p) {
  219. if (i == 0) {
  220. if (result.model[p] == null) {
  221. result.model[p] = {};
  222. }
  223. pmodel = result.model[p];
  224. i++;
  225. } else {
  226. if (pmodel[p] == null) {
  227. pmodel[p] = {};
  228. }
  229. pmodel = pmodel[p];
  230. }
  231. });
  232. if (pmodel != null) {
  233. field.model = pmodel;
  234. if (pmodel[field.key] == null) {
  235. pmodel[field.key] = null;
  236. }
  237. }
  238. } else {
  239. if (result.model[field.key] == null) {
  240. result.model[field.key] = null;
  241. }
  242. }
  243. //处理弹出框组件初始化
  244. if (field.type == "ui-input-selectmodal") {
  245. field.templateOptions.modal = $modal;
  246. //field.templateOptions.Restangular = Restangular;
  247. } else if (field.type == "ui-requesterselect") {
  248. //field.templateOptions.language = $scope.lang;
  249. field.templateOptions.modal = $modal;
  250. field.templateOptions.UserService = api_user_data;
  251. } else if (field.type == "ui-userselect") {
  252. field.templateOptions.modal = $modal;
  253. //field.templateOptions.Restangular = Restangular;
  254. } else if (field.type == "ui-multiuserselect") {
  255. field.templateOptions.modal = $modal;
  256. } else if (field.type == "ui-search") {
  257. field.templateOptions.modal = $modal;
  258. } else if (field.type == "ui-modelselect") {
  259. field.templateOptions.modal = $modal;
  260. //console.log("$rootScope.user:" + JSON.stringify($rootScope.user));
  261. field.templateOptions.loginUser = $rootScope.user;
  262. //field.templateOptions.Restangular = Restangular;
  263. } else if (field.type == "ui-dropfile") {
  264. $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
  265. url: '/uploader'
  266. });
  267. field.templateOptions.taskId = $stateParams.taskId;
  268. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  269. field.templateOptions.userId = $rootScope.user.id;
  270. //field.ApiService=api_bpm_domain;
  271. } else if (field.type == "ui-dropfilenotup") {
  272. $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
  273. url: '/uploader'
  274. });
  275. field.templateOptions.taskId = $stateParams.taskId;
  276. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  277. field.templateOptions.userId = $rootScope.user.id;
  278. //field.ApiService=api_bpm_domain;
  279. } else if (field.type == "ui-uploadFile") {
  280. $scope.fileUploader = field.templateOptions.fileUploader = new FileUploader({
  281. url: '/uploader'
  282. });
  283. field.templateOptions.taskId = $stateParams.taskId;
  284. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  285. field.templateOptions.userId = $rootScope.user.id;
  286. //field.ApiService=api_bpm_domain;
  287. } else if (field.type == "ui-dropfiletable") {
  288. if (field.templateOptions.processInstanceId) {
  289. } else {
  290. field.templateOptions.processInstanceId = $stateParams.processInstanceId;
  291. }
  292. } else if (field.type == "ui-repeatSection") {
  293. var repeatForm = {
  294. model: {
  295. },
  296. fields: field.templateOptions.fields
  297. };
  298. repeatForm.model[field.key] = [];
  299. decodeVMForm(repeatForm);
  300. } else if (field.type == "ui-currentuser") {
  301. field.templateOptions.user = vm.model["loginUser"];
  302. }
  303. }
  304. // console.log(field);
  305. result.fields.push(field);
  306. });
  307. angular.extend($scope.vm.fields, result.fields);
  308. angular.extend($scope.vm.model, result.model);
  309. console.log($rootScope.user);
  310. //vm.model["loginUser"] = $rootScope.user;
  311. if (modelWatch != null && modelWatch != '' && modelWatch.cancelUrl != null && modelWatch.cancelUrl != '') {
  312. vmForm.cancelUrl = modelWatch.cancelUrl;
  313. }
  314. $scope.formData = vmForm;
  315. //console.log($scope.vm);
  316. //解析设计数据生成表单项 end
  317. return result;
  318. }
  319. //======================处理表单设计数据 结束========================
  320. $scope.ldloading = {};
  321. function filter(obj) {
  322. angular.forEach(obj, function(key, value) {
  323. if (value === "" || value === null) {
  324. delete obj[key];
  325. } else if (Object.prototype.toString.call(value) === '[object Object]') {
  326. filter(value);
  327. } else if (angular.isArray(value)) {
  328. angular.forEach(value, function(item) {
  329. filter(item);
  330. });
  331. }
  332. });
  333. }
  334. $scope.closeModel = function() {
  335. // console.log("$stateParams.formKey="+JSON.stringify($stateParams.formKey))
  336. if (angular.isDefined($stateParams.formKey) && $stateParams.formKey != "") {
  337. if ($stateParams.formKey == "inspectionform") {
  338. $state.go('app.inspection.inspectPlan', {});
  339. } else if ($stateParams.formKey == "inspection__detailform") {
  340. $state.go('app.inspection.inspectPlan', {});
  341. }
  342. event.preventDefault();
  343. }
  344. }
  345. vm.submit = function(data, style) {
  346. // console.log("data="+JSON.stringify(data));
  347. // if($stateParams.formKey=="system_edit"){
  348. // console.log("roleid="+$scope.roleid);
  349. if (vm.form.$valid) {
  350. if (data.inspection.planStrategy && data.inspection.planStrategy.id == 1) {
  351. if (Date.parse(data.inspection.planStartTime) > (new Date().setMinutes(new Date().getMinutes() + 1))) {
  352. vm.options.updateInitialValue();
  353. $scope.ldloading[style.replace('-', '_')] = true;
  354. // alert(JSON.stringify(vm.model), null, 2);
  355. var _ = window._;
  356. vm.model = (function filter(obj) {
  357. var dateTransKeys = [];
  358. var filtered = _.pick(obj, function(v, k, obj) {
  359. if (_.isDate(v)) {
  360. dateTransKeys.push(k);
  361. }
  362. return angular.isDefined(v) && v !== null && (angular.isArray(v) ? v.length > 0 : true) && (_.isPlainObject(v) ? (!_.isEmpty(v)) : true);
  363. });
  364. return _.cloneDeep(filtered, function(v, index, object) {
  365. if (angular.isArray(dateTransKeys) && dateTransKeys.length > 0) {
  366. angular.forEach(dateTransKeys, function(item) {
  367. v[item] = moment(v[item]).format('YYYY-MM-DD HH:mm:ss');
  368. });
  369. dateTransKey = [];
  370. return v;
  371. }
  372. return !(_.isEmpty(filtered)) && v !== filtered && _.isPlainObject(v) ? filter(v) : undefined;
  373. });
  374. })(vm.model);
  375. console.log("$scope.formData=" + $scope.formData);
  376. switch ($scope.formData.url) {
  377. case "start":
  378. if(vm.model.inspection){
  379. if(vm.model.inspection.executeUser.id){
  380. delete vm.model.inspection.scheduleClass
  381. }else if(vm.model.inspection.scheduleClass.id){
  382. delete vm.model.inspection.executeUser
  383. }
  384. }
  385. if (vm.model.inspection.id) {
  386. if (vm.model.inspection.requestCategoryDTO) {
  387. vm.model.inspection.requestCategoryDTO = { id: vm.model.inspection.requestCategoryDTO.id }
  388. }
  389. vm.model.inspection
  390. serviceWatch.updData($scope.formData.modelName, vm.model).then(function(response) {
  391. if (response) {
  392. var resData = Restangular.stripRestangular(response);
  393. // if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.data.id) {
  394. if ($scope.fileUploader != null) {
  395. //$scope.uploader.options.url();
  396. $scope.fileUploader.onBeforeUploadItem = function(item) {
  397. angular.extend(item.headers, $rootScope.getSession());
  398. // item.url = api_bpm_domain.uploadAttachment(resData.data.id, '00000', $rootScope.user.id).getRequestedUrl();
  399. item.url = api_bpm_domain.uploadAttachment(resData.data.id).getRequestedUrl();
  400. item.formData.push({ 'fileName': item.file.name });
  401. //console.log();
  402. };
  403. $scope.fileUploader.uploadAll();
  404. }
  405. if (resData && resData.status == 200) {
  406. SweetAlert.swal({
  407. title: "提交成功!",
  408. type: "success",
  409. confirmButtonColor: "#007AFF"
  410. }, function() {
  411. $state.go($scope.formData.cancelUrl);
  412. });
  413. } else {
  414. SweetAlert.swal({
  415. title: "提交失败",
  416. text: "提交失败,请稍后重试!",
  417. type: "error",
  418. confirmButtonColor: "#DD6B55"
  419. });
  420. }
  421. } else {
  422. SweetAlert.swal({
  423. title: "系统错误",
  424. text: "系统错误,请稍后重试!",
  425. type: "error",
  426. confirmButtonColor: "#DD6B55"
  427. });
  428. }
  429. $scope.ldloading[style.replace('-', '_')] = false;
  430. });
  431. } else {
  432. vm.model.inspection['createUser'] = $rootScope.user;
  433. serviceWatch.addData($scope.formData.modelName, vm.model).then(function(response) {
  434. if (response) {
  435. var resData = Restangular.stripRestangular(response);
  436. if ($scope.fileUploader != null && $scope.fileUploader.getNotUploadedItems().length > 0 && resData.data.id) {
  437. // if ($scope.fileUploader != null) {
  438. //$scope.uploader.options.url();
  439. $scope.fileUploader.onBeforeUploadItem = function(item) {
  440. angular.extend(item.headers, $rootScope.getSession());
  441. // item.url = api_bpm_domain.uploadAttachment(resData.data.id, '00000', $rootScope.user.id).getRequestedUrl();
  442. item.url = api_bpm_domain.uploadAttachment(resData.data.id).getRequestedUrl();
  443. item.formData.push({ 'filename': item.file.name });
  444. //console.log();
  445. };
  446. $scope.fileUploader.uploadAll();
  447. }
  448. if (resData && resData.status == 200) {
  449. SweetAlert.swal({
  450. title: "提交成功!",
  451. type: "success",
  452. confirmButtonColor: "#007AFF"
  453. }, function() {
  454. $state.go($scope.formData.cancelUrl);
  455. });
  456. } else {
  457. SweetAlert.swal({
  458. title: "系统错误",
  459. text: "系统错误,请稍后重试!",
  460. type: "error",
  461. confirmButtonColor: "#DD6B55"
  462. });
  463. }
  464. } else {
  465. SweetAlert.swal({
  466. title: "系统错误",
  467. text: "系统错误,请稍后重试!",
  468. type: "error",
  469. confirmButtonColor: "#DD6B55"
  470. });
  471. }
  472. $scope.ldloading[style.replace('-', '_')] = false;
  473. });
  474. }
  475. break;
  476. case "save":
  477. //addData
  478. serviceWatch.addData($scope.formData.modelName, vm.model).then(function(response) {
  479. if (response) {
  480. var resData = Restangular.stripRestangular(response);
  481. modelWatch.model
  482. // console.log("resData="+JSON.stringify(resData.data.role[0].id));
  483. if (resData && resData.status == 200) {
  484. SweetAlert.swal({
  485. title: "提交成功!",
  486. type: "success",
  487. confirmButtonColor: "#007AFF"
  488. }, function() {
  489. $state.go($scope.formData.cancelUrl);
  490. });
  491. } else {
  492. SweetAlert.swal({
  493. title: "系统错误",
  494. text: "系统错误,请稍后重试!",
  495. type: "error",
  496. confirmButtonColor: "#DD6B55"
  497. });
  498. }
  499. } else {
  500. SweetAlert.swal({
  501. title: "系统错误",
  502. text: "系统错误,请稍后重试!",
  503. type: "error",
  504. confirmButtonColor: "#DD6B55"
  505. });
  506. }
  507. $scope.ldloading[style.replace('-', '_')] = false;
  508. });
  509. break;
  510. case "close":
  511. $state.go($scope.formData.cancelUrl);
  512. break;
  513. default:
  514. $scope.ldloading[style.replace('-', '_')] = false;
  515. break;
  516. }
  517. } else {
  518. SweetAlert.swal({
  519. title: "提交失败",
  520. text: "执行时间有误,请确认执行时间大于当前时间!",
  521. type: "error",
  522. confirmButtonColor: "#DD6B55"
  523. });
  524. }
  525. } else {
  526. vm.options.updateInitialValue();
  527. $scope.ldloading[style.replace('-', '_')] = true;
  528. // alert(JSON.stringify(vm.model), null, 2);
  529. var _ = window._;
  530. vm.model = (function filter(obj) {
  531. var dateTransKeys = [];
  532. var filtered = _.pick(obj, function(v, k, obj) {
  533. if (_.isDate(v)) {
  534. dateTransKeys.push(k);
  535. }
  536. return angular.isDefined(v) && v !== null && (angular.isArray(v) ? v.length > 0 : true) && (_.isPlainObject(v) ? (!_.isEmpty(v)) : true);
  537. });
  538. return _.cloneDeep(filtered, function(v, index, object) {
  539. if (angular.isArray(dateTransKeys) && dateTransKeys.length > 0) {
  540. angular.forEach(dateTransKeys, function(item) {
  541. v[item] = moment(v[item]).format('YYYY-MM-DD HH:mm:ss');
  542. });
  543. dateTransKey = [];
  544. return v;
  545. }
  546. return !(_.isEmpty(filtered)) && v !== filtered && _.isPlainObject(v) ? filter(v) : undefined;
  547. });
  548. })(vm.model);
  549. console.log("$scope.formData=" + $scope.formData);
  550. switch ($scope.formData.url) {
  551. case "start":
  552. console.log(vm);
  553. if(vm.model.inspection){
  554. if(vm.model.inspection.executeUser.id){
  555. delete vm.model.inspection.scheduleClass
  556. }else if(vm.model.inspection.scheduleClass.id){
  557. delete vm.model.inspection.executeUser
  558. }
  559. }
  560. if (vm.model.inspection.id) {
  561. if (vm.model.inspection.requestCategoryDTO) {
  562. vm.model.inspection.requestCategoryDTO = { id: vm.model.inspection.requestCategoryDTO.id }
  563. }
  564. vm.model.inspection
  565. serviceWatch.updData($scope.formData.modelName, vm.model).then(function(response) {
  566. if (response) {
  567. var resData = Restangular.stripRestangular(response);
  568. if (resData && resData.status == 200) {
  569. SweetAlert.swal({
  570. title: "提交成功!",
  571. type: "success",
  572. confirmButtonColor: "#007AFF"
  573. }, function() {
  574. $state.go($scope.formData.cancelUrl);
  575. });
  576. } else {
  577. SweetAlert.swal({
  578. title: "提交失败",
  579. text: "提交失败,请稍后重试!",
  580. type: "error",
  581. confirmButtonColor: "#DD6B55"
  582. });
  583. }
  584. } else {
  585. SweetAlert.swal({
  586. title: "系统错误",
  587. text: "系统错误,请稍后重试!",
  588. type: "error",
  589. confirmButtonColor: "#DD6B55"
  590. });
  591. }
  592. $scope.ldloading[style.replace('-', '_')] = false;
  593. });
  594. } else {
  595. vm.model.inspection['createUser'] = $rootScope.user;
  596. serviceWatch.addData($scope.formData.modelName, vm.model).then(function(response) {
  597. if (response) {
  598. var resData = Restangular.stripRestangular(response);
  599. if (resData && resData.status == 200) {
  600. SweetAlert.swal({
  601. title: "提交成功!",
  602. type: "success",
  603. confirmButtonColor: "#007AFF"
  604. }, function() {
  605. $state.go($scope.formData.cancelUrl);
  606. });
  607. } else {
  608. SweetAlert.swal({
  609. title: "系统错误",
  610. text: "系统错误,请稍后重试!",
  611. type: "error",
  612. confirmButtonColor: "#DD6B55"
  613. });
  614. }
  615. } else {
  616. SweetAlert.swal({
  617. title: "系统错误",
  618. text: "系统错误,请稍后重试!",
  619. type: "error",
  620. confirmButtonColor: "#DD6B55"
  621. });
  622. }
  623. $scope.ldloading[style.replace('-', '_')] = false;
  624. });
  625. }
  626. break;
  627. case "save":
  628. //addData
  629. serviceWatch.addData($scope.formData.modelName, vm.model).then(function(response) {
  630. if (response) {
  631. var resData = Restangular.stripRestangular(response);
  632. modelWatch.model
  633. // console.log("resData="+JSON.stringify(resData.data.role[0].id));
  634. if (resData && resData.status == 200) {
  635. SweetAlert.swal({
  636. title: "提交成功!",
  637. type: "success",
  638. confirmButtonColor: "#007AFF"
  639. }, function() {
  640. $state.go($scope.formData.cancelUrl);
  641. });
  642. } else {
  643. SweetAlert.swal({
  644. title: "系统错误",
  645. text: "系统错误,请稍后重试!",
  646. type: "error",
  647. confirmButtonColor: "#DD6B55"
  648. });
  649. }
  650. } else {
  651. SweetAlert.swal({
  652. title: "系统错误",
  653. text: "系统错误,请稍后重试!",
  654. type: "error",
  655. confirmButtonColor: "#DD6B55"
  656. });
  657. }
  658. $scope.ldloading[style.replace('-', '_')] = false;
  659. });
  660. break;
  661. case "close":
  662. $state.go($scope.formData.cancelUrl);
  663. break;
  664. default:
  665. $scope.ldloading[style.replace('-', '_')] = false;
  666. break;
  667. }
  668. }
  669. } else {
  670. SweetAlert.swal({
  671. title: "校验错误",
  672. text: "请填写必填项!",
  673. type: "error",
  674. confirmButtonColor: "#DD6B55"
  675. });
  676. angular.forEach(vm.form.$error.required, function(item) {
  677. angular.forEach(vm.fields, function(f) {
  678. if (f.name == item.$name) {
  679. f.validation.show = true;
  680. }
  681. });
  682. })
  683. }
  684. // }else{
  685. // var role={};
  686. // var data1={};
  687. // console.log("data.role="+JSON.stringify(data.role));
  688. // role['rolecode']=data.role.rolecode;
  689. // role['id']=data.role.id;
  690. // console.log("role="+JSON.stringify(role));
  691. // data1['role']=role;
  692. // console.log("data1="+JSON.stringify(data1));
  693. // api_user_data.validate(data1,'role').then(function(response){
  694. // var resData = Restangular.stripRestangular(response);
  695. // console.log("resData11="+JSON.stringify(resData));
  696. // if(resData.status==200&&resData.data=="false"&&vm.form.$valid){
  697. // // if (vm.form.$valid ) {
  698. // vm.options.updateInitialValue();
  699. // $scope.ldloading[style.replace('-', '_')] = true;
  700. // // alert(JSON.stringify(vm.model), null, 2);
  701. // var _ = window._;
  702. // vm.model = (function filter(obj) {
  703. // var dateTransKeys = [];
  704. // var filtered = _.pick(obj, function (v, k, obj) {
  705. // if(_.isDate(v)){
  706. // dateTransKeys.push(k);
  707. // }
  708. // return angular.isDefined(v) && v !== null && (angular.isArray(v)?v.length>0:true) && (_.isPlainObject(v)?(!_.isEmpty(v)):true);
  709. // });
  710. // return _.cloneDeep(filtered, function (v, index, object) {
  711. // if(angular.isArray(dateTransKeys)&&dateTransKeys.length>0){
  712. // angular.forEach(dateTransKeys,function(item){
  713. // v[item] = moment(v[item]).format('YYYY-MM-DD HH:mm:ss');
  714. // });
  715. // dateTransKey = [];
  716. // return v;
  717. // }
  718. // return !(_.isEmpty(filtered)) && v !== filtered && _.isPlainObject(v) ? filter(v) : undefined;
  719. // });
  720. // })(vm.model);
  721. // // console.log("$scope.formData="+$scope.formData);
  722. // switch($scope.formData.url){
  723. // case "create" :
  724. // //vm.model["initUser"]=$rootScope.user.id;
  725. // //addData
  726. // serviceWatch.addData($scope.formData.modelName,vm.model).then(function(response){
  727. // if(response){
  728. // var resData = Restangular.stripRestangular(response);
  729. // if(resData&&resData.status==200){
  730. // SweetAlert.swal({
  731. // title: "提交成功!",
  732. // confirmButtonColor: "#007AFF"
  733. // },function(){
  734. // $state.go($scope.formData.cancelUrl);
  735. // });
  736. // }else{
  737. // SweetAlert.swal({
  738. // title: "系统错误",
  739. // text: "系统错误,请稍后重试!",
  740. // type: "error",
  741. // confirmButtonColor: "#DD6B55"
  742. // });
  743. // }
  744. // }else{
  745. // SweetAlert.swal({
  746. // title: "系统错误",
  747. // text: "系统错误,请稍后重试!",
  748. // type: "error",
  749. // confirmButtonColor: "#DD6B55"
  750. // });
  751. // }
  752. // $scope.ldloading[style.replace('-', '_')] = false;
  753. // });
  754. // break;
  755. // case "save" :
  756. // //addData
  757. // serviceWatch.addData($scope.formData.modelName, vm.model).then(function(response){
  758. // if(response){
  759. // var resData = Restangular.stripRestangular(response);
  760. // // console.log("resData="+JSON.stringify(resData.data));
  761. // // console.log("modelWatch.model="+JSON.stringify(modelWatch.model));
  762. // if(resData&&resData.status==200){
  763. // SweetAlert.swal({
  764. // title: "提交成功!",
  765. // confirmButtonColor: "#007AFF"
  766. // },function(){
  767. // $state.go($scope.formData.cancelUrl);
  768. // });
  769. // }else{
  770. // SweetAlert.swal({
  771. // title: "系统错误",
  772. // text: "系统错误,请稍后重试!",
  773. // type: "error",
  774. // confirmButtonColor: "#DD6B55"
  775. // });
  776. // }
  777. // }else{
  778. // SweetAlert.swal({
  779. // title: "系统错误",
  780. // text: "系统错误,请稍后重试!",
  781. // type: "error",
  782. // confirmButtonColor: "#DD6B55"
  783. // });
  784. // }
  785. // $scope.ldloading[style.replace('-', '_')] = false;
  786. // });
  787. // break;
  788. // case "close" :
  789. // $state.go($scope.formData.cancelUrl);
  790. // break;
  791. // default:
  792. // $scope.ldloading[style.replace('-', '_')] = false;
  793. // break;
  794. // }
  795. // }else if(resData.status==200&&resData.data=="true"&&vm.form.$valid){
  796. // SweetAlert.swal({
  797. // title: "角色代码以存在",
  798. // text: "请重新填写角色代码!",
  799. // type: "error",
  800. // confirmButtonColor: "#DD6B55"
  801. // });
  802. // }else{
  803. // SweetAlert.swal({
  804. // title: "校验错误",
  805. // text: "请填写必填项!",
  806. // type: "error",
  807. // confirmButtonColor: "#DD6B55"
  808. // });
  809. // angular.forEach(vm.form.$error.required, function(item){
  810. // angular.forEach(vm.fields,function(f){
  811. // if(f.name == item.$name){
  812. // f.validation.show = true;
  813. // }
  814. // });
  815. // })
  816. // }
  817. // })
  818. // }
  819. };
  820. $scope.vm = vm;
  821. if (angular.isDefined($stateParams.formKey) && $stateParams.formKey != "") {
  822. api_configure_form.renderForm($stateParams.formKey, '00000').then(function(responseData) {
  823. if (responseData) {
  824. //console.log("responseData>>>");console.log(responseData);
  825. var vmForm = Restangular.stripRestangular(responseData);
  826. if (vmForm) {
  827. //console.log("vmForm>>>");console.log(vmForm);
  828. var modelData = {};
  829. //modelData=myData.data;
  830. decodeVMForm(vmForm);
  831. }
  832. }
  833. });
  834. } else {
  835. //
  836. if (angular.isDefined(fieldsWatch) && fieldsWatch.length > 0) {
  837. var vmForm = {
  838. fields: fieldsWatch,
  839. model: modelWatch
  840. }
  841. angular.extend(vmForm, formWatch);
  842. //$scope.formData = vmForm;
  843. if (vmForm) {
  844. decodeVMForm(vmForm);
  845. }
  846. } else { //for form
  847. //TODO
  848. //测试数据 开始
  849. var testJson = {
  850. fields: [{
  851. key: 'formtitle',
  852. type: 'ui-title',
  853. noFormControl: true,
  854. templateOptions: {
  855. label: 'title is ',
  856. placeholder: 'Formly is terrific!'
  857. }
  858. },
  859. {
  860. key: 'b',
  861. type: 'ui-input',
  862. className: 'col-xs-4',
  863. templateOptions: {
  864. type: 'input',
  865. label: 'input a',
  866. placeholder: 'search a...',
  867. rBtn: {
  868. icon: 'fa fa-phone',
  869. onClick: function(val, opt, el, ev, model) { alert(val); }
  870. },
  871. lAddon: '<i class="fa fa-phone"/>'
  872. }
  873. },
  874. {
  875. key: 'id',
  876. type: 'ui-select',
  877. //initialValue:"false",
  878. templateOptions: {
  879. label: "测试默认值",
  880. optionsUrl: "abc",
  881. //options:[{"id":"false","name":"不取消"},{"id":"true","name":"取消"}],
  882. // refresh:function(){
  883. // return [{"id":1,"name":"事件","code":1},{"id":2,"name":"问题","code":2},{"id":3,"name":"配置","code":3},{"id":4,"name":"服务级别","code":4},{"id":5,"name":"内部需求","code":5}];
  884. // },
  885. //options:[{"id":1,"name":"事件","code":1},{"id":2,"name":"问题","code":2},{"id":3,"name":"配置","code":3},{"id":4,"name":"服务级别","code":4},{"id":5,"name":"内部需求","code":5}],
  886. valueProp: "id",
  887. labelProp: "name",
  888. pkey: "change.source"
  889. }
  890. },
  891. {
  892. key: 'systemType',
  893. type: 'ui-multiselect',
  894. className: 'col-xs-4',
  895. templateOptions: {
  896. label: "所属系统类型",
  897. pkey: "change",
  898. valueProp: "id",
  899. labelProp: "source",
  900. optionsUrl: "data/fetchDataList/changesystemtype",
  901. optionsDataKey: "list",
  902. onChange: function(value, options, that, event, model) {
  903. var field = null;
  904. angular.forEach(that.$parent.fields, function(item) {
  905. if (item.key == 'influenceDepartment') {
  906. field = item;
  907. }
  908. if (item.key == 'notificationDepartment') {
  909. notifyField = item;
  910. }
  911. })
  912. if (field != null) {
  913. field.templateOptions.optionsPostData = {
  914. 'systemIds': []
  915. }
  916. angular.forEach(value, function(vue) {
  917. field.templateOptions.optionsPostData['systemIds'].push({ 'id': vue });
  918. })
  919. field.value([]);
  920. if (value.length > 0) {
  921. field.templateOptions.refreshData(null, field);
  922. }
  923. }
  924. if (notifyField != null) {
  925. notifyField.templateOptions.optionsPostData = {
  926. 'systemIds': []
  927. }
  928. angular.forEach(value, function(vue) {
  929. notifyField.templateOptions.optionsPostData['systemIds'].push({ 'id': vue });
  930. })
  931. notifyField.value([]);
  932. if (value.length > 0) {
  933. notifyField.templateOptions.refreshData(null, notifyField);
  934. }
  935. }
  936. }
  937. }
  938. },
  939. {
  940. key: 'influenceDepartment',
  941. type: 'ui-multiselectplus',
  942. className: 'col-xs-4',
  943. templateOptions: {
  944. label: '所影响的应用系统、部门',
  945. pkey: "change",
  946. valueProp: '', //对应value
  947. labelProp: 'dept', //对应key
  948. optionsUrl: 'dept/findBySystemType', //对应后台地址,api/之前的部分省略
  949. optionsDataKey: 'list', //对应返回数组数据的键值,
  950. optionsPostData: function(options, model, scope) {
  951. return { "systemIds": [] };
  952. },
  953. refreshData: function(search, options, model, that) {
  954. options.templateOptions.options = [{ "id": 13, "dept": "村镇银行管理部" }, { "id": 14, "dept": "电子银行部" }];
  955. options.value(options.templateOptions.options);
  956. },
  957. optionsChecked: true,
  958. required: true,
  959. ApiService: UserRestangular
  960. }
  961. },
  962. {
  963. key: 'notificationDepartment',
  964. type: 'ui-multiselectplus',
  965. className: 'col-xs-4',
  966. templateOptions: {
  967. label: '需通知部门',
  968. pkey: "change",
  969. valueProp: 'id', //对应value
  970. labelProp: 'dept', //对应key
  971. optionsUrl: 'dept/findBySystemType', //对应后台地址,api/之前的部分省略
  972. optionsDataKey: 'list', //对应返回数组数据的键值,
  973. optionsPostData: function(options, model, scope) {
  974. return { "systemIds": [] };
  975. },
  976. optionsChecked: true,
  977. required: true,
  978. ApiService: UserRestangular
  979. }
  980. },
  981. {
  982. type: 'ui-label',
  983. key: 'arrayData',
  984. className: 'col-xs-4',
  985. templateOptions: {
  986. label: '数组label数据',
  987. labelProp: 'dept'
  988. }
  989. },
  990. {
  991. key: 'selectUser',
  992. type: 'ui-requesterselect',
  993. className: 'col-xs-12',
  994. templateOptions: {
  995. label: '报修人信息',
  996. modalTitle: '报修人列表',
  997. fetchItems: function(filterData, APIService) {
  998. return APIService.fetchDataList('requester', filterData);
  999. },
  1000. Restangular: Restangular,
  1001. ApiService: api_user_data
  1002. // onClick:function(val, options, field, event , model){
  1003. // console.log(options);
  1004. // }
  1005. }
  1006. },
  1007. {
  1008. key: 'cabUser',
  1009. type: 'ui-multiuserselect',
  1010. className: 'col-xs-12',
  1011. templateOptions: {
  1012. label: 'CAB评审成员',
  1013. modalTitle: 'CAB成员列表',
  1014. fetchItems: function(filterData, APIService) {
  1015. return APIService.fetchDataList('user', filterData);
  1016. },
  1017. Restangular: Restangular,
  1018. ApiService: api_user_data,
  1019. onClick: function(val, options, field, event, model) {
  1020. console.log(model);
  1021. }
  1022. }
  1023. },
  1024. // {
  1025. // key:'incident',
  1026. // type:'ui-modelselect',
  1027. // className:'col-xs-3',
  1028. // templateOptions:{
  1029. // label:'关联事件工单',
  1030. // modalTitle:'事件列表',
  1031. // fetchItems:function(filterData,APIService){
  1032. // return APIService.fetchDataList('incident',filterData);
  1033. // },
  1034. // Restangular:"Restangular",
  1035. // ApiService:"api_bpm_data",
  1036. // columnDefs:[
  1037. // { name:'id', width:80, enableFiltering:false},
  1038. // { name:'title', displayName:'事件主题', width:140},
  1039. // { name:'type.name', displayName:'事件类型', width:140},
  1040. // { name:'emergency.name', displayName:'紧急度', width:80},
  1041. // { name:'state.name', displayName:'状态', width:100},
  1042. // { name:'emergency.name', displayName:'紧急度', width:80},
  1043. // { name:'influence.name', displayName:'影响度', width:80},
  1044. // { name:'priority.name', displayName:'优先级', width:80},
  1045. // { name:'handlerUser.name', displayName:'当前处理人', width:100},
  1046. // { name:'acceptDate', displayName:'创建时间', width:100}
  1047. // ],
  1048. // displayName:'title',
  1049. // onClick:function(val, options, field, event , model){
  1050. // //model.start_code++;
  1051. // console.log(options);
  1052. // }
  1053. // }
  1054. // },
  1055. // {
  1056. // key: 'worknumber',
  1057. // type: 'ui-workernumber',
  1058. // className:'col-xs-3',
  1059. // templateOptions: {
  1060. // label: 'work number',
  1061. // Restangular:Restangular,
  1062. // ApiService:api_bpm_domain,
  1063. // getWorkernumber: function(APIService){
  1064. // return APIService.workernumber('bg');
  1065. // }
  1066. // }
  1067. // },
  1068. // {
  1069. // key: 'chkme',
  1070. // type: 'ui-checkbox',
  1071. // className:'col-xs-3',
  1072. // templateOptions: {
  1073. // label: 'Check me out'
  1074. // }
  1075. // },
  1076. // {
  1077. // key: 'droplink',
  1078. // type: 'ui-link',
  1079. // className: 'col-xs-3',
  1080. // templateOptions:{
  1081. // label:'添加附件',
  1082. // onClick:function(val, options, field, event ,model){
  1083. // if(angular.isUndefined(field.form.dropState)){
  1084. // field.form.dropState=false;
  1085. // }
  1086. // field.form.dropState=!field.form.dropState;
  1087. // console.log(field);
  1088. // }
  1089. // }
  1090. // },
  1091. // {
  1092. // key: 'dropfile',
  1093. // type: 'ui-dropfile',
  1094. // className: 'col-xs-12',
  1095. // templateOptions:{
  1096. // label:'附件',
  1097. // uploadUrl:'http://127.0.0.1:9008/saveAttachments'
  1098. // }
  1099. // },
  1100. // {
  1101. // type: 'ui-label',
  1102. // key: 'changesign',
  1103. // className: 'col-xs-4',
  1104. // templateOptions: {
  1105. // label:'变更请求单号',
  1106. // pkey:'change'
  1107. // }
  1108. // },
  1109. // {
  1110. // type: 'ui-label',
  1111. // key: 'title',
  1112. // className: 'col-xs-4',
  1113. // templateOptions: {
  1114. // label:'变更标题',
  1115. // pkey:'change'
  1116. // }
  1117. // },
  1118. // //关联发布单号
  1119. // //新建发布
  1120. // {
  1121. // key: 'droplist',
  1122. // type: 'ui-dropfiletable',
  1123. // className: 'col-xs-12',
  1124. // templateOptions:{
  1125. // label:'附件下载列表',
  1126. // Restangular:Restangular,
  1127. // processInstanceId:'250033',
  1128. // ApiService:api_bpm_domain
  1129. // }
  1130. // },
  1131. // {
  1132. // type: 'ui-repeatSection',
  1133. // key: 'investments',
  1134. // className: 'col-xs-12',
  1135. // templateOptions: {
  1136. // btnText: '新增变更施工单',
  1137. // fields: [
  1138. // {
  1139. // className: 'col-xs-3',
  1140. // type: 'ui-input',
  1141. // key: 'aboutci',
  1142. // templateOptions: {
  1143. // label: '关联的配置项',
  1144. // required: true
  1145. // }
  1146. // },
  1147. // {
  1148. // className: 'col-xs-3',
  1149. // type: 'ui-datepicker',
  1150. // key: 'planbegintime',
  1151. // templateOptions: {
  1152. // label: '计划开始时间',
  1153. // required: true
  1154. // }
  1155. // },
  1156. // {
  1157. // className: 'col-xs-3',
  1158. // type: 'ui-datepicker',
  1159. // key: 'planendtime',
  1160. // templateOptions: {
  1161. // label: '计划完成时间',
  1162. // required: true
  1163. // }
  1164. // },
  1165. // {
  1166. // className: 'col-xs-12',
  1167. // type: 'ui-userselect',
  1168. // key: 'handleruser',
  1169. // templateOptions: {
  1170. // label: '实施人员信息',
  1171. // modalTitle:'实施人列表',
  1172. // required: true,
  1173. // fetchItems:function(filterData, APIService){
  1174. // return APIService.fetchDataList('user',filterData);
  1175. // },
  1176. // Restangular:Restangular,
  1177. // ApiService:api_user_data,
  1178. // onClick:function(val, options, field, event , model){
  1179. // //model.start_code++;
  1180. // console.log(options);
  1181. // }
  1182. // }
  1183. // },
  1184. // {
  1185. // className: 'col-xs-8',
  1186. // type: 'ui-textarea',
  1187. // key: 'handlerContent',
  1188. // templateOptions: {
  1189. // label: '实施内容',
  1190. // required: true,
  1191. // row:10
  1192. // }
  1193. // },{
  1194. // noFormControl: true,
  1195. // template:'<hr>'
  1196. // }]
  1197. // }
  1198. // },
  1199. // {
  1200. // key: 'droplist',
  1201. // type: 'ui-dropfiletable',
  1202. // className: 'col-xs-12',
  1203. // templateOptions:{
  1204. // label:'附件下载列表',
  1205. // Restangular:Restangular,
  1206. // processInstanceId:'250033',
  1207. // ApiService:api_bpm_domain
  1208. // }
  1209. // },
  1210. // {
  1211. // key: 'start_code',
  1212. // className:'col-xs-6',
  1213. // type: 'ui-hidden'
  1214. // },
  1215. // {
  1216. // key:'remark',
  1217. // type:'ui-textarea',
  1218. // className:'col-xs-12',
  1219. // templateOptions:{
  1220. // label:'remark is ',
  1221. // rows:3
  1222. // }
  1223. // },
  1224. // {
  1225. // key:'setStartCode',
  1226. // type:'ui-button',
  1227. // className:'col-xs-4',
  1228. // templateOptions:{
  1229. // label:'升级为变更',
  1230. // onClick:function(val, options, field, event ,model){
  1231. // console.log(options);
  1232. // event.preventDefault();
  1233. // //model.start_code++;
  1234. // //console.log(options);
  1235. // }
  1236. // }
  1237. // }
  1238. ],
  1239. model: {
  1240. username: "robin lau",
  1241. password: "123456",
  1242. change: { source: { id: 5 } },
  1243. chkme: false,
  1244. start_code: 0,
  1245. arrayData: [{ "id": 13, "dept": "村镇银行管理部" }, { "id": 14, "dept": "电子银行部" }],
  1246. formtitle: "Hey!I am title value!",
  1247. name: {
  1248. first: "robin",
  1249. last: "lau"
  1250. },
  1251. multiselectItem: []
  1252. //date:"2015-09-15 00:00:00"
  1253. }
  1254. };
  1255. setTimeout(function() {
  1256. decodeVMForm(testJson);
  1257. $scope.$apply();
  1258. }, 500);
  1259. //测试数据结束
  1260. }
  1261. }
  1262. console.log("end decode");
  1263. }
  1264. ]);