inspectForm.js 72 KB

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