Compare commits
32 Commits
b9c60b8c48
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a683da95a | ||
|
|
abba12dd82 | ||
|
|
213811c84d | ||
|
|
a4a03fb756 | ||
|
|
f4eca63a29 | ||
|
|
b07c03b00a | ||
|
|
f2c856b61c | ||
|
|
d6d5f75fb6 | ||
|
|
c8d152f595 | ||
|
|
a441538178 | ||
|
|
7e57cfb871 | ||
|
|
c5ff4c263f | ||
|
|
eeb6f27d47 | ||
|
|
b2a130930c | ||
|
|
b35b04452a | ||
|
|
081544019c | ||
|
|
e545aa36ca | ||
|
|
85f7484c57 | ||
|
|
cb77ad837b | ||
|
|
03c8d49a9c | ||
|
|
201a4464bb | ||
|
|
e8fce71d0e | ||
|
|
774895f901 | ||
|
|
386fb026b5 | ||
|
|
280ff0837f | ||
|
|
6625e0c1a3 | ||
|
|
354f839b4e | ||
|
|
5b95cc85f0 | ||
|
|
cf511deeef | ||
|
|
2217b14377 | ||
|
|
d57c46b531 | ||
|
|
b6d970175e |
@@ -29,3 +29,8 @@ export const getUserSelectDeptList = (type) => {
|
||||
export const getUserSelectRoleList = () => {
|
||||
return request.get({ url: `/lideeyunji/adapter/role/list` })
|
||||
}
|
||||
|
||||
//获取设备类型选择器列表
|
||||
export const getSblxSelectList = () => {
|
||||
return request.get({ url: `/system/sblx/simple-list` })
|
||||
}
|
||||
|
||||
@@ -89,4 +89,7 @@ export const batchGetTableList = (reportCodes: string, data?) => {
|
||||
return request.post({ url: `/lideeyunji/report-data/batch/list/${reportCodes}`, data })
|
||||
}
|
||||
|
||||
|
||||
//获取综合销售报表合计
|
||||
export const getAggMonthTotalDetail = (data) => {
|
||||
return request.post({ url: `lideeyunji/agg/month/total/detail`, data })
|
||||
}
|
||||
|
||||
40
src/api/system/sblx/index.ts
Normal file
40
src/api/system/sblx/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface SblxVO {
|
||||
id?: number
|
||||
industryName: string
|
||||
industryCode: string
|
||||
parentId: number
|
||||
sort: number
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
// 查询设备类型(精简)列表
|
||||
export const getSimpleSblxList = async (): Promise<SblxVO[]> => {
|
||||
return await request.get({ url: '/system/sblx/simple-list' })
|
||||
}
|
||||
|
||||
// 查询设备类型列表
|
||||
export const getSblxPage = async (params: PageParam) => {
|
||||
return await request.get({ url: '/system/sblx/list', params })
|
||||
}
|
||||
|
||||
// 查询设备类型详情
|
||||
export const getSblx = async (id: number) => {
|
||||
return await request.get({ url: '/system/sblx/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增设备类型
|
||||
export const createSblx = async (data: SblxVO) => {
|
||||
return await request.post({ url: '/system/sblx/create', data: data })
|
||||
}
|
||||
|
||||
// 修改设备类型
|
||||
export const updateSblx = async (params: SblxVO) => {
|
||||
return await request.put({ url: '/system/sblx/update', data: params })
|
||||
}
|
||||
|
||||
// 删除设备类型
|
||||
export const deleteSblx = async (id: number) => {
|
||||
return await request.delete({ url: '/system/sblx/delete?id=' + id })
|
||||
}
|
||||
@@ -15,7 +15,7 @@ defineProps({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ElCard :class="[prefixCls, 'mb-15px']" shadow="never">
|
||||
<ElCard :class="[prefixCls]" shadow="never">
|
||||
<template v-if="title" #header>
|
||||
<div class="flex items-center">
|
||||
<span class="text-16px font-700">{{ title }}</span>
|
||||
|
||||
@@ -295,8 +295,10 @@ defineExpose({ validate })
|
||||
&.control-tree,
|
||||
&.control-cascader,
|
||||
&.control-regionSelect,
|
||||
&.control-sblxSelect,
|
||||
&.control-userSelect,
|
||||
&.control-deptSelect,
|
||||
&.control-sblxSelect,
|
||||
&.control-dicTableSelect,
|
||||
&.control-map,
|
||||
&.control-color,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class="low-reoprt"
|
||||
:class="[`low-report__${reportCode}`, { summary: tableOption.showSummary }]"
|
||||
>
|
||||
<div v-if="isSearch" style="margin-bottom:6px">查询:</div>
|
||||
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
v-model:search="tableSearch"
|
||||
@@ -13,6 +13,8 @@
|
||||
:option="tableOption"
|
||||
v-bind="crudBind"
|
||||
:summary-method=summaryMethod1
|
||||
:row-style="rowStyleMethod"
|
||||
:cell-class-name="cellClassNameMethod"
|
||||
@search-change="searchChange"
|
||||
@search-reset="resetChange"
|
||||
@refresh-change="refreshChange"
|
||||
@@ -21,6 +23,9 @@
|
||||
@selection-change="selectionChange"
|
||||
@sort-change="sortChange"
|
||||
>
|
||||
<template #search>
|
||||
<!-- <div v-if="isSearch" style="margin-bottom:6px">查询:</div> -->
|
||||
</template>
|
||||
<!-- 自定义表格头部操作 -->
|
||||
<template #menu-left="{ size }">
|
||||
<ElButton
|
||||
@@ -39,6 +44,31 @@
|
||||
<Icon :size="14" icon="clarity:export-line"></Icon>
|
||||
<span>{{ t('Avue.crud.excelBtn') }}</span>
|
||||
</ElButton>
|
||||
<div ref="tableHeightRef"></div>
|
||||
</template>
|
||||
<template v-for="prop in searchReportSlots" :key="prop" #[`${prop}-search`]="scope" >
|
||||
<div>
|
||||
<el-select
|
||||
v-model="tableSearch[prop]"
|
||||
:multiple="scope.column.multiple"
|
||||
filterable
|
||||
remote
|
||||
remote-show-suffix
|
||||
clearable
|
||||
:disabled="loading"
|
||||
:collapse-tags="scope.column.collapseTags"
|
||||
:collapse-tags-tooltip="scope.column.collapseTagsTooltip"
|
||||
:placeholder="'请选择'+scope.column.label"
|
||||
:remote-method="(query) => remoteMethod(query, scope.column)"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item,index) in scope.column.dicData"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<template v-for="prop in numberRange" :key="prop" #[`${prop}-search`]="scope">
|
||||
<InputNumberRange
|
||||
@@ -69,14 +99,14 @@
|
||||
></InputTimeRange>
|
||||
</template>
|
||||
<template #header v-if="Object.keys(dimensionFields)?.length">
|
||||
<div style="display:flex;align-items:center;border-top:1px solid #eee;margin-bottom:10px;padding-top:10px;">
|
||||
<div style="display:flex;padding-top:10px;margin-bottom:10px;border-top:1px solid #eee;align-items:center;">
|
||||
<span style="margin-right:10px;">维度:</span>
|
||||
<el-checkbox-group
|
||||
@change="searchDimension" v-model="tableSearch['Group by']"
|
||||
placeholder="请选择内容">
|
||||
<template v-for="(item,key) in dimensionFields">
|
||||
<el-checkbox
|
||||
v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSearch['Group by']?.length"
|
||||
v-if="1"
|
||||
:key="key"
|
||||
:value="key"
|
||||
:label="item.label"></el-checkbox>
|
||||
@@ -92,11 +122,13 @@ v-if="tableSearch['Group by']&&tableSearch['Group by'].includes(key)||!tableSear
|
||||
import * as ReportApi from '@/api/design/report'
|
||||
import { InputNumberRange,InputDateRange ,InputDateTimeRange,InputTimeRange} from '../shareControl/index'
|
||||
import download from '@/utils/download'
|
||||
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { assembleLengObj } from '@/utils/lowDesign'
|
||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||
import Avue from '@smallwei/avue'
|
||||
import { Console } from 'console'
|
||||
defineOptions({ name: 'LowReport' })
|
||||
|
||||
interface Props {
|
||||
@@ -116,24 +148,34 @@ const { wsCache } = useCache()
|
||||
const route = useRoute()
|
||||
const message = useMessage() // 消息弹窗
|
||||
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 isInit = ref(false)
|
||||
const isSearch = ref(false)
|
||||
|
||||
|
||||
const tableHeightRef = ref<any>(null)
|
||||
const tableOption = ref<any>({})
|
||||
const tableData = ref<any>([])
|
||||
const tableSearch = ref({
|
||||
'Group by':[]
|
||||
})
|
||||
const tablePage = ref<any>({ currentPage: 1, pageSize: 100, total: 0 })
|
||||
const tablePage = ref<any>({ currentPage: 1, pageSize: 50, total: 0 })
|
||||
const tableSelect = ref<any>([])
|
||||
const tableSort = ref({ column: '', order: '' })
|
||||
const tableInfo = ref<any>({})
|
||||
const timerObj = ref<any>({})
|
||||
const numberRange = ref<string[]>([])
|
||||
const dateRange=ref<string[]>([])
|
||||
const searchReportSlots=ref<string[]>([])
|
||||
const hideColumns=ref<string[]>([])
|
||||
const dateTimeRange=ref<string[]>([])
|
||||
const timeRange=ref<string[]>([])
|
||||
@@ -144,22 +186,77 @@ const dimensionFields=ref<any>({})
|
||||
const exportLoading = ref(false)
|
||||
const fieldList = ref<any[]>([]) // 添加fieldList引用
|
||||
const hideFeilds= ref<any>({})
|
||||
const hideCols=ref<any>([])
|
||||
const dictFieldList=ref<any>([])
|
||||
const textAlignFiels=ref<any>({})
|
||||
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(() => {
|
||||
return tableSelect.value.map((item) => item['id'])
|
||||
})
|
||||
const remoteMethod= async(query,column)=>{
|
||||
if(!query){
|
||||
return
|
||||
}
|
||||
let params={
|
||||
pageSize: 100,
|
||||
pageNo:1,
|
||||
}
|
||||
params[transferFields[column.prop]?transferFields[column.prop]:column.prop]=query
|
||||
|
||||
let data = await ReportApi.getTableList(column.reportCode,params)
|
||||
column.dicData=column.formatterDic(data)
|
||||
}
|
||||
const crudBind = computed(() => {
|
||||
const obj = {}
|
||||
if (tableInfo.value.isPage) obj['page'] = tablePage.value
|
||||
return obj
|
||||
})
|
||||
|
||||
function getElementToBodyTop(el) {
|
||||
if (!el || !(el instanceof HTMLElement)) return 0;
|
||||
|
||||
// 1. 获取元素相对于视口的位置(top是元素顶部到视口顶部的距离)
|
||||
const rect = el.getBoundingClientRect();
|
||||
// 2. 视口顶部到body顶部的距离 = 页面滚动的距离(window.scrollY)
|
||||
// 最终距离 = 元素视口top + 页面滚动距离 - body的margin/padding(可选,根据场景)
|
||||
const bodyTop = document.body.getBoundingClientRect().top; // body自身的偏移(通常为0)
|
||||
return rect.top - bodyTop + window.scrollY;
|
||||
}
|
||||
const tableHeight=ref(0)
|
||||
watch(()=>tableHeightRef.value,()=>{
|
||||
if(tableHeightRef.value){
|
||||
setTimeout(()=>{
|
||||
observeHeightChange(document.querySelector('.avue-crud__search'))
|
||||
if(tableOption.value.showSummary&&tableOption.value.index&&tableOption.value.selection){
|
||||
document.querySelector('tfoot tr td').colSpan="2"
|
||||
document.querySelectorAll('tfoot tr td')[1].style.display="none"
|
||||
}
|
||||
|
||||
},2000)
|
||||
}
|
||||
})
|
||||
let resizeObserver = null;
|
||||
const observeHeightChange = (targetEl) => {
|
||||
// 确保元素已挂载
|
||||
if (!targetEl) return;
|
||||
// 创建ResizeObserver实例
|
||||
resizeObserver = new ResizeObserver((entries) => {
|
||||
const calcH= getElementToBodyTop(tableHeightRef.value)
|
||||
tableHeight.value= ('calc(100vh - '+(parseInt(calcH+160))+"px)")
|
||||
if(document.querySelector('.el-table').style){
|
||||
document.querySelector('.el-table').style.height=tableHeight.value
|
||||
}
|
||||
});
|
||||
// 开始监听目标元素
|
||||
resizeObserver.observe(targetEl);
|
||||
};
|
||||
const setLastAmountRowClass=(row,rowIndex)=>{
|
||||
if(row.isAmount===true){
|
||||
return 'lastAmountRow'
|
||||
}
|
||||
}
|
||||
|
||||
const summaryMethod1=({columns,data})=>{
|
||||
// 1. 初始化汇总结果数组(和表格列数量一致)
|
||||
const result = new Array(columns.length).fill("");
|
||||
@@ -173,6 +270,21 @@ const summaryMethod1=({columns,data})=>{
|
||||
})
|
||||
return result;
|
||||
}
|
||||
const rowStyleMethod=({row,rowIndex})=>{
|
||||
let styleObj={}
|
||||
dictFieldList.value.forEach(item=>{
|
||||
if(row[item.prop]){
|
||||
styleObj['color']=item.dicData.find(d=>d.value===row[item.prop]).cssClass
|
||||
}
|
||||
})
|
||||
return styleObj
|
||||
}
|
||||
|
||||
const cellClassNameMethod=({row,column,rowIndex,columnIndex})=>{
|
||||
if(textAlignFiels.value[column.property]){
|
||||
return 'textAlignCell'
|
||||
}
|
||||
}
|
||||
function getCurrentDate() {
|
||||
const now = new Date();
|
||||
// 补零函数:小于10则前面加0
|
||||
@@ -204,19 +316,20 @@ const initTable = async () => {
|
||||
hideColumns.value=[]
|
||||
tableInfo.value = { ...reportVo, isPage, isHeight, isPermi, isHideExport }
|
||||
tableOption.value = {
|
||||
selection: !isHideExport,
|
||||
selection: false,
|
||||
reserveSelection: true,
|
||||
menu: false,
|
||||
addBtn: false,
|
||||
height: isHeight ? 'auto' : undefined,
|
||||
calcHeight: isHeight ? 10 : '',
|
||||
calcHeight: isHeight ?10 : '',
|
||||
index: reportVo.tableConfig.includes('index'),
|
||||
indexLabel: '序号',
|
||||
indexWidth: 54,
|
||||
border: reportVo.tableConfig.includes('border'),
|
||||
stripe: reportVo.tableConfig.includes('stripe'),
|
||||
// stripe: reportVo.tableConfig.includes('stripe'),
|
||||
showSummary:false,
|
||||
|
||||
stripe:true,
|
||||
|
||||
searchBtnText:'查询',
|
||||
column: {}
|
||||
}
|
||||
|
||||
@@ -229,6 +342,7 @@ const initTable = async () => {
|
||||
const fixedFields = apiFieldList.filter(f => f.isFixedColumn === 'Y')
|
||||
const dynamicFields = apiFieldList.filter(f => f.isFixedColumn !== 'Y')
|
||||
|
||||
|
||||
// 处理固定列
|
||||
fixedFields.forEach((item) => {
|
||||
const config: any = {
|
||||
@@ -259,9 +373,8 @@ const initTable = async () => {
|
||||
|
||||
// }
|
||||
// 处理动态列(暂不构建children,等数据返回后动态生成)
|
||||
dynamicFields.forEach((item, index) => {
|
||||
dynamicFields.forEach(async (item, index) => {
|
||||
if (item.parentFieldCode && item.parentFieldCode !== '') return
|
||||
|
||||
const config: any = {
|
||||
prop: item.fieldCode,
|
||||
label: t(`${props.reportCode}.${item.fieldCode}`),
|
||||
@@ -276,7 +389,7 @@ const initTable = async () => {
|
||||
if(item.queryIsWeb == 'Y'&&item.isHideSearch !== 'Y') isSearch.value=true
|
||||
if(!!item.searchDefaultValue){
|
||||
if(['年','年度','年份'].includes(item.fieldName)&&item.searchDefaultValue=='本年'){
|
||||
tableSearch.value[config.prop]=getCurrentDate().year
|
||||
tableSearch.value[config.prop]=getCurrentDate().year.toString()
|
||||
}else if( ['月','月度','月份'].includes(item.fieldName)&&item.searchDefaultValue=='本月'){
|
||||
tableSearch.value[config.prop]=new Date().getMonth() + 1
|
||||
}else if(item.fieldType=='Date'&&item.searchDefaultValue=='当日'){
|
||||
@@ -284,10 +397,11 @@ const initTable = async () => {
|
||||
}else{
|
||||
tableSearch.value[config.prop]=item.searchDefaultValue
|
||||
}
|
||||
defualtSearch.value[config.prop]=tableSearch.value[config.prop]
|
||||
}
|
||||
|
||||
if(['年','年度','年份','月','月度','月份','年月'].includes(item.fieldName)&&config.search){
|
||||
config.searchSpan=3
|
||||
config.searchLabelWidth=60
|
||||
if(item.fieldName.includes('年')){
|
||||
config.searchType='year'
|
||||
config.valueFormat = 'YYYY'
|
||||
@@ -295,24 +409,54 @@ const initTable = async () => {
|
||||
config.searchType='select'
|
||||
config.dicData=[{label:'1月',value:'1'},{label:'2月',value:'2'},{label:'3月',value:'3'},{label:'4月',value:'4'},{label:'5月',value:'5'},{label:'6月',value:'6'},{label:'7月',value:'7'},{label:'8月',value:'8'},{label:'9月',value:'9'},{label:'10月',value:'10'},{label:'11月',value:'11'},{label:'12月',value:'12'}]
|
||||
}
|
||||
if(props.reportCode=='ZHXSQK'&&item.isDimension=='Y'){
|
||||
tableSearch.value['Group by'].push(item.fieldCode)
|
||||
}
|
||||
}
|
||||
if(['货品名称','货品名称','剂型','剂型名称','客户名称','客户','业务员'].includes(item.fieldName)&&config.search){
|
||||
config.dataType= 'string'
|
||||
config.dictType= 'defaultTable'
|
||||
config.dicUrl= `/lideeyunji/report-data/list/${item.fieldName.includes('客户') ?'khxx':(item.fieldName.includes('业务员')?'ywyxx': 'hpmx')}`
|
||||
config.dicMethod= 'post'
|
||||
config.dicQuery= { //请求参数
|
||||
pageSize: 1000000,
|
||||
pageNo:1
|
||||
}
|
||||
config.filterable= true
|
||||
// config.props ={ label:config.prop , value:config.prop }
|
||||
config.dicFormatter= (res) => { //请求数据格式化
|
||||
const arr=[...new Set(res.records.map(item=>item[config.prop]))]
|
||||
if(item.fieldName=='效期剩余时间(天)分类') config.searchSpan=5
|
||||
|
||||
if(config.search) config.searchLabelWidth=item.fieldName.length*12 +40
|
||||
const moreIn="MORE_IN".includes(item.queryMode)
|
||||
config.searchType=moreIn?'select':config.searchType
|
||||
config.multiple=config.collapseTags=config.collapseTagsTooltip =moreIn
|
||||
item.queryMode=='LIKE'?config.multiple=config.collapseTags=config.collapseTagsTooltip =true:''
|
||||
const jkTableDicFields={
|
||||
'货品名称':'hpmx',
|
||||
'货品':'hpmx',
|
||||
'剂型':'jxjk',
|
||||
'产品':'hpmx',
|
||||
'产品名称':'hpmx',
|
||||
'剂型名称':'jxjk',
|
||||
'客户名称':'khxx',
|
||||
'销售类型':'xslx',
|
||||
'客户':'khxx',
|
||||
'业务员':'ywyxx',
|
||||
'业务区域':'ywqy',
|
||||
'标准品名':'bzpm',
|
||||
}
|
||||
|
||||
if(Object.keys(jkTableDicFields).includes(item.fieldName)&&config.search){
|
||||
config.dataType= 'string'
|
||||
config.reportCode= `${jkTableDicFields[item.fieldName]}`
|
||||
const formatterData=(res) => { //请求数据格式化
|
||||
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}))
|
||||
}
|
||||
config.searchType='select'
|
||||
ReportApi.getTableList(jkTableDicFields[item.fieldName],{pageSize: 50, pageNo:1}).then(res=>{
|
||||
config.dicData=formatterData(res)
|
||||
})
|
||||
config.formatterDic=formatterData
|
||||
searchReportSlots.value.push(config.prop)
|
||||
// config.multiple?tableSearch.value[config.prop]=item.searchDefaultValue?item.searchDefaultValue.split(','):[]:''
|
||||
}
|
||||
if(item.dictCode){
|
||||
const dictData=getStrDictOptions(item.dictCode)
|
||||
config.dicData=dictData
|
||||
config.searchType= 'select'
|
||||
config.dataType= 'string'
|
||||
dictFieldList.value.push(config)
|
||||
}
|
||||
|
||||
|
||||
if(!!item.isAmount){
|
||||
index==0?amountFieds.value.fistField=config.prop:''
|
||||
@@ -321,14 +465,15 @@ const initTable = async () => {
|
||||
}
|
||||
if(item.width){
|
||||
config.width=item.width
|
||||
config.widthOld=item.width
|
||||
}
|
||||
if(item.isDimension=='Y'){
|
||||
dimensionFields.value[config.prop]=config
|
||||
hideFeilds.value[config.prop]=item.isHideDimension
|
||||
}
|
||||
if(item.isHideCol == 'Y') {
|
||||
if(item.isHideCol == 'Y') {hideCols.value.push(config.prop)
|
||||
config.hide = true
|
||||
hideColumns.value.push( config.prop )
|
||||
hideColumns.value.push(config.prop)
|
||||
}
|
||||
if (item.queryMode == 'RANGE') config.searchRange = true
|
||||
if (['Integer', 'BigInt', 'BigDecimal'].includes(item.fieldType)) config.type = 'number'
|
||||
@@ -391,6 +536,7 @@ const initTableLayout = () => {
|
||||
timerObj.value.layout = setTimeout(() => {
|
||||
if (crudRef.value) crudRef.value.getTableHeight()
|
||||
}, 100)
|
||||
|
||||
}
|
||||
|
||||
const selectionChange = (data) => {
|
||||
@@ -430,17 +576,21 @@ const getSearchData = () => {
|
||||
resolve(searchObj)
|
||||
})
|
||||
}
|
||||
|
||||
const computedIncluedes=(row,prop)=>{
|
||||
return (typeof row[prop])==='string'&&(row[prop].includes('🔴')||row[prop].includes('🟢'))
|
||||
}
|
||||
const getTableData = async (isLoading = true) => {
|
||||
if (timerObj.value.getTableData) clearTimeout(timerObj.value.getTableData)
|
||||
await new Promise((resolve) => {
|
||||
timerObj.value.getTableData = setTimeout(() => resolve(true), 100)
|
||||
})
|
||||
textAlignFiels.value={}
|
||||
return new Promise(async (resolve) => {
|
||||
if (isLoading) loading.value = true
|
||||
const searchObj = await getSearchData()
|
||||
try {
|
||||
// 获取数据
|
||||
|
||||
let data = await ReportApi.getTableList(props.reportCode, searchObj)
|
||||
|
||||
// 功能测试:CS_DTBT报表使用模拟数据
|
||||
@@ -458,7 +608,6 @@ const getTableData = async (isLoading = true) => {
|
||||
{ "yuefen": "五月", "benyue": 333, "leiji": 444 },
|
||||
{ "yuefen": "六月", "benyue": 555, "leiji": 555 },
|
||||
{ "yuefen": "六月", "benyue": 666, "leiji": 666 },
|
||||
|
||||
],
|
||||
total: 6
|
||||
}
|
||||
@@ -583,9 +732,10 @@ const getTableData = async (isLoading = true) => {
|
||||
// 没有分组字段,直接处理数据
|
||||
processedData = data.records.map((record, recordIndex) => {
|
||||
const flatRecord = { ...record }
|
||||
|
||||
// 处理固定列
|
||||
fieldList.value.forEach(field => {
|
||||
computedIncluedes(record,field.fieldCode)&&!textAlignFiels.value[field.fieldCode]?textAlignFiels.value[field.fieldCode]=true:''
|
||||
|
||||
if (field.isFixedColumn === 'Y' && field.fixedColumnValue) {
|
||||
const fixedValues = field.fixedColumnValue.split(',')
|
||||
flatRecord[field.fieldCode] = fixedValues[recordIndex] || ''
|
||||
@@ -596,34 +746,54 @@ const getTableData = async (isLoading = true) => {
|
||||
})
|
||||
}
|
||||
|
||||
tableData.value = processedData
|
||||
// amountFieds.value={
|
||||
// 'thissaqty_s':{
|
||||
// prop:'thissaqty',
|
||||
// },
|
||||
// "monthsaqty_s":{
|
||||
// prop:'monthsaqty',
|
||||
//},
|
||||
//'lastsaqty_s':{
|
||||
// prop:'lastsaqty'
|
||||
//}
|
||||
//}
|
||||
//tableData.value[0]['thissaqty_s']=6083195687
|
||||
// tableData.value[0]['monthsaqty_s']=972705058
|
||||
// tableData.value[0]['lastsaqty_s']=6075936725
|
||||
tableData.value = processedData
|
||||
Object.values(tableOption.value.column).forEach( item=>{
|
||||
let oldHide=hideCols.value.indexOf(item.prop)!==-1
|
||||
item.hide=tableData.value[0]&&((tableSearch.value['Group by']&&tableData.value[0][item.prop]===undefined&&!item.children)||(item.children?.every(child=>(!['yearplan','yearrate'].includes(child.prop))&&(tableData.value[0][child.prop]===undefined))))||oldHide
|
||||
const prH=hideColumns.value.indexOf(item.prop)
|
||||
item.hide?(prH===-1?hideColumns.value.push(item.prop):''):(prH!==-1&&hideCols.value.indexOf(item.prop)===-1?hideColumns.value.splice(prH,1):'')
|
||||
})
|
||||
|
||||
|
||||
let keys=Object.keys(amountFieds.value)
|
||||
if(!!keys.length&&!!tableData.value.length){
|
||||
let obj={isAmount:true}
|
||||
let value={...tableData.value[0]}
|
||||
if(tableInfo.value.reportCode==='ZHXSQK'){
|
||||
value=(await ReportApi.getAggMonthTotalDetail(searchObj))[0]
|
||||
// searchObj['usemonth']?'':value.thisMonthSaMoney_s=value.thissamoney_s
|
||||
|
||||
}
|
||||
keys.forEach(item=>{
|
||||
let key=amountFieds.value[item].prop
|
||||
key!=='fistField'?obj[key]=tableData.value[0][item]:''
|
||||
key!=='fistField'?obj[key]=value[item]:''
|
||||
})
|
||||
amountObj.value=obj
|
||||
}
|
||||
let field=tableSearch.value['Group by']
|
||||
let hides=[]
|
||||
if(field.length){
|
||||
field.forEach(item=>{
|
||||
hides=Object.keys(hideFeilds.value).length?hideFeilds.value[item].split(','):[]
|
||||
})
|
||||
}
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
let item=tableOption.value.column[key]
|
||||
item.hide=hides.includes(item.prop)||hideColumns.value.includes(item.prop)
|
||||
})
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
const showCols=Object.values(tableOption.value.column).filter(item=>!item.hide)
|
||||
let item=tableOption.value.column[key]
|
||||
item.children?'':(item.width=showCols.length<14?undefined:item.widthOld)
|
||||
item.children?.forEach(child=>{
|
||||
child.width=showCols.length<14?undefined:child.widthOld
|
||||
})
|
||||
})
|
||||
resolve(data.records)
|
||||
} finally {
|
||||
|
||||
if (isLoading) loading.value = false
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -668,24 +838,18 @@ const clearSearch = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const searchChange = (params?, done?) => {
|
||||
const searchChange = async (params?, done?) => {
|
||||
if (tablePage.value) tablePage.value['currentPage'] = 1
|
||||
getTableData().finally(() => {
|
||||
let field=tableSearch.value['Group by']
|
||||
let hides=[]
|
||||
if(field.length){
|
||||
hides=Object.keys(hideFeilds.value).length?hideFeilds.value[field].split(','):[]
|
||||
}
|
||||
Object.keys(tableOption.value.column).forEach(key=>{
|
||||
let item=tableOption.value.column[key]
|
||||
item.hide=hides.includes(item.prop)||hideColumns.value.includes(item.prop)
|
||||
})
|
||||
if (done) done()
|
||||
})
|
||||
await getTableData()
|
||||
|
||||
if (done) done()
|
||||
}
|
||||
const resetChange = () => {
|
||||
return new Promise(async (resolve) => {
|
||||
tableSearch.value = {}
|
||||
tableSearch.value = {
|
||||
'Group by':tableSearch.value['Group by']||[],
|
||||
...defualtSearch.value
|
||||
}
|
||||
if (tablePage.value) tablePage.value['currentPage'] = 1
|
||||
await getTableData()
|
||||
resolve(true)
|
||||
@@ -738,6 +902,18 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-form-item--default){
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
:deep(.avue-crud__pagination){
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.avue-crud__tip){
|
||||
display: none;
|
||||
}
|
||||
|
||||
.amountBox{
|
||||
&::after{
|
||||
content:'、'
|
||||
@@ -748,6 +924,41 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table){
|
||||
--el-table-border-color: #000;
|
||||
|
||||
.is-group th.el-table__cell,th.el-table__cell{
|
||||
background-color: #C6EFFE;
|
||||
}
|
||||
|
||||
.el-table__body tr.hover-row>td.el-table__cell{
|
||||
background-color: #FFFFD2;
|
||||
|
||||
}
|
||||
|
||||
&.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{
|
||||
background-color: #FFFFD2;
|
||||
}
|
||||
|
||||
td.el-table__cell,th.el-table__cell{
|
||||
border-right: 1px solid #000 !important;
|
||||
border-bottom: 1px solid #000 !important;
|
||||
|
||||
}
|
||||
|
||||
td.textAlignCell .cell{
|
||||
span{
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
tfoot .el-table__cell{
|
||||
border-top: 1px solid #000 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.lastAmountRow{
|
||||
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ const dateType = [
|
||||
]
|
||||
const treeType = ['tree', 'cascader']
|
||||
const selectType = ['select', 'radio', 'checkbox', 'switch']
|
||||
const avueSlotType = ['userSelect', 'deptSelect', 'dicTableSelect']
|
||||
const avueSlotType = ['userSelect', 'deptSelect', 'sblxSelect', 'dicTableSelect']
|
||||
|
||||
const changeType = [...timeType, ...dateType, ...treeType, ...selectType, ...avueSlotType]
|
||||
const vBind = computed(() => {
|
||||
|
||||
@@ -86,6 +86,7 @@ const btnData = computed(() => {
|
||||
if (!btnObj[key].display) continue
|
||||
btn[key] = btnObj[key]
|
||||
}
|
||||
|
||||
return { [props.type]: btn }
|
||||
} else {
|
||||
const menuObj = cloneDeep(props.buttonObj.menu)
|
||||
@@ -95,11 +96,17 @@ const btnData = computed(() => {
|
||||
if (props.row && props.row[`$btn__${key}`] !== undefined) {
|
||||
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 (props.type == 'more' && Object.keys(menu).length >= (props.maxNum || 1)) {
|
||||
more[key] = menuObj[key]
|
||||
} else menu[key] = menuObj[key]
|
||||
}
|
||||
}
|
||||
return { menu, more }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -118,7 +118,7 @@ const getTableData = async () => {
|
||||
})
|
||||
if (userIds.length) {
|
||||
const dicRes = await DicApi.getDicTableText({
|
||||
lideeYunji_dictLabel: encryptAES(JSON.stringify([{ userIdList: [...new Set(userIds)] }]))
|
||||
lideeYunJi_dictLabel: encryptAES(JSON.stringify([{ userIdList: [...new Set(userIds)] }]))
|
||||
})
|
||||
if (dicRes?.userList) {
|
||||
dicRes.userList.forEach((item) => (userObj[item.id] = item.nickname))
|
||||
|
||||
@@ -1618,6 +1618,12 @@ const beforeOpen = async (done, type) => {
|
||||
const beforeClose = async (done, type) => {
|
||||
tableCurrRow.value = {}
|
||||
tableCurrType.value = ''
|
||||
try {
|
||||
if (jsEnhanceObj.value.beforeFormData)
|
||||
jsEnhanceObj.value.beforeFormData({}, type,'close')
|
||||
} catch (error) {
|
||||
enhanceErrorTip('js增强【beforeFormData】方法执行异常,请检查', error)
|
||||
}
|
||||
done()
|
||||
}
|
||||
|
||||
@@ -1897,6 +1903,16 @@ const initEnhanceUseFun = () => {
|
||||
if (!curConfig) enhanceErrorTip(`调用useFun.setPropConfig方法,未找到字段:${prop}`, '')
|
||||
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
|
||||
|
||||
@@ -27,6 +27,20 @@
|
||||
@set-form-data="setFormData"
|
||||
></DeptSelect>
|
||||
</template>
|
||||
<template v-else-if="control.controlType == 'sblxSelect'">
|
||||
<!-- 设备类型选择 -->
|
||||
<SblxSelect
|
||||
ref="slotRef"
|
||||
v-model="model"
|
||||
:column="currColumn"
|
||||
:disabled="disabled"
|
||||
:size="scope.size"
|
||||
:type="currFormType"
|
||||
:prop="control.prop"
|
||||
:scope="scope"
|
||||
@set-form-data="setFormData"
|
||||
></SblxSelect>
|
||||
</template>
|
||||
<template v-else-if="control.controlType == 'dicTableSelect'">
|
||||
<!-- 表格选择 -->
|
||||
<DicTableSelect
|
||||
@@ -127,7 +141,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({ name: 'AvueSlot' })
|
||||
import UserSelect from './UserSelect.vue'
|
||||
import DeptSelect from './DeptSelect.vue'
|
||||
import SblxSelect from './SblxSelect.vue'
|
||||
|
||||
defineOptions({ name: 'AvueSlot', components: { UserSelect, DeptSelect, SblxSelect } })
|
||||
|
||||
interface Control {
|
||||
controlType: string
|
||||
@@ -159,7 +177,7 @@ const currFormType = computed(() => {
|
||||
})
|
||||
|
||||
const currColumn = computed(() => {
|
||||
if (['userSelect', 'deptSelect', 'dicTableSelect'].includes(props.control.controlType)) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect', 'dicTableSelect'].includes(props.control.controlType)) {
|
||||
if (props.slotType == 'search' && props.control) {
|
||||
return Object.assign(props.scope.column, props.control.column || {})
|
||||
}
|
||||
|
||||
529
src/components/LowDesign/src/shareControl/SblxSelect.vue
Normal file
529
src/components/LowDesign/src/shareControl/SblxSelect.vue
Normal file
@@ -0,0 +1,529 @@
|
||||
<template>
|
||||
<div class="sblx-select-box w-100%">
|
||||
<div
|
||||
class="sblx-input"
|
||||
:class="[
|
||||
{ disabled, 'cursor-not-allowed!': disabled && !props.column?.multiple },
|
||||
type,
|
||||
size
|
||||
]"
|
||||
@click="openSblxSelect"
|
||||
>
|
||||
<template v-if="selectId.length">
|
||||
<div class="sblx-text-list" v-if="props.column?.multiple">
|
||||
<el-tag
|
||||
v-for="id in selectId"
|
||||
:key="id"
|
||||
:closable="!disabled && !column.readonly"
|
||||
type="info"
|
||||
:size="size"
|
||||
@close="tagValueClose(id)"
|
||||
>
|
||||
{{ getCurrText(id) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-else class="px-11px overflow-hidden text-ellipsis ws-nowrap">
|
||||
{{ getCurrText(selectId[0]) }}
|
||||
<span
|
||||
v-if="
|
||||
['add', 'edit'].includes(type) &&
|
||||
props.column?.clearable !== false &&
|
||||
!disabled &&
|
||||
!column.readonly
|
||||
"
|
||||
class="sblx-input-clear pos-absolute right-11px top-50% cursor-pointer hidden"
|
||||
style="transform: translateY(-50%)"
|
||||
@click.stop="tagValueClose(selectId[0])"
|
||||
>
|
||||
<Icon :size="14" color="#909399" icon="ep:circle-close"></Icon>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="empty-text" v-else>{{ placeholderText }}</div>
|
||||
<div class="sblx-num" v-if="column.multiple && selectId.length >= 2">
|
||||
{{ t('Avue.control.selectPrepend') }}
|
||||
<span>{{ selectId.length }}</span>
|
||||
{{ t('Avue.control.selectAppend') }}
|
||||
</div>
|
||||
</div>
|
||||
<DesignPopup
|
||||
v-if="['add', 'edit'].includes(type)"
|
||||
v-model="dialogData.value"
|
||||
v-model:isFull="dialogData.isFull"
|
||||
v-bind="dialogData.params"
|
||||
:isBodyFull="true"
|
||||
>
|
||||
<template #default>
|
||||
<el-container class="h-100%" v-loading="loading">
|
||||
<el-main class="box-border">
|
||||
<avue-tree
|
||||
ref="sblxRef"
|
||||
class="sblx-tree"
|
||||
:option="treeSblxOption"
|
||||
:data="treeSblxData"
|
||||
@check-change="checkChange"
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
<template #default="{ data }">
|
||||
<span
|
||||
class="el-tree-node__label"
|
||||
:class="{
|
||||
disabled: !column.multiple && data.disabled,
|
||||
active:
|
||||
!column.multiple && data[treeSblxOption.props.value] == sblxSelect[0]?.id
|
||||
}"
|
||||
>
|
||||
{{ data[treeSblxOption.props.label] }}
|
||||
</span>
|
||||
</template>
|
||||
</avue-tree>
|
||||
</el-main>
|
||||
<el-aside width="200px">
|
||||
<div
|
||||
class="h-100% flex-basis-200px flex-shrink-0"
|
||||
:style="{ borderLeft: 'var(--el-border)' }"
|
||||
>
|
||||
<div
|
||||
class="box-border h-31px pb-5px pt-5px text-center"
|
||||
:style="{ borderBottom: 'var(--el-border)' }"
|
||||
>
|
||||
<span>{{ t('Avue.control.selectPrepend') }}({{ sblxSelectId.length }})</span>
|
||||
<el-button
|
||||
class="mt--3px p-0"
|
||||
type="primary"
|
||||
link
|
||||
v-if="sblxSelectId.length"
|
||||
@click="deepClear"
|
||||
>
|
||||
{{ t('Avue.form.emptyBtn') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
class="box-border flex flex-wrap items-center overflow-x-hidden overflow-y-auto p-10px"
|
||||
:style="{
|
||||
height: 'calc(100% - 31px)',
|
||||
columnGap: '6px',
|
||||
rowGap: '6px',
|
||||
alignContent: 'start'
|
||||
}"
|
||||
>
|
||||
<el-tag
|
||||
v-for="id in sblxSelectId"
|
||||
:key="id"
|
||||
:closable="true"
|
||||
type="info"
|
||||
:size="size"
|
||||
class="h-auto! py-4px! ws-break-spaces! break-anywhere! line-height-none"
|
||||
@close="tagTableClose(id)"
|
||||
>
|
||||
{{ getCurrText(id) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</el-aside>
|
||||
</el-container>
|
||||
</template>
|
||||
</DesignPopup>
|
||||
<DesignPopup
|
||||
v-else
|
||||
v-model="detailDialog"
|
||||
:width="800"
|
||||
:title="`<span>${column.label}</span><span class='text-14px'>(${t('Avue.control.totalPrepend')} ${selectId.length} ${t('Avue.control.totalAppend')})</span>`"
|
||||
:dialogParams="{ alignCenter: true }"
|
||||
>
|
||||
<template #default>
|
||||
<div class="h-100% box-border flex p-20px">
|
||||
<div
|
||||
class="box-border flex flex-wrap items-center overflow-x-hidden overflow-y-auto"
|
||||
:style="{
|
||||
height: '100%',
|
||||
columnGap: '6px',
|
||||
rowGap: '6px',
|
||||
alignContent: 'start'
|
||||
}"
|
||||
>
|
||||
<el-tag
|
||||
v-for="id in selectId"
|
||||
:key="id"
|
||||
type="info"
|
||||
:size="size"
|
||||
class="h-auto! py-4px! ws-break-spaces! break-anywhere! line-height-none"
|
||||
>
|
||||
{{ lowStore.dicObj[dicKey]?.[id] || id }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DesignPopup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useLowStoreWithOut } from '@/store/modules/low'
|
||||
import { listToTree, forEach } from '@/utils/tree'
|
||||
import * as DicApi from '@/api/design/dic/index'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
defineOptions({ name: 'SblxSelect' })
|
||||
|
||||
interface Column {
|
||||
label: string
|
||||
disabledIds: Array<string> //禁止选择的id
|
||||
multiple?: boolean //多选
|
||||
checkStrictly?: boolean //父子不互相关联
|
||||
leafOnly?: boolean //勾选值只保留子节点
|
||||
stopParent?: boolean //禁用父级勾选
|
||||
accordion?: boolean //每次只展开一个同级树节点
|
||||
separator?: string //分隔符
|
||||
readonly?: boolean
|
||||
placeholder?: string
|
||||
textFormatter?: string //回显名称格式化
|
||||
clearable?: boolean
|
||||
}
|
||||
interface Props {
|
||||
column: Column
|
||||
prop: string
|
||||
type: string
|
||||
size?: 'small' | 'large' | 'default'
|
||||
disabled?: boolean
|
||||
scope?: object
|
||||
}
|
||||
interface TreeSblx {
|
||||
id: string
|
||||
parentId: string
|
||||
industryName: string
|
||||
disabled?: boolean
|
||||
children?: TreeSblx[]
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const model = defineModel<string>()
|
||||
const emit = defineEmits(['set-form-data'])
|
||||
const { t } = useI18n()
|
||||
const lowStore = useLowStoreWithOut()
|
||||
const dicKey = 'sblxSelect'
|
||||
|
||||
const loading = ref(false)
|
||||
const timer = ref<any>(null)
|
||||
const sblxSelect = ref<any>([])
|
||||
const sblxSelectId = ref<Array<number | string>>([])
|
||||
const treeSblxOption = ref({
|
||||
addBtn: false,
|
||||
menu: false,
|
||||
nodeKey: 'id',
|
||||
multiple: props.column.multiple,
|
||||
checkStrictly: props.column.checkStrictly,
|
||||
accordion: props.column.accordion,
|
||||
props: { label: 'industryName', value: 'id', childern: 'children' }
|
||||
})
|
||||
const treeSblxData = ref<TreeSblx[]>([])
|
||||
const dialogData = ref({
|
||||
value: false,
|
||||
isFull: false,
|
||||
params: {
|
||||
width: '600px',
|
||||
title: t('Avue.control.select') + ' ' + (props.column.label || '设备类型'),
|
||||
footerBtn: [
|
||||
{
|
||||
params: {},
|
||||
name: t('Avue.common.cancelBtn'),
|
||||
icon: 'material-symbols:close-rounded',
|
||||
clickFun: () => {
|
||||
dialogData.value.value = false
|
||||
}
|
||||
},
|
||||
{
|
||||
params: { type: 'primary' },
|
||||
name: t('Avue.common.submitBtn'),
|
||||
icon: 'material-symbols:check-rounded',
|
||||
clickFun: () => {
|
||||
model.value = getCurrSblxSelect('confirm').join(',')
|
||||
setTimeout(() => {
|
||||
dialogData.value.value = false
|
||||
}, 30)
|
||||
}
|
||||
}
|
||||
],
|
||||
dialogParams: {
|
||||
closeOnPressEscape: true
|
||||
}
|
||||
}
|
||||
})
|
||||
const detailDialog = ref(false)
|
||||
|
||||
const sblxRef = ref()
|
||||
|
||||
const selectId = computed(() => {
|
||||
if (!model.value) return []
|
||||
if (typeof model.value != 'string') {
|
||||
try {
|
||||
return [(model.value as Number).toString()]
|
||||
} catch (error) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
return model.value.split(',')
|
||||
})
|
||||
|
||||
const placeholderText = computed(() => {
|
||||
let text = ''
|
||||
if (!props.disabled && !props.column.readonly) {
|
||||
text =
|
||||
props.column.placeholder ||
|
||||
`${t('Avue.tip.select')} ${props.column.label || '设备类型'}`
|
||||
}
|
||||
return text
|
||||
})
|
||||
|
||||
const getCurrText = (id) => {
|
||||
if (id) id = `${id}`
|
||||
const text = lowStore.dicObj[dicKey]?.[id] || ''
|
||||
const formatter = props.column.textFormatter
|
||||
if (formatter) {
|
||||
return formatter.replace(/{dicCode}/g, id).replace(/{dicText}/g, text)
|
||||
}
|
||||
return text || id
|
||||
}
|
||||
|
||||
const deepClear = () => {
|
||||
if (props.column.multiple) sblxRef.value.setCheckedKeys([])
|
||||
else {
|
||||
sblxRef.value.setCurrentKey(null)
|
||||
sblxSelect.value = []
|
||||
}
|
||||
}
|
||||
const checkChange = () => {
|
||||
if (!props.column.multiple) return false
|
||||
if (timer.value) clearTimeout(timer.value)
|
||||
timer.value = setTimeout(() => {
|
||||
sblxSelect.value = sblxRef.value.getCheckedNodes(props.column.leafOnly || false)
|
||||
}, 30)
|
||||
}
|
||||
const nodeClick = (data) => {
|
||||
if (props.column.multiple || data.disabled) return false
|
||||
if (sblxSelect.value.length && sblxSelect.value[0].id == data.id) deepClear()
|
||||
else sblxSelect.value = [data]
|
||||
}
|
||||
const openSblxSelect = () => {
|
||||
const index = props.scope?.['index']
|
||||
if (props.column['onClick']) {
|
||||
props.column['onClick']({ value: model.value, column: props.column, index })
|
||||
} else if (props.column['click'])
|
||||
props.column['click']({ value: model.value, column: props.column, index })
|
||||
if (props.disabled || props.column.readonly) {
|
||||
if (selectId.value && selectId.value.length) detailDialog.value = true
|
||||
return
|
||||
}
|
||||
dialogData.value.value = true
|
||||
}
|
||||
|
||||
const tagValueClose = (id) => {
|
||||
let list = model.value ? model.value.split(',') : []
|
||||
list = list.filter((key) => key != id)
|
||||
model.value = list.join(',')
|
||||
}
|
||||
const tagTableClose = (id) => {
|
||||
if (props.column.multiple) {
|
||||
sblxRef.value.setChecked(id, false)
|
||||
} else deepClear()
|
||||
}
|
||||
const getCurrSblxSelect = (type?) => {
|
||||
const dicObj = {}
|
||||
const textList: string[] = []
|
||||
const ids = sblxSelect.value.map((item) => {
|
||||
if (item.id && item.industryName) {
|
||||
dicObj[item.id] = item.industryName
|
||||
textList.push(item.industryName)
|
||||
}
|
||||
return item.id
|
||||
})
|
||||
if (type == 'confirm') {
|
||||
emit('set-form-data', '$' + props.prop, textList.join(props.column.separator || ' | '))
|
||||
}
|
||||
lowStore.setDicObj(dicKey, dicObj)
|
||||
return ids
|
||||
}
|
||||
|
||||
const getSblxList = (getType) => {
|
||||
const { multiple, disabledIds } = props.column
|
||||
let currData: any = {}
|
||||
|
||||
return new Promise(async (resolve) => {
|
||||
let data = await DicApi.getSblxSelectList()
|
||||
data = data.map((item) => {
|
||||
if (disabledIds && disabledIds.includes(item.id)) item.disabled = true
|
||||
if (getType == 'init' && !multiple && selectId.value.includes(item.id)) currData = item
|
||||
return item
|
||||
})
|
||||
const treeProps = { id: 'id', pid: 'parentId', children: 'children' }
|
||||
let treeData = listToTree(data, treeProps)
|
||||
|
||||
if (props.column.stopParent) {
|
||||
forEach(
|
||||
treeData,
|
||||
(node) => {
|
||||
if (node[treeProps.children]?.length) node.disabled = true
|
||||
},
|
||||
treeProps.children
|
||||
)
|
||||
}
|
||||
treeSblxData.value = treeData
|
||||
setTimeout(() => {
|
||||
if (multiple) {
|
||||
sblxRef.value.setCheckedKeys(selectId.value)
|
||||
sblxSelect.value = sblxRef.value.getCheckedNodes(props.column.leafOnly || false)
|
||||
} else {
|
||||
if (currData.id) {
|
||||
sblxRef.value.setCurrentKey(currData.id)
|
||||
sblxSelect.value = [currData]
|
||||
}
|
||||
}
|
||||
}, 30)
|
||||
resolve(true)
|
||||
})
|
||||
}
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
(value) => {
|
||||
const selectObj = {}
|
||||
cloneDeep(sblxSelect.value).forEach((item) => {
|
||||
delete item.children
|
||||
selectObj[item[treeSblxOption.value.nodeKey]] = item
|
||||
})
|
||||
const changeObj = {
|
||||
value,
|
||||
column: props.column,
|
||||
selectObj,
|
||||
row: props.scope?.['row'],
|
||||
index: props.scope?.['index']
|
||||
}
|
||||
if (props.column['onChange']) props.column['onChange'](changeObj)
|
||||
else if (props.column['change']) props.column['change'](changeObj)
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => dialogData.value.value,
|
||||
(val) => {
|
||||
if (!val) {
|
||||
if (sblxRef.value) deepClear()
|
||||
return
|
||||
}
|
||||
getSblxList('init')
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => sblxSelect.value,
|
||||
(val) => {
|
||||
sblxSelectId.value = getCurrSblxSelect()
|
||||
dialogData.value.params.footerBtn[1].name = `${t('Avue.common.submitBtn')}(${val.length})`
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sblx-tree {
|
||||
.el-tree-node__label {
|
||||
&.active {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sblx-input {
|
||||
display: flex;
|
||||
height: var(--el-component-size);
|
||||
font-size: var(--el-text-base);
|
||||
color: var(--el-input-text-color, var(--el-text-color-regular));
|
||||
cursor: pointer;
|
||||
background-color: var(--el-bg-color);
|
||||
background-image: none;
|
||||
border: var(--el-border);
|
||||
border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
|
||||
.sblx-text-list {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
padding: 0 11px;
|
||||
overflow-x: hidden;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
column-gap: 6px;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
margin: 0 10px;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
text-align: left;
|
||||
flex: 1;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.sblx-num {
|
||||
height: 100%;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
line-height: var(--el-component-size);
|
||||
color: var(--el-text-color-regular);
|
||||
background-color: var(--el-fill-color-light);
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
padding: 0 2px;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
&.edit,
|
||||
&.add {
|
||||
background-color: var(--el-disabled-bg-color);
|
||||
}
|
||||
|
||||
&.view {
|
||||
border: none;
|
||||
|
||||
.sblx-text-list {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sblx-num {
|
||||
margin-right: -20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.small {
|
||||
height: var(--el-component-size-small);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
|
||||
.sblx-num {
|
||||
height: var(--el-component-size-small);
|
||||
}
|
||||
}
|
||||
|
||||
&.large {
|
||||
height: var(--el-component-size-large);
|
||||
font-size: var(--el-font-size-large);
|
||||
|
||||
.sblx-num {
|
||||
height: var(--el-component-size-large);
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.sblx-input-clear {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -411,6 +411,21 @@ const regionSelectConfig = [
|
||||
}
|
||||
]
|
||||
|
||||
const sblxSelectConfig = [
|
||||
{
|
||||
title: '控件配置',
|
||||
list: [
|
||||
{ label: '多选', value: 'multiple', val: false, type: 'switch', dic: dicObj.boolean },
|
||||
{ label: '回显名称格式化', value: 'textFormatter', val: '', type: 'select', dic: dicObj.dictTextFormatter, params: { filterable: true, allowCreate: true } },
|
||||
{ label: '父子不互相关联', value: 'checkStrictly', val: false, type: 'switch', dic: dicObj.boolean },
|
||||
{ label: '勾选值只保留子节点', value: 'leafOnly', val: false, type: 'switch', dic: dicObj.boolean },
|
||||
{ label: '禁用父级勾选', value: 'stopParent', val: false, type: 'switch', dic: dicObj.boolean },
|
||||
{ label: '每次只展开一个同级树节点', value: 'accordion', val: false, type: 'switch', dic: dicObj.boolean },
|
||||
{ label: '分隔符', value: 'separator', val: ' | ' },
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// const ueditorConfig=[]
|
||||
|
||||
const customControlConfig = [
|
||||
@@ -431,5 +446,5 @@ export default {
|
||||
selectConfig, radioConfig, checkboxConfig, switchConfig, treeConfig, cascaderConfig,
|
||||
dateConfig, timeConfig,
|
||||
fileConfig, imageConfig,
|
||||
monacoEditorConfig, markDownConfig, dicTableSelectConfig, userSelectConfig, deptSelectConfig, regionSelectConfig, customControlConfig
|
||||
}
|
||||
monacoEditorConfig, markDownConfig, dicTableSelectConfig, userSelectConfig, deptSelectConfig, sblxSelectConfig, regionSelectConfig, customControlConfig
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ const initColumn = (column: object, control, ruleObj, componentData: Object, oth
|
||||
verifyControl.isControl = false
|
||||
}
|
||||
}
|
||||
if (['userSelect', 'deptSelect', 'dicTableSelect'].includes(type) && parentProp.indexOf('layoutTable') === 0) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect', 'dicTableSelect'].includes(type) && parentProp.indexOf('layoutTable') === 0) {
|
||||
//表格布局详情模式
|
||||
if (type == 'dicTableSelect') {
|
||||
//表格选择回显
|
||||
@@ -279,7 +279,7 @@ const initColumn = (column: object, control, ruleObj, componentData: Object, oth
|
||||
}
|
||||
}
|
||||
}
|
||||
if (['userSelect', 'deptSelect', 'markDown', 'comboBox'].includes(type)) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect', 'markDown', 'comboBox'].includes(type)) {
|
||||
verifyControl.isForm = true
|
||||
}
|
||||
if (type == 'regionSelect') {
|
||||
@@ -546,11 +546,11 @@ export const initFormOption: (formOption: any, formType: string, onlyId: string
|
||||
}
|
||||
//表单数据格式化
|
||||
export const formDataFormatting = (formOption, formData, formType) => {
|
||||
const echoObj = { userSelect: [], deptSelect: [] }
|
||||
const echoObj = { userSelect: [], deptSelect: [], sblxSelect: [] }
|
||||
const handleValue = (column, data, key, parentType) => {
|
||||
const type = column[key]?.type
|
||||
if (data[key] === '' || data[key] === null || data[key] === undefined || !type) return
|
||||
if (['userSelect', 'deptSelect', 'dicTableSelect'].includes(type)) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect', 'dicTableSelect'].includes(type)) {
|
||||
if (data[key] instanceof Array || typeof data[key] == 'number') data[key] = data[key].toString()
|
||||
if (type == 'dicTableSelect') {
|
||||
const { dictTable, dictCode, dictText } = column[key]
|
||||
@@ -613,9 +613,10 @@ export const formDataFormatting = (formOption, formData, formType) => {
|
||||
if (key.indexOf('&') !== -1 && key.split('&')[1] != 'id') return true
|
||||
return /^(\d+)$/.test(str + '');
|
||||
})
|
||||
if (['userSelect', 'deptSelect'].includes(key)) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect'].includes(key)) {
|
||||
if (echoObj[key].length) {
|
||||
dicApiData.push({ [key == 'userSelect' ? 'userIdList' : 'deptIdList']: [...new Set(echoObj[key])] })
|
||||
const keyMap = { userSelect: 'userIdList', deptSelect: 'deptIdList', sblxSelect: 'sblxIdList' }
|
||||
dicApiData.push({ [keyMap[key]]: [...new Set(echoObj[key])] })
|
||||
}
|
||||
} else if (echoObj[key]?.length) {
|
||||
const [dbformId, code, label] = key.split('&')
|
||||
@@ -624,11 +625,12 @@ export const formDataFormatting = (formOption, formData, formType) => {
|
||||
}
|
||||
if (dicApiData.length) {
|
||||
DicApi.getDicTableText({
|
||||
lideeYunji_dictLabel: encryptAES(JSON.stringify(dicApiData))
|
||||
lideeYunJi_dictLabel: encryptAES(JSON.stringify(dicApiData))
|
||||
}).then(dicData => {
|
||||
const dictData = {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname' },
|
||||
deptList: { dicKey: 'deptSelect', label: 'name' }
|
||||
deptList: { dicKey: 'deptSelect', label: 'name' },
|
||||
sblxList: { dicKey: 'sblxSelect', label: 'industryName' }
|
||||
}
|
||||
for (const key in dicData) {
|
||||
const dicObj = {}
|
||||
|
||||
@@ -3,9 +3,9 @@ import { encryptAES } from '@/components/LowDesign/src/utils/aes'
|
||||
import { getDicTableText } from '@/api/design/dic'
|
||||
|
||||
|
||||
//设置用户、部门控件数据名称
|
||||
//设置用户、部门、设备类型控件数据名称
|
||||
export const setUserAndDeptName = (params) => {
|
||||
let { userIdList, deptIdList } = params
|
||||
let { userIdList, deptIdList, sblxIdList } = params
|
||||
return new Promise(resolve => {
|
||||
const lowStore = useLowStoreWithOut()
|
||||
const dictLabel: object[] = []
|
||||
@@ -19,12 +19,18 @@ export const setUserAndDeptName = (params) => {
|
||||
deptIdList = [...new Set(deptIdList)]
|
||||
dictLabel.push({ deptIdList })
|
||||
}
|
||||
sblxIdList = (sblxIdList || []).filter(id => !lowStore.dicObj?.sblxSelect?.[id])
|
||||
if (sblxIdList?.length) {
|
||||
sblxIdList = [...new Set(sblxIdList)]
|
||||
dictLabel.push({ sblxIdList })
|
||||
}
|
||||
if (dictLabel.length) {
|
||||
const dictKeyData = {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname' },
|
||||
deptList: { dicKey: 'deptSelect', label: 'name' }
|
||||
deptList: { dicKey: 'deptSelect', label: 'name' },
|
||||
sblxList: { dicKey: 'sblxSelect', label: 'industryName' }
|
||||
}
|
||||
getDicTableText({ lideeYunji_dictLabel: encryptAES(JSON.stringify(dictLabel)) }).then(
|
||||
getDicTableText({ lideeYunJi_dictLabel: encryptAES(JSON.stringify(dictLabel)) }).then(
|
||||
(dicData) => {
|
||||
for (const key in dicData) {
|
||||
const dicObj = {}
|
||||
|
||||
@@ -289,7 +289,7 @@ const initColumn = (data, componentData, columnParams) => {
|
||||
column[fieldCode].type = 'input'
|
||||
}
|
||||
}
|
||||
if (['userSelect', 'deptSelect'].includes(controlType)) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect'].includes(controlType)) {
|
||||
let configData: any = {
|
||||
findType: 'all',
|
||||
formatter: (row, value, valueText, column) => {
|
||||
@@ -392,6 +392,9 @@ const initColumn = (data, componentData, columnParams) => {
|
||||
if (controlType == 'deptSelect' && optionData['deptCustomStr']) {
|
||||
optionData['deptCustomStr'] = decodeURIComponent(escape(atob(optionData['deptCustomStr'])))
|
||||
}
|
||||
if (controlType == 'sblxSelect' && optionData['sblxCustomStr']) {
|
||||
optionData['sblxCustomStr'] = decodeURIComponent(escape(atob(optionData['sblxCustomStr'])))
|
||||
}
|
||||
setDeepObject(controlsData, optionData)
|
||||
Object.keys(customData).forEach(key => {
|
||||
if (customData[key] && controlsData[key] && customData[key] instanceof Object) {
|
||||
@@ -532,7 +535,7 @@ const initColumn = (data, componentData, columnParams) => {
|
||||
if (isList) controlData.slotList.push('list')
|
||||
if (isSearch && !column[fieldCode].searchType) {
|
||||
controlData.slotList.push('search')
|
||||
if (['userSelect', 'deptSelect', 'dicTableSelect'].includes(controlType) && column[fieldCode].searchMultiple) {
|
||||
if (['userSelect', 'deptSelect', 'sblxSelect', 'dicTableSelect'].includes(controlType) && column[fieldCode].searchMultiple) {
|
||||
searchOption['column'].multiple = true
|
||||
}
|
||||
if (searchOption) controlData = { ...controlData, ...searchOption }
|
||||
@@ -552,7 +555,7 @@ const initButton = (data, context) => {
|
||||
const { wsCache } = useCache()
|
||||
const currentRoute = router.currentRoute.value
|
||||
const currPath = currentRoute.meta?.menuDataId as string
|
||||
const permissions = wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[currPath] || false
|
||||
const permissions = wsCache.get(CACHE_KEY.USER).lideeYunJipermissions?.[currPath] || false
|
||||
const { model, defaultTip, tableId, getPermiKey, webConfigRoleButtonVoList, isSub } = context
|
||||
const defPermiObj = {
|
||||
addBtn: 'create', addChild: 'create',
|
||||
@@ -833,7 +836,7 @@ export const tableFormatting = (data, column, otherData: any = {}) => {
|
||||
let currData = isArray ? cloneDeep(data) : cloneDeep([data])
|
||||
const dateControl = {}
|
||||
const regionControl = {}
|
||||
const userAndDeptControl: any = { props: [], userIds: [], deptIds: [], typeKey: { userSelect: 'user', deptSelect: 'dept' } }
|
||||
const userAndDeptControl: any = { props: [], userIds: [], deptIds: [], sblxIds: [], typeKey: { userSelect: 'user', deptSelect: 'dept', sblxSelect: 'sblx' } }
|
||||
const dicTableData = { propObj: {}, keyList: [] as Array<string>, dicStoreKey: {} }
|
||||
for (const prop in column) {
|
||||
const { type, hide, lazy, dictType, valueFormat } = column[prop]
|
||||
@@ -886,7 +889,7 @@ export const tableFormatting = (data, column, otherData: any = {}) => {
|
||||
})
|
||||
|
||||
//查询回显文本
|
||||
const dicApiData: any = { lideeYunji_dictLabel: [] }
|
||||
const dicApiData: any = { lideeYunJi_dictLabel: [] }
|
||||
if (dicTableData.keyList.length) {
|
||||
const dicTableApiData: Array<string> = []
|
||||
dicTableData.keyList.forEach(key => {
|
||||
@@ -899,20 +902,21 @@ export const tableFormatting = (data, column, otherData: any = {}) => {
|
||||
dicTableData[key].dataList = [...new Set(dicTableData[key].dataList)].filter((id: string) => !lowStore.dicObj[key] ? true : !lowStore.dicObj[key][id])
|
||||
if (dicTableData[key].dataList.length) dicTableApiData.push(dicTableData[key])
|
||||
})
|
||||
dicApiData.lideeYunji_dictLabel.push(...dicTableApiData)
|
||||
dicApiData.lideeYunJi_dictLabel.push(...dicTableApiData)
|
||||
}
|
||||
for (const key in userAndDeptControl.typeKey) {
|
||||
const abbr = userAndDeptControl.typeKey[key]
|
||||
userAndDeptControl[`${abbr}Ids`] = userAndDeptControl[`${abbr}Ids`].filter(id => {
|
||||
return /^(\d+)$/.test(id + '')
|
||||
})
|
||||
if (userAndDeptControl[`${abbr}Ids`].length) dicApiData.lideeYunji_dictLabel.push({ [`${abbr}IdList`]: [...new Set(userAndDeptControl[`${abbr}Ids`])] })
|
||||
if (userAndDeptControl[`${abbr}Ids`].length) dicApiData.lideeYunJi_dictLabel.push({ [`${abbr}IdList`]: [...new Set(userAndDeptControl[`${abbr}Ids`])] })
|
||||
}
|
||||
if (dicApiData.lideeYunji_dictLabel.length) {
|
||||
dicApiData.lideeYunji_dictLabel = encryptAES(JSON.stringify(dicApiData.lideeYunji_dictLabel))
|
||||
if (dicApiData.lideeYunJi_dictLabel.length) {
|
||||
dicApiData.lideeYunJi_dictLabel = encryptAES(JSON.stringify(dicApiData.lideeYunJi_dictLabel))
|
||||
const dictData = {
|
||||
userList: { dicKey: 'userSelect', label: 'nickname', value: 'id' },
|
||||
deptList: { dicKey: 'deptSelect', label: 'name', value: 'id' }
|
||||
deptList: { dicKey: 'deptSelect', label: 'name', value: 'id' },
|
||||
sblxList: { dicKey: 'sblxSelect', label: 'industryName', value: 'id' }
|
||||
}
|
||||
DicApi.getDicTableText(dicApiData).then(dicData => {
|
||||
for (const key in dicData) {
|
||||
@@ -1016,7 +1020,7 @@ export const getMultipleProp = (column) => {
|
||||
const props: Array<string> = []
|
||||
for (const prop in column) {
|
||||
const { type, multiple } = column[prop]
|
||||
if (['select', 'dicTableSelect', 'userSelect', 'deptSelect'].includes(type) && multiple) props.push(prop)
|
||||
if (['select', 'dicTableSelect', 'userSelect', 'deptSelect', 'sblxSelect'].includes(type) && multiple) props.push(prop)
|
||||
}
|
||||
return { more_select_field: props.join(',') }
|
||||
}
|
||||
|
||||
@@ -101,6 +101,9 @@ export default [
|
||||
type: 'deptSelect', controlType: 'select', label: '部门选择框', icon: 'mingcute:department-line',
|
||||
findType: 'all',
|
||||
},
|
||||
{
|
||||
type: 'sblxSelect', controlType: 'select', label: '设备类型选择框', icon: 'ep:setting',
|
||||
},
|
||||
{
|
||||
type: 'regionSelect', controlType: 'select', label: '地区选择框', icon: 'hugeicons:global-editing',
|
||||
regionType: 'ssq',
|
||||
@@ -194,4 +197,4 @@ export default [
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -155,6 +155,7 @@ const getComponentName = (type, controlType, component) => {
|
||||
'dicTableSelect',
|
||||
'userSelect',
|
||||
'deptSelect',
|
||||
'sblxSelect',
|
||||
'markDown'
|
||||
].includes(type)
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ export default defineComponent({
|
||||
name: 'Layout',
|
||||
setup() {
|
||||
return () => (
|
||||
<section class={[prefixCls, `${prefixCls}__${layout.value}`, 'w-[100%] h-[100%] relative']}>
|
||||
<section class={[prefixCls, `${prefixCls}__${layout.value}`, 'w-[100%] h-[100%] relative']} >
|
||||
{mobile.value && !collapse.value ? (
|
||||
<div
|
||||
class="absolute left-0 top-0 z-99 h-full w-full bg-[var(--el-color-black)] opacity-30"
|
||||
|
||||
@@ -42,6 +42,7 @@ const formatComponentInstance = (component, route) => {
|
||||
|
||||
<template>
|
||||
<section
|
||||
style="padding-bottom:0"
|
||||
:class="[
|
||||
'flex-1 p-[var(--app-content-padding)] w-[calc(100%-var(--app-content-padding)-var(--app-content-padding))] bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]'
|
||||
]"
|
||||
|
||||
@@ -26,7 +26,7 @@ export const setupAvue = async (app: App<Element>) => {
|
||||
searchSpan: 6,
|
||||
searchMenuSpan: 6,
|
||||
searchMenuPosition: 'left',
|
||||
searchIndex: 3,
|
||||
searchIndex: 4,
|
||||
searchIcon: true,
|
||||
searchShowBtn: true,
|
||||
labelSuffix: ' ',
|
||||
|
||||
@@ -33,7 +33,7 @@ interface DeptVO {
|
||||
|
||||
interface UserInfoVO {
|
||||
permissions: object
|
||||
lideeYunjipermissions: object
|
||||
lideeYunJipermissions: object
|
||||
roles: string[]
|
||||
isSetUser: boolean
|
||||
user: UserVO
|
||||
@@ -43,7 +43,7 @@ interface UserInfoVO {
|
||||
export const useUserStore = defineStore('admin-user', {
|
||||
state: (): UserInfoVO => ({
|
||||
permissions: {},
|
||||
lideeYunjipermissions: {},
|
||||
lideeYunJipermissions: {},
|
||||
roles: [],
|
||||
isSetUser: false,
|
||||
user: {
|
||||
@@ -58,8 +58,8 @@ export const useUserStore = defineStore('admin-user', {
|
||||
getPermissions(): object {
|
||||
return this.permissions
|
||||
},
|
||||
getLideeYunjipermissions(): object {
|
||||
return this.lideeYunjipermissions
|
||||
getLideeYunJipermissions(): object {
|
||||
return this.lideeYunJipermissions
|
||||
},
|
||||
getRoles(): string[] {
|
||||
return this.roles
|
||||
@@ -82,7 +82,7 @@ export const useUserStore = defineStore('admin-user', {
|
||||
userInfo = await getInfo()
|
||||
}
|
||||
this.permissions = userInfo.permissions
|
||||
this.lideeYunjipermissions = userInfo.lideeYunjipermissions
|
||||
this.lideeYunJipermissions = userInfo.lideeYunJipermissions
|
||||
this.roles = userInfo.roles
|
||||
this.user = userInfo.user
|
||||
this.deptInfo = userInfo.deptInfoList
|
||||
@@ -112,7 +112,7 @@ export const useUserStore = defineStore('admin-user', {
|
||||
},
|
||||
resetState() {
|
||||
this.permissions = {}
|
||||
this.lideeYunjipermissions = {}
|
||||
this.lideeYunJipermissions = {}
|
||||
this.roles = []
|
||||
this.isSetUser = false
|
||||
this.user = {
|
||||
|
||||
@@ -149,6 +149,7 @@
|
||||
.control-cascader,
|
||||
.control-switch,
|
||||
.control-regionSelect,
|
||||
.control-sblxSelect,
|
||||
.control-dicTableSelect,
|
||||
.control-map,
|
||||
.control-color,
|
||||
|
||||
@@ -50,9 +50,11 @@
|
||||
|
||||
--app-content-bg-color: #f5f7f9;
|
||||
|
||||
--app-footer-height: 50px;
|
||||
--app-footer-height: 30px;
|
||||
|
||||
--transition-time-02: 0.2s;
|
||||
|
||||
--el-fill-color-lighter: #F5F5F6;
|
||||
}
|
||||
|
||||
.dark {
|
||||
|
||||
@@ -164,14 +164,14 @@ const infoColumn = {
|
||||
dictCode: { title: '字典Code', width: 180, editRender: { name: 'LowSelect', verifyEdit: true, filterable: true, noStop: true, dicData: [] } },
|
||||
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isHideCol: { title: '隐藏列', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isHideSearch: { title: '隐藏搜索', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
// isHideSearch: { title: '隐藏搜索', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isAmount: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
|
||||
isDimension: { title: '是否维度', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
|
||||
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
|
||||
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
|
||||
//isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
|
||||
//hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
:row-class-name="rowClassName"
|
||||
@checkbox-all="(obj) => emit('selection-change', obj)"
|
||||
@checkbox-change="(obj) => emit('selection-change', obj)"
|
||||
@cell-click="(obj) => emit('cell-click', obj)"
|
||||
@cell-click="cellClick"
|
||||
>
|
||||
<vxe-column v-if="tabItem.edit" type="checkbox" width="50" align="center"></vxe-column>
|
||||
<vxe-column type="seq" width="50" align="center"></vxe-column>
|
||||
@@ -106,7 +106,16 @@ const testClick = (row) => {
|
||||
console.log('测试按钮被点击:', row)
|
||||
alert('测试按钮工作正常!')
|
||||
}
|
||||
|
||||
const cellClick = (obj) => {
|
||||
const scrollLeft = vxeTableRef.value.getScroll().scrollLeft
|
||||
const scrollTop = vxeTableRef.value.getScroll().scrollTop
|
||||
emit('cell-click', obj)
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
vxeTableRef.value.scrollTo(scrollLeft,scrollTop)
|
||||
}, 1)
|
||||
})
|
||||
}
|
||||
defineExpose({ vxeTableRef })
|
||||
</script>
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ export const dicObj = {
|
||||
{ label: '表格选择框', value: 'dicTableSelect' },
|
||||
{ label: '用户选择框', value: 'userSelect' },
|
||||
{ label: '部门选择框', value: 'deptSelect' },
|
||||
{ label: '设备类型选择框', value: 'sblxSelect' },
|
||||
{ label: '地区选择框', value: 'regionSelect' },
|
||||
{ label: '代码编辑器', value: 'monacoEditor' },
|
||||
{ label: '富文本', value: 'ueditor' },
|
||||
|
||||
205
src/views/system/sblx/index.vue
Normal file
205
src/views/system/sblx/index.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
v-model="tableForm"
|
||||
v-model:search="tableSearch"
|
||||
:table-loading="loading"
|
||||
:data="tableData"
|
||||
:option="tableOption"
|
||||
:permission="permission"
|
||||
:before-open="beforeOpen"
|
||||
@search-change="searchChange"
|
||||
@search-reset="resetChange"
|
||||
@row-save="rowSave"
|
||||
@row-update="rowUpdate"
|
||||
@row-del="rowDel"
|
||||
@refresh-change="getTableData"
|
||||
>
|
||||
<!-- 表单 -->
|
||||
<template #parentId-form>
|
||||
<el-tree-select
|
||||
v-model="tableForm.parentId"
|
||||
:data="sblxTree"
|
||||
:props="{ children: 'children', label: 'industryName', value: 'id' }"
|
||||
check-strictly
|
||||
default-expand-all
|
||||
placeholder="请选择上级设备类型"
|
||||
value-key="id"
|
||||
style="width: 366px"
|
||||
/>
|
||||
</template>
|
||||
<!-- 自定义按钮 -->
|
||||
<template #menu-left="{ size }">
|
||||
<el-button
|
||||
plain
|
||||
:size="size"
|
||||
@click="defaultExpandAllShow = !defaultExpandAllShow"
|
||||
type="danger"
|
||||
icon="el-icon-sort"
|
||||
>展开/折叠</el-button
|
||||
>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as SblxApi from '@/api/system/sblx'
|
||||
|
||||
defineOptions({ name: 'SystemSblx' })
|
||||
|
||||
const crudRef = ref()
|
||||
useCrudHeight(crudRef)
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const { getCurrPermi } = useCrudPermi()
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const defaultExpandAllShow = ref(true) // 默认展开所有表项
|
||||
const tableOption = reactive({
|
||||
align: 'center',
|
||||
headerAlign: 'center',
|
||||
searchMenuSpan: 6,
|
||||
searchMenuPosition: 'left',
|
||||
labelSuffix: ' ',
|
||||
span: 24,
|
||||
rowKey: 'id',
|
||||
rowParentKey: 'parentId',
|
||||
defaultExpandAll: defaultExpandAllShow,
|
||||
dialogWidth: '50%',
|
||||
column: {
|
||||
parentId: {
|
||||
label: '上级设备类型',
|
||||
hide: true,
|
||||
minWidth: 100,
|
||||
rules: [{ required: true, message: '上级设备类型不能为空', trigger: 'blur' }]
|
||||
},
|
||||
industryName: {
|
||||
label: '设备类型名称',
|
||||
align: 'left',
|
||||
headerAlign: 'left',
|
||||
search: true,
|
||||
minWidth: 100,
|
||||
rules: [{ required: true, message: '设备类型名称不能为空', trigger: 'blur' }]
|
||||
},
|
||||
industryCode: {
|
||||
label: '设备类型编码',
|
||||
minWidth: 100,
|
||||
rules: [{ required: true, message: '设备类型编码不能为空', trigger: 'blur' }]
|
||||
},
|
||||
sort: {
|
||||
label: '显示顺序',
|
||||
width: 80,
|
||||
span: 12,
|
||||
type: 'number',
|
||||
rules: [{ required: true, message: '显示顺序不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
}) //表格配置
|
||||
const tableForm = ref<any>({})
|
||||
const tableData = ref()
|
||||
const tableSearch = ref({})
|
||||
const sblxTree = ref() // 上级设备类型
|
||||
const permission = getCurrPermi(['system:sblx'])
|
||||
|
||||
/** 查询列表 */
|
||||
const getTableData = async () => {
|
||||
loading.value = true
|
||||
let searchObj = {
|
||||
...tableSearch.value
|
||||
}
|
||||
for (let key in searchObj) if (searchObj[key] === '') delete searchObj[key]
|
||||
try {
|
||||
const data = await SblxApi.getSblxPage(searchObj)
|
||||
|
||||
tableData.value = handleTree(data)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const searchChange = (params, done) => {
|
||||
getTableData().finally(() => {
|
||||
done()
|
||||
})
|
||||
}
|
||||
|
||||
/** 清空按钮操作 */
|
||||
const resetChange = () => {
|
||||
searchChange({}, () => {})
|
||||
}
|
||||
|
||||
/** 表单打开前 */
|
||||
const beforeOpen = async (done, type) => {
|
||||
await getTree()
|
||||
const id = tableForm.value.id
|
||||
if (['edit', 'view'].includes(type) && id) {
|
||||
tableForm.value = await SblxApi.getSblx(id)
|
||||
}
|
||||
done()
|
||||
}
|
||||
|
||||
/** 新增操作 */
|
||||
const rowSave = async (form, done, loading) => {
|
||||
let bool = await SblxApi.createSblx(form).catch(() => false)
|
||||
if (bool) {
|
||||
message.success(t('common.createSuccess'))
|
||||
resetChange()
|
||||
done()
|
||||
} else loading()
|
||||
}
|
||||
|
||||
/** 编辑操作 */
|
||||
const rowUpdate = async (form, index, done, loading) => {
|
||||
let bool = await SblxApi.updateSblx(form).catch(() => false)
|
||||
if (bool) {
|
||||
message.success(t('common.updateSuccess'))
|
||||
getTableData()
|
||||
done()
|
||||
} else loading()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const rowDel = async (form, index) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await SblxApi.deleteSblx(form.id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getTableData()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 获得设备类型树 */
|
||||
const getTree = async () => {
|
||||
sblxTree.value = []
|
||||
const data = await SblxApi.getSimpleSblxList()
|
||||
let sblx: SblxTree = { id: 0, industryName: '顶级设备类型', children: [] }
|
||||
sblx.children = handleTree(data, 'id', 'parentId')
|
||||
sblxTree.value.push(sblx)
|
||||
}
|
||||
|
||||
watch(
|
||||
() => defaultExpandAllShow.value,
|
||||
() => {
|
||||
crudRef.value?.refreshTable()
|
||||
}
|
||||
)
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await getTableData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-form-item__label) {
|
||||
width: 100px !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
6
types/global.d.ts
vendored
6
types/global.d.ts
vendored
@@ -50,4 +50,10 @@ declare global {
|
||||
name: string
|
||||
children?: Tree[] | any[]
|
||||
}
|
||||
|
||||
interface SblxTree {
|
||||
id: number
|
||||
industryName: string
|
||||
children?: Tree[] | any[]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user