Commit 5827c23c by 陈桂东

commit

parents 4ccebb3f 24af4273
import { TitleBar } from '../../view/title/TitleBar'
import { BasicTable } from '../../view/BasicTable/BasicTable'
import router from '@ohos.router';
import { Demo } from '../../view/demo/demo';
import { BasicDialog } from '../../view/BasicDialog/BasicDialog';
import wzcrkModel from '../../model/WzcrkModel';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { isEmpty } from '@ohos/common/src/main/ets/utils/util';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
.padding({top:1,bottom:1,right:7,left:7})
.borderColor('#0fa983')
.backgroundColor('#fff')
.fontColor('#0fa983')
.borderRadius(7)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Entry
@Component
export struct WzInPage {
@State fontColor: string = '#182431'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
private searchcontroller: SearchController = new SearchController()
@State defaultSelectValue:Array<SelectOption>=[{ value: "未完成" }, { value: "已完成" }]
@State selectValue:Array<SelectOption>=[{ value: "未完成" }, { value: "已完成" }, { value: "完成已绑定" }]
@State page:number=1
@State rows:number=6
@State sjlx:string="0"
@State wczt:string=""
@State pzh:string=""
params = {
pzh:this.pzh,
page: this.page,
rows: this.rows,
sjlx: this.currentIndex===0?"导入":"临时收物",
wczt: "未完成"
}
itemClick() {
router.pushUrl({url:'pages/order_detail/PzInOutDetailPage'})
}
aboutToAppear(){
try {
this.getWzcrkList()
}catch (err){
console.log("sql查询报错"+JSON.stringify(err))
}
}
async getWzcrkList() {
const res = await wzcrkModel.queryWzcrklist(this.getPM())
Logger.info('入库数据>>:', JSON.stringify(res))
// const res2 = await wzcrkModel.query("5")
// Logger.info('全部出入库数据>>:', JSON.stringify(res2))
}
getPM():string{
const sql1 =
`select * from(select crk.guid, STRFTIME ('%Y-%m-%d', crk.crkrq) crkrq, crk.pzlx, crk.pzh, crk.wczt from TAB_BZGL_KNZY_APP_WZCRK crk where 1=1`
const sql2 = ` and (crk.pzh like ${isEmpty(this.params.pzh)})`
const sql3 =
` and crk.sjlx = ${isEmpty(this.params.sjlx)} and crk.wczt = ${isEmpty(this.params.wczt)} and crk.pzlx in ('14') order by pzh+0 ) limit ${this.params.rows} offset ( ${this.params.page} - 1 ) * ${this.params.rows} `
if (this.params.pzh) {
return sql1 + sql2 + sql3
} else {
console.log("sql查询"+sql1+sql3)
return sql1 + sql3
}
}
@Builder container() {
Column() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('完成').margin({ left: 20 })
Radio({ value: 'Radio1', group: 'radioGroup' })
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
}).margin({ right: 20 })
}
}.padding({ top: 10, bottom: 10 })
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('未完成').margin({ left: 20 })
Radio({ value: 'Radio1', group: 'radioGroup' })
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
}).margin({ right: 20 })
}
}.padding({ top: 10, bottom: 10 })
}
}
dialogController: CustomDialogController = new CustomDialogController({
builder: BasicDialog({
cancel: this.onCancel,
confirm: this.onSubmit,
title: '设置状态',
container: this.container
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false
})
onCancel() {
console.info('------取消------')
}
onSubmit() {
console.info('------确认------')
}
@Builder searchSelectView(){
Column(){
}
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.lineHeight(22)
.margin({ bottom: 7 })
Divider()
.strokeWidth(2)
.color('#fff')
.width(50)
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
@Builder bottomButtons() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("临时收物")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
router.pushUrl({
url: "pages/metailmange/AddTemporaryInPage",
})
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("设置状态")
.bottomBtnSty()
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("单据匹配")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
router.pushUrl({
url: "pages/metailmange/AddTemporaryInPage",
})
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("导出数据包")
.visibility(this.currentIndex === 0 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
}).fontColor("#0fa983").fontSize("14vp")
Button("全选")
.bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
Button("清空选择")
.bottomBtnSty()
.onClick(() => {
}).fontColor("#0fa983").fontSize("14vp")
}
}.height(80)
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "物资入库" })
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
// Column().width('100%').height('100%').backgroundColor('#00CB87')
}.tabBar(this.TabBuilder(0, '导入'))
TabContent() {
// Column().width('100%').height('100%').backgroundColor('#007DFF')
}.tabBar(this.TabBuilder(1, '临时收物'))
}
.height(80)
.onChange((index: number) => {
this.currentIndex = index
})
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Search({ placeholder: '请输入凭证号', controller: this.searchcontroller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.textAlign(TextAlign.Center)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.width('60%')
.onSubmit((value: string) => {
this.pzh=value
})
.onChange((value: string) => {
})
.borderRadius(5)
Select(this.currentIndex===1?this.selectValue:this.defaultSelectValue)
.value('请选择状态')
.borderWidth(1)
.borderRadius(6)
.height(42)
.margin({ left: 10 })
.borderColor("#454545")
.onSelect(async (index: number, value?: string) => {
if (value == '未完成') {
console.log("未完成", '未完成')
} else {
console.log("已完成", '已完成')
}
})
.width(120)
.padding({
right: 15
})
}
}.margin({ top: -20 })
.width("100%")
.padding('15vp')
// 列表
Column() {
Demo({itemClick: this.itemClick}).width('90%')
}.flexGrow(1).backgroundColor('#fff').alignSelf(ItemAlign.Center)
// 底部按钮
this.bottomButtons();
}.width("100%")
}.width("100%").linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ export struct WzInList {
Row() {
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.selectedColor('#007DFF')
.select(this.item.checked)
.onChange((value: boolean) => {
console.info('Checkbox1 change is' + value)
}).margin({ right: 10, left: 10 })
......@@ -53,7 +54,7 @@ export struct WzInList {
}
}
}.margin({ top: 10 }).border({ width: { bottom: '1lpx' }, color: "#717171" })
}.width('100%').height('100%')
}.width('100%')
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import { BasicDialog } from '../../../view/BasicDialog/BasicDialog';
import wzcrkModel from '../../../model/WzcrkModel';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { WzinClass } from './Wzin.data'
import promptAction from '@ohos.promptAction';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
......@@ -132,8 +133,20 @@ export struct WzInPage {
.bottomBtnSty()
.onClick(() => {
}).fontColor("#0fa983").fontSize("14vp")
// Button("全选")
// .bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
Button("全选")
.bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
.onClick(() => {
promptAction.showToast({
message: '进来了' + this.dataSource.length
})
this.dataSource = this.dataSource.map((item) => {
return {
checked: true,
...item
}
})
Logger.info('全选:' + this.dataSource.length, JSON.stringify(this.dataSource))
})
Button("清空选择")
.bottomBtnSty()
.onClick(() => {
......@@ -214,18 +227,13 @@ export struct WzInPage {
if (this.dataSource.length == 0) {
this.renderEmpty()
} else {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
CheckboxGroup({ group: 'checkboxGroup' })
.selectedColor('#007DFF')
.onChange((itemName: CheckboxGroupResult) => {
console.info("checkbox group content" + JSON.stringify(itemName))
})
Text("全选").margin({ left: 10 })
}.margin({ bottom: -15, left: 8 }).backgroundColor('#fff').zIndex(999).width('90%')
ForEach(this.dataSource, (item) => {
WzInList({ item }).width('90%').backgroundColor('#fff')
})
List({ space: 2}) {
ForEach(this.dataSource, (item) => {
ListItem() {
WzInList({ item }).width('100%').backgroundColor('#fff')
}
})
}.padding(20)
}
......
......@@ -98,6 +98,10 @@ export class WzinClass {
* 备注
*/
dec: string
/**
* 有无被选中
*/
checked: boolean
constructor(data: {
gznd: string;
......@@ -125,6 +129,7 @@ export class WzinClass {
pzh?: number;
pzsl?: number;
crksl?: number;
checked?: boolean;
}) {
this.guid = data.guid;
this.gznd = data.gznd;
......@@ -151,6 +156,7 @@ export class WzinClass {
this.zmlx = data.zmlx;
this.bdguid = data.bdguid;
this.dec = data.dec;
this.checked = data.checked
}
}
......
......@@ -53,6 +53,9 @@ struct WzInvPage{
}).fontColor("#0fa983") .fontSize("14vp")
Button("全选")
.bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
.onClick(()=> {
})
Button("清空选择")
.bottomBtnSty()
.onClick(async () =>{
......
......@@ -54,17 +54,11 @@ export struct BasicDialog {
.padding({ top: 10, bottom: 10 })
}
Column() {
TextInput({ placeholder: '', text: this.title }).height(40).width('90%').borderRadius(4)
.onChange((value: string) => {
this.title = value
})
}
this.container()
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('确认')
.onClick(() => {
// this.httpURL = this.textValue
this.controller.close()
this.confirm()
}).CommonButtonStyle()
......
import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#fff')
.fontColor('#0fa983')
.borderRadius(10)
.type(ButtonType.Normal)
.stateEffect(true)
}
// 需要提交的表单
interface FormData {
httpURL: string,
httpPORT: string,
scoketURL: string,
scoketPORT: string,
themeName: string,
themeColor: string,
reconnection_mode: boolean,
push_mode: boolean,
transmission_mode: string,
continue_scan_mode: boolean,
scan_read_mode: string,
scanning_mode: string,
broadcastKey: string,
power: string
}
@CustomDialog
@Component
export struct GeneralDialog {
@Link formData: FormData;
@Link clickItem: UniListItem
controller: CustomDialogController
cancel: () => void
confirm: () => void
build() {
Column() {
Flex({ alignItems: ItemAlign.Start }) {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text(this.clickItem.title).fontSize(20)
}
.padding({ top: 10, bottom: 10 })
}
Column() {
}
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('确认')
.onClick(() => {
this.controller.close()
this.confirm()
}).CommonButtonStyle()
Button('取消')
.onClick(() => {
this.formData[this.clickItem?.key] = ''
this.controller.close()
this.cancel()
}).CommonButtonStyle()
}.margin({ top: 10, bottom: 10 })
}
.width('86%')
.borderRadius(5)
.backgroundColor('#fff')
}
}
\ No newline at end of file
......@@ -4,7 +4,6 @@
"pages/MainPage",
"pages/package/Pick",
"pages/package/Pack",
"pages/metailmange/WzInPage",
"pages/metailmange/WzInPage/WzInPage",
"pages/metailmange/WzOutPage",
"pages/metailmange/WzExchangePage",
......@@ -41,6 +40,5 @@
"identify/demo_page/ScanDemo",
"pages/metailmange/GoodsSelectHwPage",
"pages/metailmange/GoodsSelectRfidTools"
]
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论