進行中待辦
已完成待辦
待辦事項
待辦事項遠程api和變量配置
回調(diào)函數(shù)
function didFetch(content) {
//console.log(content.data);
// content.b = 1; 修改返回數(shù)據(jù)結(jié)構(gòu)中的 b 字段為1
let res = content.data;
let todoList = [];
for(let i in res){
todoList.push(res[i]);
}
console.log("todolist",todoList);
let result = {
"data": todoList,
"CurrentPage": content.CurrentPage,
"totalCount": content.totalCount
}
return result; // 重要,需返回 content
}
回調(diào)函數(shù)
function didFetch(content) {
// content.b = 1; 修改返回數(shù)據(jù)結(jié)構(gòu)中的 b 字段為1
let res = content.data;
let doneList = [];
for(let i in res){
doneList.push(res[i]);
}
console.log(doneList);
let result = {
"data": doneList,
"CurrentPage": content.CurrentPage,
"totalCount": content.totalCount
}
return result; // 重要,需返回 content
}
頁面js
/**
* 尊敬的用戶,你好:頁面 JS 面板是高階用法,一般不建議普通用戶使用,如需使用,請確定你具備研發(fā)背景,能夠自我排查問題。當(dāng)然,你也可以咨詢身邊的技術(shù)顧問或者聯(lián)系宜搭平臺的技術(shù)支持獲得服務(wù)(可能收費)。
* 我們可以用 JS 面板來開發(fā)一些定制度高功能,比如:調(diào)用阿里云接口用來做圖像識別、上報用戶使用數(shù)據(jù)(如加載完成打點)等等。
* 你可以點擊面板上方的 「使用幫助」了解。
*/
// 當(dāng)頁面渲染完畢后馬上調(diào)用下面的函數(shù),這個函數(shù)是在當(dāng)前頁面 - 設(shè)置 - 生命周期 - 頁面加載完成時中被關(guān)聯(lián)的。
export function didMount() {
console.log(`「頁面 JS」:當(dāng)前頁面地址 ${location.href}`);
// console.log(`「頁面 JS」:當(dāng)前頁面 id 參數(shù)為 ${this.state.urlParams.id}`);
// 更多 this 相關(guān) API 請參考:https://aliwork.com/developer/API
// document.title = window.loginUser.userName + ' | 宜搭';
this.$('dialog_lty04ne9').hide();
this.$('dialog_ltzi2k7t').hide();
}
let isUpdate = false;
let updateformInstId = '';
let deleteformInstId = '';
/**
* dialog onCancel
*/
export function onCancel() {
console.log('onCancel');
this.$('dialog_lty04ne9').hide();
}
/**
* dialog onClose
*/
export function onClose() {
console.log('onClose');
this.$('dialog_lty04ne9').hide();
}
export function onActionBarItemClick() {
this.$('textField_lty04nea').set('value', '');
this.$('radioField_lty04neb').set('value', '');
this.$('rateField_lty04nec').set('value', '');
this.$('dateField_lty04nee').set('value', '');
this.$('textareaField_lty04ned').set('value', '');
this.$('dialog_lty04ne9').show();
}
/**
* dialog onOk
*/
export function onOk() {
console.log('onOk');
let todo = this.$('textField_lty04nea').getValue();
let asort = this.$('radioField_lty04neb').getValue();
let importance = this.$('rateField_lty04nec').getValue();
let remindtime = this.$('dateField_lty04nee').getValue();
let detail = this.$('textareaField_lty04ned').getValue();
let formData = {
"textField_ltxp13oi":todo,
"radioField_ltxp13oj": asort,
"rateField_ltxp13ok": importance,
"dateField_ltxp13ol": remindtime,
"textareaField_ltxp13om": detail,
};
console.log(formData);
let formDataJson = [];
if(isUpdate){
//更新數(shù)據(jù)
let params2 = {
formInstId: this.updateformInstId,
updateFormDataJson: JSON.stringify(formData)
};
this.dataSourceMap.updateData.load(params2).then(res => {
this.$('dialog_lty04ne9').hide();
this.utils.toast("更新成功");
this.getTodoList();
});
}else{
//保存數(shù)據(jù)
let params1 = {
formUuid: "FORM-7A3395D5626C45FBA6BF08B40555B86266PI",
appType: "APP_M3YO82RIZE2UJV4R87TW",
formDataJson: JSON.stringify(formData)
};
this.dataSourceMap.saveData.load(params1).then(res =>{
this.$('dialog_lty04ne9').hide();
this.utils.toast("保存成功");
this.getTodoList();
})
}
}
//點擊todolist的刪除
export function onActionClick(rowData) {
this.deleteformInstId = rowData.formInstId;
this.$('dialog_ltzi2k7t').show();
}
export function getTodoList(){
this.dataSourceMap.getTodoList.load().then(res =>{
//console.log("todo",res.data);
});
}
export function getDoneList() {
this.dataSourceMap.getDoneList.load().then(res => {
//console.log("done", res.data);
});
}
//刪除done
export function onDeleteDoneActionClick(rowData) {
console.log(rowData);
let params2 = {
formInstId: rowData.formInstId
}
this.dataSourceMap.deleteData.load(params2).then(res => {
this.utils.toast("刪除成功");
this.getDoneList();
})
}
//數(shù)據(jù)填充到對話框
export function onEditTodoActionClick(rowData) {
isUpdate = true;
this.$('dialog_lty04ne9').set('title','更新待辦');
let formData = rowData.formData;
let arr = [];
for (let i in formData) {
arr.push(formData[i]);
}
console.log(arr);
let todo = arr[0];
let asort = arr[2];
let importance = arr[4];
let remindtime = arr[1];
let detail = arr[6];
this.$('textField_lty04nea').set('value',todo);
this.$('radioField_lty04neb').set('value', asort);
this.$('rateField_lty04nec').set('value',importance);
this.$('dateField_lty04nee').set('value',remindtime);
this.$('textareaField_lty04ned').set('value', detail);
this.$('dialog_lty04ne9').show();
this.updateformInstId = rowData.formInstId;
}
/**
* 選擇(或取消選擇)數(shù)據(jù)之后的回調(diào)
* @param selected Boolean 是否選中
* @param rowData Object 當(dāng)前操作行
* @param selectedRows Array 選中的行數(shù)據(jù)
*/
export function onSelect(selected, rowData, selectedRows) {
console.log('selectedRows',selectedRows);
//刪除todolist里這條數(shù)據(jù)
let params2 = {
formInstId: rowData.formInstId
}
this.dataSourceMap.deleteData.load(params2).then(res => {
console.log('刪除成功');
})
//保存上面刪除的數(shù)據(jù)到donelist
let formData = rowData.formData;
let arr = [];
for (let i in formData) {
arr.push(formData[i]);
}
console.log('arr',arr);
let todo = arr[0];
let asort = arr[2];
let importance = arr[4];
let remindtime = arr[1];
let detail = arr[6];
let formData1 = {
"textField_ltxpa412": todo,
"radioField_ltxpa413": asort,
"rateField_ltxpa414": importance,
"dateField_ltxpa415": remindtime,
"textareaField_ltxpa416": detail
};
let params1 = {
formUuid: "FORM-BC3BEDD73A9046B79868D53414D1D89CZXG7",
appType: "APP_M3YO82RIZE2UJV4R87TW",
formDataJson: JSON.stringify(formData1)
};
this.dataSourceMap.saveData.load(params1).then(res => {
console.log('保存成功');
})
this.getDoneList();
this.getTodoList();
}
/**
* dialog onCancel
*/
export function onCancelDelete() {
console.log('onCancel');
this.$('dialog_ltzi2k7t').hide();
}
/**
* dialog onClose
*/
export function onCloseDelete() {
console.log('onClose');
this.$('dialog_ltzi2k7t').hide();
}
/**
* dialog onOk
*/
export function onOkDelete() {
let params2 = {
formInstId: this.deleteformInstId
}
this.dataSourceMap.deleteData.load(params2).then(res => {
this.$('dialog_ltzi2k7t').hide();
this.utils.toast("刪除成功");
this.getTodoList();
})
}
/**
* tablePc onFetchData
* @param params.currentPage 當(dāng)前頁碼
* @param params.pageSize 每頁顯示條數(shù)
* @param params.searchKey 搜索關(guān)鍵字
* @param params.orderColumn 排序列
* @param params.orderType 排序方式(desc,asc)
* @param params.from 觸發(fā)來源(order,search,pagination)
*/
export function onFetchData(params) {
// 如果是搜索的話翻頁重置到 1
if (params.from === 'search') {
params.currentPage = 1;
}
this.dataSourceMap['getTodoList'].load(params);
// 如果你需要把表格查詢條件保存起來,可以取消下一行注釋,并添加一個 params 的變量類型數(shù)據(jù)源
// this.setState({ tableParams: params });
// 如果使用遠程接口作為表格數(shù)據(jù)源,理論上你只需要將下方的“dataSourceName”改為實際的數(shù)據(jù)源名稱即可
// this.dataSourceMap['dataSourceName'].load(params);
}
/**
* tablePc onFetchData
* @param params.currentPage 當(dāng)前頁碼
* @param params.pageSize 每頁顯示條數(shù)
* @param params.searchKey 搜索關(guān)鍵字
* @param params.orderColumn 排序列
* @param params.orderType 排序方式(desc,asc)
* @param params.from 觸發(fā)來源(order,search,pagination)
*/
export function onFetchData2(params) {
// 如果是搜索的話翻頁重置到 1
if (params.from === 'search') {
params.currentPage = 1;
}
// 如果你需要把表格查詢條件保存起來,可以取消下一行注釋,并添加一個 params 的變量類型數(shù)據(jù)源
// this.setState({ tableParams: params });
// 如果使用遠程接口作為表格數(shù)據(jù)源,理論上你只需要將下方的“dataSourceName”改為實際的數(shù)據(jù)源名稱即可
this.dataSourceMap['getDoneList'].load(params);
}
/**
* tablePc onFetchData
* @param params.currentPage 當(dāng)前頁碼
* @param params.pageSize 每頁顯示條數(shù)
* @param params.searchKey 搜索關(guān)鍵字
* @param params.orderColumn 排序列
* @param params.orderType 排序方式(desc,asc)
* @param params.from 觸發(fā)來源(order,search,pagination)
*/
export function onFetchData3(params) {
// 如果是搜索的話翻頁重置到 1
if (params.from === 'search') {
params.currentPage = 1;
}
// 如果你需要把表格查詢條件保存起來,可以取消下一行注釋,并添加一個 params 的變量類型數(shù)據(jù)源
// this.setState({ tableParams: params });
// 如果使用遠程接口作為表格數(shù)據(jù)源,理論上你只需要將下方的“dataSourceName”改為實際的數(shù)據(jù)源名稱即可
this.setState({
searchKey: params.searchKey,
page: params.currentPage
});
}
數(shù)據(jù)綁定表
todoList
doneList
動作設(shè)置
操作列
頂部操作:新增待辦文章來源:http://www.zghlxwxcb.cn/news/detail-844830.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-844830.html
到了這里,關(guān)于宜搭低代碼高級認證實操題1 todolist的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!