{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowFormAuth.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowFormAuth.vue","mtime":1675071991803},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.array.sort\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.to-string\";\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\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//\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//\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 flow from \"@/api/flow.js\";\nimport req from \"@/request.js\";\nimport { mapState, mapActions } from \"vuex\";\n\nvar eipAuthDialog = function eipAuthDialog() {\n  return import(\"@/components/dialog/EipAuthDialog.vue\");\n};\n\nvar flowFormSubRowAuth = function flowFormSubRowAuth() {\n  return import(\"@/components/flow/FlowFormSubRowAuth.vue\");\n};\n\nexport default {\n  props: [\"defId\", \"topDefKey\"],\n  components: {\n    eipAuthDialog: eipAuthDialog,\n    flowFormSubRowAuth: flowFormSubRowAuth\n  },\n  data: function data() {\n    return {\n      dialogVisible: false,\n      _oldPermission: {},\n      subTableList: [],\n      permissionList: [],\n      pageParams: {},\n      curAuthieldObj: {},\n      subRowAuth: {},\n      boTree: {}\n    };\n  },\n  methods: {\n    selectField: function selectField(field, rightType, action) {\n      var data = [{\n        checked: true,\n        title: \"无\",\n        type: \"none\"\n      }];\n\n      if (action == \"everyone\") {\n        data = [{\n          checked: true,\n          title: \"所有人\",\n          type: \"everyone\"\n        }];\n      }\n\n      field[rightType] = data; //当只读，编辑和必填是所有人时，将只读点击无时，自动将编辑和必填也设置为无\n\n      if (rightType == 'read' && action == 'none') {\n        field['write'] = [{\n          checked: true,\n          title: \"无\",\n          type: \"none\"\n        }];\n        field['required'] = [{\n          checked: true,\n          title: \"无\",\n          type: \"none\"\n        }];\n      } //当编辑和必填是所有人时，将编辑点击无时，自动将必填也设置为无\n\n\n      if (rightType == 'write' && action == 'none') {\n        field['required'] = [{\n          checked: true,\n          title: \"无\",\n          type: \"none\"\n        }];\n      }\n    },\n    openSunRowAuthDailog: function openSunRowAuthDailog(table) {\n      this.$refs.flowFormSubRowAuth.showDialog(this.subRowAuth, table, this.boTree);\n    },\n    showDialog: function showDialog(param) {\n      this.dialogVisible = true;\n      var this_ = this;\n      this.pageParams = param;\n      req.post(window.context.form + \"/form/rights/v1/getPermission\", param).then(function (response) {\n        var data = response.data;\n        data.permissionList.push({\n          type: \"none\",\n          title: \"无\"\n        });\n        this_._oldPermission = JSON.parse(JSON.stringify(data));\n        this_.handleData(data);\n        var permissionObj = {};\n\n        for (var i = 0, p; p = data.permissionList[i++];) {\n          permissionObj[p.type] = p.title;\n        }\n\n        this_.permissionList = permissionObj;\n      });\n      req.get(window.context.form + \"/form/form/v1/generateBoTreeData?formKey=\" + this.pageParams.formKey).then(function (response) {\n        var data = response.data;\n\n        if (data && data.value) {\n          this_.boTree = JSON.parse(data.value);\n        }\n      });\n    },\n    handleClose: function handleClose() {\n      this._oldPermission = {};\n      this.subTableList = [];\n      this.permissionList = [];\n      this.pageParams = {};\n      this.curAuthieldObj = {};\n      this.subRowAuth = {};\n      this.boTree = {};\n      this.dialogVisible = false;\n    },\n    addNewField: function addNewField() {\n      var _this = this;\n\n      var this_ = this;\n      req.post(window.context.form + \"/form/rights/v1/getDefaultByFormKey?type=1&formKey=\" + this.pageParams.formKey, this.pageParams).then(function (response) {\n        var data = response.data;\n\n        if (this_._oldPermission) {\n          // 不存在的字段，添加进来\n          _this.deepMerge(data, this_._oldPermission);\n        }\n\n        this_.handleData(data);\n      });\n    },\n    deepMerge: function deepMerge(obj1, obj2) {\n      var key;\n\n      for (key in obj2) {\n        // 如果target(也就是obj1[key])存在，且是对象的话再去调用deepMerge，否则就是obj1[key]里面没这个对象，需要与obj2[key]合并\n        if (!obj2.hasOwnProperty(key)) continue;\n        obj1[key] = obj1[key] && obj1[key].toString() === \"[object Object]\" ? this.deepMerge(obj1[key], obj2[key]) : obj1[key] = obj2[key];\n      }\n\n      return obj1;\n    },\n    emptyAll: function emptyAll() {\n      var _this2 = this;\n\n      var this_ = this;\n      req.get(window.context.form + \"/form/rights/v1/emptyAll?flowKey=\" + this.pageParams.flowKey).then(function (response) {\n        var data = response.data;\n\n        if (data.state) {\n          this_.$message.success(data.message);\n          this_.showDialog(_this2.pageParams);\n        } else {\n          this_.$message.fail(data.message);\n        }\n      });\n    },\n    getDefaultByFormKey: function getDefaultByFormKey() {\n      var this_ = this;\n      req.post(window.context.form + \"/form/rights/v1/getDefaultByFormKey?type=1&formKey=\" + this.pageParams.formKey, this.pageParams).then(function (response) {\n        var data = response.data;\n        this_.handleData(data);\n      });\n    },\n    hideOrShowAll: function hideOrShowAll() {\n      if (this.checkIsAllhide()) {\n        this.hiddenAll();\n      } else {\n        this.editAll();\n      }\n    },\n    hiddenAll: function hiddenAll() {\n      this.clickAll(\"read\", \"none\");\n      this.clickAll(\"write\", \"none\");\n      this.clickAll(\"required\", \"none\");\n    },\n    editAll: function editAll() {\n      this.clickAll(\"read\", \"everyone\");\n      this.clickAll(\"write\", \"none\");\n      this.clickAll(\"required\", \"none\");\n    },\n\n    /**\r\n     * 批量权限选择 rightType：权限类型 只读-\"read\" 编辑-\"write\" 必填-\"required\"\r\n     */\n    clickAll: function clickAll(rightType, type) {\n      for (var index = 0; index < this.subTableList.length; index++) {\n        //子表\n        if (!this.subTableList[index].main && this.subTableList[index].ctrlType != \"dataView\") {\n          if (rightType == \"write\" && type == \"none\") {\n            this.subTableList[index].rights.add = false;\n            this.subTableList[index].rights.del = false;\n          } else if (rightType == \"write\" && type == \"everyone\") {\n            this.subTableList[index].rights.add = true;\n            this.subTableList[index].rights.del = true;\n          }\n        }\n\n        var fields = this.subTableList[index].fields;\n\n        for (var j = 0, f; f = fields[j++];) {\n          f[rightType] = [{\n            type: type\n          }]; //当只读，编辑和必填是所有人时，将只读点击无时，自动将编辑和必填也设置为无\n\n          if (rightType == 'read' && type == 'none') {\n            f['write'] = [{\n              checked: true,\n              title: \"无\",\n              type: \"none\"\n            }];\n            f['required'] = [{\n              checked: true,\n              title: \"无\",\n              type: \"none\"\n            }];\n          } //当编辑和必填是所有人时，将编辑点击无时，自动将必填也设置为无\n\n\n          if (rightType == 'write' && type == 'none') {\n            f['required'] = [{\n              checked: true,\n              title: \"无\",\n              type: \"none\"\n            }];\n          }\n        }\n      }\n    },\n    checkIsAllhide: function checkIsAllhide() {\n      for (var index = 0; index < this.subTableList.length; index++) {\n        var fields = this.subTableList[index].fields;\n\n        if (fields && fields.constructor == Array) {\n          for (var j = 0; j < fields.length; j++) {\n            var file = fields[j];\n\n            if (this.checkIshide(file) == \"否\") {\n              return true;\n            }\n          }\n        }\n      }\n\n      return false;\n    },\n    checkIshide: function checkIshide(file) {\n      var desc = \"是\";\n\n      if (file && file.read && file.read.length > 0) {\n        if (file.read[0].type != \"none\") {\n          desc = \"否\";\n          return desc;\n        }\n      }\n\n      if (file && file.required && file.required.length > 0) {\n        if (file.required[0].type != \"none\") {\n          desc = \"否\";\n          return desc;\n        }\n      }\n\n      if (file && file.write && file.write.length > 0) {\n        if (file.write[0].type != \"none\") {\n          desc = \"否\";\n          return desc;\n        }\n      }\n\n      return desc;\n    },\n    hideColumn: function hideColumn(field) {\n      if (this.checkIshide(field) == \"否\") {\n        field.read = [{\n          type: \"none\"\n        }];\n        field.required = [{\n          type: \"none\"\n        }];\n        field.write = [{\n          type: \"none\"\n        }];\n      } else {\n        field.read = [{\n          type: \"everyone\"\n        }];\n        field.required = [{\n          type: \"none\"\n        }];\n        field.write = [{\n          type: \"everyone\"\n        }];\n      }\n    },\n    fieldDialog: function fieldDialog(field, rightType) {\n      this.curAuthieldObj[\"f\"] = field;\n      this.curAuthieldObj[\"t\"] = rightType;\n      var tmp = JSON.parse(JSON.stringify(field[rightType]));\n      var conf = {\n        right: tmp,\n        permissionList: this._oldPermission.permissionList\n      };\n      this.$refs.flowFormFiledAuth.showDialog(conf);\n    },\n    filedAuthConfirm: function filedAuthConfirm(conf) {\n      this.curAuthieldObj[\"f\"][this.curAuthieldObj[\"t\"]] = conf;\n    },\n    rightToDesc: function rightToDesc(right) {\n      var _this3 = this;\n\n      var desc = \"\";\n      right.forEach(function (element) {\n        if (desc) {\n          desc += \" 和 \";\n        }\n\n        var str = _this3.permissionList[element.type];\n\n        if (element.name) {\n          str += \":\" + element.name;\n        } else if (element.id) {\n          str += \":\" + element.id;\n        }\n\n        desc += str;\n      });\n      return desc;\n    },\n    indexOf: function indexOf(data, val) {\n      if (data.indexOf(val) != -1) {\n        return true;\n      }\n\n      return false;\n    },\n    saveAuth: function saveAuth() {\n      var param = JSON.parse(JSON.stringify(this.pageParams)); // 提交前拼装回json\n\n      param.permission = {};\n      param.permission.table = {};\n      var tmp = JSON.parse(JSON.stringify(this.subTableList));\n\n      var _iterator = _createForOfIteratorHelper(tmp),\n          _step;\n\n      try {\n        for (_iterator.s(); !(_step = _iterator.n()).done;) {\n          var iterator = _step.value;\n          var _fields = {};\n\n          var _iterator2 = _createForOfIteratorHelper(iterator.fields),\n              _step2;\n\n          try {\n            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n              var f = _step2.value;\n              _fields[f.fieldName] = f;\n            }\n          } catch (err) {\n            _iterator2.e(err);\n          } finally {\n            _iterator2.f();\n          }\n\n          iterator.fields = _fields;\n          param.permission.table[iterator.tableName] = iterator;\n        } //如果为实例情况，清除读写权限。\n\n      } catch (err) {\n        _iterator.e(err);\n      } finally {\n        _iterator.f();\n      }\n\n      if (param.type == \"2\") {\n        this.handPermissionData(param.permission);\n      } else {\n        param.permission.subRowAuth = this.subRowAuth;\n      }\n\n      param.permission = JSON.stringify(param.permission);\n      var this_ = this;\n      req.post(window.context.form + \"/form/rights/v1/save\", param).then(function (response) {\n        var data = response.data;\n\n        if (data.state) {\n          this_.$message.success(data.message);\n          this_.handleClose();\n        } else {\n          this_.$message.fail(data.message);\n        }\n      });\n    },\n    handPermissionData: function handPermissionData(json) {\n      //param.permission\n      var tableJson = json.table; //遍历表\n\n      for (var _key in tableJson) {\n        //获取字段\n        var fields = tableJson[_key].fields; //遍历字段\n\n        for (var fieleName in fields) {\n          //字段信息\n          var field = fields[fieleName];\n          delete field.write;\n          delete field.required;\n        }\n      }\n\n      var opinions = json.opinion;\n      if (!opinions) return;\n\n      for (var key in opinions) {\n        var opinion = opinions[key];\n        delete opinion.write;\n        delete opinion.required;\n      }\n    },\n    handleData: function handleData(data) {\n      var _this4 = this;\n\n      var tableSn = data.tableSn;\n      data = data.json;\n      this.subRowAuth = data.subRowAuth || {};\n      this.subTableList = [];\n      tableSn.forEach(function (obj) {\n        var temp = data.table[obj.name_];\n\n        if (temp) {\n          temp.tableName = obj.name_;\n          temp.grade = obj.grade_;\n          var tempArr = [];\n\n          for (var fieldName in temp.fields) {\n            var fieldTemp = temp.fields[fieldName];\n            fieldTemp.fieldName = fieldName;\n            tempArr.push(fieldTemp);\n          }\n\n          tempArr.sort(function (a, b) {\n            return a.sn - b.sn;\n          });\n          temp.fields = tempArr;\n\n          _this4.subTableList.push(temp);\n        }\n      });\n    }\n  }\n};",null]}