{"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\\HtRoleSelector.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtRoleSelector.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.regexp.split\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\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//\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 HtFieldTail from \"@/components/HtFieldTail.vue\";\nimport Selector from \"@/components/common/Selector.vue\";\nimport { setTimeout } from \"timers\";\nexport default {\n  name: \"ht-role-selector\",\n  props: {\n    validate: [String, Object],\n    value: String,\n    selectLabel: String,\n    placeholder: {\n      type: String,\n      default: \"请输入内容\"\n    },\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    single: {\n      type: Boolean,\n      default: false\n    },\n    config: Object,\n    data: {\n      type: Array,\n      default: function _default() {\n        return [];\n      }\n    },\n    tableColumns: {\n      type: Array,\n      default: function _default() {\n        return [];\n      }\n    },\n    pagination: {\n      type: Object,\n      default: function _default() {\n        return {\n          page: 1,\n          pageSize: 50,\n          total: 0\n        };\n      }\n    },\n    quickSearchProps: {\n      type: String,\n      required: true\n    },\n    appendToBody: {\n      type: Boolean,\n      default: false\n    }\n  },\n  components: {\n    HtFieldTail: HtFieldTail,\n    Selector: Selector\n  },\n  data: function data() {\n    return {\n      inputName: null,\n      writeable: true,\n      inputSuffixHeight: 30,\n      demensions: [],\n      dialogVisible: false,\n      primaryField: this.selectLabel\n    };\n  },\n  computed: {\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  },\n  watch: {\n    // 当所选择的数据发生变化时，同步到v-model中\n    demensions: function demensions(newVal) {\n      var _this = this;\n\n      var ary = [],\n          idAry = [],\n          nameAry = [],\n          codeAry = [];\n\n      if (newVal && newVal.constructor === Array && newVal.length > 0) {\n        newVal.forEach(function (m) {\n          ary.push(m.name);\n\n          if (m.hasOwnProperty(\"id\")) {\n            idAry.push(m.id);\n          }\n\n          if (m.hasOwnProperty(\"code\")) {\n            codeAry.push(m.code);\n          }\n\n          if (m.hasOwnProperty(\"name\")) {\n            nameAry.push(m.name);\n          }\n        });\n      }\n\n      if (this.config) {\n        // 配置了id的绑定关系，则回填到指定属性上\n        if (this.config.hasOwnProperty(\"id\")) {\n          utils.setValueByConfigKey(this, this.config, \"id\", idAry.join(\",\"));\n          this.primaryField = \"id\";\n        } // 配置了code的绑定关系，则回填到指定的属性上\n\n\n        if (this.config.hasOwnProperty(\"code\")) {\n          utils.setValueByConfigKey(this, this.config, \"code\", codeAry.join(\",\"));\n          this.primaryField = this.primaryField == \"id\" ? \"id\" : \"code\";\n        } // 配置了name的绑定关系，则回填到指定的属性上\n\n\n        if (this.config.hasOwnProperty(\"name\")) {\n          utils.setValueByConfigKey(this, this.config, \"name\", nameAry.join(\",\"));\n        }\n      } // 通过valueChange事件发布值变更消息\n\n\n      this.$emit(\"valueChange\", ary.join(\",\"));\n      setTimeout(function () {\n        _this.calacInputSuffixHeight();\n\n        if (_this.$refs.inputEl) {\n          _this.$refs.inputEl.focus();\n\n          _this.$refs.inputEl.blur();\n        }\n      }, 10);\n    },\n    value: function value(newVal) {\n      // 父级传递进来的value发生变更时，需要同步到当前所选数据中\n      this.valueInit();\n    }\n  },\n  mounted: function mounted() {\n    // 组件第一次挂载时，同步value到当前所选数据中\n    this.valueInit();\n  },\n  created: function created() {\n    this.inputName = this.name ? this.name : utils.getName();\n    this.$validator = this.$root.$validator;\n  },\n  methods: {\n    // 同步value到当前所选数据中\n    valueInit: function valueInit() {\n      var tmpAry = [];\n\n      if (this.value) {\n        var idAry = [],\n            nameAry = [],\n            codeAry = [];\n\n        if (this.config) {\n          // 配置了id绑定关系，则获取id的值\n          if (this.config.hasOwnProperty(\"id\")) {\n            var idVal = utils.getValueByConfigKey(this, this.config, \"id\");\n\n            if (idVal) {\n              idAry = idVal.split(\",\").trim();\n            }\n          } // 配置了code绑定关系，则获取code的值\n\n\n          if (this.config.hasOwnProperty(\"code\")) {\n            var codeVal = utils.getValueByConfigKey(this, this.config, \"code\");\n\n            if (codeVal) {\n              codeAry = codeVal.split(\",\").trim();\n            }\n          } // 配置了name绑定关系，则获取name的值\n\n\n          if (this.config.hasOwnProperty(\"name\")) {\n            var nameVal = utils.getValueByConfigKey(this, this.config, \"name\");\n\n            if (nameVal) {\n              nameAry = nameVal.split(\",\").trim();\n            }\n          }\n        } // 将name、id、code从逗号分割的字符串解析为json对象格式的数组\n\n\n        var valAry = this.value.split(\",\").trim();\n        valAry.forEach(function (m, index) {\n          var item = {\n            name: m\n          };\n\n          if (idAry.length > index) {\n            item[\"id\"] = idAry[index];\n          }\n\n          if (codeAry.length > index) {\n            item[\"code\"] = codeAry[index];\n          }\n\n          if (nameAry.length > index) {\n            item[\"name\"] = nameAry[index];\n          }\n\n          tmpAry.push(item);\n        });\n      } // 对数组做深度对比，如果值不完全相等，则进行赋值操作\n\n\n      if (!utils.arrayEquals(tmpAry, this.demensions)) {\n        this.demensions = tmpAry;\n      }\n    },\n    showDialog: function showDialog() {\n      var _this2 = this;\n\n      if (!this.inputWriteable) {\n        return;\n      }\n\n      this.dialogVisible = true;\n      setTimeout(function () {\n        _this2.$refs.demSelector.onShow();\n      });\n    },\n    handleClose: function handleClose(done) {\n      this.$refs.demSelector.onHide();\n      done && done();\n    },\n    handleDialogSure: function handleDialogSure() {\n      this.dialogVisible = false;\n      this.$refs.demSelector.onHide(true);\n    },\n    handleDialogCancel: function handleDialogCancel() {\n      this.dialogVisible = false;\n      this.$refs.demSelector.onHide();\n    },\n    handleRemove: function handleRemove(item) {\n      this.demensions.remove(item);\n    },\n    // 更新当前输入框的高度来适配已选数据的高度\n    calacInputSuffixHeight: function calacInputSuffixHeight() {\n      if (!this.$refs.tagSpans) return;\n\n      if (this.$refs.tagSpans.offsetHeight) {\n        this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5;\n      } else {\n        this.inputSuffixHeight = 30;\n      }\n    },\n    load: function load(param, cb) {\n      this.$emit(\"load\", param, cb);\n    }\n  }\n};",null]}