123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- "use strict";
- app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", "api_is_category", function (t, a, n, e, i, s, r, o, l, u, d, c, g, api_is_category) {
- a.langs = l.getAllLangs(), a.lang = "zh-cn", l.setCurrentLang(a.lang);
- var f = (t.user, r._, {
- idx: 0,
- sum: 1e3
- });
- // a.autoCloseIncidentHour = 24;//默认24小时自动关单
- a.changeAutoCloseIncidentHour = function(e){
- var v = parseFloat(e.target.value)?parseFloat(e.target.value):0;
- a.autoCloseIncidentHour.valueconfig = v > 0 ? v : 0;
- }
- //保存
- a.savesystem = function () {
- var arr = {};
- arr.systemConfiguration = [];
- angular.forEach(a.baseConfig, function (v) {
- if (v.keyconfig == 'pwd' || v.keyconfig == 'conversationSeconds') {
- arr.systemConfiguration.push(v);//用户默认密码,登录有效时长
- }
- })
- arr.systemConfiguration.push(a.repairMain);//报修主体
- arr.systemConfiguration.push(a.ifCreate);//自动建单
- arr.systemConfiguration.push(a.reqHasCategory);//是否选择事件分类
- arr.systemConfiguration.push(a.incidentWithConsumable);//是否需要绑定耗材
- arr.systemConfiguration.push(a.wxIncidentWithCmdb);//是否需要绑定资产
- arr.systemConfiguration.push(a.requesterLgoinType);//保修人登录方式
- arr.systemConfiguration.push(a.autoCloseIncidentHour);//自动关单小时
- console.log(arr,99999);
- g.addData("systemConfiguration", arr).then(function (t) {
- if (t.status == 200) {
- //获取报修主体
- api_is_category.isCategory({ "idx": 0, "sum": 1000 })
- .then(function (res) {
- if (res.status == 200) {
- //存储报修主体到缓存
- var list = res.list;
- var repairMain = list.find((v) => v.keyconfig == "repairMain"); //报修主体
- var incidentWithConsumable = list.find(
- (v) => v.keyconfig == "incidentWithConsumable"
- ); //是否绑定耗材
- var wxIncidentWithCmdb = list.find(
- (v) => v.keyconfig == "wxIncidentWithCmdb"
- ); //是否绑定资产
- sessionStorage.setItem(
- "repair_main",
- JSON.stringify(repairMain)
- );
- sessionStorage.setItem(
- "incidentWithConsumable",
- incidentWithConsumable.valueconfig
- );
- sessionStorage.setItem(
- "wxIncidentWithCmdb",
- wxIncidentWithCmdb.valueconfig
- );
- o.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- })
- }
- })
- .catch(function (err) {
- console.log(err)
- })
- } else {
- o.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- })
- }
- })
- }, a.ldloading = {}, a.refreshData = function (t, n) {
- a.ldloading[t.replace("-", "_")] = !0, angular.isUndefined(n) && (n = f), a.myData = [], g.fetchDataList("systemConfiguration", n).then(function (n) {
- if (n.status == 200) {
- var e = c.stripRestangular(n);
- a.myData = e.list, a.ldloading[t.replace("-", "_")] = !1
- console.log(a.myData);
- a.baseConfig = [];//基本配置
- a.cacheConfig = [];//缓存配置
- a.repairMain = {};//报修主体
- console.log(a.myData,77777)
- angular.forEach(a.myData, function (v, i) {
- if (v.keyconfig == 'pwd' || v.keyconfig == 'conversationSeconds' || v.keyconfig == 'formUri' || v.keyconfig == 'localhost' || v.keyconfig == 'verificationPath' || v.keyconfig == 'docpath') {
- a.baseConfig.push(v);//基本配置
- }
- if (v.keyconfig == 'userRedisIp' || v.keyconfig == 'userRedisPort') {
- a.cacheConfig.push(v);//缓存配置
- }
- if (v.keyconfig == 'repairMain') {
- a.repairMain = v;//报修主体
- }
- if (v.keyconfig == 'ifCreate') {
- a.ifCreate = v;//自动建单
- }
- if (v.keyconfig == 'reqHasCategory') {
- a.reqHasCategory = v;//是否选择事件分类
- }
- if (v.keyconfig == 'incidentWithConsumable') {
- a.incidentWithConsumable = v;//是否需要绑定耗材
- }
- if (v.keyconfig == 'wxIncidentWithCmdb') {
- a.wxIncidentWithCmdb = v;//是否需要绑定资产
- }
- if (v.keyconfig == 'requesterLgoinType') {
- a.requesterLgoinType = v;//报修人登录方式
- }
- if (v.keyconfig == 'autoCloseIncidentHour') {
- v.valueconfig = parseFloat(v.valueconfig)
- a.autoCloseIncidentHour = v;//自动关单小时
- }
- })
- }else{
- console.log(n.status);
- }
- }, function () {
- a.ldloading[t.replace("-", "_")] = !1
- })
- }, a.refreshData("expand-right", f)
- }]);
|