Compare commits
6 Commits
a441538178
...
dev_sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4a03fb756 | ||
|
|
f4eca63a29 | ||
|
|
b07c03b00a | ||
|
|
f2c856b61c | ||
|
|
d6d5f75fb6 | ||
|
|
c8d152f595 |
@@ -14,6 +14,7 @@
|
|||||||
v-bind="crudBind"
|
v-bind="crudBind"
|
||||||
:summary-method=summaryMethod1
|
:summary-method=summaryMethod1
|
||||||
:row-style="rowStyleMethod"
|
:row-style="rowStyleMethod"
|
||||||
|
:cell-class-name="cellClassNameMethod"
|
||||||
@search-change="searchChange"
|
@search-change="searchChange"
|
||||||
@search-reset="resetChange"
|
@search-reset="resetChange"
|
||||||
@refresh-change="refreshChange"
|
@refresh-change="refreshChange"
|
||||||
@@ -147,7 +148,16 @@ const { wsCache } = useCache()
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { mergeLocaleMessage, t } = useI18n() // 国际化
|
const { mergeLocaleMessage, t } = useI18n() // 国际化
|
||||||
|
const defualtSearch=ref<any>({})
|
||||||
|
const transferFields={
|
||||||
|
'zoneName':'salezonename',
|
||||||
|
'saleTypeName':'saletypename',
|
||||||
|
'salerName':'salername',
|
||||||
|
'goodsName':'goodsname',
|
||||||
|
'customName':'customname',
|
||||||
|
'dosageName':'dosagename',
|
||||||
|
|
||||||
|
}
|
||||||
const loading = ref(false) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const isInit = ref(false)
|
const isInit = ref(false)
|
||||||
const isSearch = ref(false)
|
const isSearch = ref(false)
|
||||||
@@ -178,6 +188,7 @@ const fieldList = ref<any[]>([]) // 添加fieldList引用
|
|||||||
const hideFeilds= ref<any>({})
|
const hideFeilds= ref<any>({})
|
||||||
const hideCols=ref<any>([])
|
const hideCols=ref<any>([])
|
||||||
const dictFieldList=ref<any>([])
|
const dictFieldList=ref<any>([])
|
||||||
|
const textAlignFiels=ref<any>({})
|
||||||
const permissions =
|
const permissions =
|
||||||
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
|
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
|
||||||
const selectIds = computed(() => {
|
const selectIds = computed(() => {
|
||||||
@@ -191,7 +202,8 @@ const remoteMethod= async(query,column)=>{
|
|||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo:1,
|
pageNo:1,
|
||||||
}
|
}
|
||||||
params[column.prop]=query
|
params[transferFields[column.prop]?transferFields[column.prop]:column.prop]=query
|
||||||
|
|
||||||
let data = await ReportApi.getTableList(column.reportCode,params)
|
let data = await ReportApi.getTableList(column.reportCode,params)
|
||||||
column.dicData=column.formatterDic(data)
|
column.dicData=column.formatterDic(data)
|
||||||
}
|
}
|
||||||
@@ -267,6 +279,12 @@ const summaryMethod1=({columns,data})=>{
|
|||||||
})
|
})
|
||||||
return styleObj
|
return styleObj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cellClassNameMethod=({row,column,rowIndex,columnIndex})=>{
|
||||||
|
if(textAlignFiels.value[column.property]){
|
||||||
|
return 'textAlignCell'
|
||||||
|
}
|
||||||
|
}
|
||||||
function getCurrentDate() {
|
function getCurrentDate() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
// 补零函数:小于10则前面加0
|
// 补零函数:小于10则前面加0
|
||||||
@@ -379,6 +397,7 @@ const initTable = async () => {
|
|||||||
}else{
|
}else{
|
||||||
tableSearch.value[config.prop]=item.searchDefaultValue
|
tableSearch.value[config.prop]=item.searchDefaultValue
|
||||||
}
|
}
|
||||||
|
defualtSearch.value[config.prop]=tableSearch.value[config.prop]
|
||||||
}
|
}
|
||||||
|
|
||||||
if(['年','年度','年份','月','月度','月份','年月'].includes(item.fieldName)&&config.search){
|
if(['年','年度','年份','月','月度','月份','年月'].includes(item.fieldName)&&config.search){
|
||||||
@@ -413,19 +432,20 @@ const initTable = async () => {
|
|||||||
'客户':'khxx',
|
'客户':'khxx',
|
||||||
'业务员':'ywyxx',
|
'业务员':'ywyxx',
|
||||||
'业务区域':'ywqy',
|
'业务区域':'ywqy',
|
||||||
|
'标准品名':'bzpm',
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Object.keys(jkTableDicFields).includes(item.fieldName)&&config.search){
|
if(Object.keys(jkTableDicFields).includes(item.fieldName)&&config.search){
|
||||||
config.dataType= 'string'
|
config.dataType= 'string'
|
||||||
config.reportCode= `${jkTableDicFields[item.fieldName]}`
|
config.reportCode= `${jkTableDicFields[item.fieldName]}`
|
||||||
const formatterData=(res) => { //请求数据格式化
|
const formatterData=(res) => { //请求数据格式化
|
||||||
const arr=[...new Set(res.records.map(item=>item[config.prop=="zonename"?"salezonename":config.prop]))]
|
const arr=[...new Set(res.records.map(item=>item[transferFields[config.prop]?transferFields[config.prop]:config.prop]))]
|
||||||
return arr.map(item=>({label:item,value:item}))
|
return arr.map(item=>({label:item,value:item}))
|
||||||
}
|
}
|
||||||
let data = await ReportApi.getTableList(jkTableDicFields[item.fieldName],{pageSize: 50, pageNo:1})
|
ReportApi.getTableList(jkTableDicFields[item.fieldName],{pageSize: 50, pageNo:1}).then(res=>{
|
||||||
|
config.dicData=formatterData(res)
|
||||||
|
})
|
||||||
config.formatterDic=formatterData
|
config.formatterDic=formatterData
|
||||||
config.page=1
|
|
||||||
config.total=data.total
|
|
||||||
config.dicData=formatterData(data)
|
|
||||||
searchReportSlots.value.push(config.prop)
|
searchReportSlots.value.push(config.prop)
|
||||||
// config.multiple?tableSearch.value[config.prop]=item.searchDefaultValue?item.searchDefaultValue.split(','):[]:''
|
// config.multiple?tableSearch.value[config.prop]=item.searchDefaultValue?item.searchDefaultValue.split(','):[]:''
|
||||||
}
|
}
|
||||||
@@ -556,12 +576,15 @@ const getSearchData = () => {
|
|||||||
resolve(searchObj)
|
resolve(searchObj)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const computedIncluedes=(row,prop)=>{
|
||||||
|
return (typeof row[prop])==='string'&&(row[prop].includes('🔴')||row[prop].includes('🟢'))
|
||||||
|
}
|
||||||
const getTableData = async (isLoading = true) => {
|
const getTableData = async (isLoading = true) => {
|
||||||
if (timerObj.value.getTableData) clearTimeout(timerObj.value.getTableData)
|
if (timerObj.value.getTableData) clearTimeout(timerObj.value.getTableData)
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
timerObj.value.getTableData = setTimeout(() => resolve(true), 100)
|
timerObj.value.getTableData = setTimeout(() => resolve(true), 100)
|
||||||
})
|
})
|
||||||
|
textAlignFiels.value={}
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
if (isLoading) loading.value = true
|
if (isLoading) loading.value = true
|
||||||
const searchObj = await getSearchData()
|
const searchObj = await getSearchData()
|
||||||
@@ -709,9 +732,10 @@ const getTableData = async (isLoading = true) => {
|
|||||||
// 没有分组字段,直接处理数据
|
// 没有分组字段,直接处理数据
|
||||||
processedData = data.records.map((record, recordIndex) => {
|
processedData = data.records.map((record, recordIndex) => {
|
||||||
const flatRecord = { ...record }
|
const flatRecord = { ...record }
|
||||||
|
|
||||||
// 处理固定列
|
// 处理固定列
|
||||||
fieldList.value.forEach(field => {
|
fieldList.value.forEach(field => {
|
||||||
|
computedIncluedes(record,field.fieldCode)&&!textAlignFiels.value[field.fieldCode]?textAlignFiels.value[field.fieldCode]=true:''
|
||||||
|
|
||||||
if (field.isFixedColumn === 'Y' && field.fixedColumnValue) {
|
if (field.isFixedColumn === 'Y' && field.fixedColumnValue) {
|
||||||
const fixedValues = field.fixedColumnValue.split(',')
|
const fixedValues = field.fixedColumnValue.split(',')
|
||||||
flatRecord[field.fieldCode] = fixedValues[recordIndex] || ''
|
flatRecord[field.fieldCode] = fixedValues[recordIndex] || ''
|
||||||
@@ -822,7 +846,10 @@ const searchChange = async (params?, done?) => {
|
|||||||
}
|
}
|
||||||
const resetChange = () => {
|
const resetChange = () => {
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
tableSearch.value = {}
|
tableSearch.value = {
|
||||||
|
'Group by':tableSearch.value['Group by']||[],
|
||||||
|
...defualtSearch.value
|
||||||
|
}
|
||||||
if (tablePage.value) tablePage.value['currentPage'] = 1
|
if (tablePage.value) tablePage.value['currentPage'] = 1
|
||||||
await getTableData()
|
await getTableData()
|
||||||
resolve(true)
|
resolve(true)
|
||||||
@@ -900,6 +927,7 @@ defineExpose({
|
|||||||
}
|
}
|
||||||
.el-table__body tr.hover-row>td.el-table__cell{
|
.el-table__body tr.hover-row>td.el-table__cell{
|
||||||
background-color: #FFFFD2;
|
background-color: #FFFFD2;
|
||||||
|
|
||||||
}
|
}
|
||||||
&.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
|
&.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
|
||||||
background-color: #FFFFD2;
|
background-color: #FFFFD2;
|
||||||
@@ -910,6 +938,13 @@ defineExpose({
|
|||||||
border-right: 1px solid #000 !important;
|
border-right: 1px solid #000 !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
td.textAlignCell .cell{
|
||||||
|
span{
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
--el-table-border-color: #000;
|
--el-table-border-color: #000;
|
||||||
tfoot .el-table__cell{
|
tfoot .el-table__cell{
|
||||||
border-top: 1px solid #000 !important;
|
border-top: 1px solid #000 !important;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ const btnData = computed(() => {
|
|||||||
if (!btnObj[key].display) continue
|
if (!btnObj[key].display) continue
|
||||||
btn[key] = btnObj[key]
|
btn[key] = btnObj[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
return { [props.type]: btn }
|
return { [props.type]: btn }
|
||||||
} else {
|
} else {
|
||||||
const menuObj = cloneDeep(props.buttonObj.menu)
|
const menuObj = cloneDeep(props.buttonObj.menu)
|
||||||
@@ -95,11 +96,17 @@ const btnData = computed(() => {
|
|||||||
if (props.row && props.row[`$btn__${key}`] !== undefined) {
|
if (props.row && props.row[`$btn__${key}`] !== undefined) {
|
||||||
menuObj[key].display = props.row[`$btn__${key}`]
|
menuObj[key].display = props.row[`$btn__${key}`]
|
||||||
}
|
}
|
||||||
|
if(props.buttonObj.setConfig&&props.row){
|
||||||
|
let data= props.buttonObj.setConfig(props.row)
|
||||||
|
Object.keys(data).forEach(key => {
|
||||||
|
menuObj[key]={ ...menuObj[key],...data[key]}
|
||||||
|
})
|
||||||
|
}
|
||||||
if (!menuObj[key].display) continue
|
if (!menuObj[key].display) continue
|
||||||
if (props.type == 'more' && Object.keys(menu).length >= (props.maxNum || 1)) {
|
if (props.type == 'more' && Object.keys(menu).length >= (props.maxNum || 1)) {
|
||||||
more[key] = menuObj[key]
|
more[key] = menuObj[key]
|
||||||
} else menu[key] = menuObj[key]
|
} else menu[key] = menuObj[key]
|
||||||
}
|
}
|
||||||
return { menu, more }
|
return { menu, more }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1903,6 +1903,16 @@ const initEnhanceUseFun = () => {
|
|||||||
if (!curConfig) enhanceErrorTip(`调用useFun.setPropConfig方法,未找到字段:${prop}`, '')
|
if (!curConfig) enhanceErrorTip(`调用useFun.setPropConfig方法,未找到字段:${prop}`, '')
|
||||||
else setDeepObject(curConfig, config)
|
else setDeepObject(curConfig, config)
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 设置按钮配置
|
||||||
|
* @param prop 数据绑定key
|
||||||
|
* @param config 需修改的配置,非覆盖,格式Object,支持深结构修改 例:'params.deep.deep'
|
||||||
|
*/
|
||||||
|
setMenuButtonConfig: (prop, config) => {
|
||||||
|
if(buttonObj.value){
|
||||||
|
setDeepObject(buttonObj.value, config)
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 设置附表控件配置
|
* 设置附表控件配置
|
||||||
* @param prop 数据绑定key
|
* @param prop 数据绑定key
|
||||||
|
|||||||
Reference in New Issue
Block a user