const data = window.luckysheet.transToData(celldata);
const res = await userProfileApi.getUserNames();
// data 数据格式
data:[
[{ },{ }],
[{ },{ }],
[{ },{ }]
]
//res 数据格式
[ " "," " ]
data.slice(3, -1).forEach((item, index) => {
if (
item[2] != null &&
item[2].ct.s != undefined &&
(item[0] == null || (item[0].v != "CREATE" && item[0].v != "MODIFY"))
) {
item[1] = {
fc: "#FF0000",
v: "1:Action must be specified, Please select CREATE or MODIFY",
m: "1:Action must be specified, Please select CREATE or MODIFY"
};
}
this.validate(item, res, index);
});
validate(item, res, index) {
if (
item[2] != null &&
item[2].ct.s != undefined &&
!Object.values(res.data).includes(item[2].ct.s[0].v)
) {
item[1] = {
fc: "#FF0000",
v:
item[1] == null
? "2:user is Undefined"
: item[1].v + "\n" + "2:user is Undefined",
m:
item[1] == null
? "2:user is Undefined"
: item[1].m + "\n" + "2:user is Undefined",
tb: 2 //设置换行
};
}
}
需求:使用tauri中的 rust语法定义函数 作用与js中定义的函数效果一致,需要前端去调用rust方法 得到返回结果