提交 b5d355e2 authored 作者: JaxBBLL's avatar JaxBBLL

fix

import SqlliteDbUtil from "@/utils/sqllitedb"; import SqlliteDbUtil from "@/utils/sqllitedb";
import table from "./sqllite/table.js"; import table from "./sqllite/table.js";
import { fixNullVal } from "@/utils/common"; import {
fixNullVal
} from "@/utils/common";
// 巡检 // 巡检
export default { export default {
...@@ -11,7 +13,13 @@ export default { ...@@ -11,7 +13,13 @@ export default {
); );
return rs; return rs;
}, },
async selectDataForTime() {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB();
let rs = await sqllitedb.selectSQL(
`SELECT *,strftime( '%Y年%m月',createTime) AS yearMonth FROM ${table.inspectionRecordName} order by createTime desc`
);
return rs;
},
async info(id) { async info(id) {
let sqllitedb = await SqlliteDbUtil.initSqlliteDB(); let sqllitedb = await SqlliteDbUtil.initSqlliteDB();
let sql = `select * from ${table.inspectionRecordName} where id = '${id}'`; let sql = `select * from ${table.inspectionRecordName} where id = '${id}'`;
...@@ -53,12 +61,12 @@ export default { ...@@ -53,12 +61,12 @@ export default {
idx++; idx++;
} }
column = column.endsWith(",") column = column.endsWith(",") ?
? column.substring(0, column.length - 1) column.substring(0, column.length - 1) :
: column; column;
values = values.endsWith(",") values = values.endsWith(",") ?
? values.substring(0, values.length - 1) values.substring(0, values.length - 1) :
: values; values;
let sql = `insert into ${table.inspectionRecordName}(${column}) values(${values})`; let sql = `insert into ${table.inspectionRecordName}(${column}) values(${values})`;
let has = await this.info(data.id); let has = await this.info(data.id);
...@@ -106,8 +114,11 @@ export default { ...@@ -106,8 +114,11 @@ export default {
'${data.updateTime}', '${data.updateTime}',
'${data.signImg}', '${data.signImg}',
'${JSON.stringify(data.inspectionData)}' '${JSON.stringify(data.inspectionData)}'
)`; );
await sqllitedb.executeSQL(sql); `;
debugger
let result = await sqllitedb.executeReturnDataSQL(sql);
console.log(result, '有有有有有有')
} catch (e) { } catch (e) {
console.log(e.message); console.log(e.message);
} finally { } finally {
......
...@@ -14,11 +14,11 @@ export default { ...@@ -14,11 +14,11 @@ export default {
// app初始化 // app初始化
async init() { async init() {
uni.showLoading({ // uni.showLoading({
title: '正在初始化...', // title: '正在初始化...',
}) // })
// 初始化目录 // 初始化目录
await this.initDir() // await this.initDir()
// 初始化数据库 // 初始化数据库
this.initSqlLite() this.initSqlLite()
let sqllitedb = await SqlliteDbUtil.initSqlliteDB() let sqllitedb = await SqlliteDbUtil.initSqlliteDB()
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<text>编号:</text> <text>编号:</text>
<text class="code-num">{{ details.inspectionCode }}</text> <text class="code-num">{{ details.inspectionCode }}</text>
<text>巡检日期:</text> <text>巡检日期:</text>
<text class="code-num">{{ details.submitTime }}</text> <text class="code-num">{{ details.inspectionTime }}</text>
</view> </view>
</view> </view>
<view class="img"> <view class="img">
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<image <image
class="bg-img" class="bg-img"
mode="aspectFill" mode="aspectFill"
src="@/static/img/add-img/home1.png" src="@/static/img/add-img/defaultAvatar.png"
></image> ></image>
</view> </view>
<view class="card-item" @click="toSyncPage"> <view class="card-item" @click="toSyncPage">
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
<!-- 首页 --> <!-- 首页 -->
<view class="container"> <view class="container">
<view class="flex"> <view class="flex">
<navigator url="/pages/test/index" hover-class="navigator-hover">
<button type="default" class="uni-btn">跳转TEST</button>
</navigator>
<navigator <navigator
url="/pages/inspectionContent/inspectionContentList?uid=1&backValue=home" url="/pages/inspectionContent/inspectionContentList?uid=1"
hover-class="navigator-hover" hover-class="navigator-hover"
> >
<button type="default" class="uni-btn">测试巡检</button> <button type="default" class="uni-btn">测试巡检</button>
...@@ -30,7 +33,7 @@ ...@@ -30,7 +33,7 @@
<view class="profile-left"> <view class="profile-left">
<view class="avatar"> <view class="avatar">
<image <image
src="@/static/img/add-img/home1.png" src="@/static/img/add-img/defaultAvatar.png"
mode="aspectFit" mode="aspectFit"
></image> ></image>
<view class="change-password" @click="updatePassword" <view class="change-password" @click="updatePassword"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="home-page"> <view class="home-page">
<view class="left-tab"> <view class="left-tab">
<view class="user-info"> <view class="user-info">
<image class="user-img" src="@/static/img/add-img/home1.png"></image> <image class="user-img" src="@/static/img/add-img/defaultAvatar.png"></image>
<text class="text">{{ userName }}</text> <text class="text">{{ userName }}</text>
</view> </view>
......
...@@ -18,11 +18,8 @@ ...@@ -18,11 +18,8 @@
<CommonUpload <CommonUpload
v-model="item.photos" v-model="item.photos"
:max-count="9999" :max-count="9999"
@input="onPhotoChange" @change="onPhotoChange"
> >
<template #tip>
请对检查项进行拍照留存。发现“异常、告警”时,需拍照留存。
</template>
</CommonUpload> </CommonUpload>
</view> </view>
</view> </view>
...@@ -115,7 +112,10 @@ export default { ...@@ -115,7 +112,10 @@ export default {
// 处理弹窗确认 // 处理弹窗确认
handlePopupConfirm(summary) { handlePopupConfirm(summary) {
this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域 this.itemData.detail[this.currentIndex].conclusion = summary; // 回显到文字显示区域
this.$emit("sync", this.itemData); this.$emit("sync", {
conclusion: summary,
photos: this.itemData.detail[this.currentIndex].photos,
});
}, },
// 处理】数据 // 处理】数据
getFromData() { getFromData() {
...@@ -163,7 +163,10 @@ export default { ...@@ -163,7 +163,10 @@ export default {
}, },
onPhotoChange(val) { onPhotoChange(val) {
this.itemData.detail[this.currentIndex].photos = val; this.itemData.detail[this.currentIndex].photos = val;
this.$emit("sync", this.itemData); this.$emit("sync", {
conclusion: this.itemData.detail[this.currentIndex].conclusion,
photos: val,
});
}, },
}, },
}; };
......
...@@ -167,7 +167,6 @@ import xfxt from "./components/xfxt.vue"; //消防系统 ...@@ -167,7 +167,6 @@ import xfxt from "./components/xfxt.vue"; //消防系统
import xlqk from "./components/xlqk.vue"; //线路情况 import xlqk from "./components/xlqk.vue"; //线路情况
import qt from "./components/qt.vue"; //其它 import qt from "./components/qt.vue"; //其它
import startDialog from "./components/dialog.vue"; import startDialog from "./components/dialog.vue";
import { cloneDeep } from "lodash";
export default { export default {
components: { components: {
...@@ -488,19 +487,44 @@ export default { ...@@ -488,19 +487,44 @@ export default {
return true; return true;
} }
} }
// 所有 inspectionResult 都为 0,返回 false(正常) // 所有 inspectionResult 都为 0,返回 false(正常)
return false; return false;
}, },
realSave(params, isSubmit) { realSave(data) {
const send = dataToSql(params); const send = dataToSql(data);
const api = this.uid ? inspectApi.update : inspectApi.save; const api = this.uid ? inspectApi.update : inspectApi.save;
api(this.uid ? { id: this.uid, ...send } : send).then((res) => { api(this.uid ? { id: this.uid, ...send } : send).then((res) => {
console.log("保存成功"); console.log("保存成功",res);
});
},
// 提交
submit(isSubmit = 1) {
console.log("提交时查看一下数据", this.getAllChildFormData());
let allValid = this.allValid(this.getAllChildFormData());
// 校验是否通过
if (isSubmit && !allValid) {
uni.showToast({
title: "请填写完整必填项",
icon: "none",
});
return false;
}
const params = this.getParams(isSubmit); //数据获取
console.log("提交时获取一次", params);
let logContent = ""; this.realSave(params);
// const all_data = this.$store.state.all_data; //获取全部数据
let logContent = "";
console.log("all_data", this.all_data);
if (this.uid) { if (this.uid) {
const index = this.all_data.findIndex(
(element) => element.uid == this.uid
);
params.uid = this.uid; params.uid = this.uid;
this.all_data[index] = params;
logContent = getLogContent( logContent = getLogContent(
LOG_TYPE_ENUM.edit, LOG_TYPE_ENUM.edit,
`${params.recordName}(${params.inspectionCode})`, `${params.recordName}(${params.inspectionCode})`,
...@@ -508,23 +532,39 @@ export default { ...@@ -508,23 +532,39 @@ export default {
); );
} else { } else {
this.uid = params.uid = new Date().getTime(); // 唯一标识 pad 端使用 this.uid = params.uid = new Date().getTime(); // 唯一标识 pad 端使用
this.all_data.push(params);
logContent = getLogContent( logContent = getLogContent(
LOG_TYPE_ENUM.add, LOG_TYPE_ENUM.add,
`${params.recordName}(${params.inspectionCode})`, `${params.recordName}(${params.inspectionCode})`,
"巡检模块" "巡检模块"
); );
} }
// 更新巡检list
const userInfo = this.userInfo;
console.log("all_data存储", this.all_data);
this.$store.commit("SET_ALL_DATA", this.all_data);
const inspectList = this.all_data.filter(
(item) => item.createByName == userInfo.user
);
console.log("inspectList", inspectList);
writeInspectionData(inspectList, userInfo.user);
// 更新日志 // 更新日志
const log_list = this.$store.state.log_list; const log_list = this.$store.state.log_list;
logContent.inspectionType = params.inspectionType; logContent.inspectionType = params.inspectionType;
log_list.push(logContent); log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list); this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => { addLog(log_list).then((res) => {
console.log("日志文件写入成功"); console.log("日志文件写入成功");
}); });
// 清空基础缓存信息
// this.$store.commit("SET_TEMP_DATA", {}); // 缓存[巡检信息]
// uni.showToast({
// title: isSubmit ? "提交成功" : "保存草稿成功",
// icon: "success",
// });
if (isSubmit) { if (isSubmit) {
this.startDialog(); this.startDialog();
} else { } else {
...@@ -533,29 +573,9 @@ export default { ...@@ -533,29 +573,9 @@ export default {
icon: "none", icon: "none",
}); });
} }
});
},
// 提交
submit(isSubmit = 1) {
console.log("提交时查看一下数据", this.getAllChildFormData());
let allValid = this.allValid(this.getAllChildFormData());
// 校验是否通过
if (isSubmit && !allValid) {
uni.showToast({
title: "请填写完整必填项",
icon: "none",
});
return false;
}
const params = this.getParams(isSubmit); //数据获取
console.log("提交时获取一次", params);
this.realSave(params, isSubmit);
}, },
startDialog() { startDialog() {
console.log("startDialog", this.listData); let allIsSubmitOne = this.listData.every((item) => item.isSubmit === 1);
let allIsSubmitOne = this.listData.every((item) => item.isSubmit == 1);
this.allIsSubmitOne = allIsSubmitOne; this.allIsSubmitOne = allIsSubmitOne;
console.log("是否全部完成", allIsSubmitOne); console.log("是否全部完成", allIsSubmitOne);
console.log("this.listData", this.listData); console.log("this.listData", this.listData);
...@@ -731,10 +751,12 @@ export default { ...@@ -731,10 +751,12 @@ export default {
this.switchTab((this.activeTab + 1) % this.tabs.length); this.switchTab((this.activeTab + 1) % this.tabs.length);
}, },
setQtValue(data) { setQtValue(data) {
console.log("setQtValue", data);
this.detailsInfo.originData.forEach((item) => { this.detailsInfo.originData.forEach((item) => {
if (item.details) { if (item.details && item.details.qt && item.details.qt.detail) {
item.details.qt = data; item.details.qt.detail.forEach((current) => {
item.conclusion = data.conclusion;
item.photos = data.photos;
});
} }
}); });
console.log("setQtValue", this.detailsInfo); console.log("setQtValue", this.detailsInfo);
......
...@@ -63,7 +63,6 @@ export function sqlToData(sqlData) { ...@@ -63,7 +63,6 @@ export function sqlToData(sqlData) {
originData, originData,
inspectionNumber, inspectionNumber,
allIsSubmitOne, allIsSubmitOne,
isSign: !!sqlData.signImg,
}; };
return ret; return ret;
......
<template> <template>
<!-- 巡检管理 --> <!-- 巡检管理 -->
<view class="inspection-management"> <view class="inspection-management">
<uni-nav-bar <uni-nav-bar :fixed="true" background-color="rgba(214, 240, 255, 0.0)" status-bar rightWidth="300">
:fixed="true"
background-color="rgba(214, 240, 255, 0.0)"
status-bar
rightWidth="300"
>
<block slot="left"> <block slot="left">
<view class="" @click="back"> <view class="" @click="back">
<text class="iconfont icon-fanhui"></text> <text class="iconfont icon-fanhui"></text>
...@@ -20,8 +15,7 @@ ...@@ -20,8 +15,7 @@
</block> </block>
</uni-nav-bar> </uni-nav-bar>
<!-- 搜索项 --> <!-- 搜索项 -->
<SearchCom @change="change" /> <!-- <SearchCom @change="change" /> -->
<!-- 结果 --> <!-- 结果 -->
<view class="inspection-management-content"> <view class="inspection-management-content">
<view class="count-tatal"> <view class="count-tatal">
...@@ -31,21 +25,13 @@ ...@@ -31,21 +25,13 @@
<view class="month-list"> <view class="month-list">
<!-- 每月记录 --> <!-- 每月记录 -->
<view <view class="month-record-item" v-for="(item, index) in list" :key="index">
class="month-record-item" <view v-if="(item || []).length" class="seconed-title">
v-for="(item, index) in list" {{ '2025-04'}}
:key="index"
>
<view v-if="(item.list || []).length" class="seconed-title">
{{ item.submitTime || item.time }}
</view> </view>
<view class="inspect-list"> <view class="inspect-list">
<InspectionItem <InspectionItem :details="item" />
v-for="ele in item.list"
:key="ele.uid"
:details="ele"
/>
</view> </view>
</view> </view>
...@@ -55,25 +41,25 @@ ...@@ -55,25 +41,25 @@
<!-- 开始巡检 --> <!-- 开始巡检 -->
<!-- <view class="inspection-button" @click="toPage">开始巡检</view> --> <!-- <view class="inspection-button" @click="toPage">开始巡检</view> -->
<view class="inspection-button" @click="openDialog(true)">同步数据</view <view class="inspection-button" @click="openDialog(true)">同步数据</view><!-- 打包弹窗 -->
><!-- 打包弹窗 --> <Dialog v-show="isDialog && list.length" :list="list" @close="openDialog(false)"></Dialog>
<Dialog
v-show="isDialog && list.length"
:list="list"
@close="openDialog(false)"
></Dialog>
</view> </view>
</template> </template>
<script> <script>
import SearchCom from "@/components/searchCom/index.vue"; import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue"; import InspectionItem from "@/components/inspectionItem/index.vue";
import { getDarft } from "@/request/index.js"; import {
import Dialog from "./dialog.vue"; getDarft
import { getAllInspections } from "@/request/index.js"; } from "@/request/index.js";
import Empty from "@/components/empty/index.vue"; import Dialog from "./dialog.vue";
import {
export default { getAllInspections
} from "@/request/index.js";
import Empty from "@/components/empty/index.vue";
import inspectApi from "@/api/inspect";
export default {
components: { components: {
SearchCom, SearchCom,
InspectionItem, InspectionItem,
...@@ -91,26 +77,11 @@ export default { ...@@ -91,26 +77,11 @@ export default {
countNum: 0, // 统计查询总数 countNum: 0, // 统计查询总数
}; };
}, },
mounted() { async mounted() {
uni.showLoading(); // this.getInspectRecord()
let res = await inspectApi.selectDataForTime()
getAllInspections() this.list = res
.then((res) => { console.log(res.length, '永远永远永远永远=---=>')
this.all_data = res;
this.init();
uni.hideLoading();
})
.catch((error) => {
if (0 == error.code) {
uni.showToast({
title: error.msg,
icon: "none",
duration: 1000,
});
}
this.all_data = [];
uni.hideLoading();
});
}, },
computed: { computed: {
userInfo() { userInfo() {
...@@ -118,6 +89,13 @@ export default { ...@@ -118,6 +89,13 @@ export default {
}, },
}, },
methods: { methods: {
async getInspectRecord() {
let res = await inspectApi.selectList()
console.log('阿斗者', res)
this.list = res || []
this.countNum = this.list.length
},
// 返回 // 返回
back() { back() {
uni.navigateTo({ uni.navigateTo({
...@@ -140,7 +118,9 @@ export default { ...@@ -140,7 +118,9 @@ export default {
// this.isPackedDataBtn = // this.isPackedDataBtn =
// all_data.filter((item) => item.synchronization == 0).length > 0; // all_data.filter((item) => item.synchronization == 0).length > 0;
const { inspectionTime = [] } = this.searchForm; const {
inspectionTime = []
} = this.searchForm;
const startTime = inspectionTime[0]; const startTime = inspectionTime[0];
const endTime = inspectionTime[1]; const endTime = inspectionTime[1];
...@@ -258,10 +238,10 @@ export default { ...@@ -258,10 +238,10 @@ export default {
}); });
}, },
}, },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.uni-nav-bar-text { .uni-nav-bar-text {
height: 28.8px; height: 28.8px;
width: 28.8px; width: 28.8px;
background: #ffffff; background: #ffffff;
...@@ -278,14 +258,17 @@ export default { ...@@ -278,14 +258,17 @@ export default {
font-size: 16px; font-size: 16px;
line-height: 28.8px; line-height: 28.8px;
} }
} }
.nav-right {
.nav-right {
width: 192px; width: 192px;
} }
.header-buttons {
.header-buttons {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: auto; margin-left: auto;
.button { .button {
width: 89.6px; width: 89.6px;
height: 28.8px; height: 28.8px;
...@@ -299,10 +282,12 @@ export default { ...@@ -299,10 +282,12 @@ export default {
font-weight: 400; font-weight: 400;
text-align: center; text-align: center;
} }
} }
.inspection-management {
.inspection-management {
background-image: linear-gradient(115deg, #e8f0fb 0%, #e1ebfa 100%); background-image: linear-gradient(115deg, #e8f0fb 0%, #e1ebfa 100%);
padding: 0 25.6px; padding: 0 25.6px;
.inspection-management-content { .inspection-management-content {
.count-tatal { .count-tatal {
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
...@@ -312,6 +297,7 @@ export default { ...@@ -312,6 +297,7 @@ export default {
font-weight: 400; font-weight: 400;
height: 22.4px; height: 22.4px;
line-height: 22.4px; line-height: 22.4px;
.num { .num {
font-size: 16px; font-size: 16px;
color: #3774f6; color: #3774f6;
...@@ -320,9 +306,11 @@ export default { ...@@ -320,9 +306,11 @@ export default {
margin-right: 1.6px; margin-right: 1.6px;
} }
} }
.month-list { .month-list {
height: calc(100vh - 20.8px - 12.8px - 6.4px - 28.8px - 49.6px - 25px); height: calc(100vh - 20.8px - 12.8px - 6.4px - 28.8px - 49.6px - 25px);
overflow: auto; overflow: auto;
// padding-bottom: 112px; // padding-bottom: 112px;
.seconed-title { .seconed-title {
font-size: 16px; font-size: 16px;
...@@ -331,11 +319,14 @@ export default { ...@@ -331,11 +319,14 @@ export default {
font-weight: 500; font-weight: 500;
margin-bottom: 9.6px; margin-bottom: 9.6px;
} }
.month-record-item { .month-record-item {
margin-bottom: 19.2px; margin-bottom: 19.2px;
&:last-of-type { &:last-of-type {
margin: 0; margin: 0;
} }
.inspect-list { .inspect-list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
...@@ -344,6 +335,7 @@ export default { ...@@ -344,6 +335,7 @@ export default {
} }
} }
} }
.inspection-button { .inspection-button {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -359,5 +351,5 @@ export default { ...@@ -359,5 +351,5 @@ export default {
box-shadow: 0px 8px 19.2px 0px rgba(51, 104, 246, 0.24); box-shadow: 0px 8px 19.2px 0px rgba(51, 104, 246, 0.24);
border-radius: 21.6px; border-radius: 21.6px;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="profile-left"> <view class="profile-left">
<view class="avatar"> <view class="avatar">
<image <image
src="@/static/img/add-img/home1.png" src="@/static/img/add-img/defaultAvatar.png"
mode="aspectFit" mode="aspectFit"
></image> ></image>
</view> </view>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<view class="profile-box"> <view class="profile-box">
<view class="profile-left"> <view class="profile-left">
<view class="avatar"> <view class="avatar">
<image src="@/static/img/add-img/home1.png" mode="aspectFit"></image> <image src="@/static/img/add-img/defaultAvatar.png" mode="aspectFit"></image>
</view> </view>
<view class="info"> <view class="info">
<view class="username">井道巡检</view> <view class="username">井道巡检</view>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</view> </view>
</view> </view>
<view class="tip"> <view class="tip">
<image class="tip-icon" src="@/static/img/add-img/home1.png" mode="aspectFit"></image>请点击“需巡检井道”执行巡检 <image class="tip-icon" src="@/static/img/add-img/defaultAvatar.png" mode="aspectFit"></image>请点击“需巡检井道”执行巡检
</view> </view>
<view class="tab-content"> <view class="tab-content">
<!-- 操作区域 --> <!-- 操作区域 -->
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<view class="profile-left"> <view class="profile-left">
<view class="avatar"> <view class="avatar">
<image <image
src="@/static/img/add-img/home1.png" src="@/static/img/add-img/defaultAvatar.png"
mode="aspectFit" mode="aspectFit"
></image> ></image>
</view> </view>
......
...@@ -115,7 +115,8 @@ export default class SqlliteDB { ...@@ -115,7 +115,8 @@ export default class SqlliteDB {
name: this.dbName, name: this.dbName,
sql: sql, sql: sql,
success(res) { success(res) {
resolve(); console.log('SQL execution result:', res);
resolve(res); // 暂时直接返回,方便调试
}, },
fail(e) { fail(e) {
console.log(e.message); console.log(e.message);
...@@ -124,7 +125,40 @@ export default class SqlliteDB { ...@@ -124,7 +125,40 @@ export default class SqlliteDB {
}); });
}); });
} }
// 增删改返回最后增加的id
async executeReturnDataSQL(sql) {
console.log('Executing SQL:', sql);
let _ = this
return new Promise((resolve, reject) => {
plus.sqlite.executeSql({
name: _.dbName,
sql: sql,
success(res) {
const queryLastInsertIdSql = "SELECT last_insert_rowid() AS lastId";
plus.sqlite.selectSql({
name: _.dbName,
sql: queryLastInsertIdSql,
success(result) {
if (result && result.length > 0) {
let lastInsertId = result[0].lastId;
console.log('Last Insert ID:', lastInsertId);
resolve({ success: true, lastInsertId: lastInsertId });
} else {
resolve({ success: true, lastInsertId: null });
}
},
fail(e) {
reject(e);
},
});
},
fail(e) {
console.error('SQL execution failed:', e.message);
reject(e);
},
});
});
}
// 查询使用 // 查询使用
async selectSQL(sql) { async selectSQL(sql) {
await this.checkDB(); await this.checkDB();
...@@ -155,10 +189,10 @@ export default class SqlliteDB { ...@@ -155,10 +189,10 @@ export default class SqlliteDB {
plus.sqlite.transaction({ plus.sqlite.transaction({
name: this.dbName, name: this.dbName,
operation: oper, operation: oper,
success: function (e) { success: function(e) {
resolve(); resolve();
}, },
fail: function (e) { fail: function(e) {
reject(e.message); reject(e.message);
}, },
}); });
...@@ -180,6 +214,7 @@ export default class SqlliteDB { ...@@ -180,6 +214,7 @@ export default class SqlliteDB {
} }
static async markDataAsImported(sqllitedb) { static async markDataAsImported(sqllitedb) {
await sqllitedb.executeSQL('INSERT OR REPLACE INTO SYS_CONFIG (key, value) VALUES ("data_imported", "true")'); await sqllitedb.executeSQL(
'INSERT OR REPLACE INTO SYS_CONFIG (key, value) VALUES ("data_imported", "true")');
} }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论