lijingjia 2 weeks ago
parent a379e697e3
commit e105a4f745

@ -67,8 +67,6 @@ enum Api {
GetSupplierAndClientListByCode = '/mainApi/ClientCommon/GetSupplierAndClientListByCode', GetSupplierAndClientListByCode = '/mainApi/ClientCommon/GetSupplierAndClientListByCode',
// 供应商客户类型 // 供应商客户类型
GetSupplierListByCode = '/mainApi/ClientCommon/GetSupplierListByCode', GetSupplierListByCode = '/mainApi/ClientCommon/GetSupplierListByCode',
// 全部单位下拉
GetSupplierAndClientListByCode = '/mainApi/ClientCommon/GetSupplierAndClientListByCode',
// 费用名称下拉数据 // 费用名称下拉数据
GetFeeCodeSelectList = '/mainApi/ClientCommon/GetFeeCodeSelectList', GetFeeCodeSelectList = '/mainApi/ClientCommon/GetFeeCodeSelectList',
// 获取箱型下拉数据 // 获取箱型下拉数据
@ -227,14 +225,6 @@ export function GetSupplierListByCode(params) {
params, params,
}) })
} }
// 全部单位下拉
export function GetSupplierAndClientListByCode(params) {
return request<DataResult>({
url: Api.GetSupplierAndClientListByCode,
method: 'get',
params,
})
}
// 获取费用名称下拉数据 // 获取费用名称下拉数据
export function GetFeeCodeSelectList() { export function GetFeeCodeSelectList() {
return request<DataResult>({ return request<DataResult>({

@ -90,11 +90,11 @@
// //
const rules = { const rules = {
title: [ title: [
{ // {
required: true, // required: true,
message: '请输入列头中文标题', // message: '',
trigger: 'blur' // trigger: 'blur'
} // }
], ],
// enTitle: [ // enTitle: [
// { // {
@ -133,7 +133,10 @@
} }
// //
const handleDragEnd = () => { const handleDragEnd = () => {
if ((ending.data === dragging.data) || (ending.dataIndex === dragging.dataIndex)) { if (tbType.value === 'excel' && ending.data === dragging.data) {
return
}
if (tbType.value === 'vxe' && ending.dataIndex === dragging.dataIndex) {
return return
} }
// //
@ -152,11 +155,19 @@
const tbType = ref('excel') const tbType = ref('excel')
const init = (list, type) => { const init = (list, type) => {
if (type) tbType.value = type if (type) tbType.value = type
list.forEach((item, index) => {
if (item.visible == undefined) item.visible = true
//
if (item.dataIndex == 'action') {
list.splice(index, 1)
}
})
colData.value = list colData.value = list
} }
defineExpose({ defineExpose({
getColList, getColList,
init init,
colData
}) })
</script> </script>

@ -50,15 +50,23 @@
</span> </span>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, watch, nextTick, defineProps, defineEmits } from 'vue' import { onMounted, ref, watch, nextTick } from 'vue'
import { useI18n } from '/@/hooks/web/useI18n' import { useI18n } from '/@/hooks/web/useI18n'
// //
import TableColDrag from './components/tableColDrag.vue' import TableColDrag from './components/tableColDrag.vue'
import { EditCustomColumnSet } from './api' import { EditCustomColumnSet } from './api'
// idname
import { permissionsInfo } from '/@/hooks/web/usePermission'
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { editColumnSet } from '/@/components/Table/src/components/settings/ColumnSettingApi'
const { createMessage } = useMessage() const { createMessage } = useMessage()
const { t } = useI18n() const { t } = useI18n()
const props = defineProps({ const props = defineProps({
// id (vxe使)
id: {
type: String,
default: '0'
},
// //
columns: { columns: {
type: Object, type: Object,
@ -108,14 +116,31 @@
if (!b) visible.value = false if (!b) visible.value = false
}) })
} else { } else {
loading.value = true
const columnData = TableColDragRef.value.colData
// vxe // vxe
const Apidata = {
id: props.id,
tagNo: props.code,
templateName: '列表设置',
content: JSON.stringify({
columns: columnData
})
}
editColumnSet(Object.assign(Apidata, permissionsInfo())).then((res) => {
loading.value = false
createMessage.success(res.message)
emits('updateCol', TableColDragRef.value.colData)
if (!b) visible.value = false
}).catch(() => {
loading.value = false
})
} }
} }
watch( watch(
() => props.columns, () => props.columns,
(v) => { (v) => {
colData.value = v.data colData.value = v.data || v
}, },
{ {
deep: true deep: true

@ -16,9 +16,11 @@
</a-button> </a-button>
<!-- 列设置 --> <!-- 列设置 -->
<HColSet <HColSet
:id="vxeSetId"
:code="getBindValues.id" :code="getBindValues.id"
:columns="columns" :columns="getBindValues.columns"
type="vxe" type="vxe"
@updateCol="updateCol"
/> />
</div> </div>
</div> </div>
@ -42,22 +44,27 @@
:loading="getBindValues.loading" :loading="getBindValues.loading"
@cell-dblclick="dbclickVxeRow" @cell-dblclick="dbclickVxeRow"
@sort-change="sortChangeEvent" @sort-change="sortChangeEvent"
@resizable-change="resizableChangeEvent"
> >
<vxe-column type="checkbox" width="40"></vxe-column> <vxe-column type="checkbox" width="40"></vxe-column>
<!-- <vxe-column type="seq" width="40"></vxe-column> --> <!-- <vxe-column type="seq" width="40"></vxe-column> -->
<vxe-column <template
v-for="(item, index) in getBindValues.columns" v-for="(item, index) in getBindValues.columns"
:key="`${item.dataIndex}-${index}`"
:title="item.customTitle"
:field="item.dataIndex"
:width="item.width"
:sortable="item.sorter"
:filters="item.filters"
> >
<template #default="{ row }"> <vxe-column
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot> v-if="item.visible !== false"
</template> :key="`${item.dataIndex}-${index}`"
</vxe-column> :title="item.customTitle"
:field="item.dataIndex"
:width="item.width"
:sortable="item.sorter"
:filters="item.filters"
>
<template #default="{ row }">
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot>
</template>
</vxe-column>
</template>
<template #loading> <template #loading>
<a-spin /> <a-spin />
</template> </template>
@ -94,7 +101,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import type { BasicTableProps, TableActionType, SizeType, ColumnChangeParam } from './types/table' import type { BasicTableProps, TableActionType, SizeType, ColumnChangeParam } from './types/table'
import { defineComponent, ref, computed, unref, toRaw, inject, watchEffect } from 'vue' import { defineComponent, ref, computed, unref, toRaw, inject, watchEffect, onMounted } from 'vue'
import { Table, Pagination } from 'ant-design-vue' import { Table, Pagination } from 'ant-design-vue'
import { BasicForm, useForm } from '/@/components/Form/index' import { BasicForm, useForm } from '/@/components/Form/index'
import { PageWrapperFixedHeightKey } from '/@/components/Page' import { PageWrapperFixedHeightKey } from '/@/components/Page'
@ -122,6 +129,10 @@ import { omit } from 'lodash-es'
import { basicProps } from './props' import { basicProps } from './props'
import { isFunction } from '/@/utils/is' import { isFunction } from '/@/utils/is'
import { warn } from '/@/utils/log' import { warn } from '/@/utils/log'
// vxe
import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api'
// idname
import { permissionsInfo } from '/@/hooks/web/usePermission'
export default defineComponent({ export default defineComponent({
name: 'BasicTable', name: 'BasicTable',
@ -311,7 +322,6 @@ export default defineComponent({
// if (slots.expandedRowRender) { // if (slots.expandedRowRender) {
// propsData = omit(propsData, 'scroll'); // propsData = omit(propsData, 'scroll');
// } // }
propsData = omit(propsData, ['class', 'onChange']) propsData = omit(propsData, ['class', 'onChange'])
return propsData return propsData
}) })
@ -345,7 +355,22 @@ export default defineComponent({
setPagination(pageConfig) setPagination(pageConfig)
reload() reload()
} }
const vxeSetId = ref('0')
// vxe
const getVxeColSetData = () => {
if (props.id) {
getColumnSetInfoByModule({ permissionId: permissionsInfo().permissionId, columnNo: props.id }).then(res => {
console.log(res)
const { data } = res
const columns = JSON.parse(data.content).columns
columns.forEach(item => {
item['title'] = item.customTitle
})
setColumns(columns)
vxeSetId.value = data.id
})
}
}
const tableAction: TableActionType = { const tableAction: TableActionType = {
reload, reload,
getSelectRows, getSelectRows,
@ -405,6 +430,21 @@ export default defineComponent({
fetch() fetch()
} }
} }
// vxe
const resizableChangeEvent = (item) => {
console.log(item)
}
// vxe
const updateCol = (data) => {
data.forEach(item => {
item['title'] = item.customTitle
})
setColumns(data)
}
onMounted(() => {
getVxeColSetData()
})
// //
const initColSet = () => { const initColSet = () => {
@ -419,6 +459,7 @@ export default defineComponent({
// } // }
// } // }
return { return {
vxeSetId,
formRef, formRef,
tableElRef, tableElRef,
getBindValues, getBindValues,
@ -427,6 +468,7 @@ export default defineComponent({
handleSearchInfoChange, handleSearchInfoChange,
getEmptyDataIsShowTable, getEmptyDataIsShowTable,
sortChangeEvent, sortChangeEvent,
resizableChangeEvent,
// filterChangeEvent, // filterChangeEvent,
handleTableChange, handleTableChange,
getRowClassName, getRowClassName,
@ -445,7 +487,8 @@ export default defineComponent({
getWrapperClass, getWrapperClass,
columns: getViewColumns, columns: getViewColumns,
resizeColumn, resizeColumn,
reload reload,
updateCol
} }
}, },
}) })

@ -510,7 +510,7 @@ const [registerTable, { reload, getVxeSelectRows, setLoading, setColumns }] = us
resizeHeightOffset: 75, resizeHeightOffset: 75,
immediate: false, immediate: false,
tableComponent: 'vxe', tableComponent: 'vxe',
id: 'order-ledger', id: '0',
actionColumn: { actionColumn: {
width: 60, width: 60,
title: '操作', title: '操作',

Loading…
Cancel
Save