+
取 消
确 定
diff --git a/src/views/bpm/model/form/PrintTemplate/MentionModal.vue b/src/views/bpm/model/form/PrintTemplate/MentionModal.vue
index fe96d66f..9343f225 100644
--- a/src/views/bpm/model/form/PrintTemplate/MentionModal.vue
+++ b/src/views/bpm/model/form/PrintTemplate/MentionModal.vue
@@ -6,47 +6,48 @@ const top = ref('')
const left = ref('')
const searchVal = ref('')
const list = ref([
- {id: 'startUser', name: '发起人'},
- {id: 'startUserDept', name: '发起人部门'},
- {id: 'processName', name: '流程名称'},
- {id: 'processNum', name: '流程编号'},
- {id: 'startTime', name: '发起时间'},
- {id: 'endTime', name: '发起时间'},
- {id: 'processStatus', name: '流程状态'},
- {id: 'processResult', name: '流程结果'},
- {id: 'printUser', name: '打印人'},
- {id: 'printTime', name: '打印时间'},
+ { id: 'startUser', name: '发起人' },
+ { id: 'startUserDept', name: '发起人部门' },
+ { id: 'processName', name: '流程名称' },
+ { id: 'processNum', name: '流程编号' },
+ { id: 'startTime', name: '发起时间' },
+ { id: 'endTime', name: '发起时间' },
+ { id: 'processStatus', name: '流程状态' },
+ { id: 'processResult', name: '流程结果' },
+ { id: 'printUser', name: '打印人' },
+ { id: 'printTime', name: '打印时间' }
])
const searchedList = computed(() => {
const searchValStr = searchVal.value.trim().toLowerCase()
- return list.value.filter(item => {
+ return list.value.filter((item) => {
const name = item.name.toLowerCase()
- return name.indexOf(searchValStr) >= 0;
+ return name.indexOf(searchValStr) >= 0
})
})
-const inputKeyupHandler = (event) => {
+const inputKeyupHandler = (event: any) => {
if (event.key === 'Escape') {
emit('hideMentionModal')
}
if (event.key === 'Enter') {
const firstOne = searchedList.value[0]
if (firstOne) {
- const {id, name} = firstOne
+ const { id, name } = firstOne
insertMentionHandler(id, name)
}
}
}
-const insertMentionHandler = (id, name) => {
+const insertMentionHandler = (id: any, name: any) => {
emit('insertMention', id, name)
emit('hideMentionModal')
}
const formFields = inject('formFieldsObj')
-onMounted(()=> {
+onMounted(() => {
+ // TODO @lesan:这里 idea 会爆红,看看能不能处理下;
if (formFields.value && formFields.value.length > 0) {
const cloneFormField = formFields.value.map((item) => {
return {
- name: '[表单]'+item.title,
+ name: '[表单]' + item.title,
id: item.field
}
})
@@ -66,13 +67,15 @@ onMounted(()=> {
diff --git a/src/views/bpm/model/form/PrintTemplate/index.ts b/src/views/bpm/model/form/PrintTemplate/index.ts
index 1f5298e3..4c304ed7 100644
--- a/src/views/bpm/model/form/PrintTemplate/index.ts
+++ b/src/views/bpm/model/form/PrintTemplate/index.ts
@@ -1,8 +1,9 @@
-import {Boot} from '@wangeditor/editor'
-import processRecordModule from "./module";
-import mentionModule from "@wangeditor/plugin-mention";
+import { Boot } from '@wangeditor/editor'
+import processRecordModule from './module'
+import mentionModule from '@wangeditor/plugin-mention'
-// 注册。要在创建编辑器之前注册,且只能注册一次,不可重复注册。
+// 注册:要在创建编辑器之前注册,且只能注册一次,不可重复注册
+// TODO @lesan:WangEditor 拼写
export const setupWangeditorPlugin = () => {
Boot.registerModule(processRecordModule)
Boot.registerModule(mentionModule)
diff --git a/src/views/bpm/model/form/PrintTemplate/module/elem-to-html.ts b/src/views/bpm/model/form/PrintTemplate/module/elem-to-html.ts
index 3b688c35..29af6427 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/elem-to-html.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/elem-to-html.ts
@@ -1,12 +1,12 @@
import { SlateElement } from '@wangeditor/editor'
-function processRecordToHtml(elem: SlateElement, childrenHtml: string): string {
+function processRecordToHtml(_elem: SlateElement, _childrenHtml: string): string {
return `流程记录`
}
const conf = {
type: 'process-record',
- elemToHtml: processRecordToHtml,
+ elemToHtml: processRecordToHtml
}
export default conf
diff --git a/src/views/bpm/model/form/PrintTemplate/module/index.ts b/src/views/bpm/model/form/PrintTemplate/module/index.ts
index 813b8ebf..a4e51d55 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/index.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/index.ts
@@ -1,16 +1,17 @@
-import {IModuleConf} from '@wangeditor/editor'
+import { IModuleConf } from '@wangeditor/editor'
import withProcessRecord from './plugin'
import renderElemConf from './render-elem'
import elemToHtmlConf from './elem-to-html'
import parseHtmlConf from './parse-elem-html'
-import processRecordMenu from "./menu/ProcessRecordMenu"
+import processRecordMenu from './menu/ProcessRecordMenu'
+// TODO @lesan:PrintTemplate 是参考了哪些文档哇?要不要在 index.ts 稍微写点注释,方便大家理解;
const module: Partial = {
editorPlugin: withProcessRecord,
renderElems: [renderElemConf],
elemsToHtml: [elemToHtmlConf],
parseElemsHtml: [parseHtmlConf],
- menus: [processRecordMenu],
+ menus: [processRecordMenu]
}
export default module
diff --git a/src/views/bpm/model/form/PrintTemplate/module/menu/ProcessRecordMenu.ts b/src/views/bpm/model/form/PrintTemplate/module/menu/ProcessRecordMenu.ts
index 076ec0e6..9f0346ff 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/menu/ProcessRecordMenu.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/menu/ProcessRecordMenu.ts
@@ -1,31 +1,31 @@
import { IButtonMenu, IDomEditor } from '@wangeditor/editor'
class ProcessRecordMenu implements IButtonMenu {
- readonly tag: string;
- readonly title: string;
+ readonly tag: string
+ readonly title: string
constructor() {
this.title = '流程记录'
this.tag = 'button'
}
- getValue(editor: IDomEditor): string {
+ getValue(_editor: IDomEditor): string {
return ''
}
- isActive(editor: IDomEditor): boolean {
+ isActive(_editor: IDomEditor): boolean {
return false
}
- isDisabled(editor: IDomEditor): boolean {
+ isDisabled(_editor: IDomEditor): boolean {
return false
}
- exec(editor: IDomEditor, value: string) {
+ exec(editor: IDomEditor, _value: string) {
if (this.isDisabled(editor)) return
const processRecordElem = {
type: 'process-record',
- children: [{ text: '' }],
+ children: [{ text: '' }]
}
editor.insertNode(processRecordElem)
editor.move(1)
diff --git a/src/views/bpm/model/form/PrintTemplate/module/parse-elem-html.ts b/src/views/bpm/model/form/PrintTemplate/module/parse-elem-html.ts
index 44925cfb..0582acd2 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/parse-elem-html.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/parse-elem-html.ts
@@ -2,19 +2,20 @@ import { DOMElement } from './utils/dom'
import { IDomEditor, SlateDescendant, SlateElement } from '@wangeditor/editor'
function parseHtml(
- elem: DOMElement,
- children: SlateDescendant[],
- editor: IDomEditor
+ _elem: DOMElement,
+ _children: SlateDescendant[],
+ _editor: IDomEditor
): SlateElement {
return {
+ // TODO @lesan:这里有个红色告警,可以去掉哇?
type: 'process-record',
- children: [{ text: '' }],
+ children: [{ text: '' }]
}
}
const parseHtmlConf = {
selector: 'span[data-w-e-type="process-record"]',
- parseElemHtml: parseHtml,
+ parseElemHtml: parseHtml
}
export default parseHtmlConf
diff --git a/src/views/bpm/model/form/PrintTemplate/module/plugin.ts b/src/views/bpm/model/form/PrintTemplate/module/plugin.ts
index 40cdd193..86c3f38b 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/plugin.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/plugin.ts
@@ -4,7 +4,7 @@ function withProcessRecord(editor: T) {
const { isInline, isVoid } = editor
const newEditor = editor
- newEditor.isInline = elem => {
+ newEditor.isInline = (elem) => {
const type = DomEditor.getNodeType(elem)
if (type === 'process-record') {
return true
@@ -13,7 +13,7 @@ function withProcessRecord(editor: T) {
return isInline(elem)
}
- newEditor.isVoid = elem => {
+ newEditor.isVoid = (elem) => {
const type = DomEditor.getNodeType(elem)
if (type === 'process-record') {
return true
diff --git a/src/views/bpm/model/form/PrintTemplate/module/render-elem.ts b/src/views/bpm/model/form/PrintTemplate/module/render-elem.ts
index 58a9e6b0..7f24f82c 100644
--- a/src/views/bpm/model/form/PrintTemplate/module/render-elem.ts
+++ b/src/views/bpm/model/form/PrintTemplate/module/render-elem.ts
@@ -1,72 +1,73 @@
-import {h, VNode} from 'snabbdom'
-import {DomEditor, IDomEditor, SlateElement} from '@wangeditor/editor'
+import { h, VNode } from 'snabbdom'
+import { DomEditor, IDomEditor, SlateElement } from '@wangeditor/editor'
-function renderProcessRecord(elem: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode {
+function renderProcessRecord(
+ elem: SlateElement,
+ _children: VNode[] | null,
+ editor: IDomEditor
+): VNode {
const selected = DomEditor.isNodeSelected(editor, elem)
- const vnode = h(
+ return h(
'table',
{
props: {
- contentEditable: false,
+ contentEditable: false
},
style: {
width: '100%',
- border: selected
- ? '2px solid var(--w-e-textarea-selected-border-color)'
- : '',
- },
+ border: selected ? '2px solid var(--w-e-textarea-selected-border-color)' : ''
+ }
},
[
- h('thead', [
- h('tr', [h('th', {attrs: {colSpan: 3}}, '流程记录')])
- ]),
+ h('thead', [h('tr', [h('th', { attrs: { colSpan: 3 } }, '流程记录')])]),
h('tbody', [
h('tr', [
- h('td', [h(
- 'span',
- {
- props: {
- contentEditable: false,
+ h('td', [
+ h(
+ 'span',
+ {
+ props: {
+ contentEditable: false
+ },
+ style: {
+ marginLeft: '3px',
+ marginRight: '3px',
+ backgroundColor: 'var(--w-e-textarea-slight-bg-color)',
+ borderRadius: '3px',
+ padding: '0 3px'
+ }
},
- style: {
- marginLeft: '3px',
- marginRight: '3px',
- backgroundColor: 'var(--w-e-textarea-slight-bg-color)',
- borderRadius: '3px',
- padding: '0 3px',
- },
- },
- `节点`
- )
+ `节点`
+ )
]),
- h('td', [h(
- 'span',
- {
- props: {
- contentEditable: false,
+ h('td', [
+ h(
+ 'span',
+ {
+ props: {
+ contentEditable: false
+ },
+ style: {
+ marginLeft: '3px',
+ marginRight: '3px',
+ backgroundColor: 'var(--w-e-textarea-slight-bg-color)',
+ borderRadius: '3px',
+ padding: '0 3px'
+ }
},
- style: {
- marginLeft: '3px',
- marginRight: '3px',
- backgroundColor: 'var(--w-e-textarea-slight-bg-color)',
- borderRadius: '3px',
- padding: '0 3px',
- },
- },
- `操作`
- )
+ `操作`
+ )
])
])
])
]
)
- return vnode
}
const conf = {
type: 'process-record',
- renderElem: renderProcessRecord,
+ renderElem: renderProcessRecord
}
export default conf
diff --git a/src/views/bpm/processInstance/detail/PrintDialog.vue b/src/views/bpm/processInstance/detail/PrintDialog.vue
index 498e46b6..785b70c5 100644
--- a/src/views/bpm/processInstance/detail/PrintDialog.vue
+++ b/src/views/bpm/processInstance/detail/PrintDialog.vue
@@ -12,7 +12,7 @@ const printData = ref()
const userName = computed(() => userStore.user.nickname ?? '')
const printTime = ref(formatDate(new Date(), 'YYYY-MM-DD HH:mm'))
-const open = async (id) => {
+const open = async (id: string) => {
loading.value = true
try {
printData.value = await ProcessInstanceApi.getProcessInstancePrintData(id)
@@ -98,6 +98,7 @@ const printObj = ref({