LoginPage.ets 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. // import router from '@ohos.router'
  2. // import CommonConstants from '../common/constants/CommonConstants'
  3. // import JGRequest from '../common/util/request/Request'
  4. // import { getToken, getUserInfo } from '../common/util/request/RequestInstance'
  5. // import AssistantSetModel from '../model/database/AssistantSetModel'
  6. // import UserAuthModel from '../model/database/UserAuthModel';
  7. // import UserInfo from '../model/UserInfo'
  8. // import process from '@ohos.process'
  9. // import RequestParamModel from '../viewmodel/RequestParamModel'
  10. //
  11. // export const stationDictValue: string = ''
  12. //
  13. // @Entry
  14. // @Component
  15. // struct LoginPage {
  16. // controller: TextInputController = new TextInputController()
  17. // //1是拣选,2是装配,3是测试,4是维修站,5是入库,6是出库
  18. // @State stationDictValue: string = ''
  19. // @State loginName: string = 'admin'
  20. // @State password: string = '123456'
  21. // @State dept: DeptInfo = { deptName: '仿真中心' }
  22. // @State workstation: WorkstationInfo = {}
  23. // @State productionLine: ProductionLine = { name: '仿真中心电装产线' }
  24. // @State deptArray: DeptInfo[] = []
  25. // @State lineArray: ProductionLine[] = []
  26. // @State workstationArray: WorkstationInfo[] = [{ name: '入库工位', stationDictValue: "5" },
  27. // { name: '预齐套工位', stationDictValue: "6" },
  28. // { name: '装配工位', stationDictValue: "3" }]
  29. // // 部门选择弹框
  30. // selectDeptController: CustomDialogController = new CustomDialogController({
  31. // builder: SelectDeptDialog({
  32. // dept: this.dept,
  33. // deptArray: this.deptArray
  34. // }),
  35. // autoCancel: true,
  36. // alignment: DialogAlignment.Center,
  37. // // gridCount: 3,
  38. // customStyle: true,
  39. // })
  40. // // 产线选择弹框
  41. // selectProductionLineController: CustomDialogController = new CustomDialogController({
  42. // builder: ProductionLineDialog({
  43. // productionLine: this.productionLine,
  44. // workstationArray: this.workstationArray,
  45. // workstation: this.workstation,
  46. // lineArray: this.lineArray,
  47. // }),
  48. // autoCancel: true,
  49. // alignment: DialogAlignment.Center,
  50. // // gridCount: 3,
  51. // customStyle: true,
  52. // })
  53. // // 工位选择弹框
  54. // selectWorkstationController: CustomDialogController = new CustomDialogController({
  55. // builder: SelectWorkstationDialog({
  56. // stationDictValue: this.stationDictValue,
  57. // workstation: this.workstation,
  58. // workstationArray: this.workstationArray,
  59. // lineCode: this.productionLine.code,
  60. // }),
  61. // autoCancel: true,
  62. // alignment: DialogAlignment.Center,
  63. // // gridCount: 3,
  64. // customStyle: true,
  65. // })
  66. //
  67. // async aboutToAppear() {
  68. // this.controller.stopEditing()
  69. // let userInfo = await UserAuthModel.getLast()
  70. // //登录时,查询部门、
  71. //
  72. // this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
  73. // if (this.deptArray && this.deptArray.length > 0) {
  74. // this.dept = this.deptArray[0]
  75. // }
  76. // //查询产线
  77. // this.lineArray = await JGRequest.post("/api/v1/base/productionLine/list/list", {
  78. // } as RequestParamModel) as ProductionLine[]
  79. // if (this.lineArray && this.lineArray.length > 0) {
  80. // this.productionLine = this.lineArray[0]
  81. // // 根据产线查询工位
  82. // this.workstationArray = await JGRequest.get("/api/v1/base/station/getStationList/" + this.productionLine.code + "/1", {
  83. // }) as WorkstationInfo[]
  84. // if (this.workstationArray && this.workstationArray.length > 0) {
  85. // this.workstation = this.workstationArray[0]
  86. // CommonConstants.stationDictValue = this.workstationArray[0].stationDictValue!
  87. // }
  88. // }
  89. //
  90. // if (userInfo) {
  91. // this.loginName = userInfo.userName ? userInfo.userName : ''
  92. // this.password = userInfo.password ? userInfo.password : ''
  93. // if (!userInfo.isLogin) {
  94. // return
  95. // }
  96. // }
  97. //
  98. // if (userInfo && userInfo.maintainLoginStatus === 1) {
  99. // CommonConstants.STATION_NANE = userInfo.stationName!
  100. // CommonConstants.STATION_ID = userInfo.stationId!
  101. // await getToken(userInfo.userName as string, userInfo.password as string, userInfo.orgId as number, userInfo?.stationId!.toString())
  102. // .then(token => {
  103. // if (token && token.length > 0) {
  104. // CommonConstants.AUTH_TOKEN = token
  105. // }
  106. // })
  107. // let user = await getUserInfo() as UserInfo
  108. // if (null != user) {
  109. // CommonConstants.USER_ID = user.id!
  110. // CommonConstants.USER_NAME = user.userName!
  111. // CommonConstants.USER_AVATAR = user.avatar!
  112. // CommonConstants.USER_AVATAR = user.avatar!
  113. // CommonConstants.LOGIN_OUT = false
  114. // CommonConstants.STATION_CODE = user.stationCode!
  115. // CommonConstants.STATION_IP = user.stationIp!
  116. // }
  117. // if (CommonConstants.AUTH_TOKEN && CommonConstants.AUTH_TOKEN.length > 0) {
  118. // if (CommonConstants.stationDictValue === '5') {
  119. // router.pushUrl({
  120. // url: 'pages/Menu',
  121. // params: {
  122. // userName: CommonConstants.USER_NAME as UserInfo,
  123. // avatar: CommonConstants.USER_AVATAR as UserInfo,
  124. // stationId: CommonConstants.STATION_NANE as WorkstationInfo
  125. // }
  126. // })
  127. // } else if (CommonConstants.stationDictValue === '6') {
  128. // router.pushUrl({
  129. // url: 'pages/Menu',
  130. // params: {
  131. // userName: CommonConstants.USER_NAME as UserInfo,
  132. // avatar: CommonConstants.USER_AVATAR as UserInfo,
  133. // stationId: CommonConstants.STATION_NANE as WorkstationInfo
  134. // }
  135. // })
  136. // }
  137. //
  138. // }
  139. // }
  140. // }
  141. //
  142. // build() {
  143. // Column() {
  144. // Column() {
  145. // Row() {
  146. // // Image($r('app.media.hjzx'))
  147. // // .width(px2vp(610))
  148. // // .height(px2vp(40))
  149. // }
  150. // .height('18.3%')
  151. // .width('88.5%')
  152. // .alignItems(VerticalAlign.Center)
  153. // .justifyContent(FlexAlign.Start)
  154. //
  155. // TextInput({ placeholder: '账号', text: this.loginName, controller: this.controller })
  156. // //.placeholderColor($r('app.color.0A84FF'))
  157. // //.placeholderFont({ size: $r('app.float.set_card_font_size'), weight: FontWeight.Medium })
  158. // .fontColor($r('app.color.000000'))
  159. // .fontWeight(FontWeight.Medium)
  160. // .fontSize($r('app.float.fontSize_28'))
  161. // .width('90.4%')
  162. // .enableKeyboardOnFocus(false)
  163. // .height('10.6%')
  164. // //.opacity($r('app.float.general_font_opacity'))
  165. // .borderRadius($r('app.float.virtualSize_6_4'))
  166. // .backgroundColor('#BCC2C9')
  167. // .onChange((value: string) => {
  168. // this.loginName = value
  169. // })
  170. // Row() {
  171. // }.height('4%')
  172. //
  173. // TextInput({ placeholder: '密码', text: this.password })
  174. // // .placeholderColor($r('app.color.login_text_input_placeholder_color'))
  175. // //.placeholderFont({ size: $r('app.float.set_card_font_size'), weight: FontWeight.Medium })
  176. // .fontColor($r('app.color.000000'))
  177. // .width('90.4%')
  178. // .height('10.6%')
  179. // .enableKeyboardOnFocus(false)
  180. // .fontWeight(FontWeight.Medium)
  181. // .fontSize($r('app.float.fontSize_28'))
  182. // .type(InputType.Password)
  183. // .borderRadius($r('app.float.virtualSize_6_4'))
  184. // .backgroundColor('#BCC2C9')
  185. // .onChange((value: string) => {
  186. // this.password = value
  187. // })
  188. //
  189. // Row() {
  190. // }.height('2.65%')
  191. //
  192. // // 部门、产线选择
  193. // Row() {
  194. // Row() {
  195. // Text('部门')
  196. // .fontColor($r('app.color.FFFFFF'))
  197. // .fontSize($r('app.float.fontSize_19_2'))
  198. // }
  199. // .width('47.8%')
  200. // .height('100%')
  201. // .alignItems(VerticalAlign.Top)
  202. //
  203. // Blank()
  204. // Row() {
  205. // Text('产线')
  206. // .fontColor($r('app.color.FFFFFF'))
  207. // .fontSize($r('app.float.fontSize_19_2'))
  208. // }
  209. // .alignItems(VerticalAlign.Top)
  210. // .width('47.8%')
  211. // .height('100%')
  212. // }
  213. // .height('4.5%')
  214. // .width('90.4%')
  215. //
  216. // // 部门选择
  217. // Row() {
  218. // Row() {
  219. // Text(this.dept ? this.dept.deptName : '')
  220. // .fontWeight(FontWeight.Medium)
  221. // .fontSize($r('app.float.fontSize_28'))
  222. // .fontColor($r('app.color.000000'))
  223. // //.opacity($r('app.float.general_font_opacity'))
  224. // Blank()
  225. // Row() {
  226. // Image($r('app.media.subscript_space'))
  227. // .height($r('app.float.virtualSize_16_8'))
  228. // .width($r('app.float.virtualSize_16_8'))
  229. // }
  230. // .alignItems(VerticalAlign.Bottom)
  231. // .justifyContent(FlexAlign.End)
  232. // .width('20%')
  233. // .height('100%')
  234. // }
  235. // .width('47.8%')
  236. // .height('100%')
  237. // .padding({ left: 10 })
  238. // .backgroundColor($r('app.color.FFFFFF'))
  239. // .borderRadius($r('app.float.virtualSize_6_4'))
  240. // .onClick(async () => {
  241. // this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
  242. // if (this.deptArray && this.deptArray.length > 0) {
  243. // this.dept = this.deptArray[0]
  244. // }
  245. // // 查询工位
  246. // this.workstationArray = await JGRequest.get("/api/v1/base/station/queryStationList", {
  247. // }) as WorkstationInfo[]
  248. // if (this.workstationArray && this.workstationArray.length > 0) {
  249. // this.workstation = this.workstationArray[0]
  250. // CommonConstants.stationDictValue = this.workstationArray[0].stationDictValue!
  251. //
  252. // }
  253. // this.selectDeptController.open()
  254. // })
  255. //
  256. // Blank()
  257. //
  258. // // 产线选择
  259. // Row() {
  260. // Text(this.productionLine ? this.productionLine.name : '')
  261. // .fontWeight(FontWeight.Medium)
  262. // .fontSize($r('app.float.fontSize_28'))
  263. // .fontColor($r('app.color.000000'))
  264. // //.opacity($r('app.float.general_font_opacity'))
  265. // Blank()
  266. // Row() {
  267. // Image($r('app.media.subscript_space'))
  268. // .height($r('app.float.virtualSize_16_8'))
  269. // .width($r('app.float.virtualSize_16_8'))
  270. // }
  271. // .alignItems(VerticalAlign.Bottom)
  272. // .justifyContent(FlexAlign.End)
  273. // .width('20%')
  274. // .height('100%')
  275. // }
  276. // .width('47.8%')
  277. // .height('100%')
  278. // .padding({ left: 10 })
  279. // .backgroundColor($r('app.color.FFFFFF'))
  280. // .borderRadius($r('app.float.virtualSize_6_4'))
  281. // .onClick(async () => {
  282. // this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
  283. // if (this.deptArray && this.deptArray.length > 0) {
  284. // this.dept = this.deptArray[0]
  285. // }
  286. // // 查询工位
  287. // this.workstationArray = await JGRequest.get("/api/v1/base/station/queryStationList", {
  288. // }) as WorkstationInfo[]
  289. // if (this.workstationArray && this.workstationArray.length > 0) {
  290. // this.workstation = this.workstationArray[0]
  291. // CommonConstants.stationDictValue = this.workstationArray[0].stationDictValue!
  292. //
  293. // }
  294. // this.selectProductionLineController.open()
  295. // })
  296. // }
  297. // .width('90.4%')
  298. // .height('10.6%')
  299. //
  300. // Row() {
  301. // }.height('2.65%')
  302. //
  303. // if (JSON.stringify(this.productionLine) === '{}') {
  304. // Row() {
  305. // }.height('15.1%')
  306. // } else {
  307. // // 工位选择
  308. // Row() {
  309. // Text('工位选择')
  310. // .fontColor($r('app.color.FFFFFF'))
  311. // .fontSize($r('app.float.fontSize_19_2'))
  312. // }
  313. // .height('4.5%')
  314. // .width('90.4%')
  315. // .justifyContent(FlexAlign.Start)
  316. // .alignItems(VerticalAlign.Top)
  317. //
  318. // Row() {
  319. // Text(!this.workstationArray || this.workstationArray.length <= 0 ? '无数据' : (this.workstation ? this.workstation.name : ''))
  320. // .fontWeight(FontWeight.Medium)
  321. // .fontSize($r('app.float.fontSize_28'))
  322. // .fontColor($r('app.color.000000'))
  323. // //.opacity(!this.workstationArray || this.workstationArray.length <= 0 ? $r('app.float.zero_point_two_font_opacity') : $r('app.float.general_font_opacity'))
  324. // Blank()
  325. // Row() {
  326. // Image($r('app.media.subscript_space'))
  327. // .height($r('app.float.virtualSize_16_8'))
  328. // .width($r('app.float.virtualSize_16_8'))
  329. // }
  330. // .alignItems(VerticalAlign.Bottom)
  331. // .justifyContent(FlexAlign.End)
  332. // .width('20%')
  333. // .height('100%')
  334. // }
  335. // .width('90.4%')
  336. // .height('10.6%')
  337. // .backgroundColor($r('app.color.FFFFFF'))
  338. // .borderRadius($r('app.float.virtualSize_6_4'))
  339. // .padding({ left: 10 })
  340. // .onClick(() => {
  341. // if (!this.workstationArray || this.workstationArray.length <= 0) {
  342. // return
  343. // }
  344. // this.selectWorkstationController.open()
  345. // })
  346. // }
  347. //
  348. // Column() {
  349. // Row().height('35%')
  350. // Text('登录')
  351. // .fontWeight(FontWeight.Medium)
  352. // .fontSize($r('app.float.fontSize_28'))
  353. // .fontColor($r('app.color.FFFFFF'))
  354. // .textAlign(TextAlign.Center)
  355. // .width(px2vp(608))
  356. // .height(px2vp(80))
  357. // .backgroundColor($r('app.color.0A59F7'))
  358. // .borderRadius($r('app.float.virtualSize_23'))
  359. // //.opacity(this.loginName && this.loginName.length > 0 && this.password && this.password.length > 0 && JSON.stringify(this.dept) != '{}' && JSON.stringify(this.workstation) != '{}' ? 1 : $r('app.float.card_font_default_opacity'))
  360. // }
  361. // .width('90.4%')
  362. // .layoutWeight(1)
  363. // .alignItems(HorizontalAlign.Center)
  364. // .justifyContent(FlexAlign.Start)
  365. // .onClick(async () => {
  366. //
  367. // console.log("tesTag1" + '+++++++++++++++' + this.workstation.stationDictValue)
  368. // if (this.loginName && this.loginName.length > 0 && this.password && this.password.length > 0) {
  369. // await getToken(this.loginName, this.password, this.dept?.id ? this.dept.id : 0, this.workstation?.id ? this.workstation.id : '0')
  370. // .then(token => {
  371. // if (token && token.length > 0) {
  372. // CommonConstants.AUTH_TOKEN = token
  373. // }
  374. // })
  375. // if (CommonConstants.AUTH_TOKEN.length <= 0) {
  376. // return
  377. // }
  378. // let userInfo = await getUserInfo() as UserInfo
  379. // CommonConstants.USER_ID = userInfo.id!
  380. // CommonConstants.USER_NAME = userInfo.userName!
  381. // CommonConstants.USER_AVATAR = userInfo.avatar!
  382. // CommonConstants.STATION_CODE = userInfo.stationCode!
  383. // CommonConstants.STATION_IP = userInfo.stationIp!
  384. // CommonConstants.STATION_NANE = this.workstation && this.workstation.name ? this.workstation.name : ''
  385. // CommonConstants.STATION_ID = this.workstation && this.workstation.id ? Number.parseInt(this.workstation.id) : 0
  386. // let user = await UserAuthModel.getByUserId(userInfo.id ? userInfo.id : 0)
  387. // if (!user || !user.id) {
  388. // // 将后端数据库id作为userId, 默认是保持登录
  389. // user = {
  390. // userId: userInfo.id,
  391. // userName: this.loginName,
  392. // password: this.password,
  393. // orgId: this.dept ? this.dept.id : 0,
  394. // stationId: this.workstation ? Number.parseInt(this.workstation.id!) : 0,
  395. // stationName: this.workstation && this.workstation.name ? this.workstation.name : '',
  396. // stationDictValue: this.workstation?.stationDictValue ? this.workstation.stationDictValue! : '',
  397. // avatar: userInfo.avatar,
  398. // maintainLoginStatus: 1,
  399. // updateTime: new Date().getTime(),
  400. // isLogin: true,
  401. // }
  402. // let res = await UserAuthModel.addUser(user)
  403. // res = await AssistantSetModel.addAssistantSet({
  404. // userId: userInfo.id,
  405. // voiceWakeUp: 1,
  406. // timbre: 2,
  407. // wakeFree: 2,
  408. // promptBroadcast: 1,
  409. // voiceVolume: 0,
  410. //
  411. // })
  412. // }
  413. // CommonConstants.LOGIN_OUT = false
  414. //
  415. // if (this.workstation.stationDictValue === '5') {
  416. // router.pushUrl({
  417. // url: 'pages/Menu',
  418. // params: {
  419. // userName: CommonConstants.USER_NAME as UserInfo,
  420. // avatar: CommonConstants.USER_AVATAR as UserInfo,
  421. // stationId: CommonConstants.STATION_NANE as WorkstationInfo
  422. // }
  423. // })
  424. // } else if (this.workstation.stationDictValue === '6') {
  425. // router.pushUrl({
  426. // url: 'pages/Menu',
  427. // params: {
  428. // userName: CommonConstants.USER_NAME as UserInfo,
  429. // avatar: CommonConstants.USER_AVATAR as UserInfo,
  430. // stationId: CommonConstants.STATION_NANE as WorkstationInfo
  431. // }
  432. // })
  433. // }
  434. //
  435. // }
  436. // })
  437. // }
  438. // .width('35%')
  439. // .height('70%')
  440. // .backgroundColor($r('app.color.A0A8B2'))
  441. // .borderRadius($r('app.float.virtualSize_6_4'))
  442. // .margin({ right: '8.25%' })
  443. //
  444. // Row() {
  445. // Image($r('app.media.shutdown'))
  446. // .width($r('app.float.virtualSize_36'))
  447. // .height($r('app.float.virtualSize_36'))
  448. // }
  449. // .height('19%')
  450. // .width('100%')
  451. // .alignItems(VerticalAlign.Bottom)
  452. // .justifyContent(FlexAlign.End)
  453. // .margin({ bottom: '1%', right: '1%' })
  454. // .onClick(() => {
  455. // let pro = new process.ProcessManager();
  456. // pro.exit(0);
  457. // })
  458. // }
  459. // .width('100%')
  460. // .height('100%')
  461. // .backgroundImage($r('app.media.login_backgroundImage'))
  462. // .backgroundImageSize({ width: '100%', height: '100%' })
  463. // .alignItems(HorizontalAlign.End)
  464. // .justifyContent(FlexAlign.End)
  465. //
  466. // }
  467. // }
  468. //
  469. // // 部门选择弹框
  470. // @CustomDialog
  471. // struct SelectDeptDialog {
  472. // @Link dept: DeptInfo
  473. // @State deptArray: DeptInfo[] = [{ deptName: '仿真中心', id: 111, orgId: 112 }]
  474. // controller?: CustomDialogController
  475. // cancel: () => void = () => {
  476. // }
  477. // confirm: () => void = () => {
  478. // }
  479. //
  480. // async aboutToAppear() {
  481. // if (!this.deptArray || this.deptArray.length <= 0) {
  482. // this.deptArray = await JGRequest.get("/api/v1/sys/dept/orgList", {}) as DeptInfo[]
  483. // if (this.deptArray && this.deptArray.length > 0) {
  484. // this.dept = this.deptArray[0]
  485. // }
  486. // }
  487. // }
  488. //
  489. // build() {
  490. // Column() {
  491. // Row() {
  492. // Text('选择部门')
  493. // .fontSize($r('app.float.fontSize_38'))
  494. // .fontWeight(FontWeight.Medium)
  495. // .fontColor($r('app.color.000000'))
  496. // //.opacity($r('app.float.general_font_opacity'))
  497. // }
  498. // .height('20%')
  499. // .justifyContent(FlexAlign.Center)
  500. //
  501. // Column() {
  502. // List({ space: 10 }) {
  503. // ForEach(this.deptArray, (item: DeptInfo) => {
  504. // ListItem() {
  505. // Row() {
  506. // Text(item.deptName)
  507. // .fontSize($r('app.float.fontSize_28'))
  508. // .fontWeight(FontWeight.Medium)
  509. // .fontColor(this.dept && this.dept.id === item.id ? $r('app.color.FFFFFF') : $r('app.color.000000'))
  510. // //.opacity($r('app.float.general_font_opacity'))
  511. // }
  512. // .height('15%')
  513. // .width('80%')
  514. // .backgroundColor(this.dept && this.dept.id === item.id ? $r('app.color.0A59F7') : $r('app.color.FFFFFF'))
  515. // .borderRadius($r('app.float.virtualSize_6_4'))
  516. // .padding({ left: 10 })
  517. // .onClick(() => {
  518. // this.dept = item
  519. // if (this.controller != undefined) {
  520. // this.controller.close()
  521. // }
  522. // })
  523. // }
  524. // })
  525. // }
  526. // .alignListItem(ListItemAlign.Center)
  527. // }
  528. // .height('70%')
  529. // .width('80%')
  530. // .justifyContent(FlexAlign.Start)
  531. // }
  532. // .width('48%')
  533. // .height('63%')
  534. // .backgroundColor($r('app.color.F1F3F5'))
  535. // .justifyContent(FlexAlign.Start)
  536. // .borderRadius($r('app.float.virtualSize_6_4'))
  537. // }
  538. // }
  539. //
  540. // // 产线选择弹框
  541. // @CustomDialog
  542. // struct ProductionLineDialog {
  543. // @Link productionLine: ProductionLine
  544. // @State lineArray: ProductionLine[] = []
  545. // @Link workstation: WorkstationInfo
  546. // @Link workstationArray: WorkstationInfo[]
  547. // controller?: CustomDialogController
  548. // cancel: () => void = () => {
  549. // }
  550. // confirm: () => void = () => {
  551. // }
  552. //
  553. // async aboutToAppear() {
  554. // if (this.lineArray && this.lineArray.length > 0) {
  555. // return
  556. // }
  557. // // 查询产线
  558. // this.lineArray = await JGRequest.post("/api/v1/base/productionLine/list/list", {
  559. // } as RequestParamModel) as ProductionLine[]
  560. // if (this.lineArray && this.lineArray.length > 0) {
  561. // this.productionLine = this.lineArray[0]
  562. // // 根据产线查询工位
  563. // this.workstationArray = await JGRequest.get("/api/v1/base/station/getStationList/" + this.productionLine.code + "/1", {
  564. // }) as WorkstationInfo[]
  565. // console.log("====================1234567890" + "成功+++++" + this.workstationArray[0])
  566. // if (this.workstationArray && this.workstationArray.length > 0) {
  567. // this.workstation = this.workstationArray[0]
  568. // console.log("====================1234567890" + "成功" + this.workstation)
  569. // }
  570. // }
  571. // }
  572. //
  573. // build() {
  574. // Column() {
  575. // Row() {
  576. // Text('选择产线')
  577. // .fontSize($r('app.float.fontSize_38'))
  578. // .fontWeight(FontWeight.Medium)
  579. // .fontColor($r('app.color.000000'))
  580. // //.opacity($r('app.float.general_font_opacity'))
  581. // }
  582. // .height('20%')
  583. // .justifyContent(FlexAlign.Center)
  584. //
  585. // Column() {
  586. // List({ space: 10 }) {
  587. // ForEach(this.lineArray, (item: ProductionLine) => {
  588. // ListItem() {
  589. // Row() {
  590. // Text(item.name)
  591. // .fontSize($r('app.float.fontSize_28'))
  592. // .fontWeight(FontWeight.Medium)
  593. // .fontColor(this.productionLine && this.productionLine.id === item.id ? $r('app.color.FFFFFF') : $r('app.color.000000'))
  594. // //.opacity($r('app.float.general_font_opacity'))
  595. // }
  596. // .height('15%')
  597. // .width('80%')
  598. // .backgroundColor(this.productionLine && this.productionLine.id === item.id ? $r('app.color.0A59F7') : $r('app.color.FFFFFF'))
  599. // .borderRadius($r('app.float.virtualSize_6_4'))
  600. // .padding({ left: 10 })
  601. // .onClick(async () => {
  602. // this.productionLine = item
  603. // // 根据产线查询工位
  604. // this.workstationArray = await JGRequest.get("/api/v1/base/station/getStationList/" + this.productionLine.code + "/1", {
  605. // }) as WorkstationInfo[]
  606. // if (this.workstationArray && this.workstationArray.length > 0) {
  607. // this.workstation = this.workstationArray[0]
  608. // } else {
  609. // this.workstation = {}
  610. // }
  611. // if (this.controller != undefined) {
  612. // this.controller.close()
  613. // }
  614. // })
  615. // }
  616. // })
  617. // }
  618. // .alignListItem(ListItemAlign.Center)
  619. // }
  620. // .height('70%')
  621. // .width('80%')
  622. // .justifyContent(FlexAlign.Start)
  623. // }
  624. // .width('48%')
  625. // .height('63%')
  626. // .backgroundColor($r('app.color.F1F3F5'))
  627. // .justifyContent(FlexAlign.Start)
  628. // .borderRadius($r('app.float.virtualSize_6_4'))
  629. // }
  630. // }
  631. //
  632. // // 工位选择弹框
  633. // @CustomDialog
  634. // struct SelectWorkstationDialog {
  635. // @Link stationDictValue: string
  636. // @Link workstation: WorkstationInfo
  637. // // 产线编码
  638. // private lineCode: string = ''
  639. // @Link workstationArray: WorkstationInfo[]
  640. // controller?: CustomDialogController
  641. // cancel: () => void = () => {
  642. // }
  643. // confirm: () => void = () => {
  644. // }
  645. //
  646. // async aboutToAppear() {
  647. // if (this.workstationArray && this.workstationArray.length > 0) {
  648. // return
  649. // }
  650. // if (!this.lineCode || this.lineCode.length <= 0) {
  651. // return
  652. // }
  653. // // 根据产线查询工位
  654. // this.workstationArray = await JGRequest.get("/api/v1/base/station/getStationList/" + this.lineCode + "/1", {
  655. // }) as WorkstationInfo[]
  656. // if (this.workstationArray && this.workstationArray.length > 0) {
  657. // this.workstation = this.workstationArray[0]
  658. // }
  659. // }
  660. //
  661. // build() {
  662. // Column() {
  663. // Row() {
  664. // Text('选择工位')
  665. // .fontSize($r('app.float.fontSize_38'))
  666. // .fontWeight(FontWeight.Medium)
  667. // .fontColor($r('app.color.000000'))
  668. // //.opacity($r('app.float.general_font_opacity'))
  669. // }
  670. // .height('20%')
  671. // .justifyContent(FlexAlign.Center)
  672. //
  673. // Column() {
  674. // List({ space: 10 }) {
  675. // ForEach(this.workstationArray, (item: WorkstationInfo, index: number) => {
  676. // ListItem() {
  677. // Row() {
  678. // Text(item.name)
  679. // .fontSize($r('app.float.fontSize_28'))
  680. // .fontWeight(FontWeight.Medium)
  681. // .fontColor(this.workstation && this.workstation.id === item.id ? $r('app.color.FFFFFF') : $r('app.color.000000'))
  682. // //.opacity($r('app.float.general_font_opacity'))
  683. // }
  684. // .height('15%')
  685. // .width('80%')
  686. // .backgroundColor(this.workstation && this.workstation.id === item.id ? $r('app.color.0A59F7') : $r('app.color.FFFFFF'))
  687. // .borderRadius($r('app.float.virtualSize_6_4'))
  688. // .padding({ left: 10 })
  689. // .onClick(() => {
  690. // this.workstation = item
  691. // this.stationDictValue = item.stationDictValue!
  692. // CommonConstants.stationDictValue = this.workstationArray[index].stationDictValue!
  693. //
  694. //
  695. // if (this.controller != undefined) {
  696. // this.controller.close()
  697. // }
  698. // })
  699. // }
  700. // })
  701. // }
  702. // .alignListItem(ListItemAlign.Center)
  703. // }
  704. // .height('70%')
  705. // .width('80%')
  706. // .justifyContent(FlexAlign.Start)
  707. // }
  708. // .width('48%')
  709. // .height('63%')
  710. // .backgroundColor($r('app.color.F1F3F5'))
  711. // .justifyContent(FlexAlign.Start)
  712. // .borderRadius($r('app.float.virtualSize_6_4'))
  713. // }
  714. // }
  715. //
  716. // export class DeptInfo {
  717. // id?: number
  718. // // 部门名称
  719. // deptName?: string
  720. // // 组织id
  721. // orgId?: number
  722. // }
  723. //
  724. // export class WorkstationInfo {
  725. // id?: string
  726. // // 工位名称
  727. // name?: string
  728. // //工位类型
  729. // stationDictValue?: string
  730. // }
  731. //
  732. // class ProductionLine {
  733. // // 产线code
  734. // code?: string
  735. // // 创建时间
  736. // created?: string
  737. // // 创建人
  738. // creato?: string
  739. // // 是否删除
  740. // deleted?: number
  741. // // 部门ID
  742. // deptId?: string
  743. // // 主键
  744. // id?: string
  745. // // 数级结构层级
  746. // level?: string
  747. // // 产线管理者
  748. // manager?: string
  749. // // 产线名称
  750. // name?: string
  751. // // 组织ID
  752. // orgId?: string
  753. // // 所属车间code
  754. // parentCode?: string
  755. // // 产线位置
  756. // position?: string
  757. // // 产线描述
  758. // remark?: string
  759. // // 修改时间
  760. // updated?: string
  761. // // 上次修改人
  762. // updator?: string
  763. // // 所属车间
  764. // workShopName?: string
  765. // }