{ type: "input", label: "运输用时", dataIndex: "transportationTime", vIf: () => { return (form.data.status === 3) }, 让此字段只读不可编辑 },
时间: 2024-01-08 10:04:03 浏览: 37
你可以在表单中的该字段上添加属性 `disabled: true` 来使其只读不可编辑,例如:
```javascript
{
type: "input",
label: "运输用时",
dataIndex: "transportationTime",
vIf: () => {
return form.data.status === 3;
},
disabled: true
}
```
这样用户就不能编辑这个字段了。
相关问题
v-model:value=" record.controlTypeList.find((obj) => obj.type == column.dataIndex) .control "
这段代码是使用 Vue.js 中的 v-model 指令来绑定一个值。在这个例子中,v-model:value 绑定的值是根据 record.controlTypeList 数组中的元素进行计算得到的。通过 find() 方法,找到 column.dataIndex 属性与 obj.type 相匹配的元素,并获取该元素的 control 属性作为绑定的值。
{ title: '类型', dataIndex: 'type', render: data => typeStatus(data), filters: allaFilters, filterMode: 'menu', filterSearch: true, onFilter: (value, record) => record.from.includes(value), width: '30%', },
根据你提供的代码,antd table的筛选功能应该是有问题的。filters属性应该是一个数组,每个数组元素都是一个对象,包含text和value两个属性,表示筛选项的名称和值。同时,onFilter属性应该是一个函数,用于指定如何筛选数据。你可以参考以下代码示例:
```
{
title: '类型',
dataIndex: 'type',
filters: [
{ text: '类型1', value: 'type1' },
{ text: '类型2', value: 'type2' },
],
onFilter: (value, record) => record.type === value,
render: (type) => typeStatus(type),
width: '30%',
},
```
在这个示例中,我们定义了两个筛选项,分别是类型1和类型2。onFilter函数用于判断当前数据记录是否符合筛选条件。如果你的需求不同,可以根据实际情况自行调整。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
将这个数组中的每个对象格式化成一行:[ { title: '字典名称', dataIndex: 'dic_name', key: 'dic_name', }, { title: '字典值', dataIndex: 'dic_value', key: 'dic_value', }, { title: '所属组', dataIndex: 'dic_group', key: 'dic_group', }, { title: '父级ID', dataIndex: 'dic_parent_id', key: 'dic_parent_id', }, { title: '字典类型', dataIndex: 'dic_type', key: 'dic_type', render: (text: string) => { return text === 'DIR' ? '目录' : '数据'; }, }, { title: '排序', dataIndex: 'dic_order', key: 'dic_order', }, { title: '状态', dataIndex: 'dic_state', key: 'dic_state', render: (text: string) => { return text === 'ON' ? '启用' : '注销'; }, }, { title: '操作', dataIndex: 'action', key: 'action', render: () => { return 编辑; }, }, ];
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)