diff --git a/App.vue b/App.vue index 494e0e0..7372c46 100644 --- a/App.vue +++ b/App.vue @@ -19,14 +19,14 @@ } await executeSql(` create table if not exists property( - "id" INTEGER PRIMARY KEY, + "assets_id" INTEGER PRIMARY KEY, "serial" TEXT, "name" TEXT, "position" TEXT, "worker_name" TEXT, - "active_status" INTEGER, - "files" TEXT, - "remark" TEXT, + "assets_status" INTEGER, + "photo" TEXT, + "content" TEXT, "is_check" INTEGER DEFAULT 0 ); `) diff --git a/pages/assets/index.vue b/pages/assets/index.vue index 2db8f10..e223785 100644 --- a/pages/assets/index.vue +++ b/pages/assets/index.vue @@ -103,14 +103,13 @@ const getSql = () => { let sql = "" res.data?.forEach(item => { - sql += `INSERT INTO property (id,serial,name,position,worker_name,remark) + sql += `INSERT INTO property (assets_id,serial,name,position,worker_name) VALUES ( ${item.id}, ${item.serial}, ${item.name}, ${item.position}, - ${item.worker_name}), - ${item.remark}; ` + ${item.worker_name}) ` }) return sql; } @@ -134,14 +133,13 @@ for(let i = 0;i < res?.data.length;i++){ let item = res?.data[i] await executeSql(` - insert into property (id,serial,name,position,worker_name,active_status) + insert into property (assets_id,serial,name,position,worker_name) values ( ${item.id}, "${item.serial}", "${item.name}", "${item.position}", - "${item.worker_name}", - ${item.active_status} + "${item.worker_name}" ); `) } diff --git a/pages/index/index.vue b/pages/index/index.vue index 0bb315a..67fbfa1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -3,7 +3,7 @@ - + @@ -28,11 +28,16 @@ data() { return { list: [{ - image: '/static/pic1.jpeg' + image: '/static/1.jpg' }, { - image: '/static/pic2.jpeg' - } + image: '/static/2.jpg' + }, + { + image: '/static/3.jpg' + },{ + image: '/static/4.jpg' + }, ], } }, diff --git a/pages/scan/index.vue b/pages/scan/index.vue index 5ed4983..b6fb443 100644 --- a/pages/scan/index.vue +++ b/pages/scan/index.vue @@ -3,7 +3,7 @@ - + {{ flag ? "停止扫描" : "开始扫描" }} @@ -43,7 +43,7 @@ 资产状态: - {{activeStatusFormat(fund.active_status) || " "}} + {{activeStatusFormat(fund.assets_status) || " "}} @@ -58,7 +58,7 @@ @@ -138,44 +138,41 @@ isShowSelect: false, action: `${ROOTPATH}/index.php?s=/Home/Worker/upload.html`, statusList: [{ - value: 0, - label: "正常未领用" - }, - { value: 1, - label: "已领用" - }, - { - value: -1, - label: "报废" + label: "正常" }, { - value: -2, - label: "维修停用" + value: 2, + label: "维修" } ], btnStyle: { 'margin': '60rpx 30rpx 0 30rpx' }, - list: [{ - image: '/static/pic1.jpeg' - }, - { - image: '/static/pic2.jpeg' - } + list: [{ + image: '/static/1.jpg' + }, + { + image: '/static/2.jpg' + }, + { + image: '/static/3.jpg' + },{ + image: '/static/4.jpg' + }, ], flag: 0, //当前扫码状态0未开始,1进行中 fund: { - id: 0, - name: '', - serial: '', - position: '', - worker_name: '', - active_status: '', - files: '', - remark: '' + assets_id: 0, + name: '', + serial: '', + position: '', + worker_name: '', + assets_status: '', + photo: '', + content: '' }, qrIdList: [], @@ -187,14 +184,14 @@ clear() { this.info = [] this.fund = { - id: 0, + assets_id: 0, name: '', serial: '', position: '', worker_name: '', - active_status: '', - files: '', - remark: '' + assets_status: '', + photo: '', + content: '' } }, @@ -206,7 +203,7 @@ async confirm() { - if (!this.fund.active_status && this.fund.active_status !== 0) { + if (!this.fund.assets_status) { uni.showToast({ icon: "none", title: "请选择资产状态" @@ -219,10 +216,10 @@ tempFilePath: this.$refs.uUpload.lists[0]?.url }) console.log(filePath); - this.fund.files = filePath[1]?.savedFilePath + this.fund.photo = filePath[1]?.savedFilePath } 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 assets_status = "${this.fund.assets_status}",content = "${this.fund.content}",is_check = 1${this.fund.photo ? ',photo = "' + this.fund.photo + '"' : '' } where assets_id = ${this.fund.assets_id}; `) uni.showToast({ icon: 'success', @@ -320,7 +317,7 @@ } try { let propertys = await selectFromTable(` - select * from property where id in (${getSqlIn()}); + select * from property where assets_id in (${getSqlIn()}); `) androidModule.showToast(`扫描到:${propertys.length}件资产`) this.info = propertys @@ -336,10 +333,8 @@ computed: { activeStatusFormat() { let map = new Map([ - [0, '正常未领用'], - [1, '已领用'], - [-1, '报废'], - [-2, '维修停用'] + [1, '正常'], + [2, '维修'], ]) return function(status) { return map.get(status) diff --git a/pages/upload/index.vue b/pages/upload/index.vue index 7168153..b9bfa0f 100644 --- a/pages/upload/index.vue +++ b/pages/upload/index.vue @@ -75,7 +75,7 @@ } try{ let res = await selectFromTable(` - select id,serial,name,position,worker_name,active_status,files,remark from property where is_check = 1; + select assets_id,serial,name,position,worker_name,assets_status,photo,content from property where is_check = 1; `) if(res.length === 0){ diff --git a/static/1.jpg b/static/1.jpg new file mode 100644 index 0000000..6c65a44 Binary files /dev/null and b/static/1.jpg differ diff --git a/static/2.jpg b/static/2.jpg new file mode 100644 index 0000000..3bfa46b Binary files /dev/null and b/static/2.jpg differ diff --git a/static/3.jpg b/static/3.jpg new file mode 100644 index 0000000..28b2812 Binary files /dev/null and b/static/3.jpg differ diff --git a/static/4.jpg b/static/4.jpg new file mode 100644 index 0000000..a0fc20b Binary files /dev/null and b/static/4.jpg differ