3 changed files with 284 additions and 0 deletions
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,150 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-11-14 13:08:53 |
|||
@ 备注: 日期选择器 |
|||
--> |
|||
<script lang='ts' setup> |
|||
import dayJs from 'dayjs' |
|||
|
|||
const props = withDefaults( |
|||
defineProps<{ |
|||
modelValue?: string |
|||
disabled?: boolean |
|||
data?:any |
|||
types?:number |
|||
}>(), |
|||
{} |
|||
) |
|||
const emits = defineEmits<{ |
|||
(e: 'update:modelValue', value: string): void |
|||
}>() |
|||
const value = computed({ |
|||
get: () => { |
|||
return props.modelValue |
|||
}, |
|||
set: (newVal: any) => { |
|||
emits('update:modelValue', newVal) |
|||
}, |
|||
}); |
|||
//阻止唤起键盘 |
|||
const handleClick = (event) => { |
|||
// 阻止输入框默认行为 |
|||
event.target.readOnly = true; |
|||
}; |
|||
//打印数据 |
|||
const valPrint = (val:number,group:string,type:string) => { |
|||
alert(val) |
|||
console.log(val) |
|||
switch(group){ |
|||
case "year": |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(val).format('YYYY'); |
|||
}else{ |
|||
return dayJs(val).format(type); |
|||
} |
|||
break; |
|||
case "month": |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(val).format('MM'); |
|||
}else{ |
|||
return dayJs(val).format(type); |
|||
} |
|||
break; |
|||
case "datetime": |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(val).format('YYYY-MM-DD HH:mm:ss'); |
|||
}else{ |
|||
return dayJs(val).format(type); |
|||
} |
|||
break; |
|||
case "week": |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(val).format('YYYY年第ww周'); |
|||
}else{ |
|||
return dayJs(val).format(type); |
|||
} |
|||
break; |
|||
case "datetimerange": |
|||
if(Array.isArray(val)){ |
|||
let startTime = val[0] |
|||
let endNum = val.length-1 |
|||
if(endNum<0){ |
|||
endNum = 0 |
|||
} |
|||
let endEnd = val[endNum] |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(startTime).format('YYYY-MM-DD HH:mm:ss') + " - " + dayJs(endEnd).format('YYYY-MM-DD HH:mm:ss'); |
|||
}else{ |
|||
return dayJs(startTime).format(type) + " - " + dayJs(endEnd).format(type); |
|||
} |
|||
} |
|||
break; |
|||
case "daterange": |
|||
if(Array.isArray(val)){ |
|||
let startTime = val[0] |
|||
let endNum = val.length-1 |
|||
if(endNum<0){ |
|||
endNum = 0 |
|||
} |
|||
let endEnd = val[endNum] |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(startTime).format('YYYY-MM-DD') + " - " + dayJs(endEnd).format('YYYY-MM-DD'); |
|||
}else{ |
|||
return dayJs(startTime).format(type) + " - " + dayJs(endEnd).format(type); |
|||
} |
|||
} |
|||
break; |
|||
case "monthrange": |
|||
if(Array.isArray(val)){ |
|||
let startTime = val[0] |
|||
let endNum = val.length-1 |
|||
if(endNum<0){ |
|||
endNum = 0 |
|||
} |
|||
let endEnd = val[endNum] |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(startTime).format('YYYY-MM') + " - " + dayJs(endEnd).format('YYYY-MM'); |
|||
}else{ |
|||
return dayJs(startTime).format(type) + " - " + dayJs(endEnd).format(type); |
|||
} |
|||
} |
|||
break; |
|||
default: |
|||
if(type != "" && type == "x"){ |
|||
return dayJs(val).format('YYYY-MM-DD'); |
|||
}else{ |
|||
return dayJs(val).format(type); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
</script> |
|||
<template> |
|||
<el-date-picker |
|||
v-if="props.types!=3" |
|||
align="left" |
|||
v-model="value" |
|||
:type="props.data.control.type" |
|||
range-separator="-" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
:teleported="true" |
|||
:placeholder="props.data.control.placeholder" |
|||
:value-format="props.data.valueFormat" |
|||
:format="props.data.control.format" |
|||
@click="handleClick" |
|||
@focus="handleClick" |
|||
/> |
|||
<el-text v-else class="wordColor">{{valPrint(value,props.data.control.type,props.data.control.valueFormat)}}</el-text> |
|||
|
|||
</template> |
|||
<style lang='scss' scoped> |
|||
.wordColor{ |
|||
color:#000000; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
</style> |
|||
@ -0,0 +1,133 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-06-10 15:34:04 |
|||
@ 备注: 单行文本及密码 |
|||
--> |
|||
<script lang='ts' setup> |
|||
import { AnalysisCss,AnalysisInputCss } from '@/api/common/cssInfo' |
|||
import { |
|||
constFormProps |
|||
} from '@/api/lowCode/utils'; |
|||
const props = withDefaults( |
|||
defineProps<{ |
|||
data: FormList |
|||
tablekey: any |
|||
numrun?: number |
|||
modelValue?: any // 子表和弹性布局时时有传 |
|||
tProp?: string // 子表时的form-item的prop值,用于子表校验用 |
|||
types?:number |
|||
control:any |
|||
}>(), |
|||
{} |
|||
) |
|||
const emits = defineEmits(['update:modelValue','pageIdAry']) |
|||
const formProps = inject(constFormProps, {}) as any |
|||
const config = computed(() => { |
|||
return props.data.config || {} |
|||
}) |
|||
const type = computed(() => { |
|||
return formProps.value.type |
|||
}) |
|||
const value = computed({ |
|||
get: () => { |
|||
return props.modelValue |
|||
}, |
|||
set: (newVal: any) => { |
|||
emits('update:modelValue', newVal) |
|||
}, |
|||
}); |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-06-10 14:25:01 |
|||
@ 功能: 获取组件名称 |
|||
*/ |
|||
const getLabel = (val:any) => { |
|||
if(val.label){ |
|||
return val.label; |
|||
}else{ |
|||
return ""; |
|||
} |
|||
|
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-11-13 14:36:08 |
|||
@ 功能: 解析css |
|||
*/ |
|||
const getFormItemLableStyle = (ele: any) => { |
|||
if(ele?.labelStyle){ |
|||
// console.log("返回栅格宽度3",AnalysisCss(ele)) |
|||
return AnalysisCss(ele?.labelStyle) |
|||
} |
|||
} |
|||
const getFormItemInputStyle = (ele: any,sty:number) => { |
|||
if(ele?.inputStyle){ |
|||
// console.log("返回栅格宽度4",AnalysisInputCss(ele?.inputStyle,sty)) |
|||
return AnalysisInputCss(ele?.inputStyle,sty) |
|||
} |
|||
} |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-07-27 15:11:42 |
|||
@ 功能: 判断是否禁用 |
|||
*/ |
|||
const judgeIsDisabled = (key:string) => { |
|||
return false |
|||
if (type.value === 3) { |
|||
return true // 查看模式,为不可编辑状态 |
|||
} |
|||
if (type.value === 1 && config.value.addDisabled) { |
|||
return true |
|||
} |
|||
if (type.value === 2 && config.value.editDisabled) { |
|||
return true // 编辑模式 |
|||
} |
|||
if(props.nodeKey != undefined && props.purview != undefined && props.purview != null && props.purview != null && props.purview != "" && props.purview != "") { |
|||
if(props.purview.length < 1){ |
|||
return false; |
|||
}else{ |
|||
let isShow = true; |
|||
props.purview.forEach((item)=>{ |
|||
if(item.nodeKey == props.nodeKey){ |
|||
|
|||
if(item.powerAry && item.powerAry.length > 0){ |
|||
item.powerAry.forEach((itm)=>{ |
|||
if(itm.id == key){ |
|||
console.log("判断此组件是否禁用",itm,itm.id == key,"--------->",itm.isLook) |
|||
isShow = !itm.isEdit |
|||
|
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
}) |
|||
return isShow |
|||
} |
|||
}else{ |
|||
return false; |
|||
} |
|||
} |
|||
/****input slot处理***/ |
|||
const getInputSlot = (key?: string) => { |
|||
const slot = key === 'p' ? config.value.prepend : config.value.append |
|||
const has = slot.indexOf('key:') === 0 |
|||
if (!has) { |
|||
return false |
|||
} |
|||
const slotKey = slot.replace('key:', '') |
|||
const control = getControlByName(slotKey) |
|||
if (!control || Object.keys(control)?.length === 0) { |
|||
return false |
|||
} |
|||
return control |
|||
} |
|||
</script> |
|||
<template> |
|||
<LowcodeTransfer :key="componentKey" :data="props.data" :selected-value="value" @checked-id-list-changed="checkedIdListChangedIndex" @update-model="updateModel" @re-render-component="reRenderComponent"></LowcodeTransfer> |
|||
</template> |
|||
<style lang='scss' scoped> |
|||
.wordColor{ |
|||
color:#000000; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue