Compare commits
2 Commits
1dc321ba5c
...
327064b7e5
Author | SHA1 | Date |
---|---|---|
|
327064b7e5 | |
|
64a82a6775 |
|
@ -28,7 +28,9 @@
|
|||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.4",
|
||||
"echarts": "^5.4.2",
|
||||
"html2canvas": "^1.4.1",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"jspdf": "^3.0.1",
|
||||
"lint-staged": "^15.2.10",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mitt": "^3.0.0",
|
||||
|
@ -763,7 +765,7 @@
|
|||
},
|
||||
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
|
||||
"version": "1.3.0",
|
||||
"dev": true,
|
||||
"extraneous": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
@ -3278,6 +3280,13 @@
|
|||
"query-string": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/raf": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
|
||||
"integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@types/sortablejs": {
|
||||
"version": "1.15.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.15.8.tgz",
|
||||
|
@ -3295,6 +3304,13 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/trusted-types": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@types/unist": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
|
||||
|
@ -4869,7 +4885,6 @@
|
|||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
|
||||
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
|
||||
"dev": true,
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"bin": {
|
||||
"atob": "bin/atob.js"
|
||||
|
@ -4952,6 +4967,15 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-arraybuffer": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
|
||||
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/big.js": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||
|
@ -5075,6 +5099,18 @@
|
|||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
}
|
||||
},
|
||||
"node_modules/btoa": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz",
|
||||
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"bin": {
|
||||
"btoa": "bin/btoa.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
|
@ -5244,6 +5280,26 @@
|
|||
],
|
||||
"license": "CC-BY-4.0"
|
||||
},
|
||||
"node_modules/canvg": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.11.tgz",
|
||||
"integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@types/raf": "^3.4.0",
|
||||
"core-js": "^3.8.3",
|
||||
"raf": "^3.4.1",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"rgbcolor": "^1.0.1",
|
||||
"stackblur-canvas": "^2.0.0",
|
||||
"svg-pathdata": "^6.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/capital-case": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz",
|
||||
|
@ -5972,6 +6028,15 @@
|
|||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/css-line-break": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
|
||||
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"utrie": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/css-select": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz",
|
||||
|
@ -6423,6 +6488,16 @@
|
|||
"domelementtype": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz",
|
||||
"integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)",
|
||||
"optional": true,
|
||||
"optionalDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
}
|
||||
},
|
||||
"node_modules/domutils": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
|
||||
|
@ -8296,6 +8371,12 @@
|
|||
"integrity": "sha512-V1PWovkspxQfssq/NnxoEyQo1DV+MRK/laPuPblIZmSjMN8P5u46OhlFQznSr9p/t0Sp8Uc6SbM3yCMfr0KU8g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fflate": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
|
||||
"integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/figures": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz",
|
||||
|
@ -9054,6 +9135,19 @@
|
|||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/html2canvas": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz",
|
||||
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"css-line-break": "^2.1.0",
|
||||
"text-segmentation": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/htmlparser2": {
|
||||
"version": "3.10.1",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
|
||||
|
@ -10079,6 +10173,24 @@
|
|||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/jspdf": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/jspdf/-/jspdf-3.0.1.tgz",
|
||||
"integrity": "sha512-qaGIxqxetdoNnFQQXxTKUD9/Z7AloLaw94fFsOiJMxbfYdBbrBuhWmbzI8TVjrw7s3jBY1PFHofBKMV/wZPapg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.26.7",
|
||||
"atob": "^2.1.2",
|
||||
"btoa": "^1.2.1",
|
||||
"fflate": "^0.8.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"canvg": "^3.0.11",
|
||||
"core-js": "^3.6.0",
|
||||
"dompurify": "^3.2.4",
|
||||
"html2canvas": "^1.0.0-rc.5"
|
||||
}
|
||||
},
|
||||
"node_modules/keyv": {
|
||||
"version": "4.5.4",
|
||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
||||
|
@ -11669,6 +11781,13 @@
|
|||
"integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/performance-now": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
|
@ -12225,6 +12344,16 @@
|
|||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/raf": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
||||
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"performance-now": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
|
@ -12411,6 +12540,13 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.11",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
|
||||
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/regex-not": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
|
||||
|
@ -12679,6 +12815,16 @@
|
|||
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rgbcolor": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz",
|
||||
"integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
|
||||
"license": "MIT OR SEE LICENSE IN FEEL-FREE.md",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8.15"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.46.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.46.1.tgz",
|
||||
|
@ -13629,6 +13775,16 @@
|
|||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/stackblur-canvas": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
|
||||
"integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.1.14"
|
||||
}
|
||||
},
|
||||
"node_modules/static-extend": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
|
||||
|
@ -14216,6 +14372,16 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg-pathdata": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
|
||||
"integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svgo": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz",
|
||||
|
@ -14338,6 +14504,15 @@
|
|||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/text-segmentation": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz",
|
||||
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"utrie": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyexec": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
|
||||
|
@ -15284,6 +15459,15 @@
|
|||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/utrie": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
|
||||
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"base64-arraybuffer": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/v-viewer": {
|
||||
"version": "3.0.22",
|
||||
"resolved": "https://registry.npmjs.org/v-viewer/-/v-viewer-3.0.22.tgz",
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.4",
|
||||
"echarts": "^5.4.2",
|
||||
"html2canvas": "^1.4.1",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"jspdf": "^3.0.1",
|
||||
"lint-staged": "^15.2.10",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mitt": "^3.0.0",
|
||||
|
|
|
@ -54,5 +54,38 @@ export const regulationApi = {
|
|||
// 确认制度知晓
|
||||
confirmRegulation: (regulationId: string) => {
|
||||
return http.post(`/regulation/${regulationId}/confirm`)
|
||||
},
|
||||
|
||||
// 获取制度类型列表
|
||||
getRegulationTypes: (params?: {
|
||||
page?: number
|
||||
size?: number
|
||||
typeName?: string
|
||||
remark?: string
|
||||
}) => {
|
||||
return http.get('/regulation/types', params)
|
||||
},
|
||||
|
||||
// 创建制度类型
|
||||
createRegulationType: (data: {
|
||||
typeName: string
|
||||
sortOrder?: number
|
||||
isEnabled?: string
|
||||
}) => {
|
||||
return http.post('/regulation/types', data)
|
||||
},
|
||||
|
||||
// 更新制度类型
|
||||
updateRegulationType: (typeId: string, data: {
|
||||
typeName: string
|
||||
sortOrder?: number
|
||||
isEnabled?: string
|
||||
}) => {
|
||||
return http.put(`/regulation/types/${typeId}`, data)
|
||||
},
|
||||
|
||||
// 删除制度类型
|
||||
deleteRegulationType: (typeId: string) => {
|
||||
return http.del(`/regulation/types/${typeId}`)
|
||||
}
|
||||
}
|
|
@ -22,8 +22,6 @@ export interface Regulation {
|
|||
content: string
|
||||
regulationType: string
|
||||
status: RegulationStatus
|
||||
publisherId: string
|
||||
publisherName: string
|
||||
publishTime: string
|
||||
effectiveTime: string
|
||||
expireTime: string
|
||||
|
@ -38,6 +36,7 @@ export interface Regulation {
|
|||
page: number
|
||||
pageSize: number
|
||||
delFlag: string
|
||||
confirmStatus?: string
|
||||
}
|
||||
|
||||
// 创建提案请求接口
|
||||
|
@ -54,4 +53,34 @@ export interface CreateProposalRequest {
|
|||
export interface PaginationParams {
|
||||
page: number
|
||||
size: number
|
||||
}
|
||||
|
||||
// 制度类型接口
|
||||
export interface RegulationType {
|
||||
typeId: string
|
||||
typeName: string
|
||||
sortOrder: number
|
||||
isEnabled: string
|
||||
remark?: string
|
||||
createBy: string
|
||||
createTime: string
|
||||
updateBy: string
|
||||
updateTime: string
|
||||
delFlag: string
|
||||
}
|
||||
|
||||
// 创建制度类型请求接口
|
||||
export interface CreateRegulationTypeRequest {
|
||||
typeName: string
|
||||
sortOrder?: number
|
||||
isEnabled?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 更新制度类型请求接口
|
||||
export interface UpdateRegulationTypeRequest {
|
||||
typeName: string
|
||||
sortOrder?: number
|
||||
isEnabled?: string
|
||||
remark?: string
|
||||
}
|
|
@ -37,14 +37,21 @@ export const systemRoutes: RouteRecordRaw[] = [
|
|||
path: '/regulation/system-regulation',
|
||||
name: 'SystemRegulation',
|
||||
component: () => import('@/views/regulation/repository.vue'),
|
||||
meta: { title: '制度确认', icon: 'file-text', hidden: false },
|
||||
meta: { title: '制度公告', icon: 'file-text', hidden: false },
|
||||
},
|
||||
{
|
||||
path: '/regulation/process-management',
|
||||
name: 'ProcessManagement',
|
||||
component: () => import('@/views/regulation/confirm.vue'),
|
||||
meta: { title: '流程管理', icon: 'workflow', hidden: false },
|
||||
meta: { title: '制度公示', icon: 'workflow', hidden: false },
|
||||
},
|
||||
{
|
||||
path: '/regulation/type',
|
||||
name: 'RegulationType',
|
||||
component: () => import('@/views/regulation/type/index.vue'),
|
||||
meta: { title: '制度类型', icon: 'tag', hidden: false },
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
import jsPDF from 'jspdf'
|
||||
import html2canvas from 'html2canvas'
|
||||
|
||||
// PDF生成器类
|
||||
export class PDFGenerator {
|
||||
// 生成制度PDF
|
||||
static async generateRegulationPDF(regulation: any): Promise<Blob> {
|
||||
// 创建临时HTML元素
|
||||
const tempDiv = document.createElement('div')
|
||||
tempDiv.style.position = 'absolute'
|
||||
tempDiv.style.left = '-9999px'
|
||||
tempDiv.style.top = '-9999px'
|
||||
tempDiv.style.width = '800px'
|
||||
tempDiv.style.padding = '40px'
|
||||
tempDiv.style.backgroundColor = 'white'
|
||||
tempDiv.style.fontFamily = 'Arial, sans-serif'
|
||||
tempDiv.style.fontSize = '14px'
|
||||
tempDiv.style.lineHeight = '1.6'
|
||||
tempDiv.style.color = '#333'
|
||||
|
||||
// 添加水印样式
|
||||
tempDiv.style.position = 'relative'
|
||||
tempDiv.style.overflow = 'hidden'
|
||||
|
||||
// 生成HTML内容
|
||||
tempDiv.innerHTML = `
|
||||
<div style="position: relative; z-index: 1;">
|
||||
<!-- 水印 -->
|
||||
<div style="
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) rotate(-45deg);
|
||||
font-size: 48px;
|
||||
color: rgba(200, 200, 200, 0.3);
|
||||
font-weight: bold;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
">制度管理系统</div>
|
||||
|
||||
<!-- 标题 -->
|
||||
<h1 style="
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 30px;
|
||||
color: #333;
|
||||
">${regulation.title || '制度文档'}</h1>
|
||||
|
||||
<!-- 基本信息 -->
|
||||
<div style="margin-bottom: 30px;">
|
||||
<table style="width: 100%; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>制度类型:</strong>${regulation.regulationType || '-'}</td>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>发布人:</strong>${regulation.createBy || '-'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>发布时间:</strong>${regulation.publishTime || '-'}</td>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>生效日期:</strong>${regulation.effectiveTime || '-'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>适用范围:</strong>${regulation.scope || '-'}</td>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>制度级别:</strong>${regulation.level || '-'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"><strong>版本:</strong>${regulation.version || '1.0'}</td>
|
||||
<td style="padding: 8px 0; border-bottom: 1px solid #eee;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<hr style="border: none; border-top: 2px solid #ddd; margin: 30px 0;">
|
||||
|
||||
<!-- 制度内容 -->
|
||||
<div style="margin-bottom: 30px;">
|
||||
<h2 style="font-size: 18px; font-weight: bold; margin-bottom: 15px; color: #333;">制度内容:</h2>
|
||||
<div style="
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
line-height: 1.8;
|
||||
text-align: justify;
|
||||
">${regulation.content || ''}</div>
|
||||
</div>
|
||||
|
||||
${regulation.remark ? `
|
||||
<!-- 备注信息 -->
|
||||
<div style="margin-bottom: 30px;">
|
||||
<h2 style="font-size: 18px; font-weight: bold; margin-bottom: 15px; color: #333;">备注:</h2>
|
||||
<div style="
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
line-height: 1.8;
|
||||
text-align: justify;
|
||||
">${regulation.remark}</div>
|
||||
</div>
|
||||
` : ''}
|
||||
|
||||
<!-- 页脚 -->
|
||||
<div style="
|
||||
margin-top: 50px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #ddd;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
">
|
||||
生成时间:${new Date().toLocaleString('zh-CN')} | 制度ID:${regulation.regulationId || '-'}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
// 添加到DOM
|
||||
document.body.appendChild(tempDiv)
|
||||
|
||||
try {
|
||||
// 使用html2canvas转换为图片
|
||||
const canvas = await html2canvas(tempDiv, {
|
||||
scale: 2, // 提高清晰度
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
backgroundColor: '#ffffff',
|
||||
width: 800,
|
||||
height: tempDiv.scrollHeight
|
||||
})
|
||||
|
||||
// 创建PDF
|
||||
const imgData = canvas.toDataURL('image/png')
|
||||
const pdf = new jsPDF('p', 'mm', 'a4')
|
||||
|
||||
const imgWidth = 210 // A4宽度
|
||||
const pageHeight = 295 // A4高度
|
||||
const imgHeight = (canvas.height * imgWidth) / canvas.width
|
||||
let heightLeft = imgHeight
|
||||
let position = 0
|
||||
|
||||
// 添加第一页
|
||||
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
|
||||
heightLeft -= pageHeight
|
||||
|
||||
// 添加后续页面
|
||||
while (heightLeft >= 0) {
|
||||
position = heightLeft - imgHeight
|
||||
pdf.addPage()
|
||||
pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
|
||||
heightLeft -= pageHeight
|
||||
}
|
||||
|
||||
// 返回PDF blob
|
||||
return pdf.output('blob')
|
||||
} finally {
|
||||
// 清理临时元素
|
||||
document.body.removeChild(tempDiv)
|
||||
}
|
||||
}
|
||||
|
||||
// 下载PDF文件
|
||||
static downloadPDF(blob: Blob, filename: string) {
|
||||
const url = URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = filename
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="process-management">
|
||||
<a-card title="制度提案管理" :bordered="false">
|
||||
<a-card title="制度公示管理" :bordered="false">
|
||||
<template #extra>
|
||||
<a-button type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
|
@ -88,12 +88,14 @@
|
|||
<a-col :span="12">
|
||||
<a-form-item label="提案类型" field="regulationType">
|
||||
<a-select v-model="formData.regulationType" placeholder="请选择提案类型">
|
||||
<a-option value="人事制度">人事制度</a-option>
|
||||
<a-option value="财务制度">财务制度</a-option>
|
||||
<a-option value="安全制度">安全制度</a-option>
|
||||
<a-option value="设备制度">设备制度</a-option>
|
||||
<a-option value="工作流程">工作流程</a-option>
|
||||
<a-option value="其他制度">其他制度</a-option>
|
||||
<a-option
|
||||
v-for="type in regulationTypes"
|
||||
:key="type.typeId"
|
||||
:value="type.typeName"
|
||||
:disabled="type.isEnabled === '0'"
|
||||
>
|
||||
{{ type.typeName }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -149,7 +151,7 @@
|
|||
<div class="detail-header">
|
||||
<h3>{{ currentProposal.title }}</h3>
|
||||
<div class="detail-meta">
|
||||
<span>提案人: {{ currentProposal.publisherName }}</span>
|
||||
<span>提案人: {{ currentProposal.createBy }}</span>
|
||||
<span>提案类型: {{ currentProposal.regulationType }}</span>
|
||||
<span>适用范围: {{ currentProposal.scope }}</span>
|
||||
<span>级别: <a-tag :color="getLevelColor(currentProposal.level)">{{ getLevelText(currentProposal.level) }}</a-tag></span>
|
||||
|
@ -191,7 +193,8 @@ import { regulationApi } from '@/apis/regulation'
|
|||
import {
|
||||
RegulationStatus,
|
||||
RegulationLevel,
|
||||
type Regulation
|
||||
type Regulation,
|
||||
type RegulationType
|
||||
} from '@/apis/regulation/type'
|
||||
|
||||
defineOptions({ name: 'ProcessManagement' })
|
||||
|
@ -199,7 +202,7 @@ defineOptions({ name: 'ProcessManagement' })
|
|||
// 表格列定义
|
||||
const columns = [
|
||||
{ title: '提案标题', dataIndex: 'title', key: 'title' },
|
||||
{ title: '提案人', dataIndex: 'publisherName', key: 'publisherName' },
|
||||
{ title: '提案人', dataIndex: 'createBy', key: 'createBy' },
|
||||
{ title: '提案类型', dataIndex: 'regulationType', key: 'regulationType' },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', slotName: 'status' },
|
||||
{ title: '级别', dataIndex: 'level', key: 'level', slotName: 'level' },
|
||||
|
@ -238,12 +241,15 @@ const currentProposal = ref<Regulation | null>(null)
|
|||
// 详情相关
|
||||
const detailModalVisible = ref(false)
|
||||
|
||||
// 当前用户 - 应该从用户认证系统获取
|
||||
const currentUser = ref('') // TODO: 从用户认证系统获取当前用户ID
|
||||
// 当前用户
|
||||
const currentUser = ref('admin') // 从用户认证系统获取当前用户ID
|
||||
|
||||
// 制度管理store
|
||||
const regulationStore = useRegulationStore()
|
||||
|
||||
// 制度类型列表
|
||||
const regulationTypes = ref<RegulationType[]>([])
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
title: [{ required: true, message: '请输入提案标题' }],
|
||||
|
@ -268,10 +274,10 @@ const getStatusColor = (status: RegulationStatus) => {
|
|||
// 获取状态文本
|
||||
const getStatusText = (status: RegulationStatus) => {
|
||||
const texts = {
|
||||
[RegulationStatus.DRAFT]: '草稿',
|
||||
[RegulationStatus.DRAFT]: '已公示',
|
||||
[RegulationStatus.VOTING]: '投票中',
|
||||
[RegulationStatus.REJECTED]: '已否决',
|
||||
[RegulationStatus.PUBLISHED]: '已发布',
|
||||
[RegulationStatus.PUBLISHED]: '已公告',
|
||||
[RegulationStatus.APPROVED]: '已通过',
|
||||
[RegulationStatus.ARCHIVED]: '已归档'
|
||||
}
|
||||
|
@ -311,6 +317,18 @@ const getLevelText = (level: RegulationLevel) => {
|
|||
return texts[level] || '中'
|
||||
}
|
||||
|
||||
// 获取制度类型列表
|
||||
const getRegulationTypes = async () => {
|
||||
try {
|
||||
const response = await regulationApi.getRegulationTypes()
|
||||
if (response.status === 200) {
|
||||
regulationTypes.value = response.data.records || response.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取制度类型列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取表格数据
|
||||
const getTableData = async () => {
|
||||
loading.value = true
|
||||
|
@ -450,6 +468,7 @@ const handlePageSizeChange = (pageSize: number) => {
|
|||
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
getRegulationTypes()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -36,17 +36,20 @@
|
|||
|
||||
<script setup lang="tsx">
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import SystemRegulation from './system-regulation/index.vue'
|
||||
import ProcessManagement from './process-management/index.vue'
|
||||
import SystemRegulation from './repository.vue'
|
||||
import RegulationType from './type/index.vue'
|
||||
import ProcessManagement from './confirm.vue'
|
||||
import { useDevice } from '@/hooks'
|
||||
|
||||
defineOptions({ name: 'ZhiduManagement' })
|
||||
defineOptions({ name: 'RegulationManagement' })
|
||||
|
||||
const { isDesktop } = useDevice()
|
||||
|
||||
const data = [
|
||||
{ name: '制度规范', key: 'system-regulation', icon: 'file-text', value: SystemRegulation, path: '/zhidu/system-regulation' },
|
||||
{ name: '流程管理', key: 'process-management', icon: 'workflow', value: ProcessManagement, path: '/zhidu/process-management' },
|
||||
{ name: '制度公告', key: 'system-regulation', icon: 'file-text', value: SystemRegulation, path: '/regulation/system-regulation' },
|
||||
{ name: '制度公示', key: 'process-management', icon: 'workflow', value: ProcessManagement, path: '/regulation/process-management' },
|
||||
{ name: '制度类型', key: 'type', icon: 'tag', value: RegulationType, path: '/regulation/type' },
|
||||
|
||||
]
|
||||
|
||||
const menuList = computed(() => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="system-regulation">
|
||||
<a-card title="已发布制度确认" :bordered="false">
|
||||
<a-card title="已公告制度确认" :bordered="false">
|
||||
|
||||
|
||||
<a-table
|
||||
|
@ -22,14 +22,6 @@
|
|||
<a-button type="text" size="small" @click="handleView(record)">
|
||||
查看详情
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="record.confirmStatus !== 'confirmed'"
|
||||
type="text"
|
||||
size="small"
|
||||
@click="handleConfirm(record)"
|
||||
>
|
||||
确认知晓
|
||||
</a-button>
|
||||
<a-button type="text" size="small" @click="handleDownload(record)">
|
||||
下载
|
||||
</a-button>
|
||||
|
@ -49,7 +41,7 @@
|
|||
<div class="detail-header">
|
||||
<h3>{{ currentRegulation.title }}</h3>
|
||||
<div class="detail-meta">
|
||||
<span>发布人: {{ currentRegulation.publisherName }}</span>
|
||||
<span>发布人: {{ currentRegulation.createBy }}</span>
|
||||
<span>发布时间: {{ currentRegulation.publishTime }}</span>
|
||||
<span>生效日期: {{ currentRegulation.effectiveTime }}</span>
|
||||
</div>
|
||||
|
@ -114,6 +106,7 @@ import type { Regulation } from '@/apis/regulation/type'
|
|||
import { Message } from '@arco-design/web-vue'
|
||||
import { useRegulationStore } from '@/stores/modules/regulation'
|
||||
import { regulationApi } from '@/apis/regulation'
|
||||
import { PDFGenerator } from '@/utils/pdfGenerator'
|
||||
|
||||
defineOptions({ name: 'SystemRegulation' })
|
||||
|
||||
|
@ -121,7 +114,7 @@ defineOptions({ name: 'SystemRegulation' })
|
|||
const columns = [
|
||||
{ title: '制度名称', dataIndex: 'title', key: 'title' },
|
||||
{ title: '制度类型', dataIndex: 'regulationType', key: 'regulationType' },
|
||||
{ title: '发布人', dataIndex: 'publisherName', key: 'publisherName' },
|
||||
{ title: '发布人', dataIndex: 'createBy', key: 'createBy' },
|
||||
{ title: '发布时间', dataIndex: 'publishTime', key: 'publishTime' },
|
||||
{ title: '生效日期', dataIndex: 'effectiveTime', key: 'effectiveTime' },
|
||||
{ title: '确认状态', dataIndex: 'confirmStatus', key: 'confirmStatus', slotName: 'confirmStatus' },
|
||||
|
@ -201,50 +194,26 @@ const handleConfirm = (record: any) => {
|
|||
}
|
||||
|
||||
// 下载
|
||||
const handleDownload = (record: any) => {
|
||||
const handleDownload = async (record: any) => {
|
||||
try {
|
||||
// 创建制度文档内容
|
||||
const content = `
|
||||
制度名称:${record.title}
|
||||
制度类型:${record.regulationType}
|
||||
发布人:${record.publisherName}
|
||||
发布时间:${record.publishTime}
|
||||
生效日期:${record.effectiveTime}
|
||||
|
||||
制度内容:
|
||||
${record.content}
|
||||
|
||||
适用范围:
|
||||
${record.scope}
|
||||
|
||||
实施要求:
|
||||
${record.requirements || '请按照制度要求执行'}
|
||||
|
||||
注意事项:
|
||||
${record.notes || '请严格遵守制度规定'}
|
||||
`.trim()
|
||||
|
||||
// 创建Blob对象
|
||||
const blob = new Blob([content], { type: 'text/plain;charset=utf-8' })
|
||||
|
||||
// 创建下载链接
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `${record.title}.txt`
|
||||
|
||||
// 触发下载
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
|
||||
// 清理
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(url)
|
||||
|
||||
Message.success('制度文件下载成功')
|
||||
const loadingMessage = Message.loading('正在生成PDF文件...', 0)
|
||||
|
||||
// 生成PDF
|
||||
const pdfBlob = await PDFGenerator.generateRegulationPDF(record)
|
||||
|
||||
// 关闭加载提示
|
||||
loadingMessage.close()
|
||||
|
||||
// 生成文件名
|
||||
const filename = `${record.title}_${new Date().toISOString().split('T')[0]}.pdf`
|
||||
|
||||
// 下载PDF
|
||||
PDFGenerator.downloadPDF(pdfBlob, filename)
|
||||
|
||||
Message.success('PDF文件下载成功')
|
||||
} catch (error) {
|
||||
Message.error('下载失败')
|
||||
console.error('下载错误:', error)
|
||||
Message.error('PDF生成失败')
|
||||
console.error('PDF生成错误:', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,333 @@
|
|||
<template>
|
||||
<GiPageLayout>
|
||||
<GiTable
|
||||
row-key="typeId"
|
||||
title="制度类型管理"
|
||||
:data="dataList"
|
||||
:columns="tableColumns"
|
||||
:loading="loading"
|
||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||
:pagination="pagination"
|
||||
@page-change="onPageChange"
|
||||
@page-size-change="onPageSizeChange"
|
||||
@refresh="search"
|
||||
>
|
||||
<template #top>
|
||||
<GiForm
|
||||
v-model="searchForm"
|
||||
search
|
||||
:columns="queryFormColumns"
|
||||
size="medium"
|
||||
@search="search"
|
||||
@reset="reset"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #toolbar-left>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="openAddModal">
|
||||
<template #icon><icon-plus /></template>
|
||||
<template #default>新增类型</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<!-- 启用状态 -->
|
||||
<template #isEnabled="{ record }">
|
||||
<a-tag :color="record.isEnabled === '1' ? 'green' : 'red'">
|
||||
{{ record.isEnabled === '1' ? '启用' : '禁用' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link @click="editRecord(record)">编辑</a-link>
|
||||
<a-popconfirm
|
||||
content="确定要删除这个制度类型吗?"
|
||||
@ok="deleteRecord(record)"
|
||||
>
|
||||
<a-link status="danger">删除</a-link>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</GiTable>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<a-modal
|
||||
v-model:visible="modalVisible"
|
||||
:title="modalTitle"
|
||||
width="600px"
|
||||
@ok="handleSubmit"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item label="类型名称" field="typeName">
|
||||
<a-input v-model="formData.typeName" placeholder="请输入制度类型名称" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="排序" field="sortOrder">
|
||||
<a-input-number
|
||||
v-model="formData.sortOrder"
|
||||
placeholder="请输入排序值"
|
||||
:min="0"
|
||||
:max="999"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="状态" field="isEnabled">
|
||||
<a-radio-group v-model="formData.isEnabled">
|
||||
<a-radio value="1">启用</a-radio>
|
||||
<a-radio value="0">禁用</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="备注" field="remark">
|
||||
<a-textarea
|
||||
v-model="formData.remark"
|
||||
placeholder="请输入备注信息"
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</GiPageLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import { regulationApi } from '@/apis/regulation'
|
||||
import {
|
||||
type RegulationType,
|
||||
type CreateRegulationTypeRequest,
|
||||
type UpdateRegulationTypeRequest
|
||||
} from '@/apis/regulation/type'
|
||||
|
||||
defineOptions({ name: 'RegulationType' })
|
||||
|
||||
// 表格列定义
|
||||
const tableColumns = [
|
||||
{ title: '类型名称', dataIndex: 'typeName', key: 'typeName', width: 150 },
|
||||
{ title: '备注', dataIndex: 'remark', key: 'remark', width: 200 },
|
||||
{ title: '状态', dataIndex: 'isEnabled', key: 'isEnabled', slotName: 'isEnabled', width: 100 },
|
||||
{ title: '创建人', dataIndex: 'createBy', key: 'createBy', width: 120 },
|
||||
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 180 },
|
||||
{ title: '排序', dataIndex: 'sortOrder', key: 'sortOrder', width: 100 },
|
||||
{ title: '操作', key: 'action', slotName: 'action', width: 150, fixed: 'right' }
|
||||
]
|
||||
|
||||
// 查询表单列定义
|
||||
const queryFormColumns = [
|
||||
{
|
||||
label: '类型名称',
|
||||
field: 'typeName',
|
||||
component: 'a-input',
|
||||
componentProps: {
|
||||
placeholder: '请输入类型名称'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
field: 'remark',
|
||||
component: 'a-input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注内容'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
// 表格数据
|
||||
const dataList = ref<RegulationType[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
showTotal: true,
|
||||
showJumper: true,
|
||||
showPageSize: true
|
||||
})
|
||||
|
||||
// 查询表单
|
||||
const searchForm = reactive({
|
||||
typeName: '',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
// 弹窗相关
|
||||
const modalVisible = ref(false)
|
||||
const modalTitle = ref('新增制度类型')
|
||||
const formRef = ref()
|
||||
const formData = reactive({
|
||||
typeId: '',
|
||||
typeName: '',
|
||||
sortOrder: 0,
|
||||
isEnabled: '1',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
typeName: [{ required: true, message: '请输入制度类型名称' }],
|
||||
sortOrder: [{ required: true, message: '请输入排序值' }],
|
||||
isEnabled: [{ required: true, message: '请选择状态' }]
|
||||
}
|
||||
|
||||
// 获取表格数据
|
||||
const getTableData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await regulationApi.getRegulationTypes({
|
||||
page: pagination.current,
|
||||
size: pagination.pageSize,
|
||||
typeName: searchForm.typeName || undefined,
|
||||
remark: searchForm.remark || undefined
|
||||
})
|
||||
|
||||
if (response.status === 200) {
|
||||
dataList.value = response.data.records || response.data
|
||||
pagination.total = response.data.total || response.data.length
|
||||
pagination.current = response.data.current || 1
|
||||
} else {
|
||||
Message.error('获取数据失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取制度类型列表失败:', error)
|
||||
Message.error('获取数据失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const search = () => {
|
||||
pagination.current = 1
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const reset = () => {
|
||||
Object.assign(searchForm, {
|
||||
typeName: '',
|
||||
remark: ''
|
||||
})
|
||||
pagination.current = 1
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 分页事件
|
||||
const onPageChange = (page: number) => {
|
||||
pagination.current = page
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const onPageSizeChange = (pageSize: number) => {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.current = 1
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 新增
|
||||
const openAddModal = () => {
|
||||
modalTitle.value = '新增制度类型'
|
||||
modalVisible.value = true
|
||||
resetForm()
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const editRecord = (record: RegulationType) => {
|
||||
modalTitle.value = '编辑制度类型'
|
||||
modalVisible.value = true
|
||||
Object.assign(formData, {
|
||||
typeId: record.typeId,
|
||||
typeName: record.typeName,
|
||||
sortOrder: record.sortOrder,
|
||||
isEnabled: record.isEnabled,
|
||||
remark: record.remark || ''
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
const deleteRecord = async (record: RegulationType) => {
|
||||
try {
|
||||
await regulationApi.deleteRegulationType(record.typeId)
|
||||
Message.success('删除成功')
|
||||
getTableData()
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error)
|
||||
Message.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
|
||||
if (formData.typeId) {
|
||||
// 更新
|
||||
const updateData: UpdateRegulationTypeRequest = {
|
||||
typeName: formData.typeName,
|
||||
sortOrder: formData.sortOrder,
|
||||
isEnabled: formData.isEnabled,
|
||||
remark: formData.remark
|
||||
}
|
||||
await regulationApi.updateRegulationType(formData.typeId, updateData)
|
||||
Message.success('更新成功')
|
||||
} else {
|
||||
// 新增
|
||||
const createData: CreateRegulationTypeRequest = {
|
||||
typeName: formData.typeName,
|
||||
sortOrder: formData.sortOrder,
|
||||
isEnabled: formData.isEnabled,
|
||||
remark: formData.remark
|
||||
}
|
||||
await regulationApi.createRegulationType(createData)
|
||||
Message.success('新增成功')
|
||||
}
|
||||
|
||||
modalVisible.value = false
|
||||
getTableData()
|
||||
} catch (error) {
|
||||
console.error('操作失败:', error)
|
||||
Message.error('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 取消
|
||||
const handleCancel = () => {
|
||||
modalVisible.value = false
|
||||
resetForm()
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
Object.assign(formData, {
|
||||
typeId: '',
|
||||
typeName: '',
|
||||
sortOrder: 0,
|
||||
isEnabled: '1',
|
||||
remark: ''
|
||||
})
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.regulation-type {
|
||||
.arco-card {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue