lijingjia 2 weeks ago
parent a379e697e3
commit e105a4f745

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

@ -90,11 +90,11 @@
//
const rules = {
title: [
{
required: true,
message: '请输入列头中文标题',
trigger: 'blur'
}
// {
// required: true,
// message: '',
// trigger: 'blur'
// }
],
// enTitle: [
// {
@ -133,7 +133,10 @@
}
//
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
}
//
@ -152,11 +155,19 @@
const tbType = ref('excel')
const init = (list, 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
}
defineExpose({
getColList,
init
init,
colData
})
</script>

@ -50,15 +50,23 @@
</span>
</template>
<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 TableColDrag from './components/tableColDrag.vue'
import { EditCustomColumnSet } from './api'
// idname
import { permissionsInfo } from '/@/hooks/web/usePermission'
import { useMessage } from '/@/hooks/web/useMessage'
import { editColumnSet } from '/@/components/Table/src/components/settings/ColumnSettingApi'
const { createMessage } = useMessage()
const { t } = useI18n()
const props = defineProps({
// id (vxe使)
id: {
type: String,
default: '0'
},
//
columns: {
type: Object,
@ -108,14 +116,31 @@
if (!b) visible.value = false
})
} else {
loading.value = true
const columnData = TableColDragRef.value.colData
// 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(
() => props.columns,
(v) => {
colData.value = v.data
colData.value = v.data || v
},
{
deep: true

@ -16,9 +16,11 @@
</a-button>
<!-- 列设置 -->
<HColSet
:id="vxeSetId"
:code="getBindValues.id"
:columns="columns"
:columns="getBindValues.columns"
type="vxe"
@updateCol="updateCol"
/>
</div>
</div>
@ -42,22 +44,27 @@
:loading="getBindValues.loading"
@cell-dblclick="dbclickVxeRow"
@sort-change="sortChangeEvent"
@resizable-change="resizableChangeEvent"
>
<vxe-column type="checkbox" width="40"></vxe-column>
<!-- <vxe-column type="seq" width="40"></vxe-column> -->
<vxe-column
<template
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 }">
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot>
</template>
</vxe-column>
<vxe-column
v-if="item.visible !== false"
:key="`${item.dataIndex}-${index}`"
: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>
<a-spin />
</template>
@ -94,7 +101,7 @@
</template>
<script lang="ts">
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 { BasicForm, useForm } from '/@/components/Form/index'
import { PageWrapperFixedHeightKey } from '/@/components/Page'
@ -122,6 +129,10 @@ import { omit } from 'lodash-es'
import { basicProps } from './props'
import { isFunction } from '/@/utils/is'
import { warn } from '/@/utils/log'
// vxe
import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api'
// idname
import { permissionsInfo } from '/@/hooks/web/usePermission'
export default defineComponent({
name: 'BasicTable',
@ -311,7 +322,6 @@ export default defineComponent({
// if (slots.expandedRowRender) {
// propsData = omit(propsData, 'scroll');
// }
propsData = omit(propsData, ['class', 'onChange'])
return propsData
})
@ -345,7 +355,22 @@ export default defineComponent({
setPagination(pageConfig)
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 = {
reload,
getSelectRows,
@ -405,6 +430,21 @@ export default defineComponent({
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 = () => {
@ -419,6 +459,7 @@ export default defineComponent({
// }
// }
return {
vxeSetId,
formRef,
tableElRef,
getBindValues,
@ -427,6 +468,7 @@ export default defineComponent({
handleSearchInfoChange,
getEmptyDataIsShowTable,
sortChangeEvent,
resizableChangeEvent,
// filterChangeEvent,
handleTableChange,
getRowClassName,
@ -445,7 +487,8 @@ export default defineComponent({
getWrapperClass,
columns: getViewColumns,
resizeColumn,
reload
reload,
updateCol
}
},
})

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

Loading…
Cancel
Save