master
xy 3 years ago
parent 3a3c8d9a92
commit 35c18f266e

@ -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
);
`)

@ -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}"
);
`)
}

@ -3,7 +3,7 @@
<u-navbar :is-back="false" title="首页" title-color="#fff" :background="{'background':'#107fc9'}"></u-navbar>
<u-swiper :list="list"></u-swiper>
<u-swiper :border-radius="0" :list="list" :height="450" ></u-swiper>
<u-grid :col="3">
<u-grid-item @click="switchTab('/pages/scan/index')">
@ -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'
},
],
}
},

@ -3,7 +3,7 @@
<u-navbar :is-back="false" title="资产扫码" title-color="#fff" :background="{'background':'#107fc9'}"></u-navbar>
<view class="content">
<u-swiper :list="list"></u-swiper>
<u-swiper :list="list" :border-radius="0"></u-swiper>
<u-button :ripple="true" :type="flag ? 'error' : 'primary'" :custom-style="{'margin':'20rpx 30rpx 0 30rpx'}"
@click="scanClick">{{ flag ? "停止扫描" : "开始扫描" }}</u-button>
@ -43,7 +43,7 @@
</view>
<view class="info">
<view class="info__name">资产状态</view>
<view class="info__value">{{activeStatusFormat(fund.active_status) || " "}}</view>
<view class="info__value">{{activeStatusFormat(fund.assets_status) || " "}}</view>
</view>
<u-button type="primary" :ripple="true" :custom-style="btnStyle" @click="isShowPop = true">
@ -58,7 +58,7 @@
<!-- 此处没有自定义左边的内容会默认显示一个点 -->
<template v-slot:content>
<view>
<view class="u-order-desc" @click="fund = item">{{ item.remark }}</view>
<view class="u-order-desc">{{ item.remark }}</view>
<view class="u-order-time">
{{$moment(item.created_at).format('YYYY-MM-DD HH:mm:SS')}}
</view>
@ -81,16 +81,16 @@
</u-input>
</u-form-item>
<u-form-item label="资产状态">
<u-input :value="activeStatusFormat(fund.active_status)" type="select"
<u-input :value="activeStatusFormat(fund.assets_status)" type="select"
@click="isShowSelect = true" placeholder="请选择资产状态"></u-input>
</u-form-item>
<u-form-item label="备注">
<u-input v-model="fund.remark" type="textarea" :auto-height="true" placeholder="请输入备注">
<u-input v-model="fund.content" type="textarea" :auto-height="true" placeholder="请输入备注">
</u-input>
</u-form-item>
<u-form-item label="图片上传">
<u-upload :show-progress="false" :auto-upload="false" :max-count="1" ref="uUpload"
:file-list="fund.files ? [{url:fund.files}] : []">
:file-list="fund.photo ? [{url:fund.photo}] : []">
</u-upload>
</u-form-item>
</u-form>
@ -103,7 +103,7 @@
</view>
</u-popup>
<u-select :list="statusList" v-model="isShowSelect" @confirm="e => fund.active_status = e[0].value"></u-select>
<u-select :list="statusList" v-model="isShowSelect" @confirm="e => fund.assets_status = e[0].value"></u-select>
</view>
</template>
@ -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, //01
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)

@ -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){

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Loading…
Cancel
Save