对比新文件 |
| | |
| | | import { defineComponent } from 'vue' |
| | | import type { Ref } from 'vue' |
| | | import BaseTable from '@/components/Table/Table' |
| | | import styles from './WmsMaterial.module.scss' |
| | | import { useWmsMaterial } from '../../../Controllers/WmsMaterial' |
| | | import IconButton from '@/components/IconButton/IconButton' |
| | | import WmsMaterialDrawer from '../Dialog/WmsMaterialDrawer/WmsMaterialDrawer' |
| | | import Search from '@/components/Search/Search' |
| | | import { columns } from './Config' |
| | | import TdButton from '@/components/TdButton/TdButton' |
| | | import { vPermission } from '@/libs/Permission/Permission' |
| | | |
| | | interface RenderTableType { |
| | | url?: string |
| | | dataSource: Ref<any[]> |
| | | isDrag?: boolean |
| | | isChecked?: boolean |
| | | isHidePagination?: boolean |
| | | params?: Record<string, any> |
| | | autoHeight?: boolean |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'WmsMaterial', |
| | | directives: { |
| | | permission: vPermission, |
| | | }, |
| | | setup(props, ctx) { |
| | | const { |
| | | dataSource, |
| | | contextMenu, |
| | | dialogConfig, |
| | | tableRef, |
| | | current, |
| | | search, |
| | | sort, |
| | | headers, |
| | | onError, |
| | | onSearch, |
| | | onRowClick, |
| | | onConfirmWmsMaterial, |
| | | onCheck, |
| | | onAddWmsMaterial, |
| | | onExport, |
| | | openDetail, |
| | | onSuccess, |
| | | onBeforeUpload, |
| | | } = useWmsMaterial(props, ctx) |
| | | |
| | | /** |
| | | * @returns 琛ㄦ牸 |
| | | */ |
| | | const RenderBaseTable = (props: RenderTableType) => { |
| | | const { |
| | | url, |
| | | dataSource, |
| | | isDrag, |
| | | isChecked, |
| | | isHidePagination, |
| | | params, |
| | | autoHeight, |
| | | } = props |
| | | |
| | | return ( |
| | | <div |
| | | class={{ |
| | | [styles.wmsMaterialList]: true, |
| | | }} |
| | | > |
| | | <BaseTable |
| | | ref={tableRef} |
| | | url={url} |
| | | sortUrlTpl="/api/v1/hIAWms/wmsMaterial/{id}/adjustsort/{sort}" |
| | | v-model:dataSource={dataSource.value} |
| | | columns={columns} |
| | | contextMenu={contextMenu} |
| | | params={params} |
| | | isDrag={isDrag} |
| | | isChecked={isChecked} |
| | | autoHeight={autoHeight} |
| | | onCheck={onCheck} |
| | | onRowClick={onRowClick} |
| | | isHidePagination={isHidePagination} |
| | | pageSize={50} |
| | | v-slots={{ |
| | | name: ({ row }: any) => { |
| | | return row?.name ? ( |
| | | <TdButton |
| | | onClick={() => openDetail(row)} |
| | | text={<span style="color:#5a84ff">璇︽儏</span>} |
| | | icon="scale" |
| | | tip={row?.name} |
| | | hover |
| | | > |
| | | {row?.name} |
| | | </TdButton> |
| | | ) : ( |
| | | '-' |
| | | ) |
| | | }, |
| | | }} |
| | | ></BaseTable> |
| | | </div> |
| | | ) |
| | | } |
| | | return () => { |
| | | return ( |
| | | <div class={styles.wmsMaterialContent}> |
| | | {/* 娣诲姞/缂栬緫 */} |
| | | <WmsMaterialDrawer |
| | | v-model={dialogConfig.visible} |
| | | title={dialogConfig.title} |
| | | row={current.value} |
| | | sort={sort.value} |
| | | onConfirm={onConfirmWmsMaterial} |
| | | /> |
| | | <div class={styles.headerContent}> |
| | | <div class={styles.header}> |
| | | <IconButton |
| | | v-permission="wmsMaterial-add" |
| | | icon="add-p" |
| | | onClick={onAddWmsMaterial} |
| | | type="primary" |
| | | > |
| | | 娣诲姞 |
| | | </IconButton> |
| | | <el-divider direction="vertical" /> |
| | | <el-upload |
| | | v-permission="wmsMaterial-import" |
| | | name="file" |
| | | accept=".xlsx,.xls,.csv" |
| | | show-file-list={false} |
| | | onError={onError} |
| | | onSuccess={onSuccess} |
| | | before-upload={onBeforeUpload} |
| | | headers={headers.value} |
| | | action="/api/v1/hIAWms/wmsMaterial/import" |
| | | > |
| | | <IconButton icon="in">瀵煎叆</IconButton> |
| | | </el-upload> |
| | | |
| | | <IconButton |
| | | v-permission="wmsMaterial-output" |
| | | icon="out" |
| | | onClick={onExport} |
| | | > |
| | | 瀵煎嚭 |
| | | </IconButton> |
| | | </div> |
| | | <Search |
| | | placeholder="璇疯緭鍏ュ叧閿瓧" |
| | | v-model={search.value} |
| | | onConfirm={onSearch} |
| | | style={{ marginTop: '-1px' }} |
| | | /> |
| | | </div> |
| | | <RenderBaseTable |
| | | url="/api/v1/hIAWms/wmsMaterial" |
| | | dataSource={dataSource} |
| | | isChecked={true} |
| | | isDrag={true} |
| | | /> |
| | | </div> |
| | | ) |
| | | } |
| | | }, |
| | | }) |