Explorar o código

add: 数字签名添加关闭数字签名和电子签名配置

liutian hai 2 semanas
pai
achega
773d1bd629

+ 7 - 3
packages/webview/src/components/Dialogs/SelectSignTypeDialog.vue

@@ -39,16 +39,20 @@ const useDocument = useDocumentStore()
 const dialogName = 'selectSignTypeDialog'
 const dialogName = 'selectSignTypeDialog'
 const show = computed(() => useViewer.isElementOpen(dialogName))
 const show = computed(() => useViewer.isElementOpen(dialogName))
 const activeTool = computed(() => useDocument.getActiveTool)
 const activeTool = computed(() => useDocument.getActiveTool)
+const disableDigitalSignature = computed(() => useDocument.getDisableDigitalSignature)
+const disableElectronicSignature = computed(() => useDocument.getDisableElectronicSignature)
 
 
 const type = ref('electronic')
 const type = ref('electronic')
 
 
 const showDialog = (data) => {
 const showDialog = (data) => {
   useViewer.setSelectedSignatureField(data)
   useViewer.setSelectedSignatureField(data)
-  if (activeTool.value === 'addDigitalSign') {
+  if (activeTool.value === 'addDigitalSign' || (!disableDigitalSignature.value && disableElectronicSignature.value)) {
     useViewer.openElement('addDigitalFileDialog')
     useViewer.openElement('addDigitalFileDialog')
+  } else if (activeTool.value === 'addElectronicSign' || (disableDigitalSignature.value && !disableElectronicSignature.value)) {
+    openSignCreatePanel()
+  } else {
+    useViewer.openElement('selectSignTypeDialog')
   }
   }
-  else if (activeTool.value === 'addElectronicSign') openSignCreatePanel()
-  else useViewer.openElement('selectSignTypeDialog')
 }
 }
 core.addEvent('openSelectSignTypeDialog', showDialog)
 core.addEvent('openSelectSignTypeDialog', showDialog)
 
 

+ 3 - 1
packages/webview/src/components/Dialogs/SignatureAppearanceDialog.vue

@@ -125,6 +125,8 @@ const activeTool = computed(() => useDocument.getActiveTool)
 const preview = computed(() => useViewer.getDigitalSignaturePreview)
 const preview = computed(() => useViewer.getDigitalSignaturePreview)
 const activeDigitalSignCreatePanel = computed(() => useViewer.isElementOpen('digitalSignCreatePanel'))
 const activeDigitalSignCreatePanel = computed(() => useViewer.isElementOpen('digitalSignCreatePanel'))
 const activeDigitalKeyboardCreatePanel = computed(() => useViewer.isElementOpen('digitalKeyboardCreatePanel'))
 const activeDigitalKeyboardCreatePanel = computed(() => useViewer.isElementOpen('digitalKeyboardCreatePanel'))
+const disableDigitalSignature = computed(() => useDocument.getDisableDigitalSignature)
+const disableElectronicSignature = computed(() => useDocument.getDisableElectronicSignature)
 const subject = computed(() => useViewer.getCertSubject)
 const subject = computed(() => useViewer.getCertSubject)
 const uploadImageEl = ref(null)
 const uploadImageEl = ref(null)
 
 
@@ -281,7 +283,7 @@ const closePanel = (flag) => {
 
 
   document.body.style.overflow = ''
   document.body.style.overflow = ''
 
 
-  if (!activeTool.value && flag === 'cancel') useViewer.openElement('selectSignTypeDialog')
+  if (!activeTool.value && flag === 'cancel' && disableDigitalSignature.value && disableElectronicSignature.value) useViewer.openElement('selectSignTypeDialog')
   useViewer.setActiveSignWay('keyboard')
   useViewer.setActiveSignWay('keyboard')
 
 
   Object.assign(configurations, {
   Object.assign(configurations, {

+ 2 - 0
packages/webview/src/components/DocumentContainer/DocumentContainer.vue

@@ -274,6 +274,8 @@ window.instance.initOptions = async (options) => {
     useViewer.setUpload(false)
     useViewer.setUpload(false)
   }
   }
   options.autoJumpNextSign && useDocument.setAutoJumpNextSign(true)
   options.autoJumpNextSign && useDocument.setAutoJumpNextSign(true)
+  options.disableDigitalSignature && useDocument.setDisableDigitalSignature(options.disableDigitalSignature)
+  options.disableElectronicSignature && useDocument.setDisableElectronicSignature(options.disableElectronicSignature)
 
 
   core.addEvent('onPagesUpdated', (data) => {
   core.addEvent('onPagesUpdated', (data) => {
     const { pageNumber } = data
     const { pageNumber } = data

+ 2 - 2
packages/webview/src/components/HeaderItems/HeaderItems.vue

@@ -165,7 +165,7 @@ let showToolMode = computed(()=>{
 
 
 const webviewerMode = computed(() => useViewer.getWebviewerMode)
 const webviewerMode = computed(() => useViewer.getWebviewerMode)
 const activeTool = computed(() => useDocument.getActiveTool)
 const activeTool = computed(() => useDocument.getActiveTool)
-const showDropdown = computed(() => popoverTool.value && popoverTool?.value[0].getMergedShow())
+const disableDigitalSignature = computed(() => useDocument.getDisableDigitalSignature)
 
 
 const changeToolMode = (mode) => {
 const changeToolMode = (mode) => {
   if (webviewerMode.value !== 'Standalone' && ['editor', 'document'].includes(mode)) {
   if (webviewerMode.value !== 'Standalone' && ['editor', 'document'].includes(mode)) {
@@ -173,7 +173,7 @@ const changeToolMode = (mode) => {
     else useViewer.openElement('docEditorPreventDialog')
     else useViewer.openElement('docEditorPreventDialog')
     return
     return
   }
   }
-  if (mode === 'sign') {
+  if (mode === 'sign' && !disableDigitalSignature) {
     window.$message.info($t('signatures.tip'), {
     window.$message.info($t('signatures.tip'), {
       duration: 3000,
       duration: 3000,
       showIcon: false
       showIcon: false

+ 5 - 3
packages/webview/src/components/SignatureToolBar/SignatureToolBar.vue

@@ -4,15 +4,15 @@
       <CreateSignField />
       <CreateSignField />
       <span>{{ $t('header.createSignField') }}</span>
       <span>{{ $t('header.createSignField') }}</span>
     </Button>
     </Button>
-    <Button :class="{ active: activeTool === 'addDigitalSign' }" @click="changeActiveTool('addDigitalSign')" :title="$t('header.addDigitalSign')">
+    <Button v-if="!disableDigitalSignature" :class="{ active: activeTool === 'addDigitalSign' }" @click="changeActiveTool('addDigitalSign')" :title="$t('header.addDigitalSign')">
       <AddDigitalSign />
       <AddDigitalSign />
       <span>{{ $t('header.addDigitalSign') }}</span>
       <span>{{ $t('header.addDigitalSign') }}</span>
     </Button>
     </Button>
-    <Button :class="{ active: activeTool === 'addElectronicSign' }" @click="changeActiveTool('addElectronicSign')" :title="$t('header.addElectronicSign')">
+    <Button v-if="!disableElectronicSignature" :class="{ active: activeTool === 'addElectronicSign' }" @click="changeActiveTool('addElectronicSign')" :title="$t('header.addElectronicSign')">
       <AddElectronicSign />
       <AddElectronicSign />
       <span>{{ $t('header.addElectronicSign') }}</span>
       <span>{{ $t('header.addElectronicSign') }}</span>
     </Button>
     </Button>
-    <Button @click="verifyDigitalSign" :title="$t('header.verifyDigitalSign')" :disabled="!signatures.length">
+    <Button v-if="!disableDigitalSignature" @click="verifyDigitalSign" :title="$t('header.verifyDigitalSign')" :disabled="!signatures.length">
       <VerifyDigitalSign />
       <VerifyDigitalSign />
       <span>{{ $t('header.verifyDigitalSign') }}</span>
       <span>{{ $t('header.verifyDigitalSign') }}</span>
     </Button>
     </Button>
@@ -32,6 +32,8 @@
 
 
   const activeTool = computed(() => useDocument.getActiveTool)
   const activeTool = computed(() => useDocument.getActiveTool)
   const signatures = computed(() => useDocument.getSignatures)
   const signatures = computed(() => useDocument.getSignatures)
+const disableDigitalSignature = computed(() => useDocument.getDisableDigitalSignature)
+const disableElectronicSignature = computed(() => useDocument.getDisableElectronicSignature)
 
 
   const changeActiveTool = (tool) => {
   const changeActiveTool = (tool) => {
     useDocument.setToolState(tool)
     useDocument.setToolState(tool)

+ 3 - 1
packages/webview/src/components/Signatures/SignCreatePanel.vue

@@ -100,6 +100,8 @@ const show = computed(() => useViewer.isElementOpen('signCreatePanel'))
 const activeSignWay = computed(() => useViewer.getActiveElementTab('signPanel'))
 const activeSignWay = computed(() => useViewer.getActiveElementTab('signPanel'))
 const toolMode = computed(() => useViewer.getToolMode)
 const toolMode = computed(() => useViewer.getToolMode)
 const activeTool = computed(() => useDocument.getActiveTool)
 const activeTool = computed(() => useDocument.getActiveTool)
+const disableDigitalSignature = computed(() => useDocument.getDisableDigitalSignature)
+const disableElectronicSignature = computed(() => useDocument.getDisableElectronicSignature)
 
 
 const textSgin = ref('')
 const textSgin = ref('')
 const imageData = ref('')
 const imageData = ref('')
@@ -184,7 +186,7 @@ const closePanel = (flag) => {
   clearProperty()
   clearProperty()
   document.body.style.overflow = ''
   document.body.style.overflow = ''
 
 
-  if (!activeTool.value && flag === 'cancel') useViewer.openElement('selectSignTypeDialog')
+  if (!activeTool.value && flag === 'cancel' && disableDigitalSignature.value && disableElectronicSignature.value) useViewer.openElement('selectSignTypeDialog')
 }
 }
 
 
 const clearData = () => {
 const clearData = () => {

+ 14 - 0
packages/webview/src/stores/modules/document.js

@@ -159,6 +159,8 @@ export const useDocumentStore = defineStore({
     highlightForm: true,
     highlightForm: true,
     redactionPrompted: false, // redaction首次进入提示
     redactionPrompted: false, // redaction首次进入提示
     autoJumpNextSign: false,
     autoJumpNextSign: false,
+    disableDigitalSignature: false, // 允许数字签名
+    disableElectronicSignature: false // 允许电子签名
   }),
   }),
   getters: {
   getters: {
     getTotalPages () {
     getTotalPages () {
@@ -322,6 +324,12 @@ export const useDocumentStore = defineStore({
     getAutoJumpNextSign () {
     getAutoJumpNextSign () {
       return this.autoJumpNextSign
       return this.autoJumpNextSign
     },
     },
+    getDisableDigitalSignature() {
+      return this.disableDigitalSignature
+    },
+    getDisableElectronicSignature() {
+      return this.disableElectronicSignature
+    }
   },
   },
   actions: {
   actions: {
     resetSetting () {
     resetSetting () {
@@ -530,5 +538,11 @@ export const useDocumentStore = defineStore({
       this.autoJumpNextSign = val
       this.autoJumpNextSign = val
       core.setAutoJumpNextSign(val)
       core.setAutoJumpNextSign(val)
     },
     },
+    setDisableDigitalSignature (val) {
+      this.disableDigitalSignature = val
+    },
+    setDisableElectronicSignature (val) {
+      this.disableElectronicSignature = val
+    }
   }
   }
 })
 })