表达1
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="110px">
<el-form-item label="客户名称" prop="clientName">
<el-select v-model="queryParams.clientName" placeholder="请选择客户名称" clearable size="small" >
<el-option
v-for="dict in clientnameOptions"
:key="dict.id"
:label="dict.clientName"
:value="dict.id+''"
/>
</el-select>
</el-form-item>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange" style="width: 200%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户名称" align="center" prop="cilentName":formatter="cilentNameFormat" width="100">
</el-table-column>
</el-table>
这里是引用另外一个表的数据:basics表中的
import {listBasics} from "@/api/system/basics";
created() {
listBasics({pageSize: 999999}).then(response => {
this.clientNameOptions = response.rows;
})
}
methods: {
clientNameFormat(row){
let kh= this.clientNameOptions.filter(p => p.id+'' === row.clientName).pop();
if (typeof kh === "undefined") return "";
return yz.clientName;
}
}
表达二
<el-form-item label="数量单位" prop="numberunit">
<el-select v-model="form.numberUnit" placeholder="请选择数量单位">
<el-option
v-for="dict in numberUnitOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-table-column label=" 数量单位" align="center" prop="numberUnit" :formatter="numberUnitFormat" width="120" />
created() {
this.getDicts("numberUnit").then(response => {
this.numberUnitOptions = response.data;
});
}
numberUnitFormat(row, column) {
return this.selectDictLabel(this.numberUnitOptions, row.numberUnit);
},
:key=“dict.dictValue”
:label=“dict.dictLabel”
:value=“dict.dictValue”
这里不是很明白,这是利用框架代码生成的