DEdit 添加 日期组件

szh-new
张同海 3 months ago
parent f702606541
commit 814f056dfb

@ -11,6 +11,7 @@
import { useAttrs } from '/@/hooks/core/useAttrs' import { useAttrs } from '/@/hooks/core/useAttrs'
import { useI18n } from '/@/hooks/web/useI18n' import { useI18n } from '/@/hooks/web/useI18n'
import { useAppStore } from '/@/store/modules/app' import { useAppStore } from '/@/store/modules/app'
import dayjs from 'dayjs'
const appStore = useAppStore() const appStore = useAppStore()
type OptionsItem = { label: string; value: string; disabled?: boolean } type OptionsItem = { label: string; value: string; disabled?: boolean }
export default defineComponent({ export default defineComponent({
@ -50,7 +51,9 @@
const attrs = useAttrs() const attrs = useAttrs()
const { t } = useI18n() const { t } = useI18n()
const [state] = useRuleFormItem(props, 'value', 'change') const [state] = useRuleFormItem(props, 'value', 'change')
function isDate(value) {
return value instanceof Date || Object.prototype.toString.call(value) === '[object Date]'
}
function GetState() { function GetState() {
let RData: any = null let RData: any = null
if (state.value) { if (state.value) {
@ -78,6 +81,8 @@
RData = item[props.labelField] RData = item[props.labelField]
} }
}) })
} else if (state.value.$d && state.value.$isDayjsObject) {
RData = dayjs(state.value.$d).format('YYYY-MM-DD')
} else { } else {
if (props.label == '来源明细') { if (props.label == '来源明细') {
appStore.getSourceData.forEach((item) => { appStore.getSourceData.forEach((item) => {
@ -105,6 +110,7 @@
function CilckEdit() { function CilckEdit() {
emit('edit') emit('edit')
} }
return { attrs, t, showTooltip, props, state, CilckEdit, GetState } return { attrs, t, showTooltip, props, state, CilckEdit, GetState }
}, },
}) })

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save