SwitchingStationViews.ets 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. import ProcessRequest from '../common/util/request/ProcessRequest'
  2. import { MessageInfo, MessagePage } from '../viewmodel/MessageInfo'
  3. import TaskSeqVO from '../viewmodel/process/TaskSeqInfo'
  4. import { DeptInfo, ProductionLine, WorkstationInfo } from '../viewmodel/UserInfo'
  5. import RequestParamModel from '../viewmodel/RequestParamModel'
  6. @CustomDialog
  7. export struct SwitchingStationDialog{
  8. private scrollerList: Scroller = new Scroller()
  9. //当前工位
  10. @Link currentStation:string
  11. @Link currentPLCode:string
  12. @Link currentStationId:string
  13. @State selectStationIndex: number = -1
  14. //工位列表
  15. @State stationsList : WorkstationInfo[]=[]
  16. loadStations = async () => {
  17. this.stationsList = await ProcessRequest.get(`api/v1/base/station/getStationList/${this.currentPLCode}/0`, {}) as WorkstationInfo[];
  18. };
  19. controller: CustomDialogController
  20. aboutToAppear(): void {
  21. this.loadStations();
  22. }
  23. private onSelectStation(index: number) {
  24. this.selectStationIndex = index
  25. }
  26. build() {
  27. Column() {
  28. Column() {
  29. Text("切换工位")
  30. .fontColor($r('app.color.FFFFFF'))
  31. .fontSize($r('app.float.fontSize_30'))
  32. }
  33. .height('8%')
  34. .width('100%')
  35. .justifyContent(FlexAlign.Center)
  36. Column(){
  37. List({space:10,scroller:this.scrollerList}) {
  38. ForEach(this.stationsList, (item:WorkstationInfo,index) => {
  39. ListItem() {
  40. Column(){
  41. Text(item.name)
  42. .fontSize($r('app.float.fontSize_24'))
  43. .fontColor($r('app.color.FFFFFF'))
  44. } .backgroundColor(index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
  45. .borderRadius($r('app.float.virtualSize_16'))
  46. .padding(8)
  47. .width('100%')
  48. .height('12%')
  49. .alignItems(HorizontalAlign.Center)
  50. .justifyContent(FlexAlign.Center)
  51. .border({
  52. width: index === this.selectStationIndex ? 2 : 0,
  53. color: index === this.selectStationIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  54. })
  55. .onClick(() => {
  56. this.onSelectStation(index)
  57. })
  58. }
  59. })
  60. }
  61. .width('70%')
  62. .height('100%')
  63. }
  64. .justifyContent(FlexAlign.SpaceEvenly)
  65. .width('100%')
  66. .height('81%')
  67. .margin({ top: '2%'})
  68. Column() {
  69. Divider()
  70. .vertical(false)
  71. .strokeWidth(1)
  72. .color($r('app.color.15FFFFFF'))
  73. Row() {
  74. Row() {
  75. Text('取消')
  76. .fontColor($r('app.color.60FFFFFF'))
  77. .fontSize($r('app.float.fontSize_30'))
  78. }
  79. .justifyContent(FlexAlign.Center)
  80. .width('50%')
  81. .onClick(() => this.controller.close())
  82. Divider()
  83. .vertical(true)
  84. .strokeWidth(1)
  85. .color($r('app.color.15FFFFFF'))
  86. Row() {
  87. Text('确定')
  88. .fontColor($r('app.color.007AFF'))
  89. .fontSize($r('app.float.fontSize_30'))
  90. }
  91. .justifyContent(FlexAlign.Center)
  92. .width('50%')
  93. .onClick(() => {
  94. this.currentStation = this.stationsList[this.selectStationIndex].name??""
  95. this.currentStationId=this.stationsList[this.selectStationIndex].id??""
  96. this.controller.close();
  97. })
  98. }
  99. }
  100. .width('100%')
  101. .height('8%')
  102. }
  103. .height('71%')
  104. .width('30%')
  105. .backgroundColor($r('app.color.2A2A2A'))
  106. .justifyContent(FlexAlign.End)
  107. .alignItems(HorizontalAlign.Start)
  108. .borderColor($r('app.color.000000'))
  109. .borderWidth(1)
  110. .borderRadius($r('app.float.virtualSize_16'))
  111. }
  112. }
  113. @CustomDialog
  114. export struct SwitchingProductLineDialog{
  115. private scrollerList: Scroller = new Scroller()
  116. //当前产线
  117. @Link currentProductLine:string
  118. @Link currentPLCode:string
  119. @State selectProductLineIndex: number = -1
  120. //产线列表
  121. @State productLineList : ProductionLine[]=[]
  122. loadStations = async () => {
  123. this.productLineList = await ProcessRequest.post('api/v1/base/productionLine/list/list', {}as RequestParamModel) as ProductionLine[];
  124. };
  125. controller: CustomDialogController
  126. aboutToAppear(): void {
  127. this.loadStations();
  128. }
  129. private onSelectProductLine(index: number) {
  130. this.selectProductLineIndex = index
  131. }
  132. build() {
  133. Column() {
  134. Column() {
  135. Text("切换工位")
  136. .fontColor($r('app.color.FFFFFF'))
  137. .fontSize($r('app.float.fontSize_30'))
  138. }
  139. .height('8%')
  140. .width('100%')
  141. .justifyContent(FlexAlign.Center)
  142. Column(){
  143. List({space:10,scroller:this.scrollerList}) {
  144. ForEach(this.productLineList, (item:ProductionLine,index) => {
  145. ListItem() {
  146. Column(){
  147. Text(item.name)
  148. .fontSize($r('app.float.fontSize_24'))
  149. .fontColor($r('app.color.FFFFFF'))
  150. } .backgroundColor(index === this.selectProductLineIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
  151. .borderRadius($r('app.float.virtualSize_16'))
  152. .padding(8)
  153. .width('100%')
  154. .height('12%')
  155. .alignItems(HorizontalAlign.Center)
  156. .justifyContent(FlexAlign.Center)
  157. .border({
  158. width: index === this.selectProductLineIndex ? 2 : 0,
  159. color: index === this.selectProductLineIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  160. })
  161. .onClick(() => {
  162. this.onSelectProductLine(index)
  163. })
  164. }
  165. })
  166. }
  167. .width('70%')
  168. .height('100%')
  169. }
  170. .justifyContent(FlexAlign.SpaceEvenly)
  171. .width('100%')
  172. .height('81%')
  173. .margin({ top: '2%'})
  174. Column() {
  175. Divider()
  176. .vertical(false)
  177. .strokeWidth(1)
  178. .color($r('app.color.15FFFFFF'))
  179. Row() {
  180. Row() {
  181. Text('取消')
  182. .fontColor($r('app.color.60FFFFFF'))
  183. .fontSize($r('app.float.fontSize_30'))
  184. }
  185. .justifyContent(FlexAlign.Center)
  186. .width('50%')
  187. .onClick(() => this.controller.close())
  188. Divider()
  189. .vertical(true)
  190. .strokeWidth(1)
  191. .color($r('app.color.15FFFFFF'))
  192. Row() {
  193. Text('确定')
  194. .fontColor($r('app.color.007AFF'))
  195. .fontSize($r('app.float.fontSize_30'))
  196. }
  197. .justifyContent(FlexAlign.Center)
  198. .width('50%')
  199. .onClick(() => {
  200. this.currentProductLine = this.productLineList[this.selectProductLineIndex].name??""
  201. this.currentPLCode = this.productLineList[this.selectProductLineIndex].code??""
  202. this.controller.close();
  203. })
  204. }
  205. }
  206. .width('100%')
  207. .height('8%')
  208. }
  209. .height('71%')
  210. .width('30%')
  211. .backgroundColor($r('app.color.2A2A2A'))
  212. .justifyContent(FlexAlign.End)
  213. .alignItems(HorizontalAlign.Start)
  214. .borderColor($r('app.color.000000'))
  215. .borderWidth(1)
  216. .borderRadius($r('app.float.virtualSize_16'))
  217. }
  218. }
  219. @CustomDialog
  220. export struct SwitchingDeptDialog{
  221. private scrollerList: Scroller = new Scroller()
  222. //当前部门
  223. @Link currentDept:string
  224. @Link currentOrgId:number
  225. @State selectDeptIndex: number = -1
  226. //部门列表
  227. @State departmentsList : DeptInfo[]=[]
  228. loadStations = async () => {
  229. this.departmentsList = await ProcessRequest.get('/api/v1/sys/dept/orgList', {}) as DeptInfo[];
  230. };
  231. controller: CustomDialogController
  232. aboutToAppear(): void {
  233. this.loadStations();
  234. }
  235. private onSelectStation(index: number) {
  236. this.selectDeptIndex = index
  237. }
  238. build() {
  239. Column() {
  240. Column() {
  241. Text("切换部门")
  242. .fontColor($r('app.color.FFFFFF'))
  243. .fontSize($r('app.float.fontSize_30'))
  244. }
  245. .height('8%')
  246. .width('100%')
  247. .justifyContent(FlexAlign.Center)
  248. Column(){
  249. List({space:10,scroller:this.scrollerList}) {
  250. ForEach(this.departmentsList, (item:DeptInfo,index) => {
  251. ListItem() {
  252. Column(){
  253. Text(item.deptName)
  254. .fontSize($r('app.float.fontSize_24'))
  255. .fontColor($r('app.color.FFFFFF'))
  256. } .backgroundColor(index === this.selectDeptIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
  257. .borderRadius($r('app.float.virtualSize_16'))
  258. .padding(8)
  259. .width('100%')
  260. .height('12%')
  261. .alignItems(HorizontalAlign.Center)
  262. .justifyContent(FlexAlign.Center)
  263. .border({
  264. width: index === this.selectDeptIndex ? 2 : 0,
  265. color: index === this.selectDeptIndex ? $r('app.color.2030D158') : $r('app.color.20FFFFFF')
  266. })
  267. .onClick(() => {
  268. this.onSelectStation(index)
  269. })
  270. }
  271. })
  272. }
  273. .width('70%')
  274. .height('100%')
  275. }
  276. .justifyContent(FlexAlign.SpaceEvenly)
  277. .width('100%')
  278. .height('81%')
  279. .margin({ top: '2%'})
  280. Column() {
  281. Divider()
  282. .vertical(false)
  283. .strokeWidth(1)
  284. .color($r('app.color.15FFFFFF'))
  285. Row() {
  286. Row() {
  287. Text('取消')
  288. .fontColor($r('app.color.60FFFFFF'))
  289. .fontSize($r('app.float.fontSize_30'))
  290. }
  291. .justifyContent(FlexAlign.Center)
  292. .width('50%')
  293. .onClick(() => this.controller.close())
  294. Divider()
  295. .vertical(true)
  296. .strokeWidth(1)
  297. .color($r('app.color.15FFFFFF'))
  298. Row() {
  299. Text('确定')
  300. .fontColor($r('app.color.007AFF'))
  301. .fontSize($r('app.float.fontSize_30'))
  302. }
  303. .justifyContent(FlexAlign.Center)
  304. .width('50%')
  305. .onClick(() => {
  306. this.currentDept = this.departmentsList[this.selectDeptIndex].deptName??""
  307. this.currentOrgId = this.departmentsList[this.selectDeptIndex].id??0
  308. this.controller.close();
  309. })
  310. }
  311. }
  312. .width('100%')
  313. .height('8%')
  314. }
  315. .height('71%')
  316. .width('30%')
  317. .backgroundColor($r('app.color.2A2A2A'))
  318. .justifyContent(FlexAlign.End)
  319. .alignItems(HorizontalAlign.Start)
  320. .borderColor($r('app.color.000000'))
  321. .borderWidth(1)
  322. .borderRadius($r('app.float.virtualSize_16'))
  323. }
  324. }