fix
Showing
6 changed files
with
44 additions
and
14 deletions
| ... | @@ -70,6 +70,9 @@ const editTreeItem = computed(() => { | ... | @@ -70,6 +70,9 @@ const editTreeItem = computed(() => { |
| 70 | const expendAll = computed(() => { | 70 | const expendAll = computed(() => { |
| 71 | return props.treeInfo.expendAll ?? false | 71 | return props.treeInfo.expendAll ?? false |
| 72 | }) | 72 | }) |
| 73 | const ellipsis = computed(() => { | ||
| 74 | return props.treeInfo.ellipsis ?? true | ||
| 75 | }) | ||
| 73 | 76 | ||
| 74 | interface Tree { | 77 | interface Tree { |
| 75 | [key: string]: any; | 78 | [key: string]: any; |
| ... | @@ -182,6 +185,21 @@ const appendChildren = (key, data) => { | ... | @@ -182,6 +185,21 @@ const appendChildren = (key, data) => { |
| 182 | 185 | ||
| 183 | const visibleNodes = ref({}); //解决点击树item,下拉菜单不消失的问题,原因是树的点击事件阻止冒泡了。 | 186 | const visibleNodes = ref({}); //解决点击树item,下拉菜单不消失的问题,原因是树的点击事件阻止冒泡了。 |
| 184 | 187 | ||
| 188 | function formatNodeLabel (node) { | ||
| 189 | let sliceLength = 8 | ||
| 190 | switch (node.level) { | ||
| 191 | case 2: | ||
| 192 | sliceLength = 10 | ||
| 193 | break | ||
| 194 | case 3: | ||
| 195 | sliceLength = 8 | ||
| 196 | break | ||
| 197 | case 4: | ||
| 198 | sliceLength = 8 | ||
| 199 | break | ||
| 200 | } | ||
| 201 | return node.label.slice(0, sliceLength) | ||
| 202 | } | ||
| 185 | defineExpose({ | 203 | defineExpose({ |
| 186 | getCheckedNodes, | 204 | getCheckedNodes, |
| 187 | getCheckedKeys, | 205 | getCheckedKeys, |
| ... | @@ -225,8 +243,14 @@ defineExpose({ | ... | @@ -225,8 +243,14 @@ defineExpose({ |
| 225 | </span> | 243 | </span> |
| 226 | <template v-else-if="editTreeItem && data.showEdit !== false"> | 244 | <template v-else-if="editTreeItem && data.showEdit !== false"> |
| 227 | <span class="list-item-text"> | 245 | <span class="list-item-text"> |
| 228 | <ellipsis-tooltip v-if="!customInfo" :content="node.label" class-name="w100f" popper-class="tree-popper" | 246 | <template v-if="!ellipsis"> |
| 247 | <span>{{ formatNodeLabel(node) }}</span> | ||
| 248 | </template> | ||
| 249 | <template v-else> | ||
| 250 | <ellipsis-tooltip v-if="!customInfo" :content="node.label" class-name="w100f" popper-class="tree-popper" | ||
| 229 | :refName="'tooltipOver' + node.id"></ellipsis-tooltip> | 251 | :refName="'tooltipOver' + node.id"></ellipsis-tooltip> |
| 252 | </template> | ||
| 253 | |||
| 230 | </span> | 254 | </span> |
| 231 | <div class="tags-list-right" :class="visibleNodes[node.data.guid] ? 'active' : ''"> | 255 | <div class="tags-list-right" :class="visibleNodes[node.data.guid] ? 'active' : ''"> |
| 232 | <el-popover v-model:visible="visibleNodes[node.data.guid]" placement="bottom" width="96" trigger="click" | 256 | <el-popover v-model:visible="visibleNodes[node.data.guid]" placement="bottom" width="96" trigger="click" | ... | ... |
| ... | @@ -25,8 +25,7 @@ | ... | @@ -25,8 +25,7 @@ |
| 25 | :props="standardProps" | 25 | :props="standardProps" |
| 26 | node-key="guid" | 26 | node-key="guid" |
| 27 | :highlight-current="true" | 27 | :highlight-current="true" |
| 28 | :expand-on-click-node="true" | 28 | |
| 29 | show-checkbox | ||
| 30 | check-strictly | 29 | check-strictly |
| 31 | placeholder="请选择" | 30 | placeholder="请选择" |
| 32 | :disabled="treeSelectDisabled" | 31 | :disabled="treeSelectDisabled" | ... | ... |
| ... | @@ -1198,6 +1198,10 @@ const batching = (type) => { | ... | @@ -1198,6 +1198,10 @@ const batching = (type) => { |
| 1198 | }) | 1198 | }) |
| 1199 | return | 1199 | return |
| 1200 | } | 1200 | } |
| 1201 | if (selectRowData.value.length > 30) { | ||
| 1202 | ElMessage.error('选择的代码名称不能超过30个') | ||
| 1203 | return | ||
| 1204 | } | ||
| 1201 | // console.log(selectedRowData) | 1205 | // console.log(selectedRowData) |
| 1202 | let uploadSetting = selectedRowData.value.map(item => { | 1206 | let uploadSetting = selectedRowData.value.map(item => { |
| 1203 | return { | 1207 | return { | ... | ... |
| ... | @@ -411,6 +411,11 @@ const importData = (info) => { | ... | @@ -411,6 +411,11 @@ const importData = (info) => { |
| 411 | dialogInfo.value.visible = false; | 411 | dialogInfo.value.visible = false; |
| 412 | return | 412 | return |
| 413 | } | 413 | } |
| 414 | let sheetNum = uploadSetting.value.filter(item => item.value)['length'] | ||
| 415 | if (sheetNum > 30) { | ||
| 416 | ElMessage.error('最多只能导入30个sheet页的数据。') | ||
| 417 | return | ||
| 418 | } | ||
| 414 | let paramUrl = ''; | 419 | let paramUrl = ''; |
| 415 | uploadFiles.value.forEach((item: any, index: number) => { | 420 | uploadFiles.value.forEach((item: any, index: number) => { |
| 416 | params.append("file", item.raw); | 421 | params.append("file", item.raw); |
| ... | @@ -422,11 +427,7 @@ const importData = (info) => { | ... | @@ -422,11 +427,7 @@ const importData = (info) => { |
| 422 | } | 427 | } |
| 423 | }) | 428 | }) |
| 424 | sheetMaps = JSON.stringify(sheetMaps) | 429 | sheetMaps = JSON.stringify(sheetMaps) |
| 425 | // console.log('sheetMaps', sheetMaps) | ||
| 426 | paramUrl = encodeURI(`${import.meta.env.VITE_APP_ADD_FILE}/import-data/import-batch-common?importType=${importType.value}&staffGuid=${userData.staffGuid}&tenantGuid=${userData.tenantGuid}&sheetMaps=${sheetMaps}`) | 430 | paramUrl = encodeURI(`${import.meta.env.VITE_APP_ADD_FILE}/import-data/import-batch-common?importType=${importType.value}&staffGuid=${userData.staffGuid}&tenantGuid=${userData.tenantGuid}&sheetMaps=${sheetMaps}`) |
| 427 | // if (info && Object.keys(info).length) { | ||
| 428 | // paramUrl += `&extendFields=${encodeURIComponent(JSON.stringify(info))}` | ||
| 429 | // } | ||
| 430 | dialogInfo.value.footer.btns[1].loading = true; | 431 | dialogInfo.value.footer.btns[1].loading = true; |
| 431 | addImportData(paramUrl, params).then((res: any) => { | 432 | addImportData(paramUrl, params).then((res: any) => { |
| 432 | dialogInfo.value.footer.btns[1].loading = false; | 433 | dialogInfo.value.footer.btns[1].loading = false; |
| ... | @@ -481,7 +482,7 @@ const setUploadInfo = () => { | ... | @@ -481,7 +482,7 @@ const setUploadInfo = () => { |
| 481 | cover: true, | 482 | cover: true, |
| 482 | fileList: [], | 483 | fileList: [], |
| 483 | accept: '.xlsx, .xls', | 484 | accept: '.xlsx, .xls', |
| 484 | tips: '当前支持xls、xlsx文件,支持一个文件多个sheet批量导入' | 485 | tips: '当前支持xls、xlsx文件,支持一个文件多个sheet批量导入,一次最多只能导入30个sheet页数据。' |
| 485 | } | 486 | } |
| 486 | } | 487 | } |
| 487 | ] | 488 | ] | ... | ... |
| ... | @@ -411,6 +411,11 @@ const importData = (info) => { | ... | @@ -411,6 +411,11 @@ const importData = (info) => { |
| 411 | dialogInfo.value.visible = false; | 411 | dialogInfo.value.visible = false; |
| 412 | return | 412 | return |
| 413 | } | 413 | } |
| 414 | let sheetNum = uploadSetting.value.filter(item => item.value)['length'] | ||
| 415 | if (sheetNum > 30) { | ||
| 416 | ElMessage.error('最多只能导入30个sheet页的数据。') | ||
| 417 | return | ||
| 418 | } | ||
| 414 | let paramUrl = ''; | 419 | let paramUrl = ''; |
| 415 | uploadFiles.value.forEach((item: any, index: number) => { | 420 | uploadFiles.value.forEach((item: any, index: number) => { |
| 416 | params.append("file", item.raw); | 421 | params.append("file", item.raw); |
| ... | @@ -422,11 +427,7 @@ const importData = (info) => { | ... | @@ -422,11 +427,7 @@ const importData = (info) => { |
| 422 | } | 427 | } |
| 423 | }) | 428 | }) |
| 424 | sheetMaps = JSON.stringify(sheetMaps) | 429 | sheetMaps = JSON.stringify(sheetMaps) |
| 425 | // console.log('sheetMaps', sheetMaps) | ||
| 426 | paramUrl = encodeURI(`${import.meta.env.VITE_APP_ADD_FILE}/import-data/import-batch-common?importType=${importType.value}&staffGuid=${userData.staffGuid}&tenantGuid=${userData.tenantGuid}&sheetMaps=${sheetMaps}`) | 430 | paramUrl = encodeURI(`${import.meta.env.VITE_APP_ADD_FILE}/import-data/import-batch-common?importType=${importType.value}&staffGuid=${userData.staffGuid}&tenantGuid=${userData.tenantGuid}&sheetMaps=${sheetMaps}`) |
| 427 | // if (info && Object.keys(info).length) { | ||
| 428 | // paramUrl += `&extendFields=${encodeURIComponent(JSON.stringify(info))}` | ||
| 429 | // } | ||
| 430 | dialogInfo.value.footer.btns[1].loading = true; | 431 | dialogInfo.value.footer.btns[1].loading = true; |
| 431 | addImportData(paramUrl, params).then((res: any) => { | 432 | addImportData(paramUrl, params).then((res: any) => { |
| 432 | dialogInfo.value.footer.btns[1].loading = false; | 433 | dialogInfo.value.footer.btns[1].loading = false; |
| ... | @@ -481,7 +482,7 @@ const setUploadInfo = () => { | ... | @@ -481,7 +482,7 @@ const setUploadInfo = () => { |
| 481 | cover: true, | 482 | cover: true, |
| 482 | fileList: [], | 483 | fileList: [], |
| 483 | accept: '.xlsx, .xls', | 484 | accept: '.xlsx, .xls', |
| 484 | tips: '当前支持xls、xlsx文件,支持一个文件多个sheet批量导入' | 485 | tips: '当前支持xls、xlsx文件,支持一个文件多个sheet批量导入,一次最多只能导入30个sheet页数据。' |
| 485 | } | 486 | } |
| 486 | } | 487 | } |
| 487 | ] | 488 | ] | ... | ... |
| ... | @@ -52,7 +52,8 @@ const treeInfo = ref({ | ... | @@ -52,7 +52,8 @@ const treeInfo = ref({ |
| 52 | loading: false, | 52 | loading: false, |
| 53 | currentObj: {}, | 53 | currentObj: {}, |
| 54 | editTreeItem: true, | 54 | editTreeItem: true, |
| 55 | className: 'tree-list' | 55 | className: 'tree-list', |
| 56 | ellipsis: false | ||
| 56 | }) | 57 | }) |
| 57 | function nodeClick (data) { | 58 | function nodeClick (data) { |
| 58 | console.log('nodeData', data) | 59 | console.log('nodeData', data) | ... | ... |
-
Please register or sign in to post a comment