{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtSelect.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtSelect.vue","mtime":1675232038590},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.array.find\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.split\";\nimport _toConsumableArray from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/es6.number.constructor\";\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//\n//\n//\n//\n//\n//\nimport utils from \"@/utils.js\";\nimport service from \"@/service.js\";\nimport HtFieldTail from \"@/components/HtFieldTail.vue\";\nimport { Promise } from \"q\";\nimport { setTimeout } from \"timers\";\nimport deepmerge from \"deepmerge\";\nexport default {\n  name: \"ht-select\",\n  props: {\n    validate: [String, Object],\n    value: [String, Number, Boolean, Array],\n    name: String,\n    permission: {\n      type: String,\n      default: \"w\",\n      validator: function validator(value) {\n        return [\"b\", \"w\", \"r\", \"n\"].indexOf(value) !== -1;\n      }\n    },\n    size: {\n      type: String,\n      default: \"small\"\n    },\n    options: Array,\n    props: {\n      type: Object,\n      default: function _default() {\n        return {\n          key: \"key\",\n          value: \"value\"\n        };\n      }\n    },\n    disabled: {\n      type: Boolean,\n      default: false\n    },\n    readonly: {\n      type: Boolean,\n      default: false\n    },\n    multiple: {\n      type: Boolean,\n      default: false\n    },\n    clearable: {\n      type: Boolean,\n      default: false\n    },\n    filterable: {\n      type: Boolean,\n      default: false\n    },\n    allowCreate: {\n      type: Boolean,\n      default: false\n    },\n    linkage: [Object, Array],\n    placeholder: String,\n    remoteMethod: Function,\n    remote: {\n      type: Boolean,\n      default: false\n    }\n  },\n  components: {\n    HtFieldTail: HtFieldTail\n  },\n  data: function data() {\n    return {\n      optionsAry: [],\n      tagFormatValue: [],\n      remoteMethodFn: null,\n      inputName: null,\n      writeable: true,\n      isRemote: false,\n      loading: false,\n      oldValue: this.value,\n      remoteLoaded: false\n    };\n  },\n  watch: {\n    options: {\n      handler: function handler(newVal, oldValue) {\n        if (newVal && newVal.constructor === Array) {\n          // 在加载了数据时，标记远程方法调用状态为已调用\n          this.remoteLoaded = true;\n          this.optionsAry = _toConsumableArray(newVal); // 异步加载数据 下拉框不会回显 需要加载完options 重新赋值\n\n          if ((!oldValue || oldValue.length == 0) && !utils.isEmpty(this.oldValue)) {\n            this.$emit(\"input\", this.oldValue);\n          }\n        }\n      },\n      immediate: true\n    }\n  },\n  computed: {\n    inputVal: {\n      get: function get() {\n        var _this = this;\n\n        if (utils.isEmpty(this.value) || !this.optionsAry || this.optionsAry.length == 0) {\n          return utils.isEmpty(this.value) ? \"\" : this.value;\n        }\n\n        if (this.value.constructor == String) {\n          var ary = this.value === \"\" ? [] : this.value.split(\",\");\n\n          if (this.inputWriteable) {\n            if (this.multiple) {\n              return ary;\n            } else {\n              return this.value;\n            }\n          } else {\n            // 只读 多选\n            if (this.multiple) {\n              var _ary = this.value === \"\" ? [] : this.value.split(\",\");\n\n              var optionVals = [];\n              var tempAry = deepmerge([], _ary, {\n                clone: true\n              });\n\n              _ary.forEach(function (m) {\n                _this.optionsAry.find(function (opt) {\n                  if (opt[_this.propKey] === m) {\n                    optionVals.push(opt[_this.propValue]);\n                    tempAry.remove(m);\n                  }\n\n                  if (opt.children && opt.children.length > 0) {\n                    opt.children.find(function (childOpt) {\n                      if (childOpt[_this.propKey] === m) {\n                        optionVals.push(childOpt[_this.propValue]);\n                        tempAry.remove(m);\n                      }\n                    });\n                  }\n                });\n              });\n\n              optionVals = optionVals.concat(tempAry);\n              this.tagFormatValue = optionVals;\n              return _ary;\n            }\n\n            if (this.optionsAry && this.optionsAry.length > 0) {\n              var _optionVals = [];\n\n              var _tempAry = deepmerge([], ary, {\n                clone: true\n              });\n\n              ary.forEach(function (m) {\n                _this.optionsAry.find(function (opt) {\n                  if (opt[_this.propKey] === m) {\n                    _optionVals.push(opt[_this.propValue]);\n\n                    _tempAry.remove(m);\n                  }\n\n                  if (opt.children && opt.children.length > 0) {\n                    opt.children.find(function (childOpt) {\n                      if (childOpt[_this.propKey] === m) {\n                        _optionVals.push(childOpt[_this.propValue]);\n\n                        _tempAry.remove(m);\n                      }\n                    });\n                  }\n                });\n              });\n              _optionVals = _optionVals.concat(_tempAry);\n              this.tagFormatValue = _optionVals;\n              return this.value;\n            }\n          }\n        }\n\n        return this.value;\n      },\n      set: function set(val) {\n        var result = \"\";\n\n        if (this.multiple) {\n          if (val && val.constructor === Array && val.length > 0) {\n            if (val[0].constructor === Number) {\n              throw \"多选不支持数字类型\";\n            }\n\n            result = val.join(\",\");\n          }\n        } else {\n          result = val;\n        }\n\n        this.$emit(\"input\", result);\n      }\n    },\n    inputWriteable: function inputWriteable() {\n      return this.writeable ? utils.getWriteable(this.permission) : this.writeable;\n    },\n    inputValidate: function inputValidate() {\n      return utils.addRequiredOrNot(this.permission, this.validate, this);\n    },\n    propKey: function propKey() {\n      if (this.props && this.props.key) {\n        return this.props.key;\n      }\n\n      return \"key\";\n    },\n    propValue: function propValue() {\n      if (this.props && this.props.value) {\n        return this.props.value;\n      }\n\n      return \"value\";\n    }\n  },\n  mounted: function mounted() {\n    // 字段联动规则\n    var _me = this;\n\n    this.mountedLinkage();\n\n    if (this.value) {\n      this.handleRemoteMethod();\n    }\n  },\n  created: function created() {\n    this.inputName = this.name ? this.name : utils.getName();\n    this.remoteMethodFn = this.remoteMethod;\n    this.isRemote = this.remoteMethodFn && this.remoteMethodFn.constructor === Function || !!(this.$vnode.data.directives && this.$vnode.data.directives.find(function (m) {\n      return m.name == \"query\";\n    }));\n    this.$validator = this.$root.$validator;\n  },\n  methods: {\n    mountedLinkage: function mountedLinkage() {\n      if (this.linkage) {\n        var exp = this.linkage; //如果要联动的字段权限是只读“r”,则把联动配置里面要联动的字段权限“w”改为只读“r”\n\n        if (exp && exp.length > 0) {\n          var frmInst = utils.getOnlineFormInstance(this); //表单所有字段的初始权限\n\n          if (frmInst && frmInst.permission) {\n            exp.forEach(function (item) {\n              var effect = item.effect;\n              effect.forEach(function (effectItem) {\n                var initPermission = utils.getValueByPath(frmInst, effectItem.target);\n\n                if (effectItem.target && effectItem.target.indexOf(\"permission\") != -1 && effectItem.value != \"n\" && initPermission == \"r\") {\n                  effectItem.value = initPermission;\n                }\n              });\n            });\n          }\n        }\n\n        service.linkageHandler(this, exp);\n      }\n    },\n    clickNative: function clickNative() {\n      // 在远程方法未调用时才触发远程调用\n      if (!this.remoteLoaded) {\n        this.handleRemoteMethod();\n      }\n    },\n    handleRemoteMethod: function handleRemoteMethod(query) {\n      var _this2 = this;\n\n      var _me = this;\n\n      if (this.isRemote) {\n        this.loading = true;\n        var result = this.remoteMethodFn(query);\n\n        if (result && result.finally) {\n          result.finally(function () {\n            _this2.loading = false;\n          });\n        } else {\n          setTimeout(function () {\n            _this2.loading = false;\n          }, 1000);\n        }\n      }\n    },\n    change: function change(data) {\n      var _this3 = this;\n\n      var selectObj = this.optionsAry.find(function (opt) {\n        return opt[_this3.propKey] === data;\n      });\n      this.$emit(\"change\", data, selectObj);\n    },\n    clearValue: function clearValue() {\n      this.oldValue = \"\";\n      this.inputVal = \"\";\n    },\n    visibleChange: function visibleChange(m) {\n      this.$emit(\"visible-change\", m);\n    },\n    removeTag: function removeTag(tag) {\n      this.$emit(\"remove-tag\", tag);\n    },\n    handleClear: function handleClear() {\n      this.$emit(\"clear\");\n    },\n    handleBlur: function handleBlur(event) {\n      this.$emit(\"blur\", event);\n    },\n    handleFocus: function handleFocus(event) {\n      this.$emit(\"focus\", event);\n    }\n  }\n};",null]}