// // MachineLogListViewController.swift // xingchuangke // // Created by 刘惠萍 on 2023/5/21. // import UIKit class MachineLogListViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource { let tableView: UITableView = { let tab = UITableView.init(frame: CGRect.zero, style: .plain) tab.tableFooterView = UIView.init() return tab }() var selectedActivityId: String = "" override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) appDelegate.setNavigationBarHidden(isHidden: false) self.title = "调拨日志" } override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.white initNavLeftBackButton() tableView.frame = self.view.bounds tableView.delegate = self tableView.dataSource = self tableView.separatorStyle = .none tableView.register(UINib(nibName: "MachineLogListCell", bundle: nil), forCellReuseIdentifier: "MachineLogListCell") self.view.addSubview(tableView) tableView.tableFooterView = UIView.init() tableView.showsVerticalScrollIndicator = false tableView.estimatedRowHeight = 100 tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {[weak self] in self!.currentPage = 1 self!.loadData() }) tableView.mj_header?.lastUpdatedTimeKey = "ShowTableViewCell" loadData() } // MARK: request func loadData() { let url = RequestURL.machineAllocationLog let params = NSMutableDictionary() params.setValue(CommonValue.getUserId(), forKey: "userId") // params.setValue("0002", forKey: "code") loadDataList(url: url, params: params, tableView: self.tableView, tag: 1001) } override func returnData(tag: Int) { tableView.reloadData() } override func returnError(tag: Int, type: String) { } func numberOfSections(in tableView: UITableView) -> Int { return 1 } // MARK: delegate func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.arrData.count } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 174 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MachineLogListCell", for: indexPath as IndexPath) as! MachineLogListCell cell.selectionStyle = .none let activDic = arrData[indexPath.row] as! NSDictionary cell.snCodeLbl.text = (activDic["sn_code"] as! String) cell.timeLbl.text = getString(current: indexPath.row, key: "allocation_time") cell.earnLbl.text = getString(current: indexPath.row, key: "real_name") cell.rewardLbl.text = getString(current: indexPath.row, key: "created_by") cell.oldLbl.text = getString(current: indexPath.row, key: "old_real_name") return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }