knowledgeform.js 71 KB

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