diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.xib b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib new file mode 100644 index 0000000..eb4294a --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.xib b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib new file mode 100644 index 0000000..eb4294a --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift index 145c3c5..53cce5a 100644 --- a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift @@ -23,6 +23,10 @@ var inspectUserLabel: UILabel! var inspectEndTimeLabel: UILabel! var eventListButton: UIButton! + var startPointAnnotation: MAPointAnnotation! + var endPointAnnotation: MAPointAnnotation! + + var valueDelegate: TransferIdDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -81,14 +85,29 @@ inspectUserLabel.text = detailModel.user inspectStartTimeLabel.text = detailModel.startTime inspectEndTimeLabel.text = detailModel.endTime + // 绘制起点终点 + startPointAnnotation = MAPointAnnotation() + let startPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) // 移动到巡检起始经纬度 - let pointAnnotation = MAPointAnnotation() - let pointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) - mapView.centerCoordinate = pointCoordinate // 移动到位置点 - pointAnnotation.coordinate = pointCoordinate // 显示定位点 - mapView.addAnnotation(pointAnnotation) + mapView.centerCoordinate = startPointCoordinate + startPointAnnotation.coordinate = startPointCoordinate + + endPointAnnotation = MAPointAnnotation() + let endPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.endLat), longitude: CLLocationDegrees(detailModel.endLng)) + endPointAnnotation.coordinate = endPointCoordinate + mapView.addAnnotations([startPointAnnotation!, endPointAnnotation!]) + // 绘制路线 + var lineCoordinates: [CLLocationCoordinate2D] = [] + for route in detailModel.routes { + if route.lat == nil || route.lng == nil { + return + } + lineCoordinates.append(CLLocationCoordinate2D(latitude: CLLocationDegrees(route.lat), longitude: CLLocationDegrees(route.lng))) + } + mapView.add(MAPolyline(coordinates: &lineCoordinates, count: UInt(lineCoordinates.count))) } + // 描点 func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! { if annotation.isKind(of: MAPointAnnotation.self) { let pointReuseIndetifier = "pointReuseIndetifier" @@ -96,16 +115,41 @@ if annotationView == nil { annotationView = MAPinAnnotationView(annotation: annotation, reuseIdentifier: pointReuseIndetifier) } - annotationView!.canShowCallout = true + // 区分起点终点,分别设置图标 + if annotation.isEqual(startPointAnnotation) { + annotationView!.image = UIImage(named: "qidian") + } + if annotation.isEqual(endPointAnnotation) { + annotationView!.image = UIImage(named: "zhongdian") + } + annotationView!.imageView.frame = CGRect(x: 0, y: 0, width: 32, height: 32) annotationView!.animatesDrop = true - annotationView!.isDraggable = true + annotationView!.isDraggable = false + // 设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView!.centerOffset = CGPoint(x: 0, y: -16) return annotationView! } return nil } + // 画线 + func mapView(_ mapView: MAMapView!, rendererFor overlay: MAOverlay!) -> MAOverlayRenderer! { + if overlay.isKind(of: MAPolyline.self) { + let renderer: MAPolylineRenderer = MAPolylineRenderer(overlay: overlay) + renderer.lineWidth = 4.0 + renderer.strokeColor = .red + return renderer + } + return nil + } + @objc func toEventListViewController(sender: UIButton) { - print("toEventListViewController") + let eventViewController = EventTaskViewController(nibName: "EventTaskViewController", bundle: nil) + // 委托代理 + valueDelegate = eventViewController + // 实现代理的方法,传值 + valueDelegate.transfer(controller: self, dic: ["inspectionId": id!]) + navigationController?.pushViewController(eventViewController, animated: true) } func addInspectSubview() { diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.xib b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib new file mode 100644 index 0000000..eb4294a --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift index 145c3c5..53cce5a 100644 --- a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift @@ -23,6 +23,10 @@ var inspectUserLabel: UILabel! var inspectEndTimeLabel: UILabel! var eventListButton: UIButton! + var startPointAnnotation: MAPointAnnotation! + var endPointAnnotation: MAPointAnnotation! + + var valueDelegate: TransferIdDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -81,14 +85,29 @@ inspectUserLabel.text = detailModel.user inspectStartTimeLabel.text = detailModel.startTime inspectEndTimeLabel.text = detailModel.endTime + // 绘制起点终点 + startPointAnnotation = MAPointAnnotation() + let startPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) // 移动到巡检起始经纬度 - let pointAnnotation = MAPointAnnotation() - let pointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) - mapView.centerCoordinate = pointCoordinate // 移动到位置点 - pointAnnotation.coordinate = pointCoordinate // 显示定位点 - mapView.addAnnotation(pointAnnotation) + mapView.centerCoordinate = startPointCoordinate + startPointAnnotation.coordinate = startPointCoordinate + + endPointAnnotation = MAPointAnnotation() + let endPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.endLat), longitude: CLLocationDegrees(detailModel.endLng)) + endPointAnnotation.coordinate = endPointCoordinate + mapView.addAnnotations([startPointAnnotation!, endPointAnnotation!]) + // 绘制路线 + var lineCoordinates: [CLLocationCoordinate2D] = [] + for route in detailModel.routes { + if route.lat == nil || route.lng == nil { + return + } + lineCoordinates.append(CLLocationCoordinate2D(latitude: CLLocationDegrees(route.lat), longitude: CLLocationDegrees(route.lng))) + } + mapView.add(MAPolyline(coordinates: &lineCoordinates, count: UInt(lineCoordinates.count))) } + // 描点 func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! { if annotation.isKind(of: MAPointAnnotation.self) { let pointReuseIndetifier = "pointReuseIndetifier" @@ -96,16 +115,41 @@ if annotationView == nil { annotationView = MAPinAnnotationView(annotation: annotation, reuseIdentifier: pointReuseIndetifier) } - annotationView!.canShowCallout = true + // 区分起点终点,分别设置图标 + if annotation.isEqual(startPointAnnotation) { + annotationView!.image = UIImage(named: "qidian") + } + if annotation.isEqual(endPointAnnotation) { + annotationView!.image = UIImage(named: "zhongdian") + } + annotationView!.imageView.frame = CGRect(x: 0, y: 0, width: 32, height: 32) annotationView!.animatesDrop = true - annotationView!.isDraggable = true + annotationView!.isDraggable = false + // 设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView!.centerOffset = CGPoint(x: 0, y: -16) return annotationView! } return nil } + // 画线 + func mapView(_ mapView: MAMapView!, rendererFor overlay: MAOverlay!) -> MAOverlayRenderer! { + if overlay.isKind(of: MAPolyline.self) { + let renderer: MAPolylineRenderer = MAPolylineRenderer(overlay: overlay) + renderer.lineWidth = 4.0 + renderer.strokeColor = .red + return renderer + } + return nil + } + @objc func toEventListViewController(sender: UIButton) { - print("toEventListViewController") + let eventViewController = EventTaskViewController(nibName: "EventTaskViewController", bundle: nil) + // 委托代理 + valueDelegate = eventViewController + // 实现代理的方法,传值 + valueDelegate.transfer(controller: self, dic: ["inspectionId": id!]) + navigationController?.pushViewController(eventViewController, animated: true) } func addInspectSubview() { diff --git a/LaserMethane/ViewController/Inspect/InspectViewController.swift b/LaserMethane/ViewController/Inspect/InspectViewController.swift index 3cb9617..464f971 100644 --- a/LaserMethane/ViewController/Inspect/InspectViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectViewController.swift @@ -131,8 +131,7 @@ // 实现代理的方法,传值 let row = (indexPath as NSIndexPath).row let model = rowsArray[row] - let transferDic: NSDictionary = ["id": model.id] - valueDelegate.transfer(controller: self, dic: transferDic) + valueDelegate.transfer(controller: self, dic: ["id": model.id]) navigationController?.pushViewController(mapViewController, animated: true) } } diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.xib b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib new file mode 100644 index 0000000..eb4294a --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift index 145c3c5..53cce5a 100644 --- a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift @@ -23,6 +23,10 @@ var inspectUserLabel: UILabel! var inspectEndTimeLabel: UILabel! var eventListButton: UIButton! + var startPointAnnotation: MAPointAnnotation! + var endPointAnnotation: MAPointAnnotation! + + var valueDelegate: TransferIdDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -81,14 +85,29 @@ inspectUserLabel.text = detailModel.user inspectStartTimeLabel.text = detailModel.startTime inspectEndTimeLabel.text = detailModel.endTime + // 绘制起点终点 + startPointAnnotation = MAPointAnnotation() + let startPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) // 移动到巡检起始经纬度 - let pointAnnotation = MAPointAnnotation() - let pointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) - mapView.centerCoordinate = pointCoordinate // 移动到位置点 - pointAnnotation.coordinate = pointCoordinate // 显示定位点 - mapView.addAnnotation(pointAnnotation) + mapView.centerCoordinate = startPointCoordinate + startPointAnnotation.coordinate = startPointCoordinate + + endPointAnnotation = MAPointAnnotation() + let endPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.endLat), longitude: CLLocationDegrees(detailModel.endLng)) + endPointAnnotation.coordinate = endPointCoordinate + mapView.addAnnotations([startPointAnnotation!, endPointAnnotation!]) + // 绘制路线 + var lineCoordinates: [CLLocationCoordinate2D] = [] + for route in detailModel.routes { + if route.lat == nil || route.lng == nil { + return + } + lineCoordinates.append(CLLocationCoordinate2D(latitude: CLLocationDegrees(route.lat), longitude: CLLocationDegrees(route.lng))) + } + mapView.add(MAPolyline(coordinates: &lineCoordinates, count: UInt(lineCoordinates.count))) } + // 描点 func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! { if annotation.isKind(of: MAPointAnnotation.self) { let pointReuseIndetifier = "pointReuseIndetifier" @@ -96,16 +115,41 @@ if annotationView == nil { annotationView = MAPinAnnotationView(annotation: annotation, reuseIdentifier: pointReuseIndetifier) } - annotationView!.canShowCallout = true + // 区分起点终点,分别设置图标 + if annotation.isEqual(startPointAnnotation) { + annotationView!.image = UIImage(named: "qidian") + } + if annotation.isEqual(endPointAnnotation) { + annotationView!.image = UIImage(named: "zhongdian") + } + annotationView!.imageView.frame = CGRect(x: 0, y: 0, width: 32, height: 32) annotationView!.animatesDrop = true - annotationView!.isDraggable = true + annotationView!.isDraggable = false + // 设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView!.centerOffset = CGPoint(x: 0, y: -16) return annotationView! } return nil } + // 画线 + func mapView(_ mapView: MAMapView!, rendererFor overlay: MAOverlay!) -> MAOverlayRenderer! { + if overlay.isKind(of: MAPolyline.self) { + let renderer: MAPolylineRenderer = MAPolylineRenderer(overlay: overlay) + renderer.lineWidth = 4.0 + renderer.strokeColor = .red + return renderer + } + return nil + } + @objc func toEventListViewController(sender: UIButton) { - print("toEventListViewController") + let eventViewController = EventTaskViewController(nibName: "EventTaskViewController", bundle: nil) + // 委托代理 + valueDelegate = eventViewController + // 实现代理的方法,传值 + valueDelegate.transfer(controller: self, dic: ["inspectionId": id!]) + navigationController?.pushViewController(eventViewController, animated: true) } func addInspectSubview() { diff --git a/LaserMethane/ViewController/Inspect/InspectViewController.swift b/LaserMethane/ViewController/Inspect/InspectViewController.swift index 3cb9617..464f971 100644 --- a/LaserMethane/ViewController/Inspect/InspectViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectViewController.swift @@ -131,8 +131,7 @@ // 实现代理的方法,传值 let row = (indexPath as NSIndexPath).row let model = rowsArray[row] - let transferDic: NSDictionary = ["id": model.id] - valueDelegate.transfer(controller: self, dic: transferDic) + valueDelegate.transfer(controller: self, dic: ["id": model.id]) navigationController?.pushViewController(mapViewController, animated: true) } } diff --git a/Pods/SwiftyRSA/Source/X509Certificate.swift b/Pods/SwiftyRSA/Source/X509Certificate.swift new file mode 100644 index 0000000..2cb4f86 --- /dev/null +++ b/Pods/SwiftyRSA/Source/X509Certificate.swift @@ -0,0 +1,163 @@ +// +// X509Certificate.swift +// SwiftyRSA +// +// Created by Stchepinsky Nathan on 24/06/2021. +// Copyright © 2021 Scoop. All rights reserved. +// + +import Foundation + +/// Encoding/Decoding lengths as octets +private extension NSInteger { + func encodedOctets() -> [CUnsignedChar] { + // Short form + if self < 128 { + return [CUnsignedChar(self)] + } + + // Long form + let long = Int(log2(Double(self)) / 8 + 1) + var len = self + var result: [CUnsignedChar] = [CUnsignedChar(long + 0x80)] + + for _ in 0..> 8 + } + + return result + } + + init?(octetBytes: [CUnsignedChar], startIdx: inout NSInteger) { + if octetBytes[startIdx] < 128 { + // Short form + self.init(octetBytes[startIdx]) + startIdx += 1 + } else { + // Long form + let octets = NSInteger(octetBytes[startIdx] as UInt8 - 128) + + if octets > octetBytes.count - startIdx { + self.init(0) + return nil + } + + var result = UInt64(0) + + for octet in 1...octets { + result = (result << 8) + result = result + UInt64(octetBytes[startIdx + octet]) + } + + startIdx += 1 + octets + self.init(result) + } + } +} + +public extension Data { + // This code source come from Heimdall project https://github.com/henrinormak/Heimdall published under MIT Licence + + /// This method prepend the X509 header to a given public key + func prependx509Header() -> Data { + let result = NSMutableData() + + let encodingLength: Int = (self.count + 1).encodedOctets().count + let OID: [CUnsignedChar] = [0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00] + + var builder: [CUnsignedChar] = [] + + // ASN.1 SEQUENCE + builder.append(0x30) + + // Overall size, made of OID + bitstring encoding + actual key + let size = OID.count + 2 + encodingLength + self.count + let encodedSize = size.encodedOctets() + builder.append(contentsOf: encodedSize) + result.append(builder, length: builder.count) + result.append(OID, length: OID.count) + builder.removeAll(keepingCapacity: false) + + builder.append(0x03) + builder.append(contentsOf: (self.count + 1).encodedOctets()) + builder.append(0x00) + result.append(builder, length: builder.count) + + // Actual key bytes + result.append(self) + + return result as Data + } + + func hasX509Header() throws -> Bool { + let node: Asn1Parser.Node + do { + node = try Asn1Parser.parse(data: self) + } catch { + throw SwiftyRSAError.asn1ParsingFailed + } + + // Ensure the raw data is an ASN1 sequence + guard case .sequence(let nodes) = node else { + return false + } + + // Must contain 2 elements, a sequence and a bit string + if nodes.count != 2 { + return false + } + + // Ensure the first node is an ASN1 sequence + guard case .sequence(let firstNode) = nodes[0] else { + return false + } + + // Must contain 2 elements, an object id and NULL + if firstNode.count != 2 { + return false + } + + guard case .objectIdentifier(_) = firstNode[0] else { + return false + } + + guard case .null = firstNode[1] else { + return false + } + + // The 2sd child has to be a bit string containing a sequence of 2 int + let last = nodes[1] + if case .bitString(let secondChildSequence) = last { + return try secondChildSequence.isAnHeaderlessKey() + } else { + return false + } + } + + func isAnHeaderlessKey() throws -> Bool { + let node: Asn1Parser.Node + do { + node = try Asn1Parser.parse(data: self) + } catch { + throw SwiftyRSAError.asn1ParsingFailed + } + + // Ensure the raw data is an ASN1 sequence + guard case .sequence(let nodes) = node else { + return false + } + + // Detect whether the sequence only has integers, in which case it's a headerless key + let onlyHasIntegers = nodes.filter { node -> Bool in + if case .integer = node { + return false + } + return true + }.isEmpty + + // Headerless key + return onlyHasIntegers + } +} diff --git a/LaserMethane.xcodeproj/project.pbxproj b/LaserMethane.xcodeproj/project.pbxproj index 30f31d3..4449877 100644 --- a/LaserMethane.xcodeproj/project.pbxproj +++ b/LaserMethane.xcodeproj/project.pbxproj @@ -18,6 +18,10 @@ 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC426B3EABC00606939 /* BigImageViewController.swift */; }; 65E05AC726B3EABC00606939 /* BigImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65E05AC526B3EABC00606939 /* BigImageViewController.xib */; }; 65E05AC926B3EF0600606939 /* TransferImageDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */; }; + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */; }; + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */; }; + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */; }; + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */; }; 65F2DFC526AFF1A300179EBD /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */; }; 65F2DFCA26AFF2A900179EBD /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC726AFF2A900179EBD /* Constant.swift */; }; 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */; }; @@ -521,6 +525,10 @@ 65E05AC426B3EABC00606939 /* BigImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BigImageViewController.swift; sourceTree = ""; }; 65E05AC526B3EABC00606939 /* BigImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BigImageViewController.xib; sourceTree = ""; }; 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferImageDelegate.swift; sourceTree = ""; }; + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferIdDelegate.swift; sourceTree = ""; }; + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskViewController.swift; sourceTree = ""; }; + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EventTaskViewController.xib; sourceTree = ""; }; + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTaskModel.swift; sourceTree = ""; }; 65F2DFC426AFF1A300179EBD /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65F2DFC726AFF2A900179EBD /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = ""; }; 65F2DFC926AFF2A900179EBD /* KeychainManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainManager.swift; sourceTree = ""; }; @@ -681,6 +689,7 @@ 65F2DFFD26B0128C00179EBD /* ActionResultModel.swift */, 65F2E04626B25B5D00179EBD /* EventListModel.swift */, 65BF7DD426BB8F880097B132 /* InspectDetailModel.swift */, + 65EB076F26BCD7C300F9C0EC /* EventTaskModel.swift */, ); path = Model; sourceTree = ""; @@ -745,6 +754,8 @@ 65F2E03B26B1723700179EBD /* InspectViewController.xib */, 65BF7A2826B937410097B132 /* InspectMapViewController.swift */, 65BF7A2926B937410097B132 /* InspectMapViewController.xib */, + 65EB076B26BCD76F00F9C0EC /* EventTaskViewController.swift */, + 65EB076C26BCD76F00F9C0EC /* EventTaskViewController.xib */, ); path = Inspect; sourceTree = ""; @@ -767,6 +778,7 @@ children = ( 65F2E04D26B260BC00179EBD /* TransferValueDelegate.swift */, 65E05AC826B3EF0600606939 /* TransferImageDelegate.swift */, + 65EB076526BCCA6E00F9C0EC /* TransferIdDelegate.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,6 +1317,7 @@ 65F2DFFB26B0099800179EBD /* GuideViewController.xib in Resources */, 65F2E02626B1326D00179EBD /* CommonTableViewCell.xib in Resources */, 65F2E01226B0E6D700179EBD /* MainMenuViewController.xib in Resources */, + 65EB076E26BCD76F00F9C0EC /* EventTaskViewController.xib in Resources */, 65F2E02E26B1341300179EBD /* SwitchTableViewCell.xib in Resources */, 65F2E03326B164CC00179EBD /* LogViewController.xib in Resources */, 65BF7A2B26B937410097B132 /* InspectMapViewController.xib in Resources */, @@ -1389,9 +1402,11 @@ 65F2E01C26B1019200179EBD /* SettingViewController.swift in Sources */, 6518222726AFE9EB00FCC275 /* String.swift in Sources */, 65F2E02D26B1341300179EBD /* SwitchTableViewCell.swift in Sources */, + 65EB076D26BCD76F00F9C0EC /* EventTaskViewController.swift in Sources */, 65F2E01126B0E6D700179EBD /* MainMenuViewController.swift in Sources */, 65F2E05326B2812700179EBD /* ImageCollectionViewCell.swift in Sources */, 65F2E02526B1326D00179EBD /* CommonTableViewCell.swift in Sources */, + 65EB077026BCD7C300F9C0EC /* EventTaskModel.swift in Sources */, 65F2E01426B0E8CA00179EBD /* AlertHub.swift in Sources */, 65BF7DD526BB8F880097B132 /* InspectDetailModel.swift in Sources */, 65F2E02126B1242200179EBD /* DefaultTableViewCell.swift in Sources */, @@ -1411,6 +1426,7 @@ 65F2E00A26B012D700179EBD /* LoginViewController.swift in Sources */, 65F2E04426B2392600179EBD /* ListCustomCell.swift in Sources */, 65E05AC626B3EABC00606939 /* BigImageViewController.swift in Sources */, + 65EB076626BCCA6E00F9C0EC /* TransferIdDelegate.swift in Sources */, 65F2DFCC26AFF2A900179EBD /* KeychainManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index a869621..9c0fe8f 100644 --- a/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/LaserMethane.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/LaserMethane/Model/EventListModel.swift b/LaserMethane/Model/EventListModel.swift index bb8b4b0..74f0d6e 100644 --- a/LaserMethane/Model/EventListModel.swift +++ b/LaserMethane/Model/EventListModel.swift @@ -1,6 +1,7 @@ // // EventListModel.swift // LaserMethane +// 事件记录列表Model // // Created by 203 on 2021/7/29. // diff --git a/LaserMethane/Model/EventTaskModel.swift b/LaserMethane/Model/EventTaskModel.swift new file mode 100644 index 0000000..e911620 --- /dev/null +++ b/LaserMethane/Model/EventTaskModel.swift @@ -0,0 +1,65 @@ +// +// EventTaskModel.swift +// LaserMethane +// 根据巡检id查询事件列表Model +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import SwiftyJSON + +struct EventTaskModel { + var code: Int + var data: EventModel + var message: String + var success: Bool + + init(respJson: JSON) { + code = respJson["code"].intValue + data = EventModel(respJson: respJson["data"]) + message = respJson["message"].stringValue + success = respJson["success"].boolValue + } +} + +struct EventModel { + var list: [ListModel] + + init(respJson: JSON) { + list = [ListModel]() + let listArray = respJson["list"].arrayValue + for listJson in listArray { + let value = ListModel(respJson: listJson) + list.append(value) + } + } +} + +struct ListModel { + var lat: Double + var type: String + var user: String + var images: String + var id: String + var lng: Double + var data: Int + var name: String + var description: String + var inspectionId: String + var createTime: String + + init(respJson: JSON) { + lat = respJson["lat"].doubleValue + type = respJson["type"].stringValue + user = respJson["user"].stringValue + images = respJson["images"].stringValue + id = respJson["id"].stringValue + lng = respJson["lng"].doubleValue + data = respJson["data"].intValue + name = respJson["name"].stringValue + description = respJson["description"].stringValue + inspectionId = respJson["inspectionId"].stringValue + createTime = respJson["createTime"].stringValue + } +} diff --git a/LaserMethane/Model/InspectDetailModel.swift b/LaserMethane/Model/InspectDetailModel.swift index 3bb9d19..6c9bce4 100644 --- a/LaserMethane/Model/InspectDetailModel.swift +++ b/LaserMethane/Model/InspectDetailModel.swift @@ -48,7 +48,7 @@ var endTime: String! var id: String! var name: String! - var routes: String! + var routes: [RouteModel] var startLat: Float! var startLng: Float! var startTime: String! @@ -61,10 +61,31 @@ endTime = respJson["endTime"].stringValue id = respJson["id"].stringValue name = respJson["name"].stringValue - routes = respJson["routes"].stringValue + routes = [RouteModel]() + let routesJson = respJson["routes"].stringValue + let pointArray = routesJson + .replacingOccurrences(of: "[[", with: "") + .replacingOccurrences(of: "]]", with: "") + .components(separatedBy: "],[") + for point in pointArray { +// 116.26862901475694,39.916187065972224 + let value = RouteModel(resp: point) + routes.append(value) + } startLat = respJson["startLat"].floatValue startLng = respJson["startLng"].floatValue startTime = respJson["startTime"].stringValue user = respJson["user"].stringValue } } + +struct RouteModel { + var lat: Float! + var lng: Float! + + init(resp: String) { + let point = resp.components(separatedBy: ",") + lat = Float(point[1]) + lng = Float(point[0]) + } +} diff --git a/LaserMethane/Protocol/TransferIdDelegate.swift b/LaserMethane/Protocol/TransferIdDelegate.swift new file mode 100644 index 0000000..febd7bd --- /dev/null +++ b/LaserMethane/Protocol/TransferIdDelegate.swift @@ -0,0 +1,13 @@ +// +// TransferIdDelegate.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Foundation +import UIKit + +protocol TransferIdDelegate: NSObjectProtocol { + func transfer(controller: UIViewController, dic: NSDictionary) +} diff --git a/LaserMethane/Util/Constant.swift b/LaserMethane/Util/Constant.swift index 2a1a299..3073220 100644 --- a/LaserMethane/Util/Constant.swift +++ b/LaserMethane/Util/Constant.swift @@ -23,4 +23,5 @@ case inspectList = "/inspection/search" case eventList = "/task/search" case inspectionDetail = "/inspection/info" + case searchByInspect = "/task/searchByInspection" } diff --git a/LaserMethane/ViewController/Event/EventDetailViewController.swift b/LaserMethane/ViewController/Event/EventDetailViewController.swift index 4be1b2d..a123d3c 100644 --- a/LaserMethane/ViewController/Event/EventDetailViewController.swift +++ b/LaserMethane/ViewController/Event/EventDetailViewController.swift @@ -113,8 +113,7 @@ // 委托代理 imageDelegate = bigImageViewController // 实现代理的方法,传值 - let transferDic: NSDictionary = ["row": row + 1, "images": images!] - imageDelegate.transfer(controller: self, dic: transferDic) + imageDelegate.transfer(controller: self, dic: ["row": row + 1, "images": images!]) navigationController?.pushViewController(bigImageViewController, animated: true) } } diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.swift b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift new file mode 100644 index 0000000..a8c576b --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.swift @@ -0,0 +1,75 @@ +// +// EventTaskViewController.swift +// LaserMethane +// +// Created by 203 on 2021/8/6. +// + +import Alamofire +import KeychainAccess +import SwiftyJSON +import UIKit + +class EventTaskViewController: UIViewController, TransferIdDelegate { + @IBOutlet var taskTableView: UITableView! + + var id: String? + var rowsArray: [ListModel] = [] + var valueDelegate: TransferValueDelegate! + + override func viewDidLoad() { + super.viewDidLoad() + taskTableView.register(UINib(nibName: "ListCustomCell", bundle: nil), forCellReuseIdentifier: "listCustomCell") + taskTableView.dataSource = self + taskTableView.delegate = self + // 查询事件列表 + let keychain = Keychain() + let baseURL = keychain[Constant.ServerConfig.rawValue] + let eventListURL = baseURL! + Constant.searchByInspect.rawValue + Alamofire.request(eventListURL, method: .get, parameters: ["inspectionId": id!], headers: ["token": keychain[Constant.Token.rawValue]!]).responseJSON { response in + switch response.result { + case let .success(value): + self.rowsArray = EventTaskModel(respJson: JSON(value)).data.list + // 必须要重新加载数据,否则不走数据绑定 + self.taskTableView.reloadData() + case .failure: + AlertHub.shared.showWaringAlert(controller: self, messge: "查询事件清单失败") + } + } + } + + func transfer(controller: UIViewController, dic: NSDictionary) { + id = dic["inspectionId"] as? String + } +} + +extension EventTaskViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return rowsArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell: ListCustomCell! = taskTableView.dequeueReusableCell(withIdentifier: "listCustomCell", for: indexPath) as? ListCustomCell + cell.selectionStyle = .none + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + cell.nameLabel.text = model.name + "-" + model.type + cell.dateLabel.text = model.createTime + cell.userLabel.text = model.user + return cell + } +} + +extension EventTaskViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let detailViewController = EventDetailViewController(nibName: "EventDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let transferDic: NSDictionary = ["createTime": model.createTime, "description": model.description, "data": model.data, "images": model.images] + valueDelegate.transfer(controller: self, dic: transferDic) + navigationController?.pushViewController(detailViewController, animated: true) + } +} diff --git a/LaserMethane/ViewController/Inspect/EventTaskViewController.xib b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib new file mode 100644 index 0000000..eb4294a --- /dev/null +++ b/LaserMethane/ViewController/Inspect/EventTaskViewController.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift index 145c3c5..53cce5a 100644 --- a/LaserMethane/ViewController/Inspect/InspectMapViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectMapViewController.swift @@ -23,6 +23,10 @@ var inspectUserLabel: UILabel! var inspectEndTimeLabel: UILabel! var eventListButton: UIButton! + var startPointAnnotation: MAPointAnnotation! + var endPointAnnotation: MAPointAnnotation! + + var valueDelegate: TransferIdDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -81,14 +85,29 @@ inspectUserLabel.text = detailModel.user inspectStartTimeLabel.text = detailModel.startTime inspectEndTimeLabel.text = detailModel.endTime + // 绘制起点终点 + startPointAnnotation = MAPointAnnotation() + let startPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) // 移动到巡检起始经纬度 - let pointAnnotation = MAPointAnnotation() - let pointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.startLat), longitude: CLLocationDegrees(detailModel.startLng)) - mapView.centerCoordinate = pointCoordinate // 移动到位置点 - pointAnnotation.coordinate = pointCoordinate // 显示定位点 - mapView.addAnnotation(pointAnnotation) + mapView.centerCoordinate = startPointCoordinate + startPointAnnotation.coordinate = startPointCoordinate + + endPointAnnotation = MAPointAnnotation() + let endPointCoordinate = CLLocationCoordinate2D(latitude: CLLocationDegrees(detailModel.endLat), longitude: CLLocationDegrees(detailModel.endLng)) + endPointAnnotation.coordinate = endPointCoordinate + mapView.addAnnotations([startPointAnnotation!, endPointAnnotation!]) + // 绘制路线 + var lineCoordinates: [CLLocationCoordinate2D] = [] + for route in detailModel.routes { + if route.lat == nil || route.lng == nil { + return + } + lineCoordinates.append(CLLocationCoordinate2D(latitude: CLLocationDegrees(route.lat), longitude: CLLocationDegrees(route.lng))) + } + mapView.add(MAPolyline(coordinates: &lineCoordinates, count: UInt(lineCoordinates.count))) } + // 描点 func mapView(_ mapView: MAMapView!, viewFor annotation: MAAnnotation!) -> MAAnnotationView! { if annotation.isKind(of: MAPointAnnotation.self) { let pointReuseIndetifier = "pointReuseIndetifier" @@ -96,16 +115,41 @@ if annotationView == nil { annotationView = MAPinAnnotationView(annotation: annotation, reuseIdentifier: pointReuseIndetifier) } - annotationView!.canShowCallout = true + // 区分起点终点,分别设置图标 + if annotation.isEqual(startPointAnnotation) { + annotationView!.image = UIImage(named: "qidian") + } + if annotation.isEqual(endPointAnnotation) { + annotationView!.image = UIImage(named: "zhongdian") + } + annotationView!.imageView.frame = CGRect(x: 0, y: 0, width: 32, height: 32) annotationView!.animatesDrop = true - annotationView!.isDraggable = true + annotationView!.isDraggable = false + // 设置中心点偏移,使得标注底部中间点成为经纬度对应点 + annotationView!.centerOffset = CGPoint(x: 0, y: -16) return annotationView! } return nil } + // 画线 + func mapView(_ mapView: MAMapView!, rendererFor overlay: MAOverlay!) -> MAOverlayRenderer! { + if overlay.isKind(of: MAPolyline.self) { + let renderer: MAPolylineRenderer = MAPolylineRenderer(overlay: overlay) + renderer.lineWidth = 4.0 + renderer.strokeColor = .red + return renderer + } + return nil + } + @objc func toEventListViewController(sender: UIButton) { - print("toEventListViewController") + let eventViewController = EventTaskViewController(nibName: "EventTaskViewController", bundle: nil) + // 委托代理 + valueDelegate = eventViewController + // 实现代理的方法,传值 + valueDelegate.transfer(controller: self, dic: ["inspectionId": id!]) + navigationController?.pushViewController(eventViewController, animated: true) } func addInspectSubview() { diff --git a/LaserMethane/ViewController/Inspect/InspectViewController.swift b/LaserMethane/ViewController/Inspect/InspectViewController.swift index 3cb9617..464f971 100644 --- a/LaserMethane/ViewController/Inspect/InspectViewController.swift +++ b/LaserMethane/ViewController/Inspect/InspectViewController.swift @@ -131,8 +131,7 @@ // 实现代理的方法,传值 let row = (indexPath as NSIndexPath).row let model = rowsArray[row] - let transferDic: NSDictionary = ["id": model.id] - valueDelegate.transfer(controller: self, dic: transferDic) + valueDelegate.transfer(controller: self, dic: ["id": model.id]) navigationController?.pushViewController(mapViewController, animated: true) } } diff --git a/Pods/SwiftyRSA/Source/X509Certificate.swift b/Pods/SwiftyRSA/Source/X509Certificate.swift new file mode 100644 index 0000000..2cb4f86 --- /dev/null +++ b/Pods/SwiftyRSA/Source/X509Certificate.swift @@ -0,0 +1,163 @@ +// +// X509Certificate.swift +// SwiftyRSA +// +// Created by Stchepinsky Nathan on 24/06/2021. +// Copyright © 2021 Scoop. All rights reserved. +// + +import Foundation + +/// Encoding/Decoding lengths as octets +private extension NSInteger { + func encodedOctets() -> [CUnsignedChar] { + // Short form + if self < 128 { + return [CUnsignedChar(self)] + } + + // Long form + let long = Int(log2(Double(self)) / 8 + 1) + var len = self + var result: [CUnsignedChar] = [CUnsignedChar(long + 0x80)] + + for _ in 0..> 8 + } + + return result + } + + init?(octetBytes: [CUnsignedChar], startIdx: inout NSInteger) { + if octetBytes[startIdx] < 128 { + // Short form + self.init(octetBytes[startIdx]) + startIdx += 1 + } else { + // Long form + let octets = NSInteger(octetBytes[startIdx] as UInt8 - 128) + + if octets > octetBytes.count - startIdx { + self.init(0) + return nil + } + + var result = UInt64(0) + + for octet in 1...octets { + result = (result << 8) + result = result + UInt64(octetBytes[startIdx + octet]) + } + + startIdx += 1 + octets + self.init(result) + } + } +} + +public extension Data { + // This code source come from Heimdall project https://github.com/henrinormak/Heimdall published under MIT Licence + + /// This method prepend the X509 header to a given public key + func prependx509Header() -> Data { + let result = NSMutableData() + + let encodingLength: Int = (self.count + 1).encodedOctets().count + let OID: [CUnsignedChar] = [0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00] + + var builder: [CUnsignedChar] = [] + + // ASN.1 SEQUENCE + builder.append(0x30) + + // Overall size, made of OID + bitstring encoding + actual key + let size = OID.count + 2 + encodingLength + self.count + let encodedSize = size.encodedOctets() + builder.append(contentsOf: encodedSize) + result.append(builder, length: builder.count) + result.append(OID, length: OID.count) + builder.removeAll(keepingCapacity: false) + + builder.append(0x03) + builder.append(contentsOf: (self.count + 1).encodedOctets()) + builder.append(0x00) + result.append(builder, length: builder.count) + + // Actual key bytes + result.append(self) + + return result as Data + } + + func hasX509Header() throws -> Bool { + let node: Asn1Parser.Node + do { + node = try Asn1Parser.parse(data: self) + } catch { + throw SwiftyRSAError.asn1ParsingFailed + } + + // Ensure the raw data is an ASN1 sequence + guard case .sequence(let nodes) = node else { + return false + } + + // Must contain 2 elements, a sequence and a bit string + if nodes.count != 2 { + return false + } + + // Ensure the first node is an ASN1 sequence + guard case .sequence(let firstNode) = nodes[0] else { + return false + } + + // Must contain 2 elements, an object id and NULL + if firstNode.count != 2 { + return false + } + + guard case .objectIdentifier(_) = firstNode[0] else { + return false + } + + guard case .null = firstNode[1] else { + return false + } + + // The 2sd child has to be a bit string containing a sequence of 2 int + let last = nodes[1] + if case .bitString(let secondChildSequence) = last { + return try secondChildSequence.isAnHeaderlessKey() + } else { + return false + } + } + + func isAnHeaderlessKey() throws -> Bool { + let node: Asn1Parser.Node + do { + node = try Asn1Parser.parse(data: self) + } catch { + throw SwiftyRSAError.asn1ParsingFailed + } + + // Ensure the raw data is an ASN1 sequence + guard case .sequence(let nodes) = node else { + return false + } + + // Detect whether the sequence only has integers, in which case it's a headerless key + let onlyHasIntegers = nodes.filter { node -> Bool in + if case .integer = node { + return false + } + return true + }.isEmpty + + // Headerless key + return onlyHasIntegers + } +} diff --git a/Pods/Target Support Files/Pods-LaserMethane/Pods-LaserMethane-resources.sh b/Pods/Target Support Files/Pods-LaserMethane/Pods-LaserMethane-resources.sh new file mode 100755 index 0000000..8cede9e --- /dev/null +++ b/Pods/Target Support Files/Pods-LaserMethane/Pods-LaserMethane-resources.sh @@ -0,0 +1,129 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +function on_error { + echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" +} +trap 'on_error $LINENO' ERR + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +case "${TARGETED_DEVICE_FAMILY:-}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + 3) + TARGET_DEVICE_ARGS="--target-device tv" + ;; + 4) + TARGET_DEVICE_ARGS="--target-device watch" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" || true + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_resource "${PODS_ROOT}/AMap3DMap/MAMapKit.framework/AMap.bundle" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_resource "${PODS_ROOT}/AMap3DMap/MAMapKit.framework/AMap.bundle" +fi + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find -L "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "${PODS_ROOT}*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi +fi