【宜搭】低代码开发师高级认证实操题1难点指导

本文详细解析了宜搭低代码平台的高级认证实操题,涵盖创建页面、数据展示、表单功能实现等难点,包括远程数据源的使用、表格组件的样式修改、增删改查功能的代码编写等。通过对每个功能的步骤讲解,帮助读者理解和掌握低代码开发技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

难度: 较难
知识点: 远程数据源 表单创建 表格组件使用 js增删改查功能代码编写

在本文中,我将根据题目的每一点要求,对于我在实操过程中遇到的难点进行比较详细的介绍,供大家参考,希望能够对大家有所帮助。

解题步骤:

创建页面

根据要求创建两个普通表单和一个自定义页面,分别为进行中待办已完成待办Todolist。具体相关组件的选用可以参考如下:
在这里插入图片描述

图1.1 Todolist页面

在这里插入图片描述

图1.2 进行中待办表单

注意 其中进行中待办已完成待办所构成的组件基本相同,操作列功能也基本相同,可直接复制粘贴。整个Todolist页面的页头部分可使用宜搭模板里的“待办项目”。

功能实现
1 数据展示
所涉及到的数据源

在这里插入图片描述

图2.1 获取进行中待办的数据源

注意: 参数formUuid的值为表单的Id,即APP_XXX

在这里插入图片描述

图2.2 获取已完成待办的数据源

注意: 同理于进行中待办,实际上接口可复用,只需在js面板调用接口,将对应的formUuid值赋值给参数即可,感兴趣可自行修改。

所涉及的全局变量

在这里插入图片描述

图2.3 进行中待办表格展示数据变量

在这里插入图片描述

图2.4 已完成待办表格展示数据变量

以下变量在编辑搜索功能时会有用

在这里插入图片描述

图2.5 进行中待办表格接口返回数据变量

在这里插入图片描述

图2.6 已完成待办表格接口返回数据变量

访问接口获取表单数据的代码
//获取进行中待办数据
export function getTodoListData(){
  this.dataSourceMap.getTodoTasks.load().then(res =>{
  	//console.log(res)
  	//以下根据返回内容重构数据对象,使数据格式符合宜搭组件格式要求
    let toDoData = []
    for(let i=0; i<res.data.length; i++){
      let tmpData = res.data[i].formData
      //此处另外添加formInstId属性,用于之后的复选框功能
      tmpData['formInstId'] = res.data[i].formInstId
      //将每一个重构的对象存入到全局变量ToDoData
      toDoData.push(tmpData)
    }
    //表格展示数据源。其中,currentPage和totalCount的取值会影响到表格分页器的展示
    this.setState({
      toDoListData: {
        data: toDoData,
        currentPage: res.currentPage,
        totalCount: res.totalCount
      }
    })
    //原表单真实数据集,用于后续的搜索功能
    state.ToDoData_1['data'] = toDoData
  })
  //console.log('v', state.ToDoData_1)
}

以下展示获取的数据结构以及表格构建的字段名:

在这里插入图片描述

图3.1 获取进行中待办时API返回的数据对象

在这里插入图片描述

图3.2 进行中待办表格字段名

注意: 表格字段名和toDoListData中的data属性值中每个元素中的自己key值要一一对应,这里我key值直接和返回的res对象里的key值一致,所以要和返回数据里的key值对应才能正确展示数据

绑定表格和数据源

在这里插入图片描述

图3.3 绑定数据源

在这里插入图片描述

图3.4 页面加载时调用函数进行展示数据初始化

2 重要度列样式修改

在这里插入图片描述

图4.1 重要度列样式修改

所涉及的代码
[
  {
    "color": "grey",
    "text": "1",
    "value": 1,
    "__sid__": "serial_ld3vrwkg"
  },
  {
    "color": "blue",
    "text": "2",
    "value": 2,
    "__sid__": "serial_ld3vrwkh"
  },
  {
    "color": "yellow",
    "text": "3",
    "value": 3,
    "__sid__": "serial_ld3vrwki"
  },
  {
    "color": "green",
    "text": "4",
    "value": 4,
    "__sid__": "serial_ld3vrwkj"
  },
  {
    "color": "red",
    "text": "5",
    "value": 5,
    "__sid__": "serial_ld3vrwkk"
  }
]

注意: 这里只需要关注前三个属性,最后一个“sid”只是一个唯一标识罢了,只要能相互之间不一样的取值就行,我是直接复制前面然后改动其中一个字母罢了。

3 表单项目的新建

对话框dialog组件的使用如下:
在这里插入图片描述

图5.1 新建待办对话框

所涉及的函数

点击新建待办弹出对话框:
在这里插入图片描述

图5.2 绑定打开对话框函数

所涉及代码:

//新建待办: 打开对话框
export function onAddBarItemClick() {
  this.$('dialog_lceg6n3e').show()
}

提交表单:
在这里插入图片描述

图5.3 绑定提交函数

所涉及代码

//新建进行中待办
export function updateTodoList(){
//获取对应组件的输入值
  let title = this.$('textField_la552dni').getValue()  ($()内为你自己的组件标识)
  let type = this.$('radioField_la552dnj').getValue()
  let degree = this.$('rateField_la552dnk').getValue()
  let time = this.$('dateField_la552dnl').getValue()
  let note = this.$('textareaField_la552dnm').getValue()
//将要新建的内容转换为json对象
  let dataJson = {
    "textField_la552dni": title,
    "radioField_la552dnj": type,
    "rateField_la552dnk": degree,
    "dateField_la552dnl": time,
    "textareaField_la552dnm": note
  }
  dataJson = JSON.stringify(dataJson)
//构建新建接口所需的json参数对象
  let params = {
    formUuid: "FORM-JK866XA138U6NNHJB0QJQ52Q01C32V6TE7ACL7",(你自己的)
    appType: "APP_XXX",(你自己的)
    formDataJson: dataJson
  }
  this.dataSourceMap.updateList.load(params).then(res => {
    // console.log('%', res)
    this.getTodoListData()
  }).catch(err => {
    console.log('#', err) //打印错误,可选
  })
}
4 表单搜索功能
所涉及的函数:

表格创建搜索函数:
在这里插入图片描述

图6.1 绑定搜索函数

所涉及的代码:注意注释部分params各个属性的含义
/**
* tablePc onToDoFetchData
* @param params.currentPage 当前页码
* @param params.pageSize 每页显示条数
* @param params.searchKey 搜索关键字
* @param params.orderColumn 排序列
* @param params.orderType 排序方式(desc,asc)
* @param params.from 触发来源(order,search,pagination)
*/
export function onToDoFetchData(params) {
  // 如果是搜索的话翻页重置到 1
  if (params.from  === 'search') {
params.currentPage = 1;

//判断搜索框内是否有值,有则根据搜索框内的内容,对照toDoData_1中的数据集进行比对,这里,将【分类】的值作为搜索的类别。
    if(params.searchKey){
      let tmpToDoData = state.ToDoData_1['data']
      let tmpTodoArr = []
//遍历tmpTodoData集合,比较指定键对应的值是否与search属性中的值相等,如果相等,则添加到tmpToDoArr数组中,最后,将数组重新赋值给表格展示数据源toDoListData。
      for(let i=0; i<tmpToDoData.length; i++){
        if (tmpToDoData[i]['radioField_la552dnj'] == params.searchKey){
          tmpTodoArr.push(tmpToDoData[i])
        }
      }
      this.setState({
        toDoListData: {
          data: tmpTodoArr,
          currentPage: params.currentPage,
          totalCount: tmpTodoArr.length
        }
      })
    }
  }
}
5 表单项目的删除
所需远程数据源:

在这里插入图片描述

图7.1 删除功能数据源

类似【新建待办】,在【操作列】新建【删除】列,并绑定相关函数。
在这里插入图片描述

图7.1 绑定删除函数

所涉及的函数代码:

打开删除对话框:
在这里插入图片描述

图7.2 打开删除对话框


//删除进行中的待办
export function onDelToDoClick(rowData) {
  this.$('dialog_lchqfnxt').show()
  this.setState({
    toDoRowData: rowData
  })

}

删除提交:绑定点击事件,调用删除函数
在这里插入图片描述

图7.3 绑定删除函数

所涉及的代码:
//调用删除API,此处就是前述提到的接口复用,只要在js中调用接口,不在数据源面板设置参数值,就可以通过修改参数值,就可以删除已有的任意一条数据,包括已完成待办。
export function delToDoItem(data){
  let params = {
    formInstId: data.formInstId
  }
  this.dataSourceMap.deleteToDoList.load(params).then(res => {
    this.getTodoListData()
  }).catch(err => {
    console.log(err)
  })
}
6 进行中的待办完成勾选后的同步功能
所涉及的函数

打开复选框功能:
在这里插入图片描述
注意: 复选框要生效一定需要有唯一标识,这里我选择使用已有的表单项实例id,不嫌麻烦的话,可以限制其他列字段元素为元组,使该列元素值唯一后,也能起到和前者一样的效果。

所涉及的代码

当勾选表格中的某一项后,在【进行中待办】删除该项,同时在【已完成待办】中添加该项

//这里无需重新访问接口,只需调用先前的接口,传入勾选行的元组即可,这里是先创建全局变量【hvDoneData】,再将rowData赋值给它,在传入updateList。
/**
* 选择(或取消选择)数据之后的回调
* @param selectedRowKeys Array 选中行的 key
* @param records Array 选中行的数据
*/
export function onSelectChange(selectedRowKeys, records) {
  // console.log('%%', selectedRowKeys, records[0]);
  this.setState({
    hvDoneData: records[0]
  })
  this.updateDoneList(state.hvDoneData)
  this.delToDoItem(records[0])
}

//更新已完成待办,即在已完成待办表单中新建进行中待办的删除项
export function updateDoneList(data){
  delete data.formInstId
  let dataJson = JSON.stringify(data)
  let params = {
    formUuid: "FORM-D2B665D1Q5Y655AC8OYN0DIBJMF72Z55L7ACL1",
    appType: "APP_XXX",
    formDataJson: dataJson
  }
  this.dataSourceMap.updateList.load(params).then(res => {
    // console.log('%', res)
    this.getFinishListData()
  }).catch(err => {
    console.log(err)
  })
}
问题思考

这里我忘记实现【编辑】功能,但是审核人员也让通过了我的答案。那么,就留个练习吧:

  1. 根据上述指导,实现待办中的【编辑】功能
  2. 根据上述指导,自主实现已完成待办相关功能


以上就是我在进行高级认证时实操题1的实现过程。如果觉得有帮助的话,请点个“赞”吧,我将持续更新,尽情期待。

题目如下 In this exercise, you will create a UiPath automation that performs the steps below. To achieve this, you will use the REFrameWork as the starting template and follow the UiPath development best practices. Here are the steps performed by the Robot: 1. Log in to https://www.acme-test.com. 2. On the landing page, Dashboard, click on the Work items menu item. Scrape the data in all the pages of the table, page by page, ensuring error handling and recovery. 3. For each page: - Filter the records where Status is 'Open'; - Filter the records where Type is 'WI5'; - Filter the records where WIID is less than 500000; - Append the resulting datatable into an Excel worksheet; you shouldn't worry about the headers and format of the output file. Constraints to follow in the development, using the REFrameWork: 1. TransactionItem datatype should be a String. The process should recover and retry in case of errors in navigation between WorkItems page. One transaction is the action of scraping one web page.By navigating to the next page, the next transaction will execute. (Same as ACME Process 4 Dispatcher from the UiPath Academy). 2. Create a separate workflow file for the Login to ACME. File input arguments: URL ; Username ; Password . 3. Create a separate workflow file for closing ACME. 3. Add the ACME_URL and ACME_Credential to the Config file. 4. Populate InitAllApplications.xaml from the Framework folder with Invoking the Login to ACME and navigation to the Work Items. 5. Populate CloseAllApplications.xaml from the Framework folder with Invoking the Close ACME. 6. Populate KillAllProcesses.xaml from the Framework folder with killing the process used. 7. Populate the Process.xaml file with the following actions: Web scraping, Filtering and Appending to Excel. Important Note: Don't use external file references, outside of the project folder (including Orchestrator Assets). Place all the used files within the project folder, zip that folder and upload it to the UiPath Certification Platfor
评论 49
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ag+Cu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值