1. 程式人生 > 其它 >開發申請單——流程表單有轉交時確保開發人元件值隨著轉交人變化而變化

開發申請單——流程表單有轉交時確保開發人元件值隨著轉交人變化而變化

參考宜搭平臺介面:https://www.yuque.com/yida/support/aql605

說明:只寫了一個方法 getProcessData,有頁面自動呼叫函式didMount呼叫(當前頁面 - 設定 - 生命週期 - 頁面載入完成時中被關聯的,須手動繫結didMount,這樣每次重新整理頁面是都會呼叫getProcessData)

1、根據流程例項ID獲取流程詳情

2、獲取審批記錄

3、流程例項更新

// 當頁面渲染完畢後馬上呼叫下面的函式,這個函式是在當前頁面 - 設定 - 生命週期 - 頁面載入完成時中被關聯的。
export function didMount() {
  console.log(`「頁面 JS」:當前頁面地址 ${location.href}`);
  
// console.log(`「頁面 JS」:當前頁面 id 引數為 ${this.state.urlParams.id}`); // 更多 this 相關 API 請參考:https://aliwork.com/developer/API // document.title = window.loginUser.userName + ' | 宜搭'; this.getProcessData() } export function getProcessData() { if (this.state.urlParams.procInsId || this.state.urlParams.formInstId) {
// 獲取當前流程詳細內容 let data = { processInstanceId: this.state.urlParams.procInsId || this.state.urlParams.formInstId } this.dataSourceMap['getProcessData'].load(data).then(res => { // console.log(res) for (let i = 0; i < res.length; i++) { if (res[i].type == 'TODO' && res[i].showName == '開發確認') {
// console.log(this.$('employeeField_km1jdjno').getValue()) // 上一個流程的人員不等於開發人 說明流程轉交過了 if (res[i].operator != this.$('employeeField_km1jdjno').getValue()[0].value) { // console.log('開發確認不等於開發人') let arr = [] arr.push(res[i].operator) let json = { 'employeeField_km1jdjno': arr } // 更新表單資料 let data1 = { processInstanceId: this.state.urlParams.procInsId || this.state.urlParams.formInstId, updateFormDataJson: JSON.stringify(json) } this.dataSourceMap['updateProcessData'].load(data1).then(res => { }) } } } }) } }