吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1785|回复: 19
收起左侧

[求助] 代码优化。

[复制链接]
q7215754 发表于 2022-6-30 14:03
25吾爱币
本帖最后由 q7215754 于 2022-7-1 15:08 编辑

[JavaScript] 纯文本查看 复制代码
一、
function changeParam() {

    let _this = this;

    _this.linkInfoKeys.splice(0);

    if (_this.dataForm.dblink == "0") {

        let dbcolumn = getColumn("dbColumn", _this);

        dbcolumn.forEach((item) => {

            _this.linkInfoKeys.push(item.prop);

        });

    } else if (_this.dataForm.dblink == "1") {

        let apiType = _this.dataForm.apiType;

        console.log(apiType, "apiType");

        switch (apiType) {

        case "rms":

            let mtColumn = getColumn("mtColumn", _this);

            mtColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

        case "tplus":

            let tColumn = getColumn("tColumn", _this);

            tColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "jzy":

            let jzyColumn = getColumn("jzyColumn", _this);

            jzyColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "NCC":

        case "NC6X":

        case "NC5X":

            let ncColumn = getColumn("ncColumn", _this);

            ncColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "kry":

            let kryColumn = getColumn("kryColumn", _this);

            kryColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "k3cloud":

            let k3cloudColumn = getColumn("k3cloudColumn", _this);

            k3cloudColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "yida":

            let yidaColumn = getColumn("yidaColumn", _this);

            yidaColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "jdy":

            let jdyColumn = getColumn("jdyColumn", _this);

            jdyColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "tyst":

            let sqstColumn = getColumn("sqstColumn", _this);

            sqstColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "u8":

            let u8Column = getColumn("u8Column", _this);

            u8Column.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "u8cloud":

            let u8cloudColumn = getColumn("u8cloudColumn", _this);

            u8cloudColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "tdf":

            let tdfColumn = getColumn("tdfColumn", _this);

            tdfColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "yzy":

            let yzyColumn = getColumn("yzyColumn", _this);

            yzyColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "mtsg":

            let mtsgColumn = getColumn("mtsgColumn", _this);

            mtsgColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "zly":

            let zlyColumn = getColumn("zlyColumn", _this);

            zlyColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "hacc":

            let haccColumn = getColumn("haccColumn", _this);

            haccColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "fbt":

            let fbtColumn = getColumn("fbtColumn", _this);

            fbtColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "hll":

            let hllColumn = getColumn("hllColumn", _this);

            hllColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "ekb":

            let ekbColumn = getColumn("ekbColumn", _this);

            ekbColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "myc":

            let mycColumn = getColumn("mycColumn", _this);

            mycColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "kw":

            let kiswColumn = getColumn("kiswColumn", _this);

            kiswColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "pal":

            let palColumn = getColumn("palColumn", _this);

            palColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "kis":

            let kisColumn = getColumn("kisColumn", _this);

            kisColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "eas":

            let easColumn = getColumn("easColumn", _this);

            easColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "sap":

            let sapColumn = getColumn("sapColumn", _this);

            sapColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        case "zhct":

            let zhctColumn = getColumn("zhctColumn", _this);

            zhctColumn.forEach((item) => {

                _this.linkInfoKeys.push(item.prop);

            });

            break;

        default:

            _this.linkInfoKeys = [];

        }

        _this.linkInfoKeys.push("apiType");

    }

    for (let key in _this.dataForm) {

        if (_this.linkInfoKeys.includes(key)) {

            _this.linkInfo[key] = _this.dataForm[key];

        }

    }

}
二、
// 接入方式编辑后事件

 function changeDBlink(val) {

    switch (val.value) {

      case "0":

        _this.option.group[1].display = true;

        _this.option.group[1].column = getColumn("dbColumn", _this);

        break;



      case "1":

        _this.option.group[1].display = true;

        _this.option.group[1].column = [{

          label: "平台类型",

          prop: "apiType",

          span: 12,

          labelWidth: 140,

          type: "select",

          dicUrl: RequestURL.dictionaryurl.ZD0014,

          props: {

            label: "dictValue",

            value: "dictKey",

          },

          change: (value) => {

            switch (value.value) {

              case "rms":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("mtColumn", _this)

                    ];

                break;

              case "tplus":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("tColumn", _this)];

                break;

              case "jzy":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("jzyColumn", _this)];

                break;

              case "NCC": case "NC6X": case "NC5X":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("ncColumn", _this)];

                break;

              case "kry":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("kryColumn", _this)];

                break;

              case "k3cloud":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("k3cloudColumn", _this)];

                break;

              case "yida":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("yidaColumn", _this)];

                break;

              case "jdy":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("jdyColumn", _this)];

                break;

              case "tyst":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("sqstColumn", _this)];

                break;

              case "u8":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("u8Column", _this)];

                break;

              case "u8cloud":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("u8cloudColumn", _this)];

                break;

              case "tdf":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("tdfColumn", _this)];

                break;

              case "yzy":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("yzyColumn", _this)];

                break;

              case "mtsg":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("mtsgColumn", _this)];

                break;

              case "zly":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("zlyColumn", _this)];

                break;

              case "hacc":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("haccColumn", _this)];

                break;

              case "fbt":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("fbtColumn", _this)];

                break;

              case "hll":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("hllColumn", _this)];

                break;

              case "ekb":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("ekbColumn", _this)];

                break;

              case "myc":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("mycColumn", _this)];

                break;

              case "kw":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("kiswColumn", _this)];

                break;

              case "pal":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("palColumn", _this)];

                break;

              case "kis":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("kisColumn", _this)];

                break;

              case "eas":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("easColumn", _this)];

                break;

              case "sap":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("sapColumn", _this)];

                break;

              case "zhct":

                _this.option.group[1].column = [

                        _this.findObject(_this.option.group[1].column, "apiType"), 

                        ...getColumn("zhctColumn", _this)];

                break;

              default:

                _this.option.group[1].column = [_this.findObject(_this.option.group[1].column, "apiType")];

            }

            if (!_this.firstFlag) {

              _this.$nextTick(() => {

                _this.$refs.dataForm.form.baseUrl = "";

                _this.$refs.dataForm.form.token = "";

                _this.$refs.dataForm.form.type = "";

                _this.$refs.dataForm.form.version = "";

                _this.$refs.dataForm.form.appurl = "";

                _this.$refs.dataForm.form.redirecturl = "";

                _this.$refs.dataForm.form.state = "";

                _this.$refs.dataForm.form.scope = "";

                _this.$refs.dataForm.form.appname = "";

                _this.$refs.dataForm.form.appkey = "";

                _this.$refs.dataForm.form.authurl = "";

                _this.$refs.dataForm.form.publickey = "";

                _this.$refs.dataForm.form.appsecret = "";

                _this.$refs.dataForm.form.developer = "";

                _this.$refs.dataForm.form.business = "";

                _this.$refs.dataForm.form.signkey = "";

                _this.$refs.dataForm.form.username = "";

                _this.$refs.dataForm.form.pwd = "";

                _this.$refs.dataForm.form.busiCenter = "";

                _this.$refs.dataForm.form.dsname = "";

                _this.$refs.dataForm.form.grantType = "";

                _this.$refs.dataForm.form.secretLevel = "";

                _this.$refs.dataForm.form.busiId = "";

                _this.$refs.dataForm.form.repeatCheck = "";

                _this.$refs.dataForm.form.appType = "";

                _this.$refs.dataForm.form.systemToken = "";

                _this.$refs.dataForm.form.userId = "";

                _this.$refs.dataForm.form.formUuid = "";

                _this.$refs.dataForm.form.access_key = "";

                _this.$refs.dataForm.form.secret_key = "";

                _this.$refs.dataForm.form.dataSourceUrl = "";

                _this.$refs.dataForm.form.password = "";



                _this.$refs.dataForm.init();

              })

            } else {

              _this.firstFlag = false;

            }

            _this.$nextTick(() => {

              _this.$refs.dataForm.init();

            })

          }

        }];

        break;

      default:

        _this.option.group[1].display = false;

        _this.option.group[1].column = []

    }

    _this.$nextTick(() => {

      _this.$refs.dataForm.init();

    })

}

三、
/** 根据传入的apitype类型返回对应的字段列表*/

 function getColumn(type, _this) {

  // 美团

  let mtColumn = [

    {label: "类型",labelWidth: 140,prop: "type",span: 24, },

    {label: "业务授权URL规则",labelWidth: 140,prop: "authurl",span: 24, },

    {label: "开发者",labelWidth: 140,prop: "developer",span: 12, },

    {label: "业务类型",labelWidth: 140,prop: "business",span: 12, },

    {label: "签名Key",labelWidth: 140,prop: "signkey",span: 12, },

    {label: "ISV自定义字段",labelWidth: 140,prop: "state",span: 12, },

    {label: "请求URL",labelWidth: 140,prop: "baseUrl",span: 12, },

    {label: "解除授权URL",labelWidth: 140,prop: "unAuthUrl",span: 12,

    }

  ]



  // T+

  let tColumn = [

    {label: "类型",labelWidth: 140,prop: "type",span: 24, },

    {label: "授权URL",labelWidth: 140,span: 24,prop: "authurl", },

    {label: "appKey",labelWidth: 140,prop: "appkey",span: 12, },

    {label: "appsecret",labelWidth: 140,prop: "appsecret",span: 12, },

    {label: "畅捷通的应用名",labelWidth: 140,prop: "appname",span: 12, },

    {label: "授权范围",prop: "scope",labelWidth: 140,span: 12, },

    {label: "状态值",labelWidth: 140,prop: "state",span: 12, },

    {label: "回调地址",labelWidth: 140,prop: "redirecturl",span: 12, },

    {label: "请求URL",labelWidth: 140,prop: "baseUrl",span: 12, },

    {label: "秘钥",labelWidth: 140,prop: "secret",span: 12, },

    {label: "企业Id",labelWidth: 140,prop: "orgId",span: 12, },

    {label: "应用开通url规则",labelWidth: 140,prop: "openurl",span: 12, },

  ]



  // NC

  let ncColumn = [

    {label: "类型",labelWidth: 140,prop: "type",span: 24,},

    {label: "版本号",labelWidth: 140,span: 12,prop: "version", },

    {label: "请求URL",labelWidth: 140,prop: "baseUrl",span: 12, },

    {label: "appkey",labelWidth: 140,prop: "appkey",span: 12, },

    {label: "appsecret",labelWidth: 140,prop: "appsecret",span: 12, },

    {label: "公钥",labelWidth: 140,prop: "publickey",span: 12, },

    {label: "用户",labelWidth: 140,prop: "username",span: 12, },

    {label: "密码",labelWidth: 140,prop: "pwd",span: 12, },

    {label: "NCC账套",labelWidth: 140,prop: "busiCenter",span: 12, },

    {label: "数据源",labelWidth: 140,prop: "dsname",span: 12, },

    {label: "token获取方式",labelWidth: 140,prop: "grantType",span: 12, },

    {label: "压缩加密级别",labelWidth: 140,prop: "secretLevel",span: 12, },

    {label: "业务标识",labelWidth: 140,prop: "busiId",span: 12, },

    {label: "重复调用检查",labelWidth: 140,prop: "repeatCheck",span: 12, },

  ]



  let jzyColumn = [

    {label: "请求令牌",labelWidth: 140,prop: "token",span: 24, },

    {label: "请求域名",labelWidth: 140,prop: "baseUrl",span: 24, },

  ]



  // 数据库

  let dbColumn = [

    {label: "数据库类型",labelWidth: 140,prop: "dbtype",span: 12, },

    {label: "驱动类",disabled: true,labelWidth: 140,prop: "driverClass",span: 12, },

    {label: "用户名",labelWidth: 140,prop: "dbusername",span: 12, }, 

    {label: "密码",labelWidth: 140,prop: "dbpassword",span: 12, },

    {label: "连接地址",labelWidth: 140,prop: "dbUrl",span: 24, },

  ]



  // 客如云

  let kryColumn = [

    {label: "类型",labelWidth: 140,prop: "type",span: 24, },

    {label: "授权URL",labelWidth: 140,prop: "authurl",span: 24, },

    {label: "请求URL",labelWidth: 140,prop: "baseUrl",span: 12, },

    {label: "appkey",labelWidth: 140,prop: "appkey",span: 12, },

    {label: "appsecret",labelWidth: 140,prop: "appsecret",span: 12, },

    {label: "品牌id",labelWidth: 140,prop: "brandId",span: 12, },

  ]



  // 金蝶k3cloud

  let k3cloudColumn = [

    {label: "服务地址",labelWidth: 140,prop: "serverurl",span: 24, },

    {label: "三方应用主键",labelWidth: 140,prop: "appid",span: 12, },

    {label: "应用密钥",labelWidth: 140,prop: "appsecret",span: 12, },

    {label: "授权用户",labelWidth: 140,prop: "username",span: 12, },

    {label: "账套ID",labelWidth: 140,prop: "acctid",span: 12, },

    {label: "账套语系",labelWidth: 140,prop: "lcid",span: 12, },

  ]



  // 宜搭

  let yidaColumn = [

    {label: "应用ID",labelWidth: 140,prop: "appType",span: 24, },

    {label: "应用秘钥",labelWidth: 140,prop: "systemToken",span: 12, },

    {label: "userId",labelWidth: 140,prop: "userId",span: 12, },

    {label: "表单ID",labelWidth: 140,prop: "formUuid",span: 12, },

    {label: "access_key",labelWidth: 140,prop: "accessKey",span: 12, },

    {label: "secret_key",labelWidth: 140,prop: "secretKey",span: 12, },

    {label: "baseUrl",labelWidth: 140,prop: "baseUrl",span: 12, },

  ]



  // 金蝶云星辰

  let jdyColumn = [

    {label: "应用ID",labelWidth: 140,prop: "clientId",span: 24, },

    {label: "应用安全码",labelWidth: 140,prop: "clientSecret",span: 24, },

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "回调地址",labelWidth: 140,prop: "redirectUri",span: 24, },

    {label: "分组名称",labelWidth: 140,prop: "groupName",span: 12, },

    {label: "账套ID",labelWidth: 140,prop: "accountId",span: 12, },

    {label: "账号",labelWidth: 140,prop: "username",span: 12, },

    {label: "密码",labelWidth: 140,prop: "password",span: 12, },

    {label: "账套名称",labelWidth: 140,prop: "accountName",span: 12, }

  ]

  // 社区食堂

  let sqstColumn = [

    {label: "用户名",labelWidth: 140,prop: "name",span: 24, },

    {label: "密码",labelWidth: 140,prop: "secret",span: 24, },

    {label: "客户端授权模式",labelWidth: 140,prop: "grantType",span: 24, },

    {label: "权限范围",labelWidth: 140,prop: "scope",span: 24, },

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 12, },

  ]



  //用友U8

  let u8Column = [

    {label: "调用方id",labelWidth: 140,prop: "fromAccount",span: 24, },

    {label: "提供方id",labelWidth: 140,prop: "toAccount",span: 24, },

    {label: "数据源序号",labelWidth: 140,prop: "dsSequence",span: 24, },

    {label: "应用编码",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "密钥",labelWidth: 140,prop: "appSecret",span: 24, },

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 12, },

  ]



  //用友U8Cloud

  let u8cloudColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "用户编码",labelWidth: 140,prop: "usercode",span: 24, },

    {label: "密码",labelWidth: 140,prop: "password",span: 24, },

    {label: "系统参数",labelWidth: 140,prop: "system",span: 24, },

  ]



  //二维火-tdf

  let tdfColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "应用编码",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "应用安全码",labelWidth: 140,prop: "appSecret",span: 24, },

    {label: "语言",labelWidth: 140,prop: "lang",span: 24, },

    {label: "环境变量",labelWidth: 140,prop: "env",span: 24, },

    {label: "数据格式",labelWidth: 140,prop: "format",span: 24, },

    {label: "版本号",labelWidth: 140,prop: "v",span: 24, },

  ]



  // 有赞云 - yzy

  let yzyColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "应用ID",labelWidth: 140,prop: "clientId",span: 24, },

    {label: "应用secret",labelWidth: 140,prop: "clientSecret",span: 24, },

    {label: "授权方式",labelWidth: 140,prop: "authorizeType",span: 24, },

    {label: "授权店铺ID",labelWidth: 140,prop: "grantId",span: 24, },

    {label: "ISV自定义字段",labelWidth: 140,prop: "state",span: 24, },

  ]



  // 美团闪购 - mtsg

  let mtsgColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "应用ID",labelWidth: 140,prop: "appId",span: 24, },

    {label: "门店代码",labelWidth: 140,prop: "appPoiCode",span: 24, },

    {label: "应用secret",labelWidth: 140,prop: "appSecret",span: 24, },

    {label: "ISV自定义字段",labelWidth: 140,prop: "state",span: 24, },

  ]



  // 中仑云 - zlg

  let zlyColumn = [

    {label: "请求域名",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "公钥",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "私钥",labelWidth: 140,prop: "appSecret",span: 24, },

  ]



  // 好会计-hacc

  let haccColumn = [

    {label: "类型",labelWidth: 140,prop: "type",span: 24, },

    {label: "授权URL",labelWidth: 140,prop: "authurl",span: 24, },

    {label: "appKey",labelWidth: 140,prop: "appkey",span: 12, },

    {label: "appsecret",labelWidth: 140,prop: "appsecret",span: 12, },

    {label: "畅捷通的应用名",labelWidth: 140,prop: "appname",span: 12, },

    {label: "授权范围",prop: "scope",labelWidth: 140,span: 12, },

    {label: "状态值",labelWidth: 140,prop: "state",span: 12, },

    {label: "回调地址",labelWidth: 140,prop: "redirecturl",span: 12, },

    {label: "请求URL",labelWidth: 140,prop: "baseUrl",span: 12, },

    {label: "秘钥",labelWidth: 140,prop: "secret",span: 12, },

    {label: "企业Id",labelWidth: 140,prop: "orgId",span: 12, },

    {label: "应用开通url规则",labelWidth: 140,prop: "openurl",span: 12, },

    {label: "账套id",labelWidth: 140,prop: "bookId",span: 12, },

  ]





  // 分贝通 - fbt

  let fbtColumn = [

    {label: "开放平台基础Url",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "企业ID",labelWidth: 140,prop: "appId",span: 24, },

    {label: "企业key",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "密钥",labelWidth: 140,prop: "signKey",span: 24, },

    {label: "授权负责人ID",labelWidth: 140,prop: "adminId",span: 24, },

  ]



  // 哗啦啦 - hll

  let hllColumn = [

    {label: "开放平台基础Url",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "企业Key",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "企业密钥",labelWidth: 140,prop: "appSecret",span: 24, },

    {label: "集团ID",labelWidth: 140,prop: "groupId",span: 24, },

  ]



  // 易快报 - ekb

  let ekbColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "接入账号",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "接入密码",labelWidth: 140,prop: "appSecurity",span: 24, },

  ]



  // 每刻 - myc

  let mycColumn = [

    {label: "开放平台基础Url",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "帐号",labelWidth: 140,prop: "appCode",span: 24, },

    {label: "接入密钥",labelWidth: 140,prop: "appSecret",span: 24, },

    {label: "企业编码",labelWidth: 140,prop: "entCode",span: 24, },

  ]



  // KisWise - kw

  let kiswColumn = [

    {label: "开放平台基础Url",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "数据库地址",labelWidth: 140,prop: "dataSourceUrl",span: 24, },

    {label: "用户",labelWidth: 140,prop: "username",span: 24, },

    {label: "密码",labelWidth: 140,prop: "password",span: 24, },

  ]



  // 金蝶KIS:kis

  let kisColumn = [

    {label: "请求地址",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "应用ID",labelWidth: 140,prop: "clientId",span: 24, },

    {label: "应用安全码",labelWidth: 140,prop: "clientSecret",span: 24, },

    {label: "回调地址",labelWidth: 140,prop: "redirectUri",span: 24, },

    {label: "企业名称",labelWidth: 140,prop: "orgName",span: 24, },

    {label: "产品名称",labelWidth: 140,prop: "productName",span: 24, },

    {label: "账套名称",labelWidth: 140,prop: "acctName",span: 24, },

    {label: "应用名称",labelWidth: 140,prop: "icrmName",span: 24, },

    {label: "账号",labelWidth: 140,prop: "username",span: 24, },

    {label: "密码",labelWidth: 140,prop: "password",span: 24, },

    {label: "鉴权",labelWidth: 140,prop: "authData",span: 24, },

    {label: "业务接口地址",labelWidth: 140,prop: "gwRouterAddr",span: 24, },

  ]



  // 银豹 - pal

  let palColumn = [

    {label: "开放平台基础Url",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "应用编码",labelWidth: 140,prop: "appKey",span: 24, },

    {label: "应用id",labelWidth: 140,prop: "appId",span: 24, },

  ]



  // EAS - eas

  let easColumn = [

    {label: "服务器地址 ",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "服务器端口",labelWidth: 140,prop: "port",span: 12, },

    {label: "用户名",labelWidth: 140,prop: "username",span: 12, },

    {label: "密码",labelWidth: 140,prop: "password",span: 12, },

    {label: "方案",labelWidth: 140,prop: "slnName",span: 12, },

    {label: "数据中心",labelWidth: 140,prop: "dcName",span: 12, },

    {label: "语言",labelWidth: 140,prop: "language",span: 12, },

    {label: "数据库类型",labelWidth: 140,prop: "dbType",span: 12, },

  ]



  // SAP -  sap

  let sapColumn = [

    {label: "服务器地址 ",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "接口地址",labelWidth: 140,prop: "address",span: 24, },

    {label: "用户名",labelWidth: 140,prop: "username",span: 12, },

    {label: "密码",labelWidth: 140,prop: "password",span: 12, },

  ]



  // 智慧餐台 : zhct

  let zhctColumn = [

    {label: "服务器地址 ",labelWidth: 140,prop: "baseUrl",span: 24, },

    {label: "秘钥",labelWidth: 140,prop: "key",span: 24, },

  ]



  let column = []

  switch (type) {

    case "mtColumn":column = mtColumn;break;

    case "tColumn":column = tColumn;break;

    case "ncColumn":column = ncColumn;break;

    case "jzyColumn":column = jzyColumn;break;

    case "dbColumn":column = dbColumn;break;

    case "kryColumn":column = kryColumn;break;

    case "k3cloudColumn":column = k3cloudColumn;break;

    case "yidaColumn":column = yidaColumn;break;

    case "jdyColumn":column = jdyColumn;break;

    case "sqstColumn":column = sqstColumn;break;

    case "u8Column":column = u8Column;break;

    case "u8cloudColumn":column = u8cloudColumn;break;

    case "tdfColumn":column = tdfColumn;break;

    case "yzyColumn":column = yzyColumn;break;

    case "mtsgColumn":column = mtsgColumn;break;

    case "zlyColumn":column = zlyColumn;break;

    case "haccColumn":column = haccColumn;break;

    case "fbtColumn":column = fbtColumn;break;

    case 'hllColumn':column = hllColumn;break;

    case 'ekbColumn':column = ekbColumn;break;

    case 'mycColumn':column = mycColumn break;

    case 'kiswColumn':column = kiswColumn break;

    case 'palColumn':column = palColumn break;

    case 'kisColumn':column = kisColumn break;

    case 'easColumn':column = easColumn break;

    case 'sapColumn':column = sapColumn break;

    case 'zhctColumn':column = zhctColumn break;

  }

  return column;

}



求大佬帮忙优化,现在会排版了!{:301_1004:}

新建文本文档 (6).txt

31.55 KB, 下载次数: 9, 下载积分: 吾爱币 -1 CB

附件

最佳答案

查看完整内容

这有啥可优化的,最多减少几行代码,利用这种写法

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

永恒陌 发表于 2022-6-30 14:03
这有啥可优化的,最多减少几行代码,利用这种写法
[JavaScript] 纯文本查看 复制代码
let x = {
 a:[1,2,3],
 b:{c:1,d:2}
};
return x[value];
Paranoid丶 发表于 2022-6-30 15:04
zxcczf2 发表于 2022-6-30 15:05
流星星 发表于 2022-6-30 15:07
代码格式化再发出来,否则看起来太头疼了
Homely 发表于 2022-6-30 15:07
这排班,狗看了都摇头
猫吃 发表于 2022-6-30 15:29
楼主你不会排版的话  把这个保存成代码文件,上传附件
Do_zh 发表于 2022-6-30 15:54
你确定你是个程序员 ?
 楼主| q7215754 发表于 2022-6-30 15:59
猫吃 发表于 2022-6-30 15:29
楼主你不会排版的话  把这个保存成代码文件,上传附件

大佬上传附件了。
 楼主| q7215754 发表于 2022-6-30 15:59
Do_zh 发表于 2022-6-30 15:54
你确定你是个程序员 ?

我做运维的不是开发啊 看不懂啊
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 09:50

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表