knowledgeform.js 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  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,8989);
  805. //知识库分类必填项
  806. if(!(filedata.solutionType&&filedata.solutionType.id)){
  807. SweetAlert.swal({
  808. title: "知识库分类未填!",
  809. text:"请填写此项",
  810. type: "error",
  811. confirmButtonColor: "#DD6B55"
  812. });
  813. return;
  814. }
  815. var shenhe_data = { "solution": filedata }
  816. api_solution.jry_updateSolution(shenhe_data).then(function (res) {
  817. SweetAlert.swal({
  818. title: "审核通过!",
  819. type: "success",
  820. confirmButtonColor: "#007AFF"
  821. }, function () {
  822. $state.go('app.knowledge.manager');
  823. });
  824. })
  825. }
  826. // 审核驳回
  827. $scope.jry_shenhe_bohui = function () {
  828. var filedata = vm.model.knowledge;
  829. filedata.status.id = 73;
  830. filedata["approveUser"] = { id: loginUser.id };
  831. filedata.reject = $scope.bohui_YY;
  832. filedata.approvetime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss');
  833. // delete(filedata["item"]);
  834. // delete(filedata.solutionType["isExpanded"]);
  835. console.log(filedata);
  836. var shenhe_data = { "solution": filedata }
  837. api_solution.jry_updateSolution(shenhe_data).then(function (res) {
  838. SweetAlert.swal({
  839. title: "该知识已驳回!",
  840. type: "success",
  841. confirmButtonColor: "#007AFF"
  842. }, function () {
  843. $state.go('app.knowledge.manager');
  844. });
  845. })
  846. }
  847. $scope.bohui_show = false;
  848. $scope.jry_bohuiyuanyin_show = function () {
  849. $scope.bohui_show = true;
  850. }
  851. $scope.bohuiyuanyin_close = function () {
  852. $scope.bohui_show = false;
  853. }
  854. $scope.vm = vm;
  855. if (angular.isDefined($stateParams.formKey) && $stateParams.formKey != "") {
  856. api_configure_form.renderForm($stateParams.formKey, '00000').then(function (responseData) {
  857. if (responseData) {
  858. //console.log("responseData>>>");console.log(responseData);
  859. var vmForm = Restangular.stripRestangular(responseData);
  860. if (vmForm) {
  861. //console.log("vmForm>>>");console.log(vmForm);
  862. var modelData = {};
  863. //modelData=myData.data;
  864. decodeVMForm(vmForm);
  865. }
  866. }
  867. });
  868. } else {
  869. //
  870. if (angular.isDefined(fieldsWatch) && fieldsWatch.length > 0) {
  871. var vmForm = {
  872. fields: fieldsWatch,
  873. model: modelWatch
  874. }
  875. angular.extend(vmForm, formWatch);
  876. //$scope.formData = vmForm;
  877. if (vmForm) {
  878. decodeVMForm(vmForm);
  879. }
  880. } else { //for form
  881. //TODO
  882. //测试数据 开始
  883. var testJson = {
  884. fields: [{
  885. key: 'formtitle',
  886. type: 'ui-title',
  887. noFormControl: true,
  888. templateOptions: {
  889. label: 'title is ',
  890. placeholder: 'Formly is terrific!'
  891. }
  892. },
  893. {
  894. key: 'b',
  895. type: 'ui-input',
  896. className: 'col-xs-4',
  897. templateOptions: {
  898. type: 'input',
  899. label: 'input a',
  900. placeholder: 'search a...',
  901. rBtn: {
  902. icon: 'fa fa-phone',
  903. onClick: function (val, opt, el, ev, model) { alert(val); }
  904. },
  905. lAddon: '<i class="fa fa-phone"/>'
  906. }
  907. },
  908. {
  909. key: 'id',
  910. type: 'ui-select',
  911. //initialValue:"false",
  912. templateOptions: {
  913. label: "测试默认值",
  914. optionsUrl: "abc",
  915. //options:[{"id":"false","name":"不取消"},{"id":"true","name":"取消"}],
  916. // refresh:function(){
  917. // 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}];
  918. // },
  919. //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}],
  920. valueProp: "id",
  921. labelProp: "name",
  922. pkey: "change.source"
  923. }
  924. },
  925. {
  926. key: 'systemType',
  927. type: 'ui-multiselect',
  928. className: 'col-xs-4',
  929. templateOptions: {
  930. label: "所属系统类型",
  931. pkey: "change",
  932. valueProp: "id",
  933. labelProp: "source",
  934. optionsUrl: "data/fetchDataList/changesystemtype",
  935. optionsDataKey: "list",
  936. onChange: function (value, options, that, event, model) {
  937. var field = null;
  938. angular.forEach(that.$parent.fields, function (item) {
  939. if (item.key == 'influenceDepartment') {
  940. field = item;
  941. }
  942. if (item.key == 'notificationDepartment') {
  943. notifyField = item;
  944. }
  945. })
  946. if (field != null) {
  947. field.templateOptions.optionsPostData = {
  948. 'systemIds': []
  949. }
  950. angular.forEach(value, function (vue) {
  951. field.templateOptions.optionsPostData['systemIds'].push({ 'id': vue });
  952. })
  953. field.value([]);
  954. if (value.length > 0) {
  955. field.templateOptions.refreshData(null, field);
  956. }
  957. }
  958. if (notifyField != null) {
  959. notifyField.templateOptions.optionsPostData = {
  960. 'systemIds': []
  961. }
  962. angular.forEach(value, function (vue) {
  963. notifyField.templateOptions.optionsPostData['systemIds'].push({ 'id': vue });
  964. })
  965. notifyField.value([]);
  966. if (value.length > 0) {
  967. notifyField.templateOptions.refreshData(null, notifyField);
  968. }
  969. }
  970. }
  971. }
  972. },
  973. {
  974. key: 'influenceDepartment',
  975. type: 'ui-multiselectplus',
  976. className: 'col-xs-4',
  977. templateOptions: {
  978. label: '所影响的应用系统、科室',
  979. pkey: "change",
  980. valueProp: '', //对应value
  981. labelProp: 'dept', //对应key
  982. optionsUrl: 'dept/findBySystemType', //对应后台地址,api/之前的部分省略
  983. optionsDataKey: 'list', //对应返回数组数据的键值,
  984. optionsPostData: function (options, model, scope) {
  985. return { "systemIds": [] };
  986. },
  987. refreshData: function (search, options, model, that) {
  988. options.templateOptions.options = [{ "id": 13, "dept": "村镇银行管理部" }, { "id": 14, "dept": "电子银行部" }];
  989. options.value(options.templateOptions.options);
  990. },
  991. optionsChecked: true,
  992. required: true,
  993. ApiService: UserRestangular
  994. }
  995. },
  996. {
  997. key: 'notificationDepartment',
  998. type: 'ui-multiselectplus',
  999. className: 'col-xs-4',
  1000. templateOptions: {
  1001. label: '需通知科室',
  1002. pkey: "change",
  1003. valueProp: 'id', //对应value
  1004. labelProp: 'dept', //对应key
  1005. optionsUrl: 'dept/findBySystemType', //对应后台地址,api/之前的部分省略
  1006. optionsDataKey: 'list', //对应返回数组数据的键值,
  1007. optionsPostData: function (options, model, scope) {
  1008. return { "systemIds": [] };
  1009. },
  1010. optionsChecked: true,
  1011. required: true,
  1012. ApiService: UserRestangular
  1013. }
  1014. },
  1015. {
  1016. type: 'ui-label',
  1017. key: 'arrayData',
  1018. className: 'col-xs-4',
  1019. templateOptions: {
  1020. label: '数组label数据',
  1021. labelProp: 'dept'
  1022. }
  1023. },
  1024. {
  1025. key: 'selectUser',
  1026. type: 'ui-requesterselect',
  1027. className: 'col-xs-12',
  1028. templateOptions: {
  1029. label: '报修人信息',
  1030. modalTitle: '报修人列表',
  1031. fetchItems: function (filterData, APIService) {
  1032. return APIService.fetchDataList('requester', filterData);
  1033. },
  1034. Restangular: Restangular,
  1035. ApiService: api_user_data
  1036. // onClick:function(val, options, field, event , model){
  1037. // console.log(options);
  1038. // }
  1039. }
  1040. },
  1041. {
  1042. key: 'cabUser',
  1043. type: 'ui-multiuserselect',
  1044. className: 'col-xs-12',
  1045. templateOptions: {
  1046. label: 'CAB评审成员',
  1047. modalTitle: 'CAB成员列表',
  1048. fetchItems: function (filterData, APIService) {
  1049. return APIService.fetchDataList('user', filterData);
  1050. },
  1051. Restangular: Restangular,
  1052. ApiService: api_user_data,
  1053. onClick: function (val, options, field, event, model) {
  1054. console.log(model);
  1055. }
  1056. }
  1057. },
  1058. // {
  1059. // key:'incident',
  1060. // type:'ui-modelselect',
  1061. // className:'col-xs-3',
  1062. // templateOptions:{
  1063. // label:'关联事件工单',
  1064. // modalTitle:'事件列表',
  1065. // fetchItems:function(filterData,APIService){
  1066. // return APIService.fetchDataList('incident',filterData);
  1067. // },
  1068. // Restangular:"Restangular",
  1069. // ApiService:"api_bpm_data",
  1070. // columnDefs:[
  1071. // { name:'id', width:80, enableFiltering:false},
  1072. // { name:'title', displayName:'事件主题', width:140},
  1073. // { name:'type.name', displayName:'事件类型', width:140},
  1074. // { name:'emergency.name', displayName:'紧急度', width:80},
  1075. // { name:'state.name', displayName:'状态', width:100},
  1076. // { name:'emergency.name', displayName:'紧急度', width:80},
  1077. // { name:'influence.name', displayName:'影响度', width:80},
  1078. // { name:'priority.name', displayName:'优先级', width:80},
  1079. // { name:'handlerUser.name', displayName:'当前处理人', width:100},
  1080. // { name:'acceptDate', displayName:'创建时间', width:100}
  1081. // ],
  1082. // displayName:'title',
  1083. // onClick:function(val, options, field, event , model){
  1084. // //model.start_code++;
  1085. // console.log(options);
  1086. // }
  1087. // }
  1088. // },
  1089. // {
  1090. // key: 'worknumber',
  1091. // type: 'ui-workernumber',
  1092. // className:'col-xs-3',
  1093. // templateOptions: {
  1094. // label: 'work number',
  1095. // Restangular:Restangular,
  1096. // ApiService:api_bpm_domain,
  1097. // getWorkernumber: function(APIService){
  1098. // return APIService.workernumber('bg');
  1099. // }
  1100. // }
  1101. // },
  1102. // {
  1103. // key: 'chkme',
  1104. // type: 'ui-checkbox',
  1105. // className:'col-xs-3',
  1106. // templateOptions: {
  1107. // label: 'Check me out'
  1108. // }
  1109. // },
  1110. // {
  1111. // key: 'droplink',
  1112. // type: 'ui-link',
  1113. // className: 'col-xs-3',
  1114. // templateOptions:{
  1115. // label:'添加附件',
  1116. // onClick:function(val, options, field, event ,model){
  1117. // if(angular.isUndefined(field.form.dropState)){
  1118. // field.form.dropState=false;
  1119. // }
  1120. // field.form.dropState=!field.form.dropState;
  1121. // console.log(field);
  1122. // }
  1123. // }
  1124. // },
  1125. // {
  1126. // key: 'dropfile',
  1127. // type: 'ui-dropfile',
  1128. // className: 'col-xs-12',
  1129. // templateOptions:{
  1130. // label:'附件',
  1131. // uploadUrl:'http://127.0.0.1:9008/saveAttachments'
  1132. // }
  1133. // },
  1134. // {
  1135. // type: 'ui-label',
  1136. // key: 'changesign',
  1137. // className: 'col-xs-4',
  1138. // templateOptions: {
  1139. // label:'变更请求单号',
  1140. // pkey:'change'
  1141. // }
  1142. // },
  1143. // {
  1144. // type: 'ui-label',
  1145. // key: 'title',
  1146. // className: 'col-xs-4',
  1147. // templateOptions: {
  1148. // label:'变更标题',
  1149. // pkey:'change'
  1150. // }
  1151. // },
  1152. // //关联发布单号
  1153. // //新建发布
  1154. // {
  1155. // key: 'droplist',
  1156. // type: 'ui-dropfiletable',
  1157. // className: 'col-xs-12',
  1158. // templateOptions:{
  1159. // label:'附件下载列表',
  1160. // Restangular:Restangular,
  1161. // processInstanceId:'250033',
  1162. // ApiService:api_bpm_domain
  1163. // }
  1164. // },
  1165. // {
  1166. // type: 'ui-repeatSection',
  1167. // key: 'investments',
  1168. // className: 'col-xs-12',
  1169. // templateOptions: {
  1170. // btnText: '新增变更施工单',
  1171. // fields: [
  1172. // {
  1173. // className: 'col-xs-3',
  1174. // type: 'ui-input',
  1175. // key: 'aboutci',
  1176. // templateOptions: {
  1177. // label: '关联的配置项',
  1178. // required: true
  1179. // }
  1180. // },
  1181. // {
  1182. // className: 'col-xs-3',
  1183. // type: 'ui-datepicker',
  1184. // key: 'planbegintime',
  1185. // templateOptions: {
  1186. // label: '计划开始时间',
  1187. // required: true
  1188. // }
  1189. // },
  1190. // {
  1191. // className: 'col-xs-3',
  1192. // type: 'ui-datepicker',
  1193. // key: 'planendtime',
  1194. // templateOptions: {
  1195. // label: '计划完成时间',
  1196. // required: true
  1197. // }
  1198. // },
  1199. // {
  1200. // className: 'col-xs-12',
  1201. // type: 'ui-userselect',
  1202. // key: 'handleruser',
  1203. // templateOptions: {
  1204. // label: '实施人员信息',
  1205. // modalTitle:'实施人列表',
  1206. // required: true,
  1207. // fetchItems:function(filterData, APIService){
  1208. // return APIService.fetchDataList('user',filterData);
  1209. // },
  1210. // Restangular:Restangular,
  1211. // ApiService:api_user_data,
  1212. // onClick:function(val, options, field, event , model){
  1213. // //model.start_code++;
  1214. // console.log(options);
  1215. // }
  1216. // }
  1217. // },
  1218. // {
  1219. // className: 'col-xs-8',
  1220. // type: 'ui-textarea',
  1221. // key: 'handlerContent',
  1222. // templateOptions: {
  1223. // label: '实施内容',
  1224. // required: true,
  1225. // row:10
  1226. // }
  1227. // },{
  1228. // noFormControl: true,
  1229. // template:'<hr>'
  1230. // }]
  1231. // }
  1232. // },
  1233. // {
  1234. // key: 'droplist',
  1235. // type: 'ui-dropfiletable',
  1236. // className: 'col-xs-12',
  1237. // templateOptions:{
  1238. // label:'附件下载列表',
  1239. // Restangular:Restangular,
  1240. // processInstanceId:'250033',
  1241. // ApiService:api_bpm_domain
  1242. // }
  1243. // },
  1244. // {
  1245. // key: 'start_code',
  1246. // className:'col-xs-6',
  1247. // type: 'ui-hidden'
  1248. // },
  1249. // {
  1250. // key:'remark',
  1251. // type:'ui-textarea',
  1252. // className:'col-xs-12',
  1253. // templateOptions:{
  1254. // label:'remark is ',
  1255. // rows:3
  1256. // }
  1257. // },
  1258. // {
  1259. // key:'setStartCode',
  1260. // type:'ui-button',
  1261. // className:'col-xs-4',
  1262. // templateOptions:{
  1263. // label:'升级为变更',
  1264. // onClick:function(val, options, field, event ,model){
  1265. // console.log(options);
  1266. // event.preventDefault();
  1267. // //model.start_code++;
  1268. // //console.log(options);
  1269. // }
  1270. // }
  1271. // }
  1272. ],
  1273. model: {
  1274. username: "robin lau",
  1275. password: "123456",
  1276. change: { source: { id: 5 } },
  1277. chkme: false,
  1278. start_code: 0,
  1279. arrayData: [{ "id": 13, "dept": "村镇银行管理部" }, { "id": 14, "dept": "电子银行部" }],
  1280. formtitle: "Hey!I am title value!",
  1281. name: {
  1282. first: "robin",
  1283. last: "lau"
  1284. },
  1285. multiselectItem: []
  1286. //date:"2015-09-15 00:00:00"
  1287. }
  1288. };
  1289. setTimeout(function () {
  1290. decodeVMForm(testJson);
  1291. $scope.$apply();
  1292. }, 500);
  1293. //测试数据结束
  1294. }
  1295. }
  1296. console.log("end decode");
  1297. }
  1298. ]);