master
xy 3 years ago
parent 3a3c8d9a92
commit 35c18f266e

@ -19,14 +19,14 @@
} }
await executeSql(` await executeSql(`
create table if not exists property( create table if not exists property(
"id" INTEGER PRIMARY KEY, "assets_id" INTEGER PRIMARY KEY,
"serial" TEXT, "serial" TEXT,
"name" TEXT, "name" TEXT,
"position" TEXT, "position" TEXT,
"worker_name" TEXT, "worker_name" TEXT,
"active_status" INTEGER, "assets_status" INTEGER,
"files" TEXT, "photo" TEXT,
"remark" TEXT, "content" TEXT,
"is_check" INTEGER DEFAULT 0 "is_check" INTEGER DEFAULT 0
); );
`) `)

@ -103,14 +103,13 @@
const getSql = () => { const getSql = () => {
let sql = "" let sql = ""
res.data?.forEach(item => { 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 ( VALUES (
${item.id}, ${item.id},
${item.serial}, ${item.serial},
${item.name}, ${item.name},
${item.position}, ${item.position},
${item.worker_name}), ${item.worker_name}) `
${item.remark}; `
}) })
return sql; return sql;
} }
@ -134,14 +133,13 @@
for(let i = 0;i < res?.data.length;i++){ for(let i = 0;i < res?.data.length;i++){
let item = res?.data[i] let item = res?.data[i]
await executeSql(` await executeSql(`
insert into property (id,serial,name,position,worker_name,active_status) insert into property (assets_id,serial,name,position,worker_name)
values ( values (
${item.id}, ${item.id},
"${item.serial}", "${item.serial}",
"${item.name}", "${item.name}",
"${item.position}", "${item.position}",
"${item.worker_name}", "${item.worker_name}"
${item.active_status}
); );
`) `)
} }

@ -3,7 +3,7 @@
<u-navbar :is-back="false" title="首页" title-color="#fff" :background="{'background':'#107fc9'}"></u-navbar> <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 :col="3">
<u-grid-item @click="switchTab('/pages/scan/index')"> <u-grid-item @click="switchTab('/pages/scan/index')">
@ -28,11 +28,16 @@
data() { data() {
return { return {
list: [{ 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> <u-navbar :is-back="false" title="资产扫码" title-color="#fff" :background="{'background':'#107fc9'}"></u-navbar>
<view class="content"> <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'}" <u-button :ripple="true" :type="flag ? 'error' : 'primary'" :custom-style="{'margin':'20rpx 30rpx 0 30rpx'}"
@click="scanClick">{{ flag ? "停止扫描" : "开始扫描" }}</u-button> @click="scanClick">{{ flag ? "停止扫描" : "开始扫描" }}</u-button>
@ -43,7 +43,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="info__name">资产状态</view> <view class="info__name">资产状态</view>
<view class="info__value">{{activeStatusFormat(fund.active_status) || " "}}</view> <view class="info__value">{{activeStatusFormat(fund.assets_status) || " "}}</view>
</view> </view>
<u-button type="primary" :ripple="true" :custom-style="btnStyle" @click="isShowPop = true"> <u-button type="primary" :ripple="true" :custom-style="btnStyle" @click="isShowPop = true">
@ -58,7 +58,7 @@
<!-- 此处没有自定义左边的内容会默认显示一个点 --> <!-- 此处没有自定义左边的内容会默认显示一个点 -->
<template v-slot:content> <template v-slot:content>
<view> <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"> <view class="u-order-time">
{{$moment(item.created_at).format('YYYY-MM-DD HH:mm:SS')}} {{$moment(item.created_at).format('YYYY-MM-DD HH:mm:SS')}}
</view> </view>
@ -81,16 +81,16 @@
</u-input> </u-input>
</u-form-item> </u-form-item>
<u-form-item label="资产状态"> <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> @click="isShowSelect = true" placeholder="请选择资产状态"></u-input>
</u-form-item> </u-form-item>
<u-form-item label="备注"> <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-input>
</u-form-item> </u-form-item>
<u-form-item label="图片上传"> <u-form-item label="图片上传">
<u-upload :show-progress="false" :auto-upload="false" :max-count="1" ref="uUpload" <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-upload>
</u-form-item> </u-form-item>
</u-form> </u-form>
@ -103,7 +103,7 @@
</view> </view>
</u-popup> </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> </view>
</template> </template>
@ -138,44 +138,41 @@
isShowSelect: false, isShowSelect: false,
action: `${ROOTPATH}/index.php?s=/Home/Worker/upload.html`, action: `${ROOTPATH}/index.php?s=/Home/Worker/upload.html`,
statusList: [{ statusList: [{
value: 0,
label: "正常未领用"
},
{
value: 1, value: 1,
label: "已领用" label: "正常"
},
{
value: -1,
label: "报废"
}, },
{ {
value: -2, value: 2,
label: "维修停用" label: "维修"
} }
], ],
btnStyle: { btnStyle: {
'margin': '60rpx 30rpx 0 30rpx' 'margin': '60rpx 30rpx 0 30rpx'
}, },
list: [{ 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'
},
], ],
flag: 0, //01 flag: 0, //01
fund: { fund: {
id: 0, assets_id: 0,
name: '', name: '',
serial: '', serial: '',
position: '', position: '',
worker_name: '', worker_name: '',
active_status: '', assets_status: '',
files: '', photo: '',
remark: '' content: ''
}, },
qrIdList: [], qrIdList: [],
@ -187,14 +184,14 @@
clear() { clear() {
this.info = [] this.info = []
this.fund = { this.fund = {
id: 0, assets_id: 0,
name: '', name: '',
serial: '', serial: '',
position: '', position: '',
worker_name: '', worker_name: '',
active_status: '', assets_status: '',
files: '', photo: '',
remark: '' content: ''
} }
}, },
@ -206,7 +203,7 @@
async confirm() { async confirm() {
if (!this.fund.active_status && this.fund.active_status !== 0) { if (!this.fund.assets_status) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "请选择资产状态" title: "请选择资产状态"
@ -219,10 +216,10 @@
tempFilePath: this.$refs.uUpload.lists[0]?.url tempFilePath: this.$refs.uUpload.lists[0]?.url
}) })
console.log(filePath); console.log(filePath);
this.fund.files = filePath[1]?.savedFilePath this.fund.photo = 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 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({ uni.showToast({
icon: 'success', icon: 'success',
@ -320,7 +317,7 @@
} }
try { try {
let propertys = await selectFromTable(` let propertys = await selectFromTable(`
select * from property where id in (${getSqlIn()}); select * from property where assets_id in (${getSqlIn()});
`) `)
androidModule.showToast(`扫描到:${propertys.length}件资产`) androidModule.showToast(`扫描到:${propertys.length}件资产`)
this.info = propertys this.info = propertys
@ -336,10 +333,8 @@
computed: { computed: {
activeStatusFormat() { activeStatusFormat() {
let map = new Map([ let map = new Map([
[0, '正常未领用'], [1, '正常'],
[1, '已领用'], [2, '维修'],
[-1, '报废'],
[-2, '维修停用']
]) ])
return function(status) { return function(status) {
return map.get(status) return map.get(status)

@ -75,7 +75,7 @@
} }
try{ try{
let res = await selectFromTable(` 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){ 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