diff --git a/package.json b/package.json index f357e33..b581d62 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "core-js": "3.6.5", "echarts": "^5.0.0", "element-ui": "^2.15.14", + "exceljs": "^4.4.0", "js-cookie": "2.2.0", "moment": "^2.29.4", "normalize.css": "7.0.0", @@ -29,7 +30,9 @@ "vue-jsonp": "^2.0.0", "vue-router": "3.0.6", "vuex": "3.1.0", - "vxe-table": "^3.8.22" + "vxe-pc-ui": "^3.1.0", + "vxe-table": "^3.8.25", + "vxe-table-plugin-export-xlsx": "^3.3.4" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.4", diff --git a/src/api/flow/index.js b/src/api/flow/index.js index 2f28286..f26bc4b 100644 --- a/src/api/flow/index.js +++ b/src/api/flow/index.js @@ -53,6 +53,14 @@ export function deal(flow_id,data) { }) } +export function getNextNode(params,isLoading=false) { + return request({ + method: 'get', + url: '/api/oa/flow/get-next-node', + params, + isLoading + }) +} export function checkIsThroughNode(params,isLoading=false) { return request({ method: 'get', diff --git a/src/main.js b/src/main.js index 8a761e3..a740d59 100644 --- a/src/main.js +++ b/src/main.js @@ -32,20 +32,19 @@ if (process.env.NODE_ENV === 'production') { //Vue.use(ElementUI, { locale }) // 如果想要中文版 element-ui,按如下方式声明 Vue.use(ElementUI) + +// vxe-table +import { VxeUI, VxeUpload } from 'vxe-pc-ui' +import 'vxe-pc-ui/lib/style.css' +Vue.use(VxeUpload) import VxeTable from 'vxe-table' -//import { VxeButton, VxeIcon, VxeTable, VxeColumn, VxeColgroup, VxeModal, VxeToolbar, VxeTableEditModule, VxeTableValidatorModule, VxeTableExportModule } from "vxe-table"; import "vxe-table/styles/index.scss" +import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx' +import ExcelJS from 'exceljs' +VxeTable.use(VXETablePluginExportXLSX, { + ExcelJS +}) Vue.use(VxeTable) -// Vue.use(VxeTableEditModule); -// Vue.use(VxeTableValidatorModule); -// Vue.use(VxeTableExportModule); -// Vue.use(VxeIcon); -// Vue.use(VxeTable); -// Vue.use(VxeColumn); -// Vue.use(VxeColgroup); -// Vue.use(VxeModal); -// Vue.use(VxeToolbar); -// Vue.use(VxeButton); Vue.config.productionTip = false diff --git a/src/utils/formBuilder.js b/src/utils/formBuilder.js index 2287c20..afa26fa 100644 --- a/src/utils/formBuilder.js +++ b/src/utils/formBuilder.js @@ -3,6 +3,7 @@ import { CreateElement, VNode } from "vue"; import moment from "moment"; import { getToken } from "@/utils/auth"; import { deepCopy } from "@/utils/index"; +import axios from 'axios' import { flowList } from "@/api/flow" /** * @param {String} device 'desktop' or 'mobile' @@ -248,7 +249,44 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab ); break; case "file": - formItem = h( + formItem = row ? + h( + 'vxe-upload', + { + props: { + value: row[info.name], + 'progress-text': "{percent}%", + 'more-config': {maxCount: 1, layout: 'horizontal'}, + 'show-button-text': false, + 'limit-size': 20, + multiple: !!info.multiple, + readonly: pReadable, + 'upload-method': ({ file }) => { + const formData = new FormData() + formData.append('file', file) + return axios.post(process.env.VUE_APP_UPLOAD_API, formData, { + headers: { + Authorization: `Bearer ${getToken()}`, + } + }).then((response) => { + if (response.status === 200 && !response.data.code) { + if (!(row[info.name] instanceof Array)) { + row[info.name] = [] + } + row[info.name].push({ + ...response.data.data, + name: response.data.data.original_name, + url: response.data.data.url, + }) + } else { + this.$message.error("上传失败") + } + }) + } + } + } + ) : + h( formBuilderMap(device).get(info.type), { props: { @@ -258,7 +296,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab }, accept: "application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", - multiple: true, + multiple: !!info.multiple, fileList: this.file[info.name], beforeUpload: (file) => { if (file.size / 1024 / 1024 > 20) { @@ -616,9 +654,19 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab h, row, info._writeable, - info._readable, + false, ); }, + [subField.type === 'file' ? 'default' : false]: ({ row }) => { + return formBuilder.bind(this)( + device, + subField, + h, + row, + info._writeable, + true, + ); + } }, }) ), @@ -647,7 +695,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab color: "#333", }, }, - this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日 HH时mm分ss秒") : '' + this.form[info.name] ? moment(this.form[info.name]).format("YYYY年MM月DD日 HH时mm分") : '' ); break; case "select": diff --git a/src/utils/index.js b/src/utils/index.js index d1bb72c..3c84de8 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -198,3 +198,8 @@ export function parseMoney(money, precision = 2) { if (isNaN(Number(money))) return Number(0).toFixed(precision) return Number(money).toFixed(precision).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') } + + +export function generateRandomString() { + return Math.random().toString(36).substring(2, 34)+new Date().getTime(); +} diff --git a/src/utils/print.js b/src/utils/print.js index 52eb923..be380be 100644 --- a/src/utils/print.js +++ b/src/utils/print.js @@ -2,10 +2,18 @@ import store from '@/store' /** * @param{string} printJs 打印模版 * @param{boolean} isLog 是否带审批 - * @param{string} logContent 审批表格html + * @param{object} form data数据 + * @param{string} [logContent] 审批表格html * @return{void} **/ -export function print(printJs, isLog, logContent) { +export function print(printJs, isLog, form, logContent) { + const staticMap = new Map([ + ['apply_name', () => `${form.creator?.name}`], + ['apply_department_name', () => `${form.creator_department?.name}`], + ['apply_sign', () => `${form.creator?.name}`], + ['created_at', () => `${form.created_at}`], + ]) + let printStr = printJs const regexField = /]*>(.*?)<\/field>/g; let fieldMaths = [] @@ -16,11 +24,14 @@ export function print(printJs, isLog, logContent) { } fieldMaths.forEach(fieldMath => { const matchName = fieldMath.match(/name="([^"]+)"/); - if (matchName) { const nameValue = matchName[1]; - const value = store.getters.device === 'desktop' ? document.querySelector(`[for=${nameValue}]+div`).innerHTML : document.querySelector(`[for=${nameValue}] > div:nth-child(2)`).innerHTML - printStr = printStr.replace(fieldMath,`${value}`) + if (Array.from(staticMap.keys()).indexOf(nameValue) !== -1) { + printStr = printStr.replace(fieldMath, staticMap.get(nameValue)) + } else { + const value = store.getters.device === 'desktop' ? document.querySelector(`[for=${nameValue}]+div`).innerHTML : document.querySelector(`[for=${nameValue}] > div:nth-child(2)`).innerHTML + printStr = printStr.replace(fieldMath,`${value}`) + } } else { console.log('未找到name属性'); } diff --git a/src/views/attendance/statistics.vue b/src/views/attendance/statistics.vue index e6d61dc..dfbe288 100644 --- a/src/views/attendance/statistics.vue +++ b/src/views/attendance/statistics.vue @@ -20,7 +20,8 @@ :row-config="{ isHover: true }" :header-cell-style="{ 'white-space': 'wrap' }" :print-config="{}" - :export-config="{}" + :export-config="{ + }" :column-config="{ resizable: true }" :data="tableData.admins"> @@ -54,6 +55,7 @@ + @@ -70,7 +72,8 @@ export default { }, tableData: { admins: [], - dates: [] + dates: [], + leave_types: [] } } }, diff --git a/src/views/flow/DesktopForm.vue b/src/views/flow/DesktopForm.vue index 5ab5e17..0feff35 100644 --- a/src/views/flow/DesktopForm.vue +++ b/src/views/flow/DesktopForm.vue @@ -291,4 +291,7 @@ export default { } ::v-deep .el-form-item__content { } +::v-deep .el-radio, .el-radio__input { + line-height: 1.5; +} diff --git a/src/views/flow/components/assign.vue b/src/views/flow/components/assign.vue index cac88c5..e8dd95d 100644 --- a/src/views/flow/components/assign.vue +++ b/src/views/flow/components/assign.vue @@ -4,7 +4,7 @@ :value="visible" show-footer :z-index="zIndex" - title="转办" + title="流转" show-zoom :fullscreen="$store.getters.device === 'mobile'" show-confirm-button @@ -106,7 +106,7 @@