{"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\\bizComponents\\eipControl\\EipSignature.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\bizComponents\\eipControl\\EipSignature.vue","mtime":1675071991475},{"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/es6.function.name\";\nimport \"core-js/modules/es6.array.sort\";\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//\nimport { mapState } from \"vuex\";\nimport req from \"@/request.js\";\nimport utils from \"@/components/bizComponents/utils.js\";\nimport { Base64 } from \"js-base64\";\nimport sub_pio_mixin from \"@/components/bizComponents/sub-permission-mixin.js\";\nexport default {\n  name: \"eip-signature\",\n  props: [\"maxPeople\", \"permission\", \"value\", \"fieldPath\"],\n  data: function data() {\n    return {\n      dialogVisible: false,\n      inputVal: \"\",\n      password: \"\",\n      signatureList: [],\n      showSignatureBtn: true,\n      showSignatureMap: {}\n    };\n  },\n  mixins: [sub_pio_mixin],\n  //混入方式引入表单组件中公共属性，处理子表、孙表行内联动（切面修改permission_sub）\n  computed: mapState({\n    userId: function userId(state) {\n      if (state.login && state.login.currentUser) {\n        return state.login.currentUser.userId;\n      }\n\n      return '';\n    },\n    userName: function userName(state) {\n      if (state.login && state.login.currentUser) {\n        return state.login.currentUser.username;\n      }\n\n      return '';\n    },\n    signatureConfig: function signatureConfig(state) {\n      return state.storeProcess.signatureConfig;\n    },\n    signatureStatus: function signatureStatus(state) {\n      return state.storeProcess.signatureConfig.status;\n    }\n  }),\n  watch: {\n    inputVal: function inputVal(newVal, oldVal) {\n      this.$emit(\"input\", newVal);\n    },\n    signatureList: {\n      handler: function handler(newVal, oldValue) {\n        if (!newVal || newVal.length == 0) {\n          this.showSignatureBtn = true;\n          this.$emit(\"input\", '');\n        } else if (newVal && newVal.length >= 1) {\n          var _this = this;\n\n          var signatures = JSON.parse(JSON.stringify(newVal));\n          signatures.forEach(function (item) {\n            if (item.userId == _this.userId) {\n              _this.showSignatureBtn = false;\n            }\n          });\n          this.$emit(\"input\", JSON.stringify(signatures));\n        }\n      },\n      deep: true,\n      immediate: true\n    },\n    signatureConfig: {\n      handler: function handler(newVal, oldVal) {\n        if (this.signatureConfig.field == this.fieldPath) {\n          if (newVal.status === 'start') {\n            this.submitSignature('ing'); //发出消息，开始签章处理\n\n            if (this.signatureConfig.isCover) {\n              this.signatureList = [];\n            } else {\n              var index = this.getCurrentIndex(null);\n\n              if (index >= 0) {\n                this.signatureList.splice(index, 1);\n              }\n            }\n\n            this.getSignature(this.signatureConfig.password);\n          }\n        } else if (newVal.status === 'start' && !this.fieldPath) {\n          this.$message.warning(\"未获取到签章字段路径，请初始化表单模板后重新保存表单！\");\n        }\n      },\n      deep: true,\n      immediate: true\n    }\n  },\n  methods: {\n    doSignature: function doSignature() {\n      this.password = '';\n      this.dialogVisible = true;\n    },\n    submitSignature: function submitSignature(status) {\n      this.$store.dispatch(\"storeProcess/setSignatureStatus\", status).then(function (rep) {});\n    },\n    getSignature: function getSignature(password) {\n      var _this2 = this;\n\n      var _this = this;\n\n      var url = window.context.uc + '/uc/electronicSeal/v1/getElectronicSeal?password=' + password + '&secretFree=' + this.signatureConfig.secretFree;\n      req.get(url).then(function (resp) {\n        if (resp.data.state) {\n          _this.dialogVisible = false;\n\n          _this.reloadSignatures(resp.data.value);\n\n          setTimeout(function () {\n            _this.submitSignature('success');\n          }, 300);\n        } else {\n          _this2.submitSignature('fail');\n        }\n      });\n    },\n    getShowSignature: function getShowSignature(fileId) {\n      var _this = this;\n\n      if (!this.showSignatureMap || !this.showSignatureMap[fileId]) {\n        var imgUrl = '';\n        req.get(window.context.portal + '/file/onlinePreviewController/v1/getFileById_' + fileId, 'arraybuffer').then(function (response) {\n          var type = response.headers['content-type'];\n\n          if (type) {\n            imgUrl = window.URL.createObjectURL(new Blob([response.data], {\n              type: type\n            }));\n          } else {\n            imgUrl = window.URL.createObjectURL(new Blob([response.data]));\n          }\n\n          _this.showSignatureMap[fileId] = imgUrl;\n\n          try {\n            _this.$refs['signature_' + fileId][0].src = imgUrl;\n          } catch (error) {\n            return imgUrl;\n          }\n        });\n        return imgUrl;\n      } else {\n        setTimeout(function () {\n          try {\n            if (_this.$refs['signature_' + fileId]) {\n              _this.$refs['signature_' + fileId][0].src = _this.showSignatureMap[fileId];\n            } else {\n              _this.getShowSignature(fileId);\n            }\n          } catch (error) {\n            return _this.showSignatureMap[fileId];\n          }\n        }, 100);\n      }\n    },\n    reloadSignatures: function reloadSignatures(fileId) {\n      if (fileId) {\n        this.showSignatureMap[fileId] = null;\n      }\n\n      var index = this.getCurrentIndex(fileId);\n\n      if (index < 0) {\n        this.signatureList.push({\n          index: this.signatureList.length + 1,\n          userId: this.userId,\n          name: this.userName,\n          signature: fileId,\n          createTime: utils.formatDate(new Date())\n        });\n      }\n    },\n    getCurrentIndex: function getCurrentIndex(fileId) {\n      var _this = this;\n\n      var rindex = -1;\n\n      if (this.signatureList.length > 0) {\n        var index = 0;\n        this.signatureList.forEach(function (f) {\n          if (f.userId == _this.userId) {\n            if (fileId) {\n              f.signature = fileId;\n              _this.showSignatureBtn = false;\n            }\n\n            rindex = index;\n            return rindex;\n          }\n\n          index++;\n        });\n      }\n\n      return rindex;\n    },\n    handleSort: function handleSort() {\n      this.signatureList.sort(function (a, b) {\n        var x = 'index'; //要排序字段\n\n        if (a[x] < b[x]) {\n          return -1;\n        }\n\n        if (a[x] > b[x]) {\n          return 1;\n        }\n\n        return 0;\n      });\n    },\n    getImgFit: function getImgFit(item) {\n      return item.name + ' 于 ' + item.createTime + ' 进行了签章';\n    },\n    handleRemove: function handleRemove(item) {\n      var index = 0;\n      var rIdx = 0;\n      this.signatureList.forEach(function (sn) {\n        if (sn.userId == item.userId) {\n          rIdx = index;\n        }\n\n        index++;\n      });\n      this.signatureList.splice(rIdx, 1);\n      this.showSignatureBtn = true;\n    },\n    onConfirm: function onConfirm() {\n      if (!this.password) {\n        this.$message.error(\"请填写获取签章密码！\");\n        return;\n      }\n\n      this.getSignature(this.password);\n    },\n    handleClose: function handleClose() {\n      this.dialogVisible = false;\n      this.submitSignature('fail');\n    }\n  },\n  mounted: function mounted() {\n    this.$validator = this.$root.$validator;\n\n    if (this.value) {\n      this.signatureList = JSON.parse(this.value); // let list = JSON.parse(this.value);\n      // let _this = this;\n      // list.forEach(item =>{\n      //   _this.showCurSignature(item.userId, item.name, item.signature);\n      // })\n    }\n  }\n};",null]}