|
|
|
@ -9,6 +9,10 @@
|
|
|
|
@click="scanClick">{{ flag ? "停止扫描" : "开始扫描" }}</u-button>
|
|
|
|
@click="scanClick">{{ flag ? "停止扫描" : "开始扫描" }}</u-button>
|
|
|
|
|
|
|
|
|
|
|
|
<u-card title="资产列表" v-show="info.length > 0">
|
|
|
|
<u-card title="资产列表" v-show="info.length > 0">
|
|
|
|
|
|
|
|
<view slot="head" style="display: flex;justify-content: space-between;align-items: center;">
|
|
|
|
|
|
|
|
<view style="flex: 1;">资产列表</view>
|
|
|
|
|
|
|
|
<u-button size="medium" type="primary" @click="clear">清空</u-button>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
<view class="card-body" slot="body">
|
|
|
|
<view class="card-body" slot="body">
|
|
|
|
<view v-for="(item,index) in info" :key="item.id"
|
|
|
|
<view v-for="(item,index) in info" :key="item.id"
|
|
|
|
style="display: flex;justify-content: space-between;padding: 10rpx 0;align-items: center;">
|
|
|
|
style="display: flex;justify-content: space-between;padding: 10rpx 0;align-items: center;">
|
|
|
|
@ -174,12 +178,26 @@
|
|
|
|
remark: ''
|
|
|
|
remark: ''
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
qrIdList:[],
|
|
|
|
qrIdList: [],
|
|
|
|
info: [],
|
|
|
|
info: [],
|
|
|
|
logs: []
|
|
|
|
logs: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
|
|
|
|
this.info = []
|
|
|
|
|
|
|
|
this.fund = {
|
|
|
|
|
|
|
|
id: 0,
|
|
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
|
|
serial: '',
|
|
|
|
|
|
|
|
position: '',
|
|
|
|
|
|
|
|
worker_name: '',
|
|
|
|
|
|
|
|
active_status: '',
|
|
|
|
|
|
|
|
files: '',
|
|
|
|
|
|
|
|
remark: ''
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
async getLogs() {
|
|
|
|
async getLogs() {
|
|
|
|
this.logs = await selectFromTable(`
|
|
|
|
this.logs = await selectFromTable(`
|
|
|
|
select * from log where type = 1;
|
|
|
|
select * from log where type = 1;
|
|
|
|
@ -204,7 +222,7 @@
|
|
|
|
this.fund.files = filePath[1]?.savedFilePath
|
|
|
|
this.fund.files = filePath[1]?.savedFilePath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await executeSql(`
|
|
|
|
await executeSql(`
|
|
|
|
update property set active_status = "${this.fund.active_status}",remark = "${this.fund.remark}",is_check = 1,${this.fund.files ? 'files = "' + this.fund.files + '"' : '' } where id = ${this.fund.id};
|
|
|
|
update property set active_status = "${this.fund.active_status}",remark = "${this.fund.remark}",is_check = 1${this.fund.files ? ',files = "' + this.fund.files + '"' : '' } where id = ${this.fund.id};
|
|
|
|
`)
|
|
|
|
`)
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'success',
|
|
|
|
icon: 'success',
|
|
|
|
@ -228,7 +246,7 @@
|
|
|
|
onReceive: (context, intent) => {
|
|
|
|
onReceive: (context, intent) => {
|
|
|
|
plus.android.importClass(intent)
|
|
|
|
plus.android.importClass(intent)
|
|
|
|
let action = intent.getAction()
|
|
|
|
let action = intent.getAction()
|
|
|
|
switch (action){
|
|
|
|
switch (action) {
|
|
|
|
case "com.rfid.SCAN":
|
|
|
|
case "com.rfid.SCAN":
|
|
|
|
let id = byteToString(intent.getExtra("data"))
|
|
|
|
let id = byteToString(intent.getExtra("data"))
|
|
|
|
this.qrIdList.push(id)
|
|
|
|
this.qrIdList.push(id)
|
|
|
|
@ -256,9 +274,9 @@
|
|
|
|
let intentStart = new intent("com.rfid.SCAN_INIT")
|
|
|
|
let intentStart = new intent("com.rfid.SCAN_INIT")
|
|
|
|
main.sendBroadcast(intentStart)
|
|
|
|
main.sendBroadcast(intentStart)
|
|
|
|
let intentTime = new intent("com.rfid.SCAN_TIME")
|
|
|
|
let intentTime = new intent("com.rfid.SCAN_TIME")
|
|
|
|
intentTime.putExtra("time",1000)
|
|
|
|
intentTime.putExtra("time", 1000)
|
|
|
|
let intentBroad = new intent("com.rfid.SET_SCAN_MODE")
|
|
|
|
let intentBroad = new intent("com.rfid.SET_SCAN_MODE")
|
|
|
|
intentBroad.putExtra("mode",0)
|
|
|
|
intentBroad.putExtra("mode", 0)
|
|
|
|
main.sendBroadcast(intentBroad)
|
|
|
|
main.sendBroadcast(intentBroad)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
@ -271,7 +289,7 @@
|
|
|
|
let intentScan = new intent("com.rfid.SCAN_CMD")
|
|
|
|
let intentScan = new intent("com.rfid.SCAN_CMD")
|
|
|
|
timerQR = setInterval(() => {
|
|
|
|
timerQR = setInterval(() => {
|
|
|
|
main.sendBroadcast(intentScan)
|
|
|
|
main.sendBroadcast(intentScan)
|
|
|
|
},500)
|
|
|
|
}, 500)
|
|
|
|
|
|
|
|
|
|
|
|
//rfid扫描
|
|
|
|
//rfid扫描
|
|
|
|
androidModule.asyncStartReading()
|
|
|
|
androidModule.asyncStartReading()
|
|
|
|
@ -296,7 +314,7 @@
|
|
|
|
androidModule.tagInventoryRealTime(async res => {
|
|
|
|
androidModule.tagInventoryRealTime(async res => {
|
|
|
|
let dataList = JSON.parse(res)
|
|
|
|
let dataList = JSON.parse(res)
|
|
|
|
const getSqlIn = () => {
|
|
|
|
const getSqlIn = () => {
|
|
|
|
return Array.from(new Set([...dataList,...this.qrIdList])).map(item => {
|
|
|
|
return Array.from(new Set([...dataList, ...this.qrIdList])).map(item => {
|
|
|
|
return `"${item.replace(/^1(0+)/g,"")}"`
|
|
|
|
return `"${item.replace(/^1(0+)/g,"")}"`
|
|
|
|
}).toString()
|
|
|
|
}).toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -306,7 +324,7 @@
|
|
|
|
`)
|
|
|
|
`)
|
|
|
|
androidModule.showToast(`扫描到:${propertys.length}件资产`)
|
|
|
|
androidModule.showToast(`扫描到:${propertys.length}件资产`)
|
|
|
|
this.info = propertys
|
|
|
|
this.info = propertys
|
|
|
|
if(this.info.length > 0)this.fund = this.info[0]
|
|
|
|
this.fund = propertys[0]
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.warn('sqlite-err', e);
|
|
|
|
console.warn('sqlite-err', e);
|
|
|
|
androidModule.showToast(err)
|
|
|
|
androidModule.showToast(err)
|
|
|
|
@ -354,6 +372,25 @@
|
|
|
|
androidModule.showToast(err)
|
|
|
|
androidModule.showToast(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// #endif
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uni.$on('uploadSuccess',() => {
|
|
|
|
|
|
|
|
this.clear()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
uni.$on('assetsSync',async () => {
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
await executeSql(`
|
|
|
|
|
|
|
|
DELETE from log;
|
|
|
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
await executeSql(`
|
|
|
|
|
|
|
|
UPDATE sqlite_sequence SET seq = 0 where name = 'log';
|
|
|
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
}catch(err){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyed() {
|
|
|
|
|
|
|
|
uni.$off()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|