|
@@ -7,6 +7,8 @@ import { Warehousing}from '../common/component/Warehousing'
|
|
|
import { SmartFactoryCard }from '../common/component/SmartFactoryCard'
|
|
|
import CommonConstants from '../common/constants/CommonConstants'
|
|
|
import UniversalCard from '../model/UniversalCard'
|
|
|
+import UniversalCardModel from '../model/database/UniversalCardModel';
|
|
|
+//登录退出
|
|
|
@CustomDialog
|
|
|
struct login {
|
|
|
@Link textValue: string
|
|
@@ -60,6 +62,7 @@ struct login {
|
|
|
.backgroundColor('#ffff')
|
|
|
}
|
|
|
}
|
|
|
+//卡片服务
|
|
|
@CustomDialog
|
|
|
struct confirmPopup {
|
|
|
@Link cardServices:UniversalCard[]
|
|
@@ -109,18 +112,19 @@ struct confirmPopup {
|
|
|
.width('120%')
|
|
|
.backgroundColor($r('app.color.general_font_white_color'))
|
|
|
|
|
|
-
|
|
|
- Image(this.index===1?$r("app.media.processImages"):$r('app.media.storage'))
|
|
|
- .width(px2vp(220))
|
|
|
- .height(px2vp(220))
|
|
|
+ Image(this.index===1?$r("app.media.processImages")
|
|
|
+ :this.index===2?$r('app.media.jg_circular_icon'):$r('app.media.storage'))
|
|
|
+ .width(px2vp(280))
|
|
|
+ .height(px2vp(280))
|
|
|
.borderRadius(15)
|
|
|
}
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
.width('350px')
|
|
|
.height('600px')
|
|
|
- .offset({x:this.x+20+'px', y:this.y-340+'px'})
|
|
|
+ .offset({x:this.x+'px', y:this.y-410+'px'})
|
|
|
}
|
|
|
}
|
|
|
+//开关重启
|
|
|
@CustomDialog
|
|
|
struct shutdown {
|
|
|
@Link shutdownTransparency:number
|
|
@@ -184,7 +188,7 @@ struct Index {
|
|
|
@State index:number=0
|
|
|
@State x:number=0
|
|
|
@State y:number=0
|
|
|
- @State cardServices:UniversalCard[] = CommonConstants.Card_DATA
|
|
|
+ @State cardServices:UniversalCard[] =[]
|
|
|
@State SmartFactoryCardDelete:number=0
|
|
|
@State SmartFactoryDelete:number=0
|
|
|
@State SmartFactoryCarLongPressDelete:number=0
|
|
@@ -231,6 +235,26 @@ struct Index {
|
|
|
autoCancel:true,
|
|
|
customStyle:true,
|
|
|
})
|
|
|
+ async aboutToAppear(){
|
|
|
+ this.cardServices= await UniversalCardModel.getListByUserId(CommonConstants.USER_ID)
|
|
|
+ if (!this.cardServices||this.cardServices.length<=0) {
|
|
|
+ for (let index = 0; index < CommonConstants.CARD_TYPE_DATA.length; index++) {
|
|
|
+ const card:UniversalCard = {
|
|
|
+ userId:CommonConstants.USER_ID,
|
|
|
+ cardType: CommonConstants.CARD_TYPE_DATA[index],
|
|
|
+ cardStatus:1,
|
|
|
+ cardSort: index
|
|
|
+ };
|
|
|
+ UniversalCardModel.addUniversalCard(card)
|
|
|
+ this.cardServices.push(card)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ console.log("查询结果"+ JSON.stringify(this.cardServices))
|
|
|
+
|
|
|
+ }
|
|
|
build() {
|
|
|
Stack(){
|
|
|
Row() {
|
|
@@ -240,196 +264,201 @@ struct Index {
|
|
|
this.avatarFrame=!this.avatarFrame
|
|
|
})
|
|
|
Row() {
|
|
|
-
|
|
|
- Flex({ wrap: FlexWrap.Wrap }) {
|
|
|
- if (this.cardServices[1].cardStatus===1){
|
|
|
- Stack(){
|
|
|
- Column(){
|
|
|
- TaskComp({isHomePage: this.isHomePage})
|
|
|
- Text('生产操作')
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .margin({top:5})
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontColor($r('app.color.robot_set_card_white'))
|
|
|
- }
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
- .gesture(
|
|
|
- LongPressGesture({ repeat: false })
|
|
|
- .onActionEnd(() => {
|
|
|
- this.deleteConfirmation=1
|
|
|
- })
|
|
|
- )
|
|
|
- if (this.deleteConfirmation===1){
|
|
|
- Row(){
|
|
|
- Text('取消')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width('20%')
|
|
|
- .height('20%')
|
|
|
- .margin(10)
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
- .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
- .onClick(()=>{
|
|
|
- this.deleteConfirmation=0
|
|
|
- })
|
|
|
- Text('删除')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .width('20%')
|
|
|
- .margin(10)
|
|
|
- .fontColor($r('app.color.general_font_white_color'))
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .height('20%')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
- .onClick(()=>{
|
|
|
- this.deleteConfirmation=0
|
|
|
- this.cardServices[1]= {
|
|
|
- id:this.cardServices[1].id,
|
|
|
- userId:this.cardServices[1].userId,
|
|
|
- cardType:this.cardServices[1].cardType,
|
|
|
- cardStatus:2,
|
|
|
- cardSort:this.cardServices[1].cardSort,
|
|
|
+ Column() {
|
|
|
+ List(){
|
|
|
+ ForEach(this.cardServices,(item:UniversalCard,index)=>{
|
|
|
+ ListItem(){
|
|
|
+ if (item.cardType===3 && item.cardStatus === 1){
|
|
|
+ Stack(){
|
|
|
+ Column(){
|
|
|
+ TaskComp({isHomePage: this.isHomePage})
|
|
|
+ Text('生产操作')
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .margin({top:5})
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.robot_set_card_white'))
|
|
|
+ }
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ .gesture(
|
|
|
+ LongPressGesture({ repeat: false })
|
|
|
+ .onActionEnd(() => {
|
|
|
+ this.deleteConfirmation=1
|
|
|
+ })
|
|
|
+ )
|
|
|
+ if (this.deleteConfirmation===1){
|
|
|
+ Row(){
|
|
|
+ Text('取消')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .width('20%')
|
|
|
+ .height('20%')
|
|
|
+ .margin(10)
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
+ .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.deleteConfirmation=0
|
|
|
+ })
|
|
|
+ Text('删除')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .width('20%')
|
|
|
+ .margin(10)
|
|
|
+ .fontColor($r('app.color.general_font_white_color'))
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .height('20%')
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.deleteConfirmation=0
|
|
|
+ this.cardServices[0]= {
|
|
|
+ id:this.cardServices[0].id,
|
|
|
+ userId:this.cardServices[0].userId,
|
|
|
+ cardType:this.cardServices[0].cardType,
|
|
|
+ cardStatus:2,
|
|
|
+ cardSort:this.cardServices[0].cardSort,
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if (this.cardServices[0].cardStatus===1){
|
|
|
- Stack(){
|
|
|
- Column(){
|
|
|
- Warehousing()
|
|
|
- Text('智能仓储')
|
|
|
- .margin({top:5})
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontColor($r('app.color.robot_set_card_white'))
|
|
|
- }
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
- .margin({left:10})
|
|
|
- .onClick(()=>{
|
|
|
- router.pushUrl({
|
|
|
- url:'pages/Storage'
|
|
|
- })
|
|
|
- })
|
|
|
- .gesture(
|
|
|
- LongPressGesture({ repeat: false })
|
|
|
- .onActionEnd(() => {
|
|
|
- this.smartWarehouseCard=1
|
|
|
- })
|
|
|
- )
|
|
|
- if (this.smartWarehouseCard===1){
|
|
|
- Row(){
|
|
|
- Text('取消')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width('20%')
|
|
|
- .height('20%')
|
|
|
- .margin(10)
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
- .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
- .onClick(()=>{
|
|
|
- this.smartWarehouseCard=0
|
|
|
- })
|
|
|
- Text('删除')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .width('20%')
|
|
|
- .margin(10)
|
|
|
- .fontColor($r('app.color.general_font_white_color'))
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .height('20%')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
- .onClick(()=>{
|
|
|
- this.smartWarehouseCard=0
|
|
|
- this.cardServices[0]= {
|
|
|
- id:this.cardServices[0].id,
|
|
|
- userId:this.cardServices[0].userId,
|
|
|
- cardType:this.cardServices[0].cardType,
|
|
|
- cardStatus:2,
|
|
|
- cardSort:this.cardServices[0].cardSort,
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (item.cardType===1 && item.cardStatus === 1){
|
|
|
+ Stack(){
|
|
|
+ Column(){
|
|
|
+ Warehousing()
|
|
|
+ Text('智能仓储')
|
|
|
+ .margin({top:5})
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.robot_set_card_white'))
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.SmartFactoryCardDelete===0){
|
|
|
- Stack(){
|
|
|
- Column(){
|
|
|
- SmartFactoryCard()
|
|
|
- Text('智汇工厂')
|
|
|
- .margin({top:5})
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontColor($r('app.color.robot_set_card_white'))
|
|
|
- }
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
- .margin({left:10})
|
|
|
- .onClick(()=>{
|
|
|
- router.pushUrl({
|
|
|
- url:'pages/SmartFactory'
|
|
|
- })
|
|
|
- })
|
|
|
- .gesture(
|
|
|
- LongPressGesture({ repeat: false })
|
|
|
- .onActionEnd(() => {
|
|
|
- this.SmartFactoryCarLongPressDelete=1
|
|
|
- })
|
|
|
- )
|
|
|
- if (this.SmartFactoryCarLongPressDelete===1){
|
|
|
- Row(){
|
|
|
- Text('取消')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width('20%')
|
|
|
- .height('20%')
|
|
|
- .margin(10)
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
- .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
- .onClick(()=>{
|
|
|
- this.SmartFactoryCarLongPressDelete=0
|
|
|
- })
|
|
|
- Text('删除')
|
|
|
- .fontWeight(FontWeight.Medium)
|
|
|
- .fontSize(px2vp(27))
|
|
|
- .width('20%')
|
|
|
- .margin(10)
|
|
|
- .fontColor($r('app.color.general_font_white_color'))
|
|
|
- .borderRadius(px2vp(21))
|
|
|
- .height('20%')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
- .onClick(()=>{
|
|
|
- this.SmartFactoryCarLongPressDelete=0
|
|
|
- this.SmartFactoryCardDelete=1
|
|
|
- })
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ .onClick(()=>{
|
|
|
+ router.pushUrl({
|
|
|
+ url:'pages/Storage'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .gesture(
|
|
|
+ LongPressGesture({ repeat: false })
|
|
|
+ .onActionEnd(() => {
|
|
|
+ this.smartWarehouseCard=1
|
|
|
+ })
|
|
|
+ )
|
|
|
+ if (this.smartWarehouseCard===1){
|
|
|
+ Row(){
|
|
|
+ Text('取消')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .width('20%')
|
|
|
+ .height('20%')
|
|
|
+ .margin(10)
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
+ .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.smartWarehouseCard=0
|
|
|
+ })
|
|
|
+ Text('删除')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .width('20%')
|
|
|
+ .margin(10)
|
|
|
+ .fontColor($r('app.color.general_font_white_color'))
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .height('20%')
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.smartWarehouseCard=0
|
|
|
+ this.cardServices[1]= {
|
|
|
+ id:this.cardServices[1].id,
|
|
|
+ userId:this.cardServices[1].userId,
|
|
|
+ cardType:this.cardServices[1].cardType,
|
|
|
+ cardStatus:2,
|
|
|
+ cardSort:this.cardServices[1].cardSort,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (item.cardType===5 && item.cardStatus === 1){
|
|
|
+ Stack(){
|
|
|
+ Column(){
|
|
|
+ SmartFactoryCard()
|
|
|
+ Text('智汇工厂')
|
|
|
+ .margin({top:5})
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontColor($r('app.color.robot_set_card_white'))
|
|
|
+ }
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ .onClick(()=>{
|
|
|
+ router.pushUrl({
|
|
|
+ url:'pages/SmartFactory'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .gesture(
|
|
|
+ LongPressGesture({ repeat: false })
|
|
|
+ .onActionEnd(() => {
|
|
|
+ this.SmartFactoryCarLongPressDelete=1
|
|
|
+ })
|
|
|
+ )
|
|
|
+ if (this.SmartFactoryCarLongPressDelete===1){
|
|
|
+ Row(){
|
|
|
+ Text('取消')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .width('20%')
|
|
|
+ .height('20%')
|
|
|
+ .margin(10)
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .fontColor($r('app.color.robot_set_card_blue'))
|
|
|
+ .backgroundColor($r('app.color.general_font_white_color'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.SmartFactoryCarLongPressDelete=0
|
|
|
+ })
|
|
|
+ Text('删除')
|
|
|
+ .fontWeight(FontWeight.Medium)
|
|
|
+ .fontSize(px2vp(27))
|
|
|
+ .width('20%')
|
|
|
+ .margin(10)
|
|
|
+ .fontColor($r('app.color.general_font_white_color'))
|
|
|
+ .borderRadius(px2vp(21))
|
|
|
+ .height('20%')
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .backgroundColor( $r('app.color.robot_set_card_blue'))
|
|
|
+ .onClick(()=>{
|
|
|
+ this.SmartFactoryCarLongPressDelete=0
|
|
|
+ this.cardServices[2]= {
|
|
|
+ id:this.cardServices[2].id,
|
|
|
+ userId:this.cardServices[2].userId,
|
|
|
+ cardType:this.cardServices[2].cardType,
|
|
|
+ cardStatus:2,
|
|
|
+ cardSort:this.cardServices[2].cardSort,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ .height('40%')
|
|
|
+ .width('95%')
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .height('40%')
|
|
|
- .width('32%')
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
+ })
|
|
|
+ }.lanes(3)
|
|
|
|
|
|
}
|
|
|
.width('100%')
|
|
@@ -499,7 +528,7 @@ struct Index {
|
|
|
}
|
|
|
this.x=touchPoint.x
|
|
|
this.y=touchPoint.y
|
|
|
- this.index=0
|
|
|
+ this.index=1
|
|
|
this.confirmPopupDialogController.open()
|
|
|
|
|
|
})
|
|
@@ -563,7 +592,7 @@ struct Index {
|
|
|
}
|
|
|
this.x=touchPoint.x
|
|
|
this.y=touchPoint.y
|
|
|
- this.index=1
|
|
|
+ this.index=0
|
|
|
this.confirmPopupDialogController.open()
|
|
|
})
|
|
|
)
|
|
@@ -588,9 +617,37 @@ struct Index {
|
|
|
}
|
|
|
.width('100%')
|
|
|
.height('16%')
|
|
|
- BottomOperateComp({ isHomePage: this.isHomePage,
|
|
|
+ Stack(){
|
|
|
+ BottomOperateComp({ isHomePage: this.isHomePage})
|
|
|
+ Text().width('8%')
|
|
|
+ .height('8%')
|
|
|
+ .id('Warehousing')
|
|
|
+ .onClick(()=>{
|
|
|
+ router.pushUrl({
|
|
|
+ url:'pages/SmartFactory'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .gesture(
|
|
|
+ LongPressGesture({ repeat: false })
|
|
|
+ .onActionEnd(() => {
|
|
|
+ let rect = componentLocation.getComponentRect('Warehousing')
|
|
|
+ let touchPoint: TouchObject = {
|
|
|
+ id: 2,
|
|
|
+ x: rect.left, // 组件中心点x坐标
|
|
|
+ y:rect.bottom, // 组件中心点y坐标
|
|
|
+ type: TouchType.Down,
|
|
|
+ screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
|
|
|
+ screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
|
|
|
+ }
|
|
|
+ this.x=touchPoint.x
|
|
|
+ this.y=touchPoint.y
|
|
|
+ this.index=2
|
|
|
+ this.confirmPopupDialogController.open()
|
|
|
+ })
|
|
|
+ )
|
|
|
}
|
|
|
- )
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
.backgroundImage($r('app.media.BG'))
|
|
|
.backgroundImageSize({ width: '100%', height: '100%' })
|