From fa3ac93010bea3805438ee3ab0a182bfbf7423da Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期一, 27 五月 2024 16:19:31 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/dry/DryOrderTrendList.vue | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 169 insertions(+), 0 deletions(-) diff --git a/src/views/dry/DryOrderTrendList.vue b/src/views/dry/DryOrderTrendList.vue new file mode 100644 index 0000000..9889d8c --- /dev/null +++ b/src/views/dry/DryOrderTrendList.vue @@ -0,0 +1,169 @@ +<template> + <div> + <!--寮曠敤琛ㄦ牸--> + <BasicTable @register="registerTable" :rowSelection="rowSelection"> + <!--鎻掓Ы:table鏍囬--> + <template #tableTitle> + <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 鏂板</a-button> + <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 瀵煎嚭</a-button> + <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">瀵煎叆</j-upload-button> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <template #overlay> + <a-menu> + <a-menu-item key="1" @click="batchHandleDelete"> + <Icon icon="ant-design:delete-outlined" /> + 鍒犻櫎 + </a-menu-item> + </a-menu> + </template> + <a-button + >鎵归噺鎿嶄綔 + <Icon icon="mdi:chevron-down" /> + </a-button> + </a-dropdown> + </template> + <!--鎿嶄綔鏍�--> + <template #action="{ record }"> + <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> + </template> + <!--瀛楁鍥炴樉鎻掓Ы--> + <template #htmlSlot="{ text }"> + <div v-html="text"></div> + </template> + <!--鐪佸競鍖哄瓧娈靛洖鏄炬彃妲�--> + <template #pcaSlot="{ text }"> + {{ getAreaTextByCode(text) }} + </template> + <template #fileSlot="{ text }"> + <span v-if="!text" style="font-size: 12px; font-style: italic">鏃犳枃浠�</span> + <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">涓嬭浇</a-button> + </template> + </BasicTable> + <!-- 琛ㄥ崟鍖哄煙 --> + <DryOrderTrendModal @register="registerModal" @success="handleSuccess" /> + </div> +</template> + +<script lang="ts" name="dry-dryOrderTrend" setup> + import { ref } from 'vue' + import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './api/DryOrderTrend.api' + import DryOrderTrendModal from './components/DryOrderTrendModal.vue' + import { columns, searchFormSchema } from './dataDefine/DryOrderTrend.data' + import { useModal } from '/@/components/Modal' + import { BasicTable, TableAction } from '/@/components/Table' + import { useListPage } from '/@/hooks/system/useListPage' + import { downloadFile } from '/@/utils/common/renderUtils' + const checkedKeys = ref<Array<string | number>>([]) + //娉ㄥ唽model + const [registerModal, { openModal }] = useModal() + //娉ㄥ唽table鏁版嵁 + const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ + tableProps: { + title: '宸ュ崟杩囩▼瓒嬪娍', + api: list, + columns, + canResize: false, + formConfig: { + //labelWidth: 120, + schemas: searchFormSchema, + autoSubmitOnEnter: true, + showAdvancedButton: true, + fieldMapToNumber: [], + fieldMapToTime: [], + }, + actionColumn: { + width: 120, + fixed: 'right', + }, + }, + exportConfig: { + name: '宸ュ崟杩囩▼瓒嬪娍', + url: getExportUrl, + }, + importConfig: { + url: getImportUrl, + success: handleSuccess, + }, + }) + + const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext + + /** + * 鏂板浜嬩欢 + */ + function handleAdd() { + openModal(true, { + isUpdate: false, + showFooter: true, + }) + } + /** + * 缂栬緫浜嬩欢 + */ + function handleEdit(record: Recordable) { + openModal(true, { + record, + isUpdate: true, + showFooter: true, + }) + } + /** + * 璇︽儏 + */ + function handleDetail(record: Recordable) { + openModal(true, { + record, + isUpdate: true, + showFooter: false, + }) + } + /** + * 鍒犻櫎浜嬩欢 + */ + async function handleDelete(record) { + await deleteOne({ id: record.id }, handleSuccess) + } + /** + * 鎵归噺鍒犻櫎浜嬩欢 + */ + async function batchHandleDelete() { + await batchDelete({ ids: selectedRowKeys.value }, handleSuccess) + } + /** + * 鎴愬姛鍥炶皟 + */ + function handleSuccess() { + ;(selectedRowKeys.value = []) && reload() + } + /** + * 鎿嶄綔鏍� + */ + function getTableAction(record) { + return [ + { + label: '缂栬緫', + onClick: handleEdit.bind(null, record), + }, + ] + } + /** + * 涓嬫媺鎿嶄綔鏍� + */ + function getDropDownAction(record) { + return [ + { + label: '璇︽儏', + onClick: handleDetail.bind(null, record), + }, + { + label: '鍒犻櫎', + popConfirm: { + title: '鏄惁纭鍒犻櫎', + confirm: handleDelete.bind(null, record), + }, + }, + ] + } +</script> + +<style scoped></style> -- Gitblit v1.9.3