{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\dialog\\CustomDialogShowDetail.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\dialog\\CustomDialogShowDetail.vue","mtime":1667327529169},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport req from \"@/request.js\";\r\nimport hotentUiUtils from '@/hotent-ui-util.js'\r\n\r\nexport default {\r\n  name: \"custom-dialog-show-detail\",\r\n  props: {\r\n    //自定义对话框的别名\r\n    alias: {\r\n      type: String,\r\n      required: true\r\n    },\r\n    //自定义对话框的配置\r\n    customDialog: {\r\n      type: Object,\r\n      required: true\r\n    }\r\n  },\r\n  data() {\r\n    return {\r\n      customDialogPostParam: [], //为REST接口且请求类型是POST，条件字段是固定值的参数\r\n      customDialogGetUrl: \"\", //为REST接口且请求类型是GET，条件字段是固定值的请求地址\r\n      selectionRadio: [], //ht-table列表单选选择的数据\r\n      textRadio: \"\", //ht-table列表数据的单选按钮\r\n      selectable: true, //表示ht-table列表第一列是否显示复选框\r\n      isShowSearch: false, //是否显示高级搜索\r\n      nopagination: false, //是否隐藏分页组件，false：显示，true：隐藏\r\n      tableData: [], //ht-table列表数据\r\n      pageResult: {\r\n        page: 1,\r\n        pageSize: 20,\r\n        total: 0\r\n      }\r\n    };\r\n  },\r\n  methods: {\r\n    //显示对话框\r\n    initData() {\r\n      this.customDialogPostParam = []; //清空为REST接口且请求类型是POST，条件字段是固定值的参数\r\n      this.customDialogGetUrl = \"\"; //清空为REST接口且请求类型是GET，条件字段是固定值的请求地址\r\n      this.selectionRadio = []; //清空ht-table列表单选选择的数据\r\n      this.textRadio = \"\"; //清空ht-table列表数据单选按钮的选中状态\r\n      this.isShowSearch = false; //不显示高级搜索\r\n      //是否单选  1：单选；-1：多选\r\n      if (this.customDialog.selectNum == 1) {\r\n        this.selectable = false;\r\n      } else {\r\n        this.selectable = true;\r\n      }\r\n      //是否显示分页组件，true：显示，false：隐藏\r\n      if (this.customDialog.needPage) {\r\n        this.nopagination = false;\r\n      } else {\r\n        this.nopagination = true;\r\n      }\r\n      //判断是否有条件查询,且数据来源是数据源或者数据来源是REST接口且请求类型是POST\r\n      if (\r\n        this.customDialog.conditionfield.length > 0 &&\r\n        (this.customDialog.dsType == \"dataSource\" ||\r\n          (this.customDialog.dsType != \"dataSource\" &&\r\n            this.customDialog.requestType == \"POST\"))\r\n      ) {\r\n        for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {\r\n          //判断条件字段是否是参数传入并控制器的类型为单行文本框  （controllerType有值就代表控制器的类型为单行文本框，defaultType：1：参数传入，2：固定值 ）\r\n          if (\r\n            this.customDialog.conditionfield[i].controllerType &&\r\n            this.customDialog.conditionfield[i].defaultType == \"1\"\r\n          ) {\r\n            this.isShowSearch = true; //显示高级搜索\r\n            //如果条件字段为data类型，则控制器的类型为日期类型\r\n            if (this.customDialog.conditionfield[i].dbType == \"date\") {\r\n              this.customDialog.conditionfield[i].type = \"date\";\r\n            } else {\r\n              this.customDialog.conditionfield[i].type = \"text\";\r\n            }\r\n          } else {\r\n            if (\r\n              this.customDialog.dsType != \"dataSource\" &&\r\n              this.customDialog.requestType == \"POST\"\r\n            ) {\r\n              this.customDialogPostParam.push(\r\n                this.customDialog.conditionfield[i]\r\n              ); //为REST接口且请求类型是POST，条件字段是固定值的参数\r\n            }\r\n            //如果是条件字段固定值就清除\r\n            this.customDialog.conditionfield.splice(i, 1);\r\n          }\r\n        }\r\n      }\r\n      //判断是否有条件查询,且数据来源是REST接口且请求类型是GET\r\n      if (\r\n        this.customDialog.conditionfield.length > 0 &&\r\n        this.customDialog.dsType != \"dataSource\" &&\r\n        this.customDialog.requestType == \"GET\"\r\n      ) {\r\n        for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {\r\n          //判断条件字段是否是固定值（defaultType：1：参数传入，2：固定值 ）\r\n          if (this.customDialog.conditionfield[i].defaultType == \"2\") {\r\n            //判断请求地址是否带有 ？\r\n            if (this.customDialog.url.indexOf(\"?\") == -1) {\r\n              //无\r\n              this.customDialog.url =\r\n                this.customDialog.url +\r\n                \"?\" +\r\n                this.customDialog.conditionfield[i].comment +\r\n                \"=\" +\r\n                this.customDialog.conditionfield[i].defaultValue;\r\n            } else {\r\n              //有\r\n              this.customDialog.url =\r\n                this.customDialog.url +\r\n                \"&\" +\r\n                this.customDialog.conditionfield[i].comment +\r\n                \"=\" +\r\n                this.customDialog.conditionfield[i].defaultValue;\r\n            }\r\n            //如果是条件字段固定值就清除\r\n            this.customDialog.conditionfield.splice(i, 1);\r\n            this.customDialogGetUrl = this.customDialog.url;\r\n            //判断条件字段是否是参数传入并控制器的类型为单行文本框（controllerType有值就代表控制器的类型为单行文本框，defaultType：1：参数传入，2：固定值 ）\r\n          } else if (\r\n            this.customDialog.conditionfield[i].controllerType &&\r\n            this.customDialog.conditionfield[i].defaultType == \"1\"\r\n          ) {\r\n            this.isShowSearch = true; //显示高级搜索\r\n          }\r\n        }\r\n      }\r\n    },\r\n    //加载数据\r\n    async loadData(param, cb) {\r\n      //为REST接口且请求类型是POST，条件字段是固定值的参数\r\n      if (\r\n        this.customDialog.dsType != \"dataSource\" &&\r\n        this.customDialog.requestType == \"POST\" &&\r\n        this.customDialogPostParam.length > 0\r\n      ) {\r\n        for (let i = 0; i < this.customDialogPostParam.length; i++) {\r\n          //构建查询条件\r\n          let operation=this.getOperation(this.customDialogPostParam[i].condition);\r\n          let obj = {\r\n            group: \"main\",\r\n            operation: operation,\r\n            property: this.customDialogPostParam[i].comment,\r\n            relation: \"AND\",\r\n            value: this.customDialogPostParam[i].defaultValue\r\n          };\r\n          if (param.querys && param.querys.length > 0) {\r\n            param.querys.push(obj);\r\n          } else {\r\n            param.querys = [];\r\n            param.querys.push(obj);\r\n          }\r\n        }\r\n      }\r\n      // post restful接口，并且配置了post参数。则以post参数作为请求参数\r\n      if (\r\n        this.customDialog.dsType != 'dataSource' &&\r\n        this.customDialog.requestType == 'POST' &&\r\n        this.customDialog.dataParam &&\r\n        this.customDialog.dataParam.constructor == String \r\n      ) {\r\n        // 构建上下文数据对象\r\n        let ctx = {}\r\n        param && param.querys && param.querys.forEach((element) => {\r\n          ctx[element.property] = element.value\r\n        })\r\n        const exp = hotentUiUtils.parseExp(this.customDialog.dataParam, ctx)\r\n        try {\r\n          param = JSON.parse(exp)\r\n        } catch (e) {\r\n          this.$message.error(`POST参数不是有效的JSON格式${query.dataParam}`)\r\n        }\r\n      }\r\n      //判断是否有条件查询,且数据来源是REST接口且请求类型是GET，并且判断参数传入是否填写了查询条件\r\n      if (\r\n        this.customDialog.conditionfield.length > 0 &&\r\n        this.customDialog.dsType != \"dataSource\" &&\r\n        this.customDialog.requestType == \"GET\" &&\r\n        param.querys &&\r\n        param.querys.length > 0\r\n      ) {\r\n        for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {\r\n          //判断条件字段是否是参数传入并控制器的类型为单行文本框（controllerType有值就代表控制器的类型为单行文本框，defaultType：1：参数传入，2：固定值 ）\r\n          if (\r\n            this.customDialog.conditionfield[i].controllerType &&\r\n            this.customDialog.conditionfield[i].defaultType == \"1\"\r\n          ) {\r\n            //参数传入填写了查询条件\r\n            for (let j = 0; j < param.querys.length; j++) {\r\n              //判断为REST接口且请求类型是GET，条件字段是固定值的请求地址是否为空\r\n              if (this.customDialogGetUrl != \"\") {\r\n                this.customDialog.url = this.customDialogGetUrl; //赋值为REST接口且请求类型是GET，条件字段是固定值的请求地址\r\n              } else {\r\n                this.customDialogGetUrl = this.customDialog.url;\r\n              }\r\n              //判断请求地址是否带有 ？\r\n              if (this.customDialog.url.indexOf(\"?\") == -1) {\r\n                //无\r\n                this.customDialog.url =\r\n                  this.customDialog.url +\r\n                  \"?\" +\r\n                  param.querys[j].property +\r\n                  \"=\" +\r\n                  param.querys[j].value;\r\n              } else {\r\n                //有\r\n                this.customDialog.url =\r\n                  this.customDialog.url +\r\n                  \"&\" +\r\n                  param.querys[j].property +\r\n                  \"=\" +\r\n                  param.querys[j].value;\r\n              }\r\n            }\r\n          }\r\n        }\r\n      } else {\r\n        //判断为REST接口且请求类型是GET，条件字段是固定值的请求地址是否为空\r\n        if (this.customDialogGetUrl != \"\") {\r\n          this.customDialog.url = this.customDialogGetUrl; //赋值为REST接口且请求类型是GET，条件字段是固定值的请求地址\r\n        }\r\n      }\r\n      let queryUrl =\r\n        this.customDialog.dsType == \"dataSource\"\r\n          ? \"${form}/form/customDialog/v1/getListData?alias=\" +\r\n            this.alias +\r\n            \"&mapParam=\"\r\n          : this.customDialog.url;\r\n      let requestMethod = \"POST\";\r\n      //如果自定义对话框列表查询数据不是数据源则请求方法为restful配置的请求方式\r\n      if (this.customDialog.dsType != \"dataSource\") {\r\n        requestMethod = this.customDialog.requestType;\r\n      }\r\n      //查询数据\r\n      let response = await req\r\n        .request({\r\n          url: queryUrl,\r\n          method: requestMethod,\r\n          data: param\r\n        })\r\n        .finally(() => cb&&cb());\r\n      //如果数据来源是REST接口，且请求类型是GET\r\n      if (\r\n        this.customDialog.dsType != \"dataSource\" &&\r\n        this.customDialog.requestType == \"GET\"\r\n      ) {\r\n        this.tableData = response.data;\r\n        this.nopagination = true; //隐藏分页组件\r\n      }\r\n      //如果数据来源是REST接口且请求类型是POST\r\n      if (\r\n        this.customDialog.dsType != \"dataSource\" &&\r\n        this.customDialog.requestType == \"POST\"\r\n      ) {\r\n        this.tableData = response.data[this.customDialog.listKey];\r\n        //如果有分页\r\n        if (response.data[this.customDialog.pageKey]) {\r\n          this.pageResult = {\r\n            page: response.data[this.customDialog.pageKey],\r\n            pageSize: response.data[this.customDialog.pageSizeKey],\r\n            total: response.data[this.customDialog.totalKey]\r\n          };\r\n          this.nopagination = false; //显示分页组件\r\n        } else {\r\n          this.nopagination = true; //隐藏分页组件\r\n        }\r\n      }\r\n      //如果数据来源是数据源\r\n      if (this.customDialog.dsType == \"dataSource\") {\r\n        if (response.data &&response.data.rows){\r\n          this.tableData = response.data.rows;\r\n          //如果有分页\r\n          if (response.data.page) {\r\n            this.pageResult = {\r\n              page: response.data.page,\r\n              pageSize: response.data.pageSize,\r\n              total: response.data.total\r\n            };\r\n            this.nopagination = false; //显示分页组件\r\n          } else {\r\n            this.nopagination = true; //隐藏分页组件\r\n          }\r\n        } else{\r\n          this.tableData=[];\r\n          this.nopagination = true; //隐藏分页组件\r\n        }\r\n\r\n      }\r\n    },\r\n        //获取运算符号\r\n    getOperation(old){\r\n      if(!old){\r\n        return \"\";\r\n      }else if(old == \"EQ\"){\r\n        return \"EQUAL\";\r\n      }else if(old == \"EIC\"){\r\n        return \"EQUAL_IGNORE_CASE\"\r\n      }else if(old == \"LT\"){\r\n        return \"LESS\"\r\n      }else if(old == \"GT\"){\r\n        return \"GREAT\"\r\n      }else if(old == \"LE\"){\r\n        return \"LESS_EQUAL\"\r\n      }else if(old == \"GE\"){\r\n        return \"GREAT_EQUAL\"\r\n      }else if(old == \"NE\"){\r\n        return \"NOT_EQUAL\"\r\n      }else if(old == \"LK\"){\r\n        return \"LIKE\"\r\n      }else if(old == \"LFK\"){\r\n        return \"LEFT_LIKE\"\r\n      }else if(old == \"RHK\"){\r\n        return \"RIGHT_LIKE\"\r\n      }else if(old == \"ISNULL\"){\r\n        return \"IS_NULL\"\r\n      }else if(old == \"NOTNULL\"){\r\n        return \"NOTNULL\"\r\n      }else if(old == \"IN\"){\r\n        return \"IN\"\r\n      }else if(old == \"BETWEEN\"){\r\n        return \"BETWEEN\"\r\n      } else{\r\n        return \"LIKE\"\r\n      }\r\n    },\r\n    //点击列表某一条数据时触发\r\n    orgRowClick(row, column, event) {\r\n      //是否单选  1：单选；-1：多选\r\n      if (this.customDialog.selectNum === 1) {\r\n        //选中单选按钮\r\n        this.textRadio =\r\n          event.currentTarget.children[0].children[0].children[0].__vue__.$refs.radio.value;\r\n        this.selectionRadio = [row];\r\n        this.$emit(\"orgRowClick\",row)\r\n      } else {\r\n        //点击列表数据选中复选框\r\n        this.$refs.htTable.$refs.htTable.toggleRowSelection(row);\r\n      }\r\n    },\r\n  }\r\n};\r\n",null]}