|
@@ -123,12 +123,13 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
|
|
|
|
|
|
/// 提交
|
|
|
void doSubmit() async {
|
|
|
+ Log.d("labour_review controller 提交");
|
|
|
|
|
|
var needNumController = state.formData['no_of_staff']!['controller'];
|
|
|
var amountController = state.formData['amount']!['controller'];
|
|
|
String needNum = needNumController.text.toString()??"0";
|
|
|
String amount = amountController.text.toString();
|
|
|
- String? jobApplyPreId = state.preSelectedIds;
|
|
|
+ // String? jobApplyPreId = state.preSelectedIds;
|
|
|
|
|
|
var remarkController = state.formData['remark']!['controller'];
|
|
|
var eventController = state.formData['event']!['controller'];
|
|
@@ -173,50 +174,110 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
|
|
|
|
|
|
Future<HttpResult> taskFuture;
|
|
|
if (state.pageType != 0 && Utils.isNotEmpty(state.appliedId) && state.appliedId != "0") {
|
|
|
+ Map<String, dynamic> params = {
|
|
|
+ "requestId": state.appliedId,
|
|
|
+ "templateId": state.selectedTemplateId,
|
|
|
+ "jobStart": "${DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd')} ${DateTimeUtils.formatDate(state.selectedStartTime, format: 'HH:mm')}:00",
|
|
|
+ "jobEnd": "${DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd')} ${DateTimeUtils.formatDate(state.selectedEndTime, format: 'HH:mm')}:00",
|
|
|
+ "departmentId": state.selectedDepartmentId,
|
|
|
+ "needNum": needNum,
|
|
|
+ "salaryBy": 'hour',
|
|
|
+ "amount": state.labReqOption?.serviceType == 1 ? amount : null,
|
|
|
+ "certificate": state.selectedCertificateList?.join(",")?? "",
|
|
|
+ "challenge25": state.selectedChallenge25Id?? "",
|
|
|
+ "vehicle": state.selectedVehicleList?.join(",")??"",
|
|
|
+ "description": remark,
|
|
|
+ "employmentType": state.selectedTypeId,
|
|
|
+ "eventName": event,
|
|
|
+ "eventType": eventType,
|
|
|
+ "passengers": eventPax,
|
|
|
+ "estRevenue": revenue,
|
|
|
+ "position": position,
|
|
|
+ "estCost": totalCost,
|
|
|
+ "attUrl": state.attFilePath,
|
|
|
+ 'cancelToken': cancelToken
|
|
|
+ };
|
|
|
+ // Log.d("编辑时 state.selectedCertificateList ${state.selectedCertificateList}");
|
|
|
+ // Log.d("编辑时 state.selectedCertificateList ${state.selectedCertificateList.join(",")}");
|
|
|
+ // Log.d("编辑时 state.selectedVehicleList ${state.selectedVehicleList.join(",")}");
|
|
|
+ //
|
|
|
+ // Log.d("编辑时准备提交的 params ${params}");
|
|
|
// 编辑
|
|
|
taskFuture = _ukLabourRepository.editLabourRequestSubmit(
|
|
|
- requestId: state.appliedId,
|
|
|
- templateId: state.selectedTemplateId,
|
|
|
- jobStart: "${DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd')} ${DateTimeUtils.formatDate(state.selectedStartTime, format: 'HH:mm')}:00",
|
|
|
- jobEnd: "${DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd')} ${DateTimeUtils.formatDate(state.selectedEndTime, format: 'HH:mm')}:00",
|
|
|
- departmentId: state.selectedDepartmentId,
|
|
|
- needNum: needNum,
|
|
|
- salaryBy: 'hour',
|
|
|
- amount: state.labReqOption?.serviceType == 1 ? amount : null,
|
|
|
- description: remark,
|
|
|
- employmentType: state.selectedTypeId,
|
|
|
- eventName: event,
|
|
|
- eventType: eventType,
|
|
|
- passengers: eventPax,
|
|
|
- estRevenue: revenue,
|
|
|
- position: position,
|
|
|
- estCost: totalCost,
|
|
|
- attUrl: state.attFilePath,
|
|
|
- cancelToken: cancelToken
|
|
|
+ requestId: params['requestId'],
|
|
|
+ templateId: params['templateId'],
|
|
|
+ jobStart: params['jobStart'],
|
|
|
+ jobEnd: params['jobEnd'],
|
|
|
+ departmentId: params['departmentId'],
|
|
|
+ needNum: params['needNum'],
|
|
|
+ salaryBy: params['salaryBy'],
|
|
|
+ amount: params['amount'],
|
|
|
+ certificate: params['certificate'],
|
|
|
+ challenge25: params['challenge25'],
|
|
|
+ vehicle: params['vehicle'],
|
|
|
+ description: params['description'],
|
|
|
+ employmentType: params['employmentType'],
|
|
|
+ eventName: params['eventName'],
|
|
|
+ eventType: params['eventType'],
|
|
|
+ passengers: params['passengers'],
|
|
|
+ estRevenue: params['estRevenue'],
|
|
|
+ position: params['position'],
|
|
|
+ estCost: params['estCost'],
|
|
|
+ attUrl: params['attUrl'],
|
|
|
+ cancelToken: params['cancelToken'],
|
|
|
);
|
|
|
} else {
|
|
|
+ Map<String, dynamic> params = {
|
|
|
+ "templateId": state.selectedTemplateId,
|
|
|
+ "jobDate": DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd'),
|
|
|
+ "jobStart": "${DateTimeUtils.formatDate(state.selectedStartTime, format: 'HH:mm')}",
|
|
|
+ "jobEnd": "${DateTimeUtils.formatDate(state.selectedEndTime, format: 'HH:mm')}",
|
|
|
+ "departmentId": state.selectedDepartmentId,
|
|
|
+ "needNum": needNum,
|
|
|
+ "salaryBy": 'hour',
|
|
|
+ "repeatDateStr": state.repeatDateStr,
|
|
|
+ "amount": state.labReqOption?.serviceType == 1 ? amount : null,
|
|
|
+ "certificate": state.selectedCertificateList?.join(",")?? "",
|
|
|
+ "challenge25": state.selectedChallenge25Id?? "",
|
|
|
+ "vehicle": state.selectedVehicleList?.join(",")??"",
|
|
|
+ "jobApplyPreId": state.preSelectedIds,
|
|
|
+ "description": remark,
|
|
|
+ "employmentType": state.selectedTypeId,
|
|
|
+ "eventName": event,
|
|
|
+ "eventType": eventType,
|
|
|
+ "passengers": eventPax,
|
|
|
+ "estRevenue": revenue,
|
|
|
+ "position": position,
|
|
|
+ "estCost": totalCost,
|
|
|
+ "attUrl": state.attFilePath,
|
|
|
+ 'cancelToken': cancelToken,
|
|
|
+ };
|
|
|
+ // Log.d("新增时准备提交的 params ${params}");
|
|
|
// 新增
|
|
|
taskFuture = _ukLabourRepository.addLabourRequestSubmit(
|
|
|
- templateId: state.selectedTemplateId,
|
|
|
- jobDate: DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd'),
|
|
|
- jobStart: "${DateTimeUtils.formatDate(state.selectedStartTime, format: 'HH:mm')}",
|
|
|
- jobEnd: "${DateTimeUtils.formatDate(state.selectedEndTime, format: 'HH:mm')}",
|
|
|
- departmentId: state.selectedDepartmentId,
|
|
|
- needNum: needNum,
|
|
|
- salaryBy: 'hour',
|
|
|
- repeatDateStr: state.repeatDateStr,
|
|
|
- amount: state.labReqOption?.serviceType == 1 ? amount : null,
|
|
|
- jobApplyPreId: state.preSelectedIds,
|
|
|
- description: remark,
|
|
|
- employmentType: state.selectedTypeId,
|
|
|
- eventName: event,
|
|
|
- eventType: eventType,
|
|
|
- passengers: eventPax,
|
|
|
- estRevenue: revenue,
|
|
|
- position: position,
|
|
|
- estCost: totalCost,
|
|
|
- attUrl: state.attFilePath,
|
|
|
- cancelToken: cancelToken,
|
|
|
+ templateId: params['templateId'],
|
|
|
+ jobDate: params['jobDate'],
|
|
|
+ jobStart: params['jobStart'],
|
|
|
+ jobEnd: params['jobEnd'],
|
|
|
+ departmentId: params['departmentId'],
|
|
|
+ needNum: params['needNum'],
|
|
|
+ salaryBy: params['salaryBy'],
|
|
|
+ repeatDateStr: params['repeatDateStr'],
|
|
|
+ amount: params['amount'],
|
|
|
+ certificate: params['certificate'],
|
|
|
+ challenge25: params['challenge25'],
|
|
|
+ vehicle: params['vehicle'],
|
|
|
+ jobApplyPreId: params['jobApplyPreId'],
|
|
|
+ description: params['description'],
|
|
|
+ employmentType: params['employmentType'],
|
|
|
+ eventName: params['eventName'],
|
|
|
+ eventType: params['eventType'],
|
|
|
+ passengers: params['passengers'],
|
|
|
+ estRevenue: params['estRevenue'],
|
|
|
+ position: params['position'],
|
|
|
+ estCost: params['estCost'],
|
|
|
+ attUrl: params['attUrl'],
|
|
|
+ cancelToken: params['cancelToken'],
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -262,10 +323,10 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
|
|
|
OptionPickerUtil.showCupertinoOptionPicker(
|
|
|
items: state.labReqOption!.templateList!.map((e) => e.txt!).toList(growable: false),
|
|
|
initialSelectIndex: selectedTemplateIndex,
|
|
|
- onPickerChanged: (_, index) {
|
|
|
+ onPickerChanged: (_, index) async{
|
|
|
state.selectedTemplateId = state.labReqOption!.templateList![index].value!.toString();
|
|
|
+ Log.d("选择标题后,此时选择的selectedTemplateId:${state.selectedTemplateId} ");
|
|
|
// 选择了标题后 需要 将此时选择的 标题 回显 给position
|
|
|
-
|
|
|
var positionController = state.formData['position']!['controller'];
|
|
|
state.position = state.templateList!
|
|
|
.firstWhere((element) => element.value.toString() == state.selectedTemplateId,
|
|
@@ -273,12 +334,58 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
|
|
|
.txt ??
|
|
|
"";
|
|
|
positionController.text = state.position;
|
|
|
- // 更新
|
|
|
- update();
|
|
|
+
|
|
|
+ // 并且需要根据 state.selectedTemplateId调用 接口 回显 证书 、vehicle
|
|
|
+ await _getShowTemplateData(state.selectedTemplateId!);
|
|
|
+
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Future<HttpResult?> _getShowTemplateData(String templateId) async{
|
|
|
+ final result = await _ukLabourRepository.fetchLabourRequestShowTemplateData(templateId);
|
|
|
+ if (result.isSuccess) {
|
|
|
+ state.showTemplateData = result.data;
|
|
|
+ if (state.showTemplateData != null) {
|
|
|
+ // 回显 证书、vehicle
|
|
|
+ if((state.showTemplateData?.certificate??'').isNotEmpty){
|
|
|
+ state.selectedCertificateList = state.showTemplateData?.certificate?.split(',')?? [];
|
|
|
+ // 循环 state.labReqOption?.certificateList 满足条件修改 checked
|
|
|
+ state.labReqOption?.certificateList?.forEach((e)=> {
|
|
|
+ if(state.selectedCertificateList.contains(e.value.toString())){
|
|
|
+ e.checked = 'checked'
|
|
|
+ }else {
|
|
|
+ e.checked = ''
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ Log.d("切换模板后, 需要回显的证书列表: ${state.selectedCertificateList}");
|
|
|
+ Log.d("切换模板后, 证书的回显 selectedCertificateList: ${state.labReqOption?.certificateList}");
|
|
|
+
|
|
|
+ state.selectedVehicleList = state.showTemplateData?.vehicle?.split(',')?? [];
|
|
|
+ // 循环 state.labReqOption?.vehicleList 满足条件修改 checked
|
|
|
+ state.labReqOption?.vehicleList?.forEach((e)=> {
|
|
|
+ if(state.selectedVehicleList.contains(e.value.toString())){
|
|
|
+ e.checked = 'checked'
|
|
|
+ }else {
|
|
|
+ e.checked = ''
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ Log.d("切换模板后, 需要回显的vehicle列表: ${state.selectedVehicleList}");
|
|
|
+ Log.d("切换模板后, 证书的回显 vehicleList: ${state.labReqOption?.vehicleList}");
|
|
|
+
|
|
|
+ }
|
|
|
+ // 更新
|
|
|
+ update();
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//选择日期
|
|
|
void pickJobDate() {
|
|
|
if (state.labReqOption == null || state.pageType == 2) {
|