Integration & Automation-query employee check-in status
1. Usage scenarios
Submit a form within YIDA to query the employee's sign-in status, including whether to sign-in, sign-in time, sign-in location, etc.
2. Procedure
2.1 Step 1: Create a form
Create two common forms, in which the check-in query table is used to trigger the connector for query. The query result record is used to receive the results returned by the connector for easy viewing.
2.1.1 Create a query form
Procedure:
- Create a normal form named check in query table 」.
- Add two date components, named "query start date" and "query end date" respectively. The format is set to "Year-Month-Day: Minute" and is set to required. (The operation is shown in Figure 2.1-1)
Figure 2.1-1 add and configure date components
- Add a member component, named employee to be queried, and set it to required. (The operation is shown in Figure 2,1-2)
Figure 2.1-2 add and configure member components
- Click save in the upper-right corner of the page.
2.1.2 create a result record form
Procedure:
- Create a common form named query result record 」.
- Add a multi-line text component named "connector return result receiving" and set it to hidden state to receive the initial data returned by the connector. (The operation is shown in Figure 2.1-3)
Figure 2.1-3 add and configure multi-line text components
- Add a subform component named sign-in result, and add three single-line text components named sign-in time, sign-in place, and sign-in note to the subform, displays the processing results of the data returned by the connector. (The operation is shown in Figure 2.1-4)
Figure 2.1-4 configure Subforms
- Click save in the upper-right corner.
2.2 Step 2: configure the sign-in query form connector
For more information about connectors, seeIntegration & Automation
The sign-in query function is implemented by configuring the sign-in query form connector, and the query results are automatically added to the query result record form.
Procedure:
- Background management interface> Integration & automation> Click the "create Integration & Automation" button on the page. (The operation is shown in Figure 2.2-1)
Figure 2.2-1 connector entry
- Name the connector sign-in query> trigger type as form event trigger and specify the trigger form as sign-in query Table> Click OK. (The operation is shown in Figure 2.2-2)
Figure 2.2-2 New connector
- Click the "form event trigger" node, and select "created" as the trigger event, and select "all data" as the data filter 」.
(The operation is shown in Figure 2.2-3)
Figure 2.2-3 configuration form event triggering
- Click the connector node, select the sign-in application, and click the Next button. (The operation is shown in Figure 2.2-4)
Figure 2.2-4 select connector application
- Select get personal sign-in record and click next. (The operation is shown in Figure 2.2-5)
Figure 2.2-5 Select connector execution action
- Configure the execution action and click save. (Operation is shown in Figure 2.2-6)
Figure 2.2-6 configuration connector execution action
- Move the cursor over the connector node, click +, and select Add data node. (The operation is shown in Figure 2.2-7)
Figure 2.2-7 add data node
- Configure the add data node. Add method: select "Add in form" and select "query result record" for the form; Add data: select "Add a single piece of data"; Set fields; click save. (The operation is shown in Figure 2.2-8)
Figure 2.2-8 configure the add data node
- Edit the JS panel of the query result record form and put the JS code into
didMount()
Function. (The operation is shown in Figure 2.2-9)
Figure 2.2-9 edit the JS panel of the query result record form
Note:The code shown in the preceding figure is as follows and can be copied directly. ButNote the replacement of the unique identifier of each component!
export function didMount() {
// 获取连接器返回数据,其中「textareaField_kyiduf87」为多行文本组件唯一标识,请注意替换,否则会失效哦!!!
const str = this.$("textareaField_kyiduf87").getValue();
//进行数据处理
const obj = JSON.parse(str);
let arr = [];
const valList = obj.map(item => {
let valObject = {};
//签到时间
//需将 textField_kyie87xz 替换为您创建的组件的唯一标识,由于连接器返回的数据为时间戳,需要使用Date toLocaleString()方法进行转换。
valObject.textField_kyie87xz = new Date(item.checkin_time).toLocaleString().replace(/:d{1,2}$/, ' ');
//签到地点
//需将 textField_kyifrc1q 替换为您创建的组件的唯一标识
valObject.textField_kyifrc1q = item.detail_place;
//签到备注
//需将 textField_kyie87y1 替换为您创建的组件的唯一标识
valObject.textField_kyie87y1 = item.remark;
arr.push(valObject);
})
//将处理好的数据赋值给子表单组件
//需将 tableField_kyiezna8 替换为您创建的单行文本组件的唯一标识
this.$("tableField_kyiezna8").setValue(arr);
}
- Click save in the upper-right corner of the page and click Publish.
2.3 Step 3: submit the sign-in query form to trigger the connector
Figure 2.3-1 submit form
3. Effect display
Figure 3-1 effect display