在crud.txs文件里,先选择时间类型,根据不同选择,选择时间字段type的值不一样,选择年type=‘year’;选择月type=‘month’等等timeType: {
title: '时间类型',
type: 'dict-select',
search: {
show: true,
component: {
props: {
clearable: true,
},
},
valueChange({ form, value, getComponentRef }) {
},
},
column: {
show: false,
},
form: {
show: false,
},
dict: dict({
async getData(dict: any) {
return await api.GetType({ parent: '46' }).then((ret: any) => {
console.log('这是时间类型接口地址', ret.data);
const res = ret.data;
const data = [];
for (const item of res) {
const obj = { label: '', value: '' };
obj.label = item.label;
obj.value = item.value;
data.push(obj);
}
return data;
});
},
}),
},
time: {
title: '选择时间',
type: 'year',
search: { },
form: {
show: true,
component: {
maxlength: 20,
type: 'datetime',
},
},
column: {
show: false,
},
},