修改下载单个项目

This commit is contained in:
ancong 2026-01-21 17:48:45 +08:00
parent ad076d279b
commit 5f4dc9cc68
40 changed files with 3445 additions and 771 deletions

View File

@ -5,7 +5,8 @@
// import config from '@/config.js';
import { createNetworkMonitor } from '@/components/x-network-monitor/js_sdk/index.js';
import useshujuStore from '@/store/usershuju';
import permissionManager from '@/utils/permissionManager.js';
import fileManager from '@/utils/fileManager.js';
//
@ -31,7 +32,23 @@
// this.reloadData();
}
});
const initpermission = async () => {
//
//
// const packageName = 'com.skzh.xfgczlszhpt';
//
const hasPermission = await permissionManager.ensureStoragePermission();
if (hasPermission) {
console.log('权限申请成功,应用准备就绪');
// this.$store && this.$store.dispatch('app/initApp');
await fileManager.init();
} else {
console.error('权限申请失败,部分功能可能无法使用');
}
}
const initConfig = () => {
@ -72,95 +89,20 @@
});
}
// // SQLite[1,4](@ref)
// const generateTableFields = (tableName, dataObject) => {
// const fields = ['id INTEGER PRIMARY KEY AUTOINCREMENT'];
// for (const key in dataObject) {
// if (Object.prototype.hasOwnProperty.call(dataObject, key)) {
// fields.push(`${key} TEXT DEFAULT ''`);
// }
// }
// fields.push(`padstatus TEXT DEFAULT '0'`);
// // return `CREATE TABLE IF NOT EXISTS ${tableName} (${fields.join(', ')})`;
// return `CREATE TABLE IF NOT EXISTS ${tableName} (${fields.join(', ')})`;
// }
// const inittable = () => {
// //
// const shujuStore = useshujuStore();
// let isopen = proxy.$dbUtils.isOpen('xiaofangdb'); //
// if (isopen) {
// //
// console.log('isopen ' + isopen);
// } else {
// let opendb = proxy.$dbUtils.openDb('xiaofangdb'); //
// console.log('opendb ' + opendb);
// }
// if (shujuStore.networkType != 'none') {
// //
// console.log('fgdfg1' + shujuStore.networkType);
// shujuStore.projectDownload().then((res1 : any) => {
// console.log("555", res1)
// //
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res1.rows.length > 0) {
// let biaofieldssql = generateTableFields('projecttable', res1.rows[0]);
// console.log(' ' + biaofieldssql);
// //
// proxy.$dbUtils.init("xiaofangdb", [{
// tableName: 'projecttable',
// sql: biaofieldssql
// }]); //
// syncProjectData('projecttable', res1.rows)
// }
// }).catch((error : any) => {
// }); //
// }
// // let isopen = this.$dbUtils.isOpen('xiaofangdb'); //
// // if (isopen) {
// // //
// // console.log('isopen ' + isopen);
// // } else {
// // let opendb = this.$dbUtils.openDb('xiaofangdb'); //
// // console.log('opendb ' + opendb);
// // }
// // //
// // this.$dbUtils.init('xiaofangdb', [{
// // tableName: 'xiaofang_table',
// // sql: "CREATE TABLE IF NOT EXISTS xiaofang_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// // }]); //
// }
onLaunch(() => {
onLaunch(async () => {
console.log('App Launch')
// #ifdef APP-PLUS
initConfig(); //
await initpermission();
setTimeout(() => {
plus.screen.lockOrientation('landscape-primary');
plus.navigator.setFullscreen(true);//
//
initConfig(); //
}, 500);

View File

@ -129,7 +129,13 @@
<view style="display: flex; align-items: center; margin-right: 20px;color: #999;"
v-if="userStore.parentmenutitle=='执行'">
<view>网络状态{{shujuStore.networkType=='none'?'暂无网络':shujuStore.networkType}}</view>
<u-button @click="gengxinshuju()" style="width:80px; margin-left: 20px;" type="success" text="更新数据"
<!-- <u-button @click="gengxinshuju()" style="width:80px; margin-left: 20px;" type="success" text="更新数据"
size="small"></u-button> -->
<u-button @click="jcsjshuju()" style="width:120px; margin-left: 20px;" type="primary" text="下载全部基础数据"
size="small"></u-button>
<u-button @click="xiazaixmshuju()" style="width:90px; margin-left: 20px;" type="success" text="下载项目数据"
size="small"></u-button>
<u-button @click="shangchaunxmshuju()" style="width:90px; margin-left: 20px;" type="warning" text="上传项目数据"
size="small"></u-button>
</view>
<view style="display: flex; align-items: center; margin-right: 20px;color: #999;">
@ -201,6 +207,16 @@
getappConfigKey
} from "@/apis/system/user"
import logoimg from '@/static/logo-DN6OD_0Z.png'
import {
queryxianchangLocalDataByPadStatus,
exampleUsage
} from '@/utils/usersqlite/posteditxianchang.js'
import {
syncsprojectxcdownloadData
} from '@/utils/usersqlite/projectxcdownload.js'
import dbUtils from '@/uni_modules/zjy-sqlite-manage/components/zjy-sqlite-manage/dbUtils.js'
export default {
data() {
return {
@ -503,12 +519,156 @@
},
gengxinshuju() {
//
// gengxinshuju() {
// //
// if (this.shujuStore.networkType != 'none') {
// this.shujuStore.inittable(); //
// } else {
// this.$modal.msgError("")
// }
// },
async jcsjshuju() {
//
if (this.shujuStore.networkType != 'none') {
this.shujuStore.inittable(); //
// this.shujuStore.inittable(); //
this.$modal.confirm('确定要更新全部的基础数据信息吗?').then(async () => {
this.shujuStore.setpageloadingtext("基础数据下载中...")
this.shujuStore.setpageloading(true)
const xmresults = await this.shujuStore.projectDownload() //
this.shujuStore.setpageloading(false)
if (xmresults.success) {
//
uni.redirectTo({
url: "/pages/zhixing/xianchang"
})
uni.showToast({
title: `下载成功!`,
icon: 'success'
});
} else {
uni.showToast({
title: `下载失败!`,
icon: 'none'
});
}
});
} else {
this.$modal.msgError("当前无网络请连接,请联网!")
this.$modal.msgError("当前无网络连接,请联网!")
}
},
async xiazaixmshuju() {
//
if (this.shujuStore.networkType != 'none') {
// this.shujuStore.inittable(); //
const xctableExists = await dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
if (xctableExists) {
// 1. padstatus234
const xianchanglocalData = await queryxianchangLocalDataByPadStatus([2, 3, 4], this.shujuStore
.activeprojectid);
// console.log("sdsa", xianchanglocalData)
let fcxwtdatasj = await dbUtils.getprojectcount('xiaofangdb', 'fcxwttable', this.shujuStore
.activeprojectid)
console.log('有无复查新问题', fcxwtdatasj)
let fcdatasj = await dbUtils.getprojectcount('xiaofangdb', 'fctable', this.shujuStore
.activeprojectid)
console.log('有无复查', fcdatasj)
if ((xianchanglocalData && xianchanglocalData.length > 0) || (fcxwtdatasj[0].projectcount !== 0 ||
fcdatasj[
0].projectcount !== 0)) {
this.$modal.msgError("当前项目存在未上传数据请先上传!")
return;
}
}
this.$modal.confirm(`确定要下载项目为'${this.shujuStore.activeprojetname}'的数据信息吗?`).then(async () => {
this.shujuStore.setpageloadingtext("项目数据下载中...")
this.shujuStore.setpageloading(true)
const xcresults = await syncsprojectxcdownloadData(this.shujuStore.activeprojectid)
this.shujuStore.setpageloading(false);
if (xcresults.success) {
//
uni.redirectTo({
url: "/pages/zhixing/xianchang"
})
uni.showToast({
title: `下载成功!`,
icon: 'success'
});
} else {
uni.showToast({
title: `下载失败!`,
icon: 'none'
});
}
});
} else {
this.$modal.msgError("当前无网络连接,请联网!")
}
},
async shangchaunxmshuju() {
//
if (this.shujuStore.networkType != 'none') {
// this.shujuStore.inittable(); //
const xctableExists = await dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
if (!xctableExists) {
this.$modal.msgError("暂无可上传数据!")
return;
} else {
// 1. padstatus234
const xianchanglocalData = await queryxianchangLocalDataByPadStatus([2, 3, 4], this.shujuStore
.activeprojectid);
let fcxwtdatasj = await dbUtils.getprojectcount('xiaofangdb', 'fcxwttable', this.shujuStore
.activeprojectid)
console.log('有无复查新问题', fcxwtdatasj)
let fcdatasj = await dbUtils.getprojectcount('xiaofangdb', 'fctable', this.shujuStore
.activeprojectid)
console.log('有无复查', fcdatasj)
if ((xianchanglocalData && xianchanglocalData.length > 0) || (fcxwtdatasj[0].projectcount !== 0 ||
fcdatasj[
0].projectcount !== 0)) {
} else {
this.$modal.msgError("当前项目暂无可上传数据!")
return;
}
}
this.$modal.confirm(`确定要上传项目为'${this.shujuStore.activeprojetname}'的数据信息吗?`).then(async () => {
this.shujuStore.setpageloadingtext("上传数据中...")
this.shujuStore.setpageloading(true)
const xmtjresults = await exampleUsage(this.shujuStore.activeprojectid)
this.shujuStore.setpageloading(false)
if (xmtjresults.success) {
//
uni.redirectTo({
url: "/pages/zhixing/xianchang"
})
uni.showToast({
title: `上传成功!`,
icon: 'success'
});
} else {
uni.showToast({
title: `上传失败!`,
icon: 'none'
});
}
});
} else {
this.$modal.msgError("当前无网络连接,请联网!")
}
},
},

View File

@ -1,153 +1,156 @@
{
"name" : "消防工程质量数字化管理平台",
"appid" : "__UNI__CBEBC0C",
"package" : "com.skzh.xfgczlszhpt",
"description" : "消防工程质量app",
"versionName" : "1.0.1",
"versionCode" : 101,
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
"name": "消防工程质量数字化管理平台",
"appid": "__UNI__CBEBC0C",
"package": "com.skzh.xfgczlszhpt",
"description": "消防工程质量app",
"versionName": "1.0.1",
"versionCode": 101,
"transformPx": false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"permissions": {
"android.permission.WRITE_EXTERNAL_STORAGE": {},
"FileSystemManager": {
"desc": "文件系统权限"
},
"plus": {
"description": "访问系统文件",
"features": ["io", "sqlite"]
},
"android": {
"CAMERA": {},
"READ_EXTERNAL_STORAGE": {},
"WRITE_EXTERNAL_STORAGE": {}
},
"android.permission.READ_EXTERNAL_STORAGE": {}
},
"compatible": {
"ignoreVersion": true
},
/* */
"modules": {
"Maps": {},
"Camera": {},
"Record": {},
"SQLite": {}
},
/* */
"distribute": {
/* android */
"android": {
"manifestPlaceholders": {
"android:usesCleartextTraffic": "true"
},
"permissions" : {
"android.permission.WRITE_EXTERNAL_STORAGE" : {},
"FileSystemManager" : {
"desc" : "文件系统权限"
},
"plus" : {
"description" : "访问系统文件",
"features" : [ "io", "sqlite" ]
},
"android" : {
"CAMERA" : {},
"READ_EXTERNAL_STORAGE" : {},
"WRITE_EXTERNAL_STORAGE" : {}
},
"android.permission.READ_EXTERNAL_STORAGE" : {}
},
"compatible" : {
"ignoreVersion" : true
},
/* */
"modules" : {
"Maps" : {},
"Camera" : {},
"Record" : {},
"SQLite" : {}
},
/* */
"distribute" : {
/* android */
"android" : {
"requestLegacyExternalStorage" : true,
"packagename" : "com.skzh.xfgczlszhpt",
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\" tools:ignore=\"ScopedStorage\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"minSdkVersion" : 21,
"manifest" : {
"application" : {
"attributes" : {
"android:requestLegacyExternalStorage" : "true"
}
}
}
},
/* ios */
"ios" : {
"dSYMs" : false,
"idfa" : false
},
/* SDK */
"sdkConfigs" : {
"ad" : {},
"maps" : {
"amap" : {
"name" : "amap_15553236855AAFjBypAL",
"appkey_ios" : "692db8a4cd9ed6232d69cc04e56fe81e",
"appkey_android" : "692db8a4cd9ed6232d69cc04e56fe81e"
}
}
},
"icons" : {
"android" : {
"hdpi" : "src/static/appicon/72x72.png",
"xhdpi" : "src/static/appicon/96x96.png",
"xxhdpi" : "src/static/appicon/144x144.png",
"xxxhdpi" : "src/static/appicon/192x192.png"
},
"ios" : {
"appstore" : ""
}
"requestLegacyExternalStorage": true,
"packagename": "com.skzh.xfgczlszhpt",
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\" tools:ignore=\"ScopedStorage\"/>"
],
"abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"],
"minSdkVersion": 21,
"manifest": {
"application": {
"attributes": {
"android:requestLegacyExternalStorage": "true"
}
}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxf7b12e274ddb9542",
"setting" : {
"urlCheck" : false,
"es6" : true,
"postcss" : false,
"minified" : true
},
/* ios */
"ios": {
"dSYMs": false,
"idfa": false
},
/* SDK */
"sdkConfigs": {
"ad": {},
"maps": {
"amap": {
"name": "amap_15553236855AAFjBypAL",
"appkey_ios": "692db8a4cd9ed6232d69cc04e56fe81e",
"appkey_android": "692db8a4cd9ed6232d69cc04e56fe81e"
}
}
},
"icons": {
"android": {
"hdpi": "src/static/appicon/72x72.png",
"xhdpi": "src/static/appicon/96x96.png",
"xxhdpi": "src/static/appicon/144x144.png",
"xxxhdpi": "src/static/appicon/192x192.png"
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"h5" : {
"devServer" : {},
"sdkConfigs" : {
"maps" : {
"amap" : {
"key" : "6f0391b48bc4ebf8b6ddff94c9892af2",
"securityJsCode" : "59615c514d9e0b826bfe0b00082ac48e",
"serviceHost" : ""
}
}
"ios": {
"appstore": ""
}
}
}
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid": "wxf7b12e274ddb9542",
"setting": {
"urlCheck": false,
"es6": true,
"postcss": false,
"minified": true
},
"vueVersion" : "3"
}
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"h5": {
"devServer": {},
"sdkConfigs": {
"maps": {
"amap": {
"key": "6f0391b48bc4ebf8b6ddff94c9892af2",
"securityJsCode": "59615c514d9e0b826bfe0b00082ac48e",
"serviceHost": ""
}
}
}
},
"vueVersion": "3"
}

View File

@ -44,6 +44,10 @@
<text class="register">忘记密码</text>
</navigator>
</view> -->
<!-- color="#2f7d09" textColor="#2f7d09" -->
<zero-loading color="#2f7d09" textColor="#2f7d09" v-if="shujuStore.pageloading" :showText="true"
:text="shujuStore.pageloadingtext" type="wobble"></zero-loading>
</view>
</template>
@ -89,6 +93,25 @@
},
}
},
computed: {
activepageloadingtext() {
const shujuStore = useshujuStore();
return shujuStore.pageloadingtext
},
activepageloading() {
const shujuStore = useshujuStore();
return shujuStore.pageloading
},
activeprojectid() {
// debugger
// return userStore.usernam
const shujuStore = useshujuStore();
return shujuStore.activeprojectid
},
},
mounted() {
const userStore = useUserStore();
this.formData.username = userStore.username;

View File

@ -68,12 +68,15 @@
<view class="querybox2">
<view class="querybox_title">
<view style="color: #ca4341; margin-right:5px;"></view>
<view> {{item.label}}</view>
<view> {{item.infopadobj.label}}</view>
</view>
<view class="querybox_title2">
<view style="display:flex; flex-direction: row; align-items: center;">
<u-input style="width:100px; margin-left: 10px;" placeholder="" border="surround" clearable
v-model="item.value" v-for="(item, index) in item.infopadlist"></u-input>
<block v-for="(item, index) in item.infopadobj.list">
<u-input style="width:100px; margin-left: 10px;" placeholder="" border="surround" clearable
v-model="item.value"></u-input>{{item.dw}}
</block>
</view>
</view>
</view>
@ -84,7 +87,7 @@
<view class="clsbox1" v-if="formdata.materialActivityFiles.length>0">
<view>现场验收</view>
<uni-row :gutter="0" style="display: flex; flex-direction: row; justify-content: center;">
<uni-col :xs="8" :sm="8" :md="8" v-for="(item, index) in formdata.materialActivityFiles"
<uni-col :xs="12" :sm="12" :md="12" v-for="(item, index) in formdata.materialActivityFiles"
style="margin-left: 10px;">
<view class="querybox2">
<view class="querybox_title">
@ -126,7 +129,7 @@
<view> 净高度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.high"></u-input>
</view>
</view>
@ -138,7 +141,7 @@
<view> 净宽度m</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -150,7 +153,7 @@
<view> 下沿据地高度m</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.blowHigt"></u-input>
</view>
</view>
@ -218,7 +221,7 @@
<view> 净宽度m</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -230,7 +233,7 @@
<view> 净高度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.high"></u-input>
</view>
</view>
@ -319,10 +322,12 @@
</view>
<view class="querybox_title2">
<view style="display: flex; flex-direction: row; align-items: center;">
<u-input style="width:180px;margin-right: 10px;" placeholder="请输入" border="surround" clearable
v-model="fubiaoobj.formdata.turningAreaLength"></u-input>m*
<u-input style="margin-left: 10px;width:180px" placeholder="请输入" border="surround" clearable
v-model="fubiaoobj.formdata.turningAreaWidth"></u-input>m
<u-input style="margin-left: 10px;width:130px" placeholder="请输入" border="surround" clearable
v-model="fubiaoobj.formdata.turningAreaWidth"></u-input>m <view style="padding: 0 20px 0 20px;">X
</view>
<u-input style="width:130px;" placeholder="请输入" border="surround" clearable
v-model="fubiaoobj.formdata.turningAreaLength"></u-input>m
<u-checkbox v-model:checked="fubiaoobj.formdata.deadEndFireLaneFlag" style="margin-left: 10px;">
<view class="u-flex" style="font-size: 14px; color: #333;">
<text>是否为尽头式消防车道</text>
@ -332,14 +337,15 @@
</view>
</view>
</uni-col>
<uni-col :xs="12" :sm="12" :md="12">
<uni-col :xs="24" :sm="24" :md="24">
<view class="querybox2">
<view class="querybox_title">
<view style="color: #ca4341; margin-right:5px;"></view>
<view> 环形消防车道与其他车道的连通处情况</view>
</view>
<view class="querybox_title2">
<u-radio-group v-model="fubiaoobj.formdata.roadConnectionType" placement="row" activeColor="#007aff">
<u-radio-group v-model="fubiaoobj.formdata.roadConnectionType"
style="display: flex; flex-direction: row;" placement="row" activeColor="#007aff">
<u-radio activeColor="green" :name="item.value" :label="item.label"
style="margin-left: 20px; margin-right: 10px;"
v-for="(item, index) in fubiaoobj.jsonmap.roadConnectionTypelist"></u-radio>
@ -382,7 +388,7 @@
<view> 宽度m</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -571,8 +577,8 @@
</u-radio-group>
<view style="display: flex; flex-direction: row; align-items: center;">
自动关闭时间(s)
<u-input style="width:100px;margin-left: 10px;" placeholder="请输入" type="number" border="surround"
clearable v-model="fubiaoobj.formdata.autoCloseTimeDuration"></u-input>S
<u-input style="width:100px;margin-left: 10px;" placeholder="请输入" border="surround" clearable
v-model="fubiaoobj.formdata.autoCloseTimeDuration"></u-input>S
</view>
@ -593,8 +599,8 @@
<view> 尺寸/规格</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;margin: 0;padding: 4px;" placeholder="" type="number"
border="surround" clearable v-model="fubiaoobj.formdata.specification"></u-input>
<u-input style="margin-left: 10px;margin: 0;padding: 4px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.specification"></u-input>
</view>
</view>
</uni-col>
@ -1102,7 +1108,7 @@
<view> 距地面高度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.high"></u-input>
</view>
</view>
@ -1161,7 +1167,7 @@
<view> 最不利处疏散宽度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -1191,7 +1197,7 @@
<view> 疏散楼梯净宽(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -1253,7 +1259,7 @@
<view> 防火分区位置</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.compartmentLocation"></u-input>
</view>
</view>
@ -1284,7 +1290,7 @@
<view> 疏散门净宽度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -1320,7 +1326,7 @@
<view> 净宽度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.width"></u-input>
</view>
</view>
@ -1332,7 +1338,7 @@
<view> 净高度(m)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.high"></u-input>
</view>
</view>
@ -1344,7 +1350,7 @@
<view>耐火极限(h)</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.fireResistantLimit"></u-input>
</view>
</view>
@ -3034,7 +3040,7 @@
</view>
<view class="querybox_title2">
<view style="display: flex;flex-direction: row; align-items: center;">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.level"></u-input>
<view> A</view>
</view>
@ -3048,7 +3054,7 @@
<view> 配制数量</view>
</view>
<view class="querybox_title2">
<u-input style="margin-left: 10px;" placeholder="" type="number" border="surround" clearable
<u-input style="margin-left: 10px;" placeholder="" border="surround" clearable
v-model="fubiaoobj.formdata.extinguisherSize"></u-input>
</view>
</view>
@ -3391,7 +3397,53 @@
this.formdata.voiceUrl = '';
},
parseStr(str, resultInfo = "") {
const regex = /\{(\d+)\}/g;
const matches = [];
let match;
// {}
while ((match = regex.exec(str)) !== null) {
matches.push({
number: match[1],
start: match.index,
end: regex.lastIndex
});
}
//
if (matches.length === 0) {
return {
name: str,
list: []
};
}
//
const lastMatch = matches[matches.length - 1];
const dw = str.substring(lastMatch.end).trim();
// name
const namePart = str
.substring(0, lastMatch.start)
.replace(regex, '')
.trim();
// resultInfo
const values = resultInfo.split(',').map(v => v.trim());
// list
const list = matches.map((match, index) => ({
value: index < values.length ? values[index] : '',
maxvalue: parseInt(match.number, 10),
dw: index === matches.length - 1 ? dw : ''
}));
return {
label: namePart,
list
};
},
async getinfo() {
//
@ -3443,69 +3495,14 @@
}
}
// this.recordslist = JSON.parse(objitem.records) || [];
let recordsl = JSON.parse(objitem.records) || [];
for (let xx of recordsl) {
// let titlestr = xx.info;
// let [labelPart, valuePart] = titlestr.split('{');
// let maxvalue = parseInt(valuePart.replace('}', ''), 10);
// xx.label = labelPart;
// xx.maxvalue = maxvalue;
let info = xx.info;
let resultInfo = xx.resultInfo;
let [labelPart, valuePart] = info.split('{');
let maxvalue = parseInt(valuePart.replace('}', ''), 10);
xx.label = labelPart;
//
xx.infopadlist = [];
xx.infopadobj = this.parseStr(info, resultInfo);
//infopadlist
//
if (resultInfo.includes(',')) {
//
let [leftPart, rightPart] = info.split('');
//
let max1 = leftPart.match(/\{(\d+)\}/)?.[1] || 0;
let max2 = rightPart.match(/\{(\d+)\}/)?.[1] || 0;
//
let unit = rightPart.replace(/\d+$/, '');
if (resultInfo.includes(',')) {
let reslist = resultInfo.split(',');
// console.log('444444', reslist);
// resultInfo
reslist.forEach((val, index) => {
xx.infopadlist.push({
value: val,
maxvalue: index === 0 ? max1 : max2,
dw: unit || 'm' // 'm'
});
});
} else {
xx.infopadlist.push({
value: '',
maxvalue: '',
dw: ':' // 'm'
}, {
value: '',
maxvalue: '',
dw: 'm' // 'm'
});
}
} else {
let maxvalue = parseInt(valuePart.replace('}', ''), 10);
xx.infopadlist.push({
value: xx.resultInfo,
maxvalue: maxvalue,
dw: '' // 'm'
});
}
}
console.log('777777777', recordsl);
@ -3628,12 +3625,16 @@
for (let mm of this.locationslist) {
mm.selectFlag = null;
}
for (let m of this.formdata.checkPointids) {
let index = this.locationslist.findIndex(element => element.standardLocationId == m); // 使 findIndex
if (index != -1) {
this.locationslist[index].selectFlag = true;
if (this.formdata.checkPointids) {
for (let m of this.formdata.checkPointids) {
let index = this.locationslist.findIndex(element => element.standardLocationId ==
m); // 使 findIndex
if (index != -1) {
this.locationslist[index].selectFlag = true;
}
}
}
if (this.formdata.imgUrlbase64list) {
this.formdata.imgUrlbase64list = JSON.stringify(this.formdata.imgUrlbase64list);
}
@ -3641,9 +3642,10 @@
this.formdata.imgUrl = this.imgfileList1.toString();
// this.formdata.voiceUrl = this.voiceUrlfileList1.toString();
if (this.formdata.records) {
for (let s of this.formdata.records) {
let vallsit = s.infopadlist.map(item => item.value);
let vallsit = s.infopadobj.list.map(item => item.value);
s.resultInfo = vallsit.toString();
}
this.formdata.records = JSON.stringify(this.formdata.records);
@ -3746,6 +3748,11 @@
let xinzneg = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'projectxianchangtable', updata, 'uuid', this
.formdata
.uuid);
if (xinzneg) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
console.log('更新结果:', xinzneg, this
.formdata
.uuid);
@ -3753,7 +3760,11 @@
console.log('马上新增11111:', updata);
let xinzneg = await this.$dbUtils.addTabItems('xiaofangdb', 'projectxianchangtable', [updata]);
if (xinzneg) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
console.log('新增结果:', xinzneg, this
.formdata
.uuid);
@ -3780,12 +3791,18 @@
for (let mm of this.locationslist) {
mm.selectFlag = null;
}
for (let m of this.formdata.checkPointids) {
let index = this.locationslist.findIndex(element => element.standardLocationId == m); // 使 findIndex
if (index != -1) {
this.locationslist[index].selectFlag = true;
if (this.formdata.checkPointids) {
for (let m of this.formdata.checkPointids) {
let index = this.locationslist.findIndex(element => element.standardLocationId ==
m); // 使 findIndex
if (index != -1) {
this.locationslist[index].selectFlag = true;
}
}
}
if (this.formdata.imgUrlbase64list) {
this.formdata.imgUrlbase64list = JSON.stringify(this.formdata.imgUrlbase64list);
}
@ -3807,9 +3824,12 @@
if (this.formdata.materialActivityFiles) {
this.formdata.materialActivityFiles = JSON.stringify(this.formdata.materialActivityFiles)
}
if (this.formdata.records) {
for (let s of this.formdata.records) {
let vallsit = s.infopadlist.map(item => item.value);
let vallsit = s.infopadobj.list.map(item => item.value);
s.resultInfo = vallsit.toString();
}
this.formdata.records = JSON.stringify(this.formdata.records);
@ -3896,6 +3916,11 @@
let xinzneg = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'projectxianchangtable', updata, 'uuid', this
.formdata
.uuid);
if (xinzneg) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
console.log('更新结果:', xinzneg, this
.formdata
.uuid);
@ -3903,7 +3928,11 @@
console.log('马上新增11111:', updata);
let xinzneg = await this.$dbUtils.addTabItems('xiaofangdb', 'projectxianchangtable', [updata]);
if (xinzneg) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
console.log('新增结果:', xinzneg, this
.formdata
.uuid);
@ -3921,73 +3950,12 @@
this.regulatoryCompanyMaplist = JSON.parse(this.objitem.regulatoryCompanyMap) || [];
// this.recordslist = JSON.parse(objitem.records) || [];
let recordsl = JSON.parse(this.objitem.records) || [];
// for (let xx of recordsl) {
// let titlestr = xx.info;
// let [labelPart, valuePart] = titlestr.split('{');
// let maxvalue = parseInt(valuePart.replace('}', ''), 10);
// xx.label = labelPart;
// xx.maxvalue = maxvalue;
// }
for (let xx of recordsl) {
// let titlestr = xx.info;
// let [labelPart, valuePart] = titlestr.split('{');
// let maxvalue = parseInt(valuePart.replace('}', ''), 10);
// xx.label = labelPart;
// xx.maxvalue = maxvalue;
let info = xx.info;
let resultInfo = xx.resultInfo;
let [labelPart, valuePart] = info.split('{');
let maxvalue = parseInt(valuePart.replace('}', ''), 10);
xx.label = labelPart;
//
xx.infopadlist = [];
//
if (resultInfo.includes(',')) {
//
let [leftPart, rightPart] = info.split('');
//
let max1 = leftPart.match(/\{(\d+)\}/)?.[1] || 0;
let max2 = rightPart.match(/\{(\d+)\}/)?.[1] || 0;
//
let unit = rightPart.replace(/\d+$/, '');
if (resultInfo.includes(',')) {
let reslist = resultInfo.split(',');
// console.log('444444', reslist);
// resultInfo
reslist.forEach((val, index) => {
xx.infopadlist.push({
value: val,
maxvalue: index === 0 ? max1 : max2,
dw: unit || 'm' // 'm'
});
});
} else {
xx.infopadlist.push({
value: '',
maxvalue: '',
dw: ':' // 'm'
}, {
value: '',
maxvalue: '',
dw: 'm' // 'm'
});
}
xx.infopadobj = this.parseStr(info, resultInfo);
} else {
let maxvalue = parseInt(valuePart.replace('}', ''), 10);
xx.infopadlist.push({
value: xx.resultInfo,
maxvalue: maxvalue,
dw: '' // 'm'
});
}
}
@ -4008,6 +3976,13 @@
this.formdata.tableLevel4Id = null;
this.formdata.tableLevel4Code = null;
this.fubiaoobj = null;
this.formdata.attachmentJson = null;
this.formdata.buildingId = null;
this.formdata.checkPointids = null;
this.formdata.remark = null;
this.formdata.issue = null;
this.formdata.resultType = null;
this.formdata.checkPoint = null;
if (this.formdata.attachmentType) {
this.fubiaoobj = {
typeid: this.formdata.attachmentType,
@ -4016,6 +3991,7 @@
jsonmap: null,
datalist: [],
}
if (this.formdata.attachmentJson) {
this.fubiaoobj.formdata = JSON.parse(this.formdata.attachmentJson);
let jsonlist = fujianjson.fubiaolist;

View File

@ -476,9 +476,19 @@
if (chalist.length == 0) {
//
const result = await this.$dbUtils.addTabItems('xiaofangdb', 'fctable', [updata]);
if (result) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
} else {
//
let gengxin = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'fctable', updata, 'uuid', chalist[0].uuid);
if (gengxin) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
}
this.$emit("tkeventclose"); //

View File

@ -533,9 +533,19 @@
if (chalist.length == 0) {
//
const result = await this.$dbUtils.addTabItems('xiaofangdb', 'fcxwttable', [updata]);
if (result) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
} else {
//
let gengxin = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'fcxwttable', updata, 'uuid', chalist[0].uuid);
if (gengxin) {
this.$modal.msgSuccess("保存成功!")
} else {
this.$modal.msgError("保存失败!")
}
}
this.$emit("tkeventclose"); //
},

View File

@ -76,7 +76,7 @@
<view style="width:80%;display: flex; flex-direction: column;">
<u-table row-key="uuid" rowHeight="200" customClass="mewtable2" ref="pageTable" :scrollX="true"
:data="tableData" :ellipsis="false" height="460" :border="true" @select="handleSelectionChange"
:span-method="spanMethodWithColspan" v-if="tableshow">
:span-method="spanMethodWithColspan" v-if="tableshow&&projectcount">
<u-table-column type="selection" fixed width="55" align="center" headerAlign="center"></u-table-column>
<u-table-column prop="checkContent" width="300" :headerEllipsis="false" label="查验内容" align="left"
headerAlign="center">
@ -174,14 +174,7 @@
<template #default="{ row, index }">
<view v-if="row.records" style="display: flex; flex-direction: column;">
<view v-for="(item1,index1) in row.records" :key="index1" style="display: flex;flex-direction: row; ">
{{item1.info?.split('{')[0]}}
<view>
<view v-if="item1.resultInfo.includes(',')">
{{item1.resultInfo.split(',')[0]+''+item1.resultInfo.split(',')[1]+'m'}}
</view>
<view v-else>
{{item1.resultInfo}}
</view>
<view>{{recordsformatStr(item1.info,item1.resultInfo)}}
</view>
</view>
</view>
@ -222,6 +215,8 @@
</template>
</u-table-column>
</u-table>
<view v-else style="text-align: center; font-size: 16px; margin-top: 100px; color: #3c9cff;">
暂无当前项目数据请联网下载</view>
</view>
</view>
<u-modal content="" :closeOnClickOverlay="true" title="图片预览" confirmText="关闭" width="600px" :show="imgboxshow"
@ -289,14 +284,10 @@
</scroll-view>
</view>
</u-modal>
<UniMenu />
<!-- color="#2f7d09" textColor="#2f7d09" -->
<zero-loading v-if="shujuStore.pageloading" :maskOpacity="0.3" color="#c41818" textColor="#c41818" :mask="true"
:showText="true" :text="shujuStore.pageloadingtext" type="wobble"></zero-loading>
</view>
</template>
@ -419,9 +410,19 @@
activeitemtableLevel4Id: 0,
currentvalue: 0,
tabsshow: true,
projectcount: 0,
}
},
computed: {
activepageloadingtext() {
const shujuStore = useshujuStore();
return shujuStore.pageloadingtext
},
activepageloading() {
const shujuStore = useshujuStore();
return shujuStore.pageloading
},
activeprojectid() {
// debugger
// return userStore.usernam
@ -469,33 +470,52 @@
onShow() {
},
onLoad() {
async onLoad() {
// this.getlistinfo(); //
const userStore = useUserStore();
userStore.setparentmenutitle('执行');
userStore.setchildrenmenutitle('现场检查');
this.queryParams.projectId = this.shujuStore.activeprojectid;
console.error('eewrewr:', this.shujuStore.activeprojectid, this.shujuStore.activeprojetname);
// console.error('1:', this.queryParams.projectId);
if (this.queryParams.projectId) {
this.$dbUtils.getDataListAll('xiaofangdb', 'projectst1table', {
projectId: this.queryParams.projectId
}, {
byName: 'sortNum',
byType: 'asc'
}).then((data) => {
}).then(async (data) => {
// shujuStore.setgongsishuju(data);
console.error('项目下1级数据:', data);
this.tabslist1 = data;
this.queryParams.standardTableLevel1Id = this.tabslist1[0].key;
const xctableExists = await this.$dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
if (!xctableExists) {
console.log("现场表不存在")
this.getjctree();
return;
}
let datasj = await this.$dbUtils.getprojectcount('xiaofangdb', 'projectxianchangtable', this
.queryParams
.projectId)
console.error('项目条数', datasj)
this.projectcount = datasj[0].projectcount;
if (this.projectcount == 0) {
this.getjctree();
this.$modal.msgError("暂无当前项目数据请联网下载!");
return;
}
this.getlistinfo(); //
});
// this.getlistinfo(); //
}
const userStore = useUserStore();
userStore.setparentmenutitle('执行');
userStore.setchildrenmenutitle('现场检查');
},
@ -613,8 +633,11 @@
}, 100)
},
fuchfxxwt() {
fuchfxxwt(e) {
//
if (e) {
this.activeitem = e;
}
if (!this.activeitem.tableLevel4Id) {
this.$modal.msgError("请先创建检查点!");
return;
@ -715,6 +738,60 @@
this.imgboxshow = true;
},
recordsformatStr(str, values = "") {
if (!str) return '';
// values
const valueArray = values.split(',')
.map(v => v.trim())
.filter(v => v !== '');
// {}
const regex = /\{(\d+)\}/g;
const matches = [];
let lastMatch = null;
//
let match;
while ((match = regex.exec(str)) !== null) {
matches.push({
index: match.index,
length: match[0].length,
number: match[1]
});
lastMatch = match;
}
//
if (matches.length === 0) return str;
//
let result = '';
let lastIndex = 0;
let valueIndex = 0;
// values
for (const item of matches) {
//
result += str.substring(lastIndex, item.index);
//
const replacement = valueIndex < valueArray.length ?
String(valueArray[valueIndex]) :
'';
result += replacement;
//
lastIndex = item.index + item.length;
valueIndex++;
}
//
result += str.substring(lastIndex);
return result;
},
shanchujiancha() {
//
let vm = this;
@ -838,9 +915,12 @@
this.qingchu();
console.error('标签索引改变时触发:', e);
},
changexiangmu(e) {
async changexiangmu(e) {
// debugger
console.error('标签索引值:', this.currentvalue);
if (this.queryParams.projectId) {
this.shujuStore.setactiveprojectid(this.queryParams.projectId);
this.shujuStore.setactiveprojetname(e.name);
}
if (this.queryParams.projectId) {
this.$dbUtils.getDataListAll('xiaofangdb', 'projectst1table', {
@ -848,7 +928,7 @@
}, {
byName: 'sortNum',
byType: 'asc'
}).then((data) => {
}).then(async (data) => {
// shujuStore.setgongsishuju(data);
console.error('项目下1级数据:', data);
this.currentvalue = 0;
@ -860,11 +940,35 @@
this.currentvalue = 0;
this.queryParams.standardTableLevel1Id = this.tabslist1[0].key;
const xctableExists = await this.$dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
if (!xctableExists) {
console.log("现场表不存在")
this.getjctree();
return;
}
let datasj = await this.$dbUtils.getprojectcount('xiaofangdb', 'projectxianchangtable', this
.queryParams
.projectId)
console.error('项目条数', datasj)
this.projectcount = datasj[0].projectcount;
if (this.projectcount == 0) {
this.getjctree();
this.$modal.msgError("暂无当前项目数据请联网下载!");
return;
}
console.error('标签索引值:', this.currentvalue);
this.getlistinfo(); //
});
// this.getlistinfo(); //
}
},
async getlistinfo() {
//
@ -874,7 +978,13 @@
this.activeitem = null;
this.tableData = [];
this.statistic = '';
this.getjctree();
// this.clearSelection(); //
const xctableExists = await this.$dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
if (!xctableExists) {
console.log("现场表不存在")
return;
}
let datalist = await this.$dbUtils.getDataListpadstatusAll('xiaofangdb', 'projectxianchangtable', this
.queryParams);
@ -905,7 +1015,7 @@
this.getjctree();
},

View File

@ -16,12 +16,16 @@ import { exampleUsage } from '@/utils/usersqlite/posteditxianchang.js'
import { parseObjectToArray, saveNetworkImage } from '@/utils/util'
import { getpadlevel4project, getpadlevel4st1project, getpadlevel4companylist, getpadlevel4defaultst2, getpadlevel4list } from '@/apis/gongyong'
// import { getUserProfile } from '@/apis/systemuser'
import fileManager from '@/utils/fileManager.js'
interface shujuInfoStoreInt {
activeprojectid: string
activeprojetname: string
xiangmushuju: any
gongsishuju: any
networkType: string
storagePath: string
pageloadingtext: string
pageloading: boolean
}
//networkType 状态
//wifi - WiFi 网络
@ -37,16 +41,35 @@ export default defineStore(
() => {
const shujuInfo = ref<shujuInfoStoreInt>({
activeprojectid: '',
activeprojetname: '',
xiangmushuju: [],
gongsishuju: [],
networkType: 'none'
networkType: 'none',
storagePath: '',
pageloadingtext: '加载中...',
pageloading: false
})
//debugger
shujuInfo.value.activeprojectid = storage.get(constant.activeprojectid)
shujuInfo.value.activeprojetname = storage.get(constant.activeprojetname)
shujuInfo.value.xiangmushuju = storage.get(constant.xiangmushuju)
shujuInfo.value.networkType = storage.get(constant.networkType)
shujuInfo.value.gongsishuju = storage.get(constant.gongsishuju)
shujuInfo.value.storagePath = storage.get(constant.storagePath)
// shujuInfo.value.pageloadingtext = storage.get(constant.pageloadingtext)
// shujuInfo.value.pageloading = storage.get(constant.pageloading)
const pageloadingtext = computed(() => {
return shujuInfo.value.pageloadingtext
})
const pageloading = computed(() => {
return shujuInfo.value.pageloading
})
const storagePath = computed(() => {
return shujuInfo.value.storagePath
})
const gongsishuju = computed(() => {
return shujuInfo.value.gongsishuju
})
@ -59,11 +82,31 @@ export default defineStore(
const activeprojectid = computed(() => {
return shujuInfo.value.activeprojectid
})
const activeprojetname = computed(() => {
return shujuInfo.value.activeprojetname
})
function setpageloadingtext(pageloadingtext: any) {
shujuInfo.value.pageloadingtext = pageloadingtext
storage.set(constant.pageloadingtext, pageloadingtext)
}
function setpageloading(pageloading: any) {
shujuInfo.value.pageloading = pageloading
storage.set(constant.pageloading, pageloading)
}
function setstoragePath(storagePath: any) {
shujuInfo.value.storagePath = storagePath
storage.set(constant.storagePath, storagePath)
}
function setactiveprojectid(activeprojectid: any) {
shujuInfo.value.activeprojectid = activeprojectid
storage.set(constant.activeprojectid, activeprojectid)
}
function setactiveprojetname(activeprojetname: any) {
shujuInfo.value.activeprojetname = activeprojetname
storage.set(constant.activeprojetname, activeprojetname)
}
function setnetworkType(networkType: any) {
shujuInfo.value.networkType = networkType
@ -217,7 +260,12 @@ export default defineStore(
}
} catch (error) {
console.error('下载项目数据时发生错误:', error)
throw new Error(`项目数据下载失败: ${error.message}`)
return {
success: false,
data: '',
message: `项目数据下载失败: ${error.message}`
}
// throw new Error(`项目数据下载失败: ${error.message}`)
}
}
@ -302,8 +350,10 @@ export default defineStore(
x.voiceUrllist = ''
if (x.voiceUrl) {
x.voiceUrllist = []
let xbse64 = await saveNetworkImage(userStore1.allurl + x.voiceUrl)
x.voiceUrllist = [xbse64]
let result = await fileManager.saveNetworkImage(userStore1.allurl + x.voiceUrl, projectId)
x.voiceUrllist = [result]
// let xbse64 = await saveNetworkImage(userStore1.allurl + x.voiceUrl)
// x.voiceUrllist = [xbse64]
}
if (x.imgUrl) {
x.imgUrlbase64list = []
@ -312,13 +362,17 @@ export default defineStore(
let imglist = x.imgUrl.split(',')
for (let xx of imglist) {
if (xx) {
let xbse64 = await saveNetworkImage(userStore1.allurl + xx)
x.imgUrlbase64list.push(xbse64)
// let xbse64 = await saveNetworkImage(userStore1.allurl + xx)
// x.imgUrlbase64list.push(xbse64)
let result = await fileManager.saveNetworkImage(userStore1.allurl + xx, projectId)
x.imgUrlbase64list.push(result)
}
}
} else {
let xbse64 = await saveNetworkImage(userStore1.allurl + x.imgUrl)
x.imgUrlbase64list = [xbse64]
// let xbse64 = await saveNetworkImage(userStore1.allurl + x.imgUrl)
// x.imgUrlbase64list = [xbse64]
let result = await fileManager.saveNetworkImage(userStore1.allurl + x.imgUrl, projectId)
x.imgUrlbase64list = [result]
}
}
@ -336,8 +390,10 @@ export default defineStore(
s.voiceUrllist = ''
if (s.voiceUrl) {
s.voiceUrllist = []
let xbse64 = await saveNetworkImage(userStore1.allurl + s.voiceUrl)
s.voiceUrllist = [xbse64]
// let xbse64 = await saveNetworkImage(userStore1.allurl + s.voiceUrl)
// s.voiceUrllist = [xbse64]
let result = await fileManager.saveNetworkImage(userStore1.allurl + s.voiceUrl, projectId)
s.voiceUrllist = [result]
}
if (s.imgUrl) {
s.imgUrlbase64list = []
@ -346,13 +402,17 @@ export default defineStore(
let imglist = s.imgUrl.split(',')
for (let x of imglist) {
if (x) {
let xbse64 = await saveNetworkImage(userStore1.allurl + x)
s.imgUrlbase64list.push(xbse64)
// let xbse64 = await saveNetworkImage(userStore1.allurl + x)
// s.imgUrlbase64list.push(xbse64)
let result = await fileManager.saveNetworkImage(userStore1.allurl + x, projectId)
s.imgUrlbase64list.push(result)
}
}
} else {
let xbse64 = await saveNetworkImage(userStore1.allurl + s.imgUrl)
s.imgUrlbase64list = [xbse64]
// let xbse64 = await saveNetworkImage(userStore1.allurl + s.imgUrl)
// s.imgUrlbase64list = [xbse64]
let result = await fileManager.saveNetworkImage(userStore1.allurl + s.imgUrl, projectId)
s.imgUrlbase64list = [result]
}
}
@ -512,264 +572,6 @@ export default defineStore(
throw new Error(`一级数据下载失败: ${error.message}`)
}
}
// async function projectDownload() {
// // return new Promise((resolve, reject) => {
// getpadlevel4project()
// .then(async (res1: any) => {
// console.log('项目下载', res1)
// //下载执行中所有项目
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res1.rows.length > 0) {
// let biaofieldssql = generateTableFields('projecttable', res1.rows[0])
// console.log('项目表字段 ' + biaofieldssql)
// if (!(await dbUtils.isTable('xiaofangdb', 'projecttable'))) {
// //表是否存在
// //初始化表
// await dbUtils.init('xiaofangdb', [
// {
// tableName: 'projecttable',
// sql: biaofieldssql
// }
// ]) //初始化表
// await syncProjectData('projecttable', res1.rows)
// }
// // setTimeout(() => {
// // }, 1000)
// }
// // resolve(res1)
// })
// .catch((err) => {
// // reject(err)
// })
// //})
// }
// async function xianchanglistDownload(standardTableLevel1Id: string, projectid: string) {
// console.log('现场查验数据请求参数', projectid, standardTableLevel1Id)
// // return new Promise((resolve, reject) => {
// getpadlevel4list(projectid, standardTableLevel1Id)
// .then(async (res4: any) => {
// //debugger
// console.error('现场请求数据', res4)
// //下载执行中所有项目
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res4.rows.length > 0) {
// for (let s of res4.rows) {
// if (s.buildingMap !== null && typeof s.buildingMap === 'object') {
// let buildingMap0 = parseObjectToArray(s.buildingMap)
// console.error('buildingMap0', buildingMap0)
// s.buildingMap = JSON.stringify(buildingMap0)
// }
// if (s.companyMap !== null && typeof s.companyMap === 'object') {
// let companyMap0 = parseObjectToArray(s.companyMap)
// console.error('companyMap0', companyMap0)
// s.companyMap = JSON.stringify(companyMap0)
// }
// if (s.regulatoryCompanyMap !== null && typeof s.regulatoryCompanyMap === 'object') {
// let regulatoryCompanyMap0 = parseObjectToArray(s.regulatoryCompanyMap)
// console.error('regulatoryCompanyMap0', regulatoryCompanyMap0)
// s.regulatoryCompanyMap = JSON.stringify(regulatoryCompanyMap0)
// }
// if (s.issueTypeMap !== null && typeof s.issueTypeMap === 'object') {
// let issueTypeMap0 = parseObjectToArray(s.issueTypeMap)
// console.error('issueTypeMap0', issueTypeMap0)
// s.issueTypeMap = JSON.stringify(issueTypeMap0)
// }
// if (s.checkResultTypeMap !== null && typeof s.checkResultTypeMap === 'object') {
// let checkResultTypeMap0 = parseObjectToArray(s.checkResultTypeMap)
// console.error('checkResultTypeMap0', checkResultTypeMap0)
// s.checkResultTypeMap = JSON.stringify(checkResultTypeMap0)
// }
// if (s.records) {
// s.records = JSON.stringify(s.records)
// }
// if (s.location) {
// s.location = JSON.stringify(s.location)
// }
// if (s.locations) {
// s.locations = JSON.stringify(s.locations)
// }
// if (s.locationInfos) {
// s.locationInfos = JSON.stringify(s.locationInfos)
// }
// s.phaseTypes = ''
// if (s.phaseTypesControlInfo) {
// let plist = s.phaseTypesControlInfo.map((item3: any) => item3.phaseType)
// s.phaseTypesControlInfo = JSON.stringify(s.phaseTypesControlInfo)
// s.phaseTypes = JSON.stringify(plist)
// }
// if (s.materialActivityFiles) {
// s.materialActivityFiles = JSON.stringify(s.materialActivityFiles)
// }
// if (s.standardCommonIssues) {
// s.standardCommonIssues = JSON.stringify(s.standardCommonIssues)
// }
// // if (s.logs) {
// // s.logs = JSON.stringify(s.logs)
// // }
// }
// let biaofieldssql = generateTableFields('projectxianchangtable', res4.rows[0])
// // console.log('现场表字段 ' + biaofieldssql)
// if (!(await dbUtils.isTable('xiaofangdb', 'projectxianchangtable'))) {
// //表是否存在
// //初始化表
// await dbUtils.init('xiaofangdb', [
// {
// tableName: 'projectxianchangtable',
// sql: biaofieldssql
// }
// ]) //初始化表
// await syncxianchangData('projectxianchangtable', res4.rows, projectid, standardTableLevel1Id)
// }
// //setTimeout(() => {
// // }, 1000)
// }
// // resolve(res4)
// })
// .catch((err) => {
// // reject(err)
// })
// // })
// }
// async function fenxianglistDownload(standardTableLevel1Id: string, projectid: string) {
// // return new Promise((resolve, reject) => {
// console.log('项目下2级请求参数', projectid, standardTableLevel1Id)
// getpadlevel4defaultst2(standardTableLevel1Id, projectid)
// .then(async (res5: any) => {
// //debugger
// console.log('项目下2级请求数据', res5)
// //下载执行中所有项目
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res5.rows.length > 0) {
// for (let s of res5.rows) {
// s.projectId = projectid
// s.standardTableLevel1Id = standardTableLevel1Id
// }
// let biaofieldssql = generateTableFields('projectst2table', res5.rows[0])
// // console.log('项目下2级表字段 ' + biaofieldssql)
// if (!(await dbUtils.isTable('xiaofangdb', 'projectst2table'))) {
// //表是否存在
// //初始化表
// await dbUtils.init('xiaofangdb', [
// {
// tableName: 'projectst2table',
// sql: biaofieldssql
// }
// ]) //初始化表
// await syncst2Data('projectst2table', res5.rows, projectid, standardTableLevel1Id)
// }
// //setTimeout(() => {
// // }, 1000)
// }
// // resolve(res5)
// })
// .catch((err) => {
// // reject(err)
// })
// // })
// }
// async function fenbulistDownload(projectId: string) {
// // return new Promise((resolve, reject) => {
// getpadlevel4st1project(projectId)
// .then(async (res3: any) => {
// //debugger
// // console.log('项目下1级', res3.rows)
// //下载执行中所有项目
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res3.rows.length > 0) {
// for (let s of res3.rows) {
// s.projectId = projectId
// s.name = s.value
// }
// let biaofieldssql = generateTableFields('projectst1table', res3.rows[0])
// // console.log('项目下1级表字段 ' + biaofieldssql)
// if (!(await dbUtils.isTable('xiaofangdb', 'projectst1table'))) {
// //表是否存在
// //初始化表
// await dbUtils.init('xiaofangdb', [
// {
// tableName: 'projectst1table',
// sql: biaofieldssql
// }
// ]) //初始化表
// await syncst1Data('projectst1table', res3.rows, projectId)
// }
// // setTimeout(() => {
// // }, 1000)
// }
// // resolve(res3)
// })
// .catch((err) => {
// // reject(err)
// })
// //})
// }
// async function canyudwDownload(projectId: string) {
// // return new Promise((resolve, reject) => {
// // getpadlevel4companylist({ projectId: projectId })
// getpadlevel4companylist(projectId)
// .then(async (res2: any) => {
// //debugger
// // console.log('公司下拉', res2)
// //下载执行中所有项目
// // let biaofields = "CREATE TABLE IF NOT EXISTS kuanglaqu_table (id INTEGER PRIMARY KEY AUTOINCREMENT," +
// // "jsondata TEXT DEFAULT '',createTime TEXT DEFAULT '',hole_info_ids TEXT DEFAULT '', drill_pipe_iddata TEXT DEFAULT '', androidurl TEXT DEFAULT '', updateTime TEXT DEFAULT ''," +
// // "shangchuan TEXT DEFAULT '',status TEXT DEFAULT '')"
// if (res2.rows.length > 0) {
// for (let s of res2.rows) {
// s.projectId = projectId
// }
// let biaofieldssql = generateTableFields('projectgongsitable', res2.rows[0])
// // console.log('公司表字段 ' + biaofieldssql)
// if (!(await dbUtils.isTable('xiaofangdb', 'projectgongsitable'))) {
// //表是否存在
// //初始化表
// await dbUtils.init('xiaofangdb', [
// {
// tableName: 'projectgongsitable',
// sql: biaofieldssql
// }
// ]) //初始化表
// await syncgongsiData('projectgongsitable', res2.rows, projectId)
// }
// //setTimeout(() => {
// // }, 1000)
// }
// // resolve(res2)
// })
// .catch((err) => {
// // reject(err)
// })
// // })
// }
// 下载项目信息-2 根据项目查询参与单位
async function canyudwDownload(projectId: string): Promise<any> {
@ -836,14 +638,29 @@ export default defineStore(
}
if (shujuStore.networkType != 'none') {
//有网络时判断 更新数据库数据进行下载
uni.redirectTo({
url: '/pages/login/dengdai'
})
// uni.redirectTo({
// url: '/pages/login/dengdai'
// })
console.log('当前网络' + shujuStore.networkType)
await exampleUsage() //先去提交数据
await shujuStore.projectDownload() //获取项目信息
const xmtableExists = await dbUtils.isTable('xiaofangdb', 'projecttable')
if (!xmtableExists) {
//项目表不存在
shujuStore.setpageloadingtext('基础数据数据下载中...')
shujuStore.setpageloading(true)
const xmresults = await shujuStore.projectDownload() //获取项目信息
shujuStore.setpageloading(false)
if (xmresults.success) {
//下载成功后
uni.redirectTo({
url: '/pages/zhixing/xianchang'
})
}
} else {
uni.redirectTo({
url: '/pages/zhixing/xianchang'
})
}
} else {
//没有网络
}
@ -857,6 +674,8 @@ export default defineStore(
canyudwDownload,
activeprojectid,
setactiveprojectid,
activeprojetname,
setactiveprojetname,
xiangmushuju,
setxiangmushuju,
setgongsishuju,
@ -864,7 +683,13 @@ export default defineStore(
networkType,
setnetworkType,
generateTableFields,
inittable
inittable,
storagePath,
setstoragePath,
pageloadingtext,
pageloading,
setpageloadingtext,
setpageloading
}
},
{

View File

@ -192,6 +192,7 @@
// #endif
// #ifdef VUE3
if (this.modelValue && this.modelValue.length > 0 && this.filterMixinDatacomResData.length > 0) {
this.current = this.modelValue.map(item => {
let current = this.mixinDatacomResData.find(e =>
e[this.dataValue] == item
@ -207,16 +208,28 @@
// #ifndef VUE3
if (this.value || this.value == 0) {
this.current = this.formatItemName(this.filterMixinDatacomResData.find(e =>
e[this.dataValue] == this.value
))
}
// #endif
// #ifdef VUE3
if (this.modelValue || this.value == 0) {
this.current = this.formatItemName(this.filterMixinDatacomResData.find(e =>
e[this.dataValue] == this.modelValue
))
} else {
if (this.modelValue !== null && this.modelValue !== '' && this.modelValue !== undefined) {
} else {
this.current = "";
}
}
// #endif
}
@ -320,6 +333,7 @@
}
},
initDefVal() {
// console.log('1sdfs8', this.current, this.modelValue)
let defValue = ''
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
defValue = this.valueCom
@ -357,6 +371,7 @@
this.currentArr = []
}
} else {
// console.log('1sdfs7', this.current, this.modelValue)
// const def = this.mixinDatacomResData.find(item => item[this.dataValue] === defValue)
const def = this.mixinDatacomResData.find(item => item[this.dataValue] == defValue)
this.current = def ? this.formatItemName(def) : ''
@ -422,8 +437,10 @@
}
this.filterInput = ""
} else {
this.showSelector = false
this.current = this.formatItemName(item)
if (this.filterable) {
this.filterInput = item[this.dataKey]
}
@ -452,6 +469,7 @@
.dataValue]))
this.$emit('change', currentArr)
} else {
this.$emit('input', val)
this.$emit('update:modelValue', val)
const current = this.mixinDatacomResData.find(item => val == item[this.dataValue])
@ -483,12 +501,14 @@
})
if (this.filterable && this.current && this.showSelector) {
if (!this.multiple) {
this.placeholderOld = this.current
// this.filterInput = ""
}
} else if (this.filterable && !this.current && !this.showSelector) {
if (this.placeholderOld != this.placeholder) {
if (!this.multiple) {
this.current = this.placeholderOld
}
}

View File

@ -0,0 +1,55 @@
## 1.4.32025-10-22
### 增加两个动画
| book | 书籍 (自定义颜色) |
| cube | 立方体 (自定义颜色) |
## 1.4.22025-04-03
## 增加两个动画
| locating | 定位 (自定义颜色) |
| photo | 照片 (自定义颜色) |
## 1.4.12024-07-02
### 1. 增加动画equal(等边), wobble(摇摆)
### 2. 原来的triangle(三角)改为surround(环绕)
### 3. 新增可自定义颜色项
## 1.4.02024-06-28
## 增加 loading 加载文字提醒配置项,默认 false
## 1.3.22023-10-31
修改遮罩默认透明度为 0.1
## 1.3.12023-10-31
## 新增支持,自定义动画颜色(仅部分动画支持)
## 新增动画-annulus(圆环)
## 1.3.02023-08-11
支持 vue3 使用, 增加动画类型 radar(雷达)
## 1.2.22023-06-12
增加 maskOpacity, maskMini, maskDark 自定义参数, 提供更丰富的自定义遮罩层能力
## 1.2.12022-09-09
增加齿轮动画 type=gear
## 1.2.02022-05-27
1. 增加加载类型-剑气sword原子atom
2. 默认类型改为 atom
3. 遮罩透明度调整
## 1.1.12022-04-02
更新使用说明
## 1.1.02022-02-23
增加 type="love" 的心形加载动画
## 1.0.02022-01-28
首次发布

View File

@ -0,0 +1,45 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-annulus",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
width: 60px;
height: 60px;
}
.loader::before {
content: "";
box-sizing: border-box;
position: absolute;
width: 60px;
height: 60px;
border-radius: 50%;
border-top: 2px solid var(--color);
border-right: 2px solid transparent;
animation: spinner 1s linear infinite;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
</style>

View File

@ -0,0 +1,108 @@
<template>
<view class="animations">
<view class="box" :style="{ '--color': color }">
<view class="atom"></view>
<view class="atom"></view>
<view class="atom"></view>
<view class="dot"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-atom",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.box {
position: relative;
width: 120rpx;
height: 120rpx;
}
.dot {
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--color);
animation: dotbreath 2s linear infinite;
}
.atom {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
border-left-width: 6rpx;
border-top-width: 6rpx;
border-left-color: var(--color);
border-left-style: solid;
border-top-style: solid;
border-top-color: transparent;
}
.atom:nth-of-type(1) {
left: 0%;
top: 0%;
animation: atom1 1s linear infinite;
}
.atom:nth-of-type(2) {
right: 0%;
top: 0%;
animation: atom2 1s linear infinite;
}
.atom:nth-of-type(3) {
right: 0%;
bottom: 0%;
animation: atom3 1s linear infinite;
}
@keyframes dotbreath {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
@keyframes atom1 {
0% {
transform: rotateZ(120deg) rotateX(66deg) rotateZ(0deg);
}
100% {
transform: rotateZ(120deg) rotateX(66deg) rotateZ(360deg);
}
}
@keyframes atom2 {
0% {
transform: rotateZ(240deg) rotateX(66deg) rotateZ(0deg);
}
100% {
transform: rotateZ(240deg) rotateX(66deg) rotateZ(360deg);
}
}
@keyframes atom3 {
0% {
transform: rotateZ(360deg) rotateX(66deg) rotateZ(0deg);
}
100% {
transform: rotateZ(360deg) rotateX(66deg) rotateZ(360deg);
}
}
</style>

View File

@ -0,0 +1,80 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }">
<view></view>
<view></view>
<view></view>
<view></view>
<view></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-book",
props: {
color: {
type: String,
default: "#767979",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
position: relative;
width: 66rpx;
height: 66rpx;
perspective: 134rpx;
}
.loader view {
width: 100%;
height: 100%;
background: var(--color);
position: absolute;
left: 50%;
transform-origin: left;
animation: loader 2s infinite;
}
.loader view:nth-child(1) {
animation-delay: 0.15s;
}
.loader view:nth-child(2) {
animation-delay: 0.3s;
}
.loader view:nth-child(3) {
animation-delay: 0.45s;
}
.loader view:nth-child(4) {
animation-delay: 0.6s;
}
.loader view:nth-child(5) {
animation-delay: 0.75s;
}
@keyframes loader {
0% {
transform: rotateY(0deg);
}
50%, 80% {
transform: rotateY(-180deg);
}
90%, 100% {
opacity: 0;
transform: rotateY(-180deg);
}
}
</style>

View File

@ -0,0 +1,84 @@
<template>
<view class="animations">
<view class="box">
<view class="dot dot1"></view>
<view class="dot dot2"></view>
<view class="dot dot3"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-bounce",
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.box {
width: 100rpx;
height: 50rpx;
position: relative;
}
.dot {
width: 14rpx;
height: 14rpx;
background: #007aff;
border-radius: 50%;
position: absolute;
top: calc(50% - 5rpx);
}
.dot1 {
background: #1fa2ff;
left: 0rpx;
-webkit-animation: bounce 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
infinite;
animation: bounce 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
}
.dot2 {
background: #12d8fa;
left: 40rpx;
-webkit-animation: bounce 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28)
alternate infinite;
animation: bounce 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
infinite;
}
.dot3 {
background: #29ffc6;
left: 80rpx;
-webkit-animation: bounce 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28)
alternate infinite;
animation: bounce 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate
infinite;
}
@-webkit-keyframes bounce {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
100% {
-webkit-transform: translateY(-20rpx);
transform: translateY(-20rpx);
}
}
@keyframes bounce {
0% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
100% {
-webkit-transform: translateY(-20rpx);
transform: translateY(-20rpx);
}
}
</style>

View File

@ -0,0 +1,96 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-circle",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
// .container {
// position: absolute;
// top: 50%;
// left: 50%;
// transform: translate(-50%, -50%);
// }
.loader {
display: block;
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 3rpx solid transparent;
border-top-color: var(--color);
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
position: relative;
}
.loader::before {
content: "";
position: absolute;
top: 8rpx;
left: 8rpx;
right: 8rpx;
bottom: 8rpx;
border-radius: 50%;
border: 3rpx solid transparent;
border-top-color: var(--color);
-webkit-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
.loader::after {
content: "";
position: absolute;
top: 16rpx;
left: 16rpx;
right: 16rpx;
bottom: 16rpx;
border-radius: 50%;
border: 3rpx solid transparent;
border-top-color: var(--color);
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>

View File

@ -0,0 +1,87 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-cube",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
width: 96rpx;
height: 96rpx;
margin: auto;
position: relative;
}
.loader::before {
content: '';
width: 96rpx;
height: 10rpx;
background: #999;
position: absolute;
top: 120rpx;
left: 0;
border-radius: 50%;
animation: shadow324 0.5s linear infinite;
}
.loader::after {
content: '';
width: 100%;
height: 100%;
background: var(--color);
position: absolute;
top: 0;
left: 0;
border-radius: 8rpx;
animation: jump7456 0.5s linear infinite;
}
@keyframes jump7456 {
15% {
border-bottom-right-radius: 6rpx;
}
25% {
transform: translateY(18rpx) rotate(22.5deg);
}
50% {
transform: translateY(36rpx) scale(1, .9) rotate(45deg);
border-bottom-right-radius: 80rpx;
}
75% {
transform: translateY(18rpx) rotate(67.5deg);
}
100% {
transform: translateY(0) rotate(90deg);
}
}
@keyframes shadow324 {
0%,
100% {
transform: scale(1, 1);
}
50% {
transform: scale(1.2, 1);
}
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-equal",
props: {
color: {
type: String,
default: "#ff1919",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
width: 50px;
aspect-ratio: 1.154;
position: relative;
background: conic-gradient(
from 120deg at 50% 64%,
#0000,
var(--color) 1deg 120deg,
#0000 121deg
);
animation: spin 1.5s infinite cubic-bezier(0.3, 1, 0, 1);
}
.loader:before,
.loader:after {
content: "";
position: absolute;
inset: 0;
background: inherit;
transform-origin: 50% 66%;
animation: separate 1.5s infinite;
}
.loader:after {
--s: -1;
}
@keyframes spin {
0%,
30% {
transform: rotate(0);
}
70% {
transform: rotate(120deg);
}
70.01%,
100% {
transform: rotate(360deg);
}
}
@keyframes separate {
0% {
transform: rotate(calc(var(--s, 1) * 120deg)) translate(0);
}
30%,
70% {
transform: rotate(calc(var(--s, 1) * 120deg))
translate(calc(var(--s, 1) * -5px), 10px);
}
100% {
transform: rotate(calc(var(--s, 1) * 120deg)) translate(0);
}
}
</style>

View File

@ -0,0 +1,78 @@
<template>
<view class="animations">
<view class="box">
<view class="eye"></view>
<view class="eye"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-eyes",
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.box {
width: 110rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.eye {
width: 50rpx;
height: 50rpx;
background: linear-gradient(135deg, #1fa2ff, #12d8fa);
border-radius: 50%;
position: relative;
}
.eye:after {
background-color: #ffffff;
width: 18rpx;
height: 18rpx;
border-radius: 50%;
left: 20rpx;
top: 24rpx;
position: absolute;
content: "";
-webkit-animation: eyeball 1s linear infinite alternate;
-moz-animation: eyeball 1s linear infinite alternate;
animation: eyeball 1s linear infinite alternate;
}
@-webkit-keyframes eyeball {
0% {
left: 30rpx;
}
100% {
left: 2rpx;
}
}
@-moz-keyframes eyeball {
0% {
left: 30rpx;
}
100% {
left: 2rpx;
}
}
@keyframes eyeball {
0% {
left: 30rpx;
}
100% {
left: 2rpx;
}
}
</style>

View File

@ -0,0 +1,118 @@
<template>
<view class="animations">
<view class="box">
<view class="gear1">
<view class="inner inner1"> </view>
<view class="inner inner2"> </view>
<view class="inner inner3"> </view>
</view>
<view class="gear2">
<view class="inner inner1"> </view>
<view class="inner inner2"> </view>
<view class="inner inner3"> </view>
</view>
<view class="gear3">
<view class="inner inner1"> </view>
<view class="inner inner2"> </view>
<view class="inner inner3"> </view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "loading-gear",
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
$size: 80rpx;
$bgc: red;
.box {
width: 200rpx;
height: 200rpx;
position: relative;
}
@mixin gear($size: $size, $bgc: $bgc) {
width: $size;
height: $size;
.inner {
position: absolute;
width: $size;
height: $size;
top: 0;
left: 0;
background: $bgc;
border-radius: 6rpx;
mask: radial-gradient(transparent 40%, #fff 60%);
}
.inner2 {
transform: rotate(120deg);
}
.inner3 {
transform: rotate(240deg);
}
// &:after {
// position: absolute;
// content: '';
// background: #fff;
// width: $size / 1.8;
// height: $size / 1.8;
// border-radius: 100%;
// top: 50%;
// left: 50%;
// transform: translate(-50%, -50%);
// }
}
.gear1 {
@include gear(60rpx, #0396ff);
position: absolute;
top: 35rpx;
left: 35rpx;
animation: rotate 5s infinite linear;
}
.gear2 {
@include gear(50rpx, #dd524d);
position: absolute;
top: 50rpx;
left: 110rpx;
animation: rotateR 5s infinite linear;
}
.gear3 {
@include gear(50rpx, #f0ad4e);
position: absolute;
top: 110rpx;
left: 50rpx;
animation: rotateR 5s infinite linear;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes rotateR {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-locating",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
width: 96rpx;
height: 96rpx;
display: block;
margin: 40rpx auto;
box-sizing: border-box;
position: relative;
}
.loader::after {
content: '';
width: 96rpx;
height: 96rpx;
left: 0;
bottom: 0;
position: absolute;
border-radius: 50% 50% 0;
border: 30rpx solid var(--color);
transform: rotate(45deg) translate(0, 0);
box-sizing: border-box;
animation: animMarker 0.4s ease-in-out infinite alternate;
}
.loader::before {
content: '';
box-sizing: border-box;
position: absolute;
left: 0;
right: 0;
margin: auto;
top: 150%;
width: 48rpx;
height: 8rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.2);
animation: animShadow 0.4s ease-in-out infinite alternate;
}
@keyframes animMarker {
0% {
transform: rotate(45deg) translate(10rpx, 10rpx);
}
100% {
transform: rotate(45deg) translate(-10rpx, -10rpx);
}
}
@keyframes animShadow {
0% {
transform: scale(0.5);
}
100% {
transform: scale(1);
}
}
</style>

View File

@ -0,0 +1,87 @@
<template>
<view class="animations">
<view class="loader" :style="{ '--color': color }"></view>
</view>
</template>
<script>
export default {
name: "loading-photo",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.loader {
width: 128rpx;
height: 128rpx;
position: relative;
background: #f4f4f4;
border-radius: 8rpx;
overflow: hidden;
}
.loader:before {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 80rpx;
height: 80rpx;
transform: rotate(45deg) translate(30%, 40%);
background: var(--color);
box-shadow: 64rpx -68rpx 0 10rpx var(--color);
animation: slide 2s infinite ease-in-out alternate;
}
.loader:after {
content: "";
position: absolute;
left: 20rpx;
top: 20rpx;
width: 28rpx;
height: 28rpx;
border-radius: 50%;
background: var(--color);
transform: rotate(0deg);
transform-origin: 70rpx 290rpx;
animation: rotate 2s infinite ease-in-out;
}
@keyframes slide {
0% , 100% {
bottom: -70rpx
}
25% , 75% {
bottom: -4rpx
}
20% , 80% {
bottom: 4rpx
}
}
@keyframes rotate {
0% {
transform: rotate(-15deg)
}
25% , 75% {
transform: rotate(0deg)
}
100% {
transform: rotate(25deg)
}
}
</style>

View File

@ -0,0 +1,67 @@
<template>
<view class="animations">
<view class="box" :style="{ '--color': color }">
<view class="pulse-bubble pulse-bubble-1"></view>
<view class="pulse-bubble pulse-bubble-2"></view>
<view class="pulse-bubble pulse-bubble-3"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-pulse",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.box {
width: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.pulse-bubble {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background: var(--color);
}
.pulse-bubble-1 {
// background: #1fa2ff;
animation: pulse 0.4s ease 0s infinite alternate;
}
.pulse-bubble-2 {
// background: #12d8fa;
animation: pulse 0.4s ease 0.2s infinite alternate;
}
.pulse-bubble-3 {
// background: #29ffc6;
animation: pulse 0.4s ease 0.4s infinite alternate;
}
@keyframes pulse {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0.25;
transform: scale(0.75);
}
}
</style>

View File

@ -0,0 +1,132 @@
<template>
<view class="animations">
<view class="radar">
<view class="dot dot-1"></view>
<view class="dot dot-2"></view>
<view class="dot dot-3"></view>
<view class="cover"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-radar",
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
$size: 180rpx;
$dotSize: 4rpx;
$maincolor: #2da3f6;
.radar {
position: relative;
z-index: 1;
height: $size;
width: $size;
background: -webkit-repeating-radial-gradient(
rgba(45, 163, 246, 0) 0%,
rgba(45, 163, 246, 0) 23%,
rgba(45, 163, 246, 0.7) 24%,
rgba(45, 163, 246, 0) 25%
);
margin: 0 auto;
border-radius: 50%;
border: 2rpx solid rgba(45, 163, 246, 0.7);
overflow: hidden;
}
.radar::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: $dotSize;
height: $dotSize;
background: $maincolor;
margin-left: -1rpx;
margin-top: -1rpx;
border-radius: 1rpx;
}
.dot {
position: absolute;
width: $dotSize;
height: $dotSize;
background: $maincolor;
opacity: 0;
border-radius: 50%;
animation: breath 3s linear infinite;
box-shadow: 0 0 2rpx 2rpx rgba(45, 163, 246, 0.5);
}
.dot-1 {
top: 50rpx;
left: 30rpx;
animation-delay: 1s;
}
.dot-2 {
top: 60rpx;
right: 20rpx;
animation-delay: 0.2s;
}
.dot-3 {
top: 140rpx;
right: 100rpx;
animation-delay: 2.3s;
}
.cover {
transform-origin: bottom right;
border-right: 1rpx solid $maincolor;
background: linear-gradient(
45deg,
rgba(255, 255, 255, 0) 45%,
$maincolor 100%
);
width: 50%;
height: 50%;
position: absolute;
top: 0;
left: 0;
animation: rotation 3s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes breath {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
20% {
opacity: 1;
}
40% {
opacity: 0;
}
100% {
opacity: 0;
}
}
</style>

View File

@ -0,0 +1,91 @@
<template>
<view class="animations">
<view class="box">
<view class="loader">
<view class="loader__ball"></view>
<view class="loader__ball"></view>
<view class="loader__ball"></view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "loading-triangle",
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
$dotColor: linear-gradient(135deg, #1fa2ff, #12d8fa, #29ffc6);
$dotSize: 30rpx;
$duration: 2s;
.animations {
width: 160rpx;
height: 160rpx;
position: relative;
}
.box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.loader {
animation: rotate $duration linear infinite normal;
position: relative;
transform-origin: 50% 50%;
&__ball {
height: $dotSize;
width: $dotSize;
left: -$dotSize * 0.5;
position: absolute;
top: -$dotSize * 0.5;
transform-origin: 50% 50%;
&:nth-of-type(2) {
transform: rotate(120deg);
}
&:nth-of-type(3) {
transform: rotate(240deg);
}
&::after {
animation: move $duration * 0.5 ease-in-out infinite alternate;
background: $dotColor;
border-radius: 50%;
content: "";
display: inline-block;
height: 100%;
width: 100%;
transform-origin: 50% 50%;
}
}
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@keyframes move {
0%,
15% {
transform: translateY(0);
}
100% {
transform: translateY(-150%);
}
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<view class="animations">
<view class="box" :style="{ '--color': color }">
<view class="sword"></view>
<view class="sword"></view>
<view class="sword"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-sword",
props: {
color: {
type: String,
default: "#ED213A",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
.box {
position: relative;
width: 120rpx;
height: 120rpx;
}
.sword {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
}
.sword:nth-of-type(1) {
left: 0%;
top: 0%;
border-bottom: 8rpx solid var(--color);
animation: sword1 0.8s linear infinite;
}
.sword:nth-of-type(2) {
right: 0%;
top: 0%;
border-right: 8rpx solid var(--color);
animation: sword2 0.8s linear infinite;
}
.sword:nth-of-type(3) {
right: 0%;
bottom: 0%;
border-top: 8rpx solid var(--color);
animation: sword3 0.8s linear infinite;
}
@keyframes sword1 {
0% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
}
100% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
}
}
@keyframes sword2 {
0% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
}
100% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
}
}
@keyframes sword3 {
0% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
}
100% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
}
}
</style>

View File

@ -0,0 +1,127 @@
<template>
<view class="animations">
<view class="three-body" :style="{ '--color': color }">
<view class="three-body__dot"></view>
<view class="three-body__dot"></view>
<view class="three-body__dot"></view>
</view>
</view>
</template>
<script>
export default {
name: "loading-wobble",
props: {
color: {
type: String,
default: "#0396FF",
},
},
data() {
return {};
},
};
</script>
<style lang="scss" scoped>
$size: 100rpx;
$speed: 1s;
.three-body {
position: relative;
display: inline-block;
height: $size;
width: $size;
animation: spin78236 calc($speed * 2.5) infinite linear;
}
.three-body__dot {
position: absolute;
height: 100%;
width: 27%;
}
.three-body__dot:after {
content: "";
position: absolute;
height: 0%;
width: 100%;
padding-bottom: 100%;
background-color: var(--color);
border-radius: 50%;
}
.three-body__dot:nth-child(1) {
bottom: 5%;
left: 0;
transform: rotate(60deg);
transform-origin: 50% 85%;
}
.three-body__dot:nth-child(1)::after {
bottom: 0;
left: 0;
animation: wobble1 $speed infinite ease-in-out;
animation-delay: calc($speed * -0.3);
}
.three-body__dot:nth-child(2) {
bottom: 5%;
right: 0;
transform: rotate(-60deg);
transform-origin: 50% 85%;
}
.three-body__dot:nth-child(2)::after {
bottom: 0;
left: 0;
animation: wobble1 $speed infinite calc($speed * -0.15) ease-in-out;
}
.three-body__dot:nth-child(3) {
bottom: -5%;
left: 0;
transform: translateX(116.666%);
}
.three-body__dot:nth-child(3)::after {
top: 0;
left: 0;
animation: wobble2 $speed infinite ease-in-out;
}
@keyframes spin78236 {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes wobble1 {
0%,
100% {
transform: translateY(0%) scale(1);
opacity: 1;
}
50% {
transform: translateY(-66%) scale(0.65);
opacity: 0.8;
}
}
@keyframes wobble2 {
0%,
100% {
transform: translateY(0%) scale(1);
opacity: 1;
}
50% {
transform: translateY(66%) scale(0.65);
opacity: 0.8;
}
}
</style>

View File

@ -0,0 +1,186 @@
<template>
<!-- -->
<view
:style="{ position: position, 'z-index': zIndex, '--opacity': maskOpacity }"
class="container"
:class="[
mask ? 'mask' : '',
maskMini ? 'mask-mini' : '',
(mask || maskMini) && maskDark ? 'mask-dark' : '',
]"
@click.prevent="handleClick"
>
<view>
<view class="main">
<loading0 v-if="type == 'circle'" :color="color"></loading0>
<loading1 v-if="type == 'pulse'" :color="color"></loading1>
<loading2 v-if="type == 'bounce'"></loading2>
<loading3 v-if="type == 'eyes'"></loading3>
<loading4 v-if="type == 'surround'"></loading4>
<loading5 v-if="type == 'book'" :color="color"></loading5>
<loading6 v-if="type == 'cube'"></loading6>
<loading7 v-if="type == 'sword'" :color="color"></loading7>
<loading8 v-if="type == 'atom'" :color="color"></loading8>
<loading9 v-if="type == 'gear'"></loading9>
<loading10 v-if="type == 'radar'"></loading10>
<loading11 v-if="type == 'annulus'" :color="color"></loading11>
<loading12 v-if="type == 'wobble'" :color="color"></loading12>
<loading13 v-if="type == 'equal'" :color="color"></loading13>
<loading14 v-if="type == 'photo'" :color="color"></loading14>
<loading15 v-if="type == 'locating'" :color="color"></loading15>
</view>
<view
class="tips"
v-if="showText"
:style="{ color: textColor, fontSize: textSize, marginTop: textGap }"
>{{ text }}</view
>
</view>
</view>
</template>
<script>
import loading0 from "./static/loading-circle.vue";
import loading1 from "./static/loading-pulse.vue";
import loading2 from "./static/loading-bounce.vue";
import loading3 from "./static/loading-eyes.vue";
import loading4 from "./static/loading-surround.vue";
import loading5 from "./static/loading-book.vue";
import loading6 from "./static/loading-cube.vue";
import loading7 from "./static/loading-sword.vue";
import loading8 from "./static/loading-atom.vue";
import loading9 from "./static/loading-gear.vue";
import loading10 from "./static/loading-radar.vue";
import loading11 from "./static/loading-annulus.vue";
import loading12 from "./static/loading-wobble.vue";
import loading13 from "./static/loading-equal.vue";
import loading14 from "./static/loading-photo.vue";
import loading15 from "./static/loading-locating.vue";
export default {
name: "zero-loading",
components: {
loading0,
loading1,
loading2,
loading3,
loading4,
loading5,
loading6,
loading7,
loading8,
loading9,
loading10,
loading11,
loading12,
loading13,
loading14,
loading15,
},
props: {
type: {
type: String,
default: "atom",
},
position: {
type: String,
default: "fixed",
},
zIndex: {
type: Number,
default: 9,
},
mask: {
type: Boolean,
default: false,
},
maskOpacity: {
type: Number,
default: 0.1,
},
maskMini: {
type: Boolean,
default: false,
},
maskDark: {
type: Boolean,
default: true,
},
color: {
type: String,
default: "#0396FF",
},
showText: {
type: Boolean,
default: false,
},
text: {
type: String,
default: "加载中...",
},
textSize: {
type: String,
default: "28rpx",
},
textColor: {
type: String,
default: "#333333",
},
textGap: {
type: String,
default: "40rpx",
},
},
data() {
return {};
},
methods: {
handleClick() {
this.$emit("click");
},
},
};
</script>
<style lang="scss" scoped>
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
}
.tips {
// margin-top: 40rpx;
text-align: center;
}
.mask {
z-index: 999 !important;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100vh;
width: 100vw;
background: rgba(255, 255, 255, var(--opacity));
transform: translate(0, 0);
}
.mask-mini {
height: 300rpx;
width: 300rpx;
border-radius: 20rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.mask-dark {
background: rgba(7, 17, 27, var(--opacity));
}
</style>

View File

@ -0,0 +1,100 @@
{
"id": "zero-loading",
"displayName": "zero-loading(加载动画)",
"version": "1.4.3",
"description": "纯css加载动画, 一个标签元素即可实现炫酷的全屏loading效果,支持vue2,vue3",
"keywords": [
"loading",
"加载动画",
"css动画",
"加载"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0",
"uni-app": "^4.71",
"uni-app-x": "^4.71"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": "",
"type": "component-vue",
"darkmode": "x",
"i18n": "x",
"widescreen": "x"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "√",
"aliyun": "√",
"alipay": "√"
},
"client": {
"uni-app": {
"vue": {
"vue2": "√",
"vue3": "√"
},
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"vue": "√",
"nvue": "-",
"android": "√",
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√",
"alipay": "√",
"toutiao": "√",
"baidu": "√",
"kuaishou": "√",
"jd": "√",
"harmony": "√",
"qq": "√",
"lark": "√"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"uni-app-x": {
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-"
}
}
}
}
}
}

View File

@ -0,0 +1,71 @@
# zero-loading
> 仅测试于 vue2, vue3, 微信小程序. 其他平台自行测试
## 使用方法
导入 `uni_modules` 后直接使用即可
提供多种加载动画类型,传入 type 改变 loading 样式,不传默认 circle
### 全屏使用
```html
<zero-loading v-if="loading"></zero-loading>
```
### 局部使用
**父元素的 `position` 记得改为 `relative` 不然可能影响效果**
```html
<zero-loading type="pulse" position="absolute"></zero-loading>
```
## 参数说明
| 参数 | 类型 | 默认值 | 描述 |
| ----------- | -------- | --------- | ---------------------------------------------- |
| type | String | atom | 样式 |
| position | String | fixed | 定位方式 |
| zIndex | Number | 9 | |
| mask | Boolean | false | 是否需要遮罩 (默认为全屏遮罩,背景色默认为黑色) |
| maskOpacity | Number | 0.1 | 遮罩透明度 |
| maskMini | Boolean | false | 传入 true 时,使用小遮罩 |
| maskDark | Boolean | true | 传入 false 时,遮罩背景色为白色 |
| color | String | #0396FF | 自定义颜色,仅部分支持 |
| showText | showText | false | 是否显示文字 |
| text | String | 加载中... | 文本内容 |
| textSize | String | 28rpx | 文字大小 |
| textColor | String | #333333 | 文字颜色 |
| textGap | String | 40rpx | 文字与 loading 动画的间距 |
### type 可选值:
| type 值 | 描述 |
| -------- | ----------------- |
| book | 书籍 (自定义颜色) |
| cube | 立方体 (自定义颜色) |
| locating | 定位 (自定义颜色) |
| photo | 照片 (自定义颜色) |
| equal | 等边 (自定义颜色) |
| wobble | 摇摆 (自定义颜色) |
| annulus | 圆环 (自定义颜色) |
| sword | 剑气 (自定义颜色) |
| atom | 原子 (自定义颜色) |
| pulse | 脉冲 (自定义颜色) |
| circle | 圆圈 (自定义颜色) |
| eyes | 眼睛 |
| surround | 环绕 |
| bounce | 弹跳 |
| radar | 雷达 |
| gear | 齿轮 |
| ~~love~~ | ~~爱心~~ (已废弃) |
| ~~sun~~ | ~~太阳~~(已废弃) |
插件预览:
![code](https://cdn.zerojs.cn/image/common/code-z_1722414660881_1.jpg?imageMogr2/thumbnail/200x)
[](https://ext.dcloud.net.cn/plugin?id=7339)
> 小程序搜索: 零技术
> 预览的小程序不一定能及时更新当前插件

View File

@ -1,13 +1,17 @@
/**
* 打开数据库
*/
import useshujuStore from '@/store/usershuju'
const openDb = (name) => {
//如果数据库存在则打开,不存在则创建。
//console.error('dsiasdjajd', `${useshujuStore().storagePath}/${name}.db`)
return new Promise((resolve, reject) => {
plus.sqlite.openDatabase({
name: name, //数据库名称
path: `_doc/${name}.db`, //数据库地址
// path: `_doc/${name}.db`, //数据库地址
// location: 'default', // 存储位置(默认应用私有目录)
path: `${useshujuStore().storagePath}/${name}.db`, //数据库地址
success(e) {
console.info("数据库打开成功", e)
resolve(e);
@ -1181,6 +1185,25 @@ const deleteProjectIdData = async (dbName, tabName, projectId = '', standardTabl
// }
// return totalDeleted;
// };
// 查询单个项目在表里的数据条数
const getprojectcount = async (dbName, tabName, projectId = '') => {
let sql = `select count(*) as projectcount from ${tabName} where projectId = '${projectId}'`
// console.log('das', sql)
return new Promise((resolve, reject) => {
plus.sqlite.selectSql({
name: dbName,
sql: sql,
success(e) {
resolve(e);
},
fail(e) {
console.log(e)
reject(e);
}
})
})
}
export default {
openDb, //打开数据库
init, //初始化数据库
@ -1206,4 +1229,5 @@ export default {
clearTableWithReset, //清空表
delResetTable, // 清空数据表
deleteProjectIdData, //清空项目id等于值的数据表并且uuid 不重置
getprojectcount, //查询单个项目在表里的数据条数
}

View File

@ -20,7 +20,11 @@ const constant = {
networkType: 'vuex_networkType',
xiangmushuju: 'vuex_xiangmushuju',
activeprojectid: 'vuex_activeprojectid',
gongsishuju: 'vuex_gongsishuju'
activeprojetname: 'vuex_activeprojetname',
gongsishuju: 'vuex_gongsishuju',
storagePath: 'vuex_storagePath',
pageloadingtext: 'vuex_pageloadingtext',
pageloading: 'vuex_pageloading'
}
export default constant

364
src/utils/fileManager.js Normal file
View File

@ -0,0 +1,364 @@
import useshujuStore from '@/store/usershuju'
export class FileManager {
constructor() {
this.basePath = '/storage/emulated/0/Android/data/uni.app.UNICBEBC0C';
this.packageName = ''; // 将在初始化时设置
this.privateStoragePath = "";
}
// 初始化包名
init() {
//plus.io.PUBLIC_DOCUMENTS ---公共文档目录 /storage/emulated/0/Android/data/io.dcloud.HBuilder/documents/myAppData/
//plus.io.PRIVATE_DOC ---应用私有文档目录 /storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/myAppData/
// 1. 获取应用的私有文档目录
plus.io.requestFileSystem(plus.io.PUBLIC_DOCUMENTS, function(fs) {
// fs.root 是目录对象,代表应用的私有文档目录根目录 (/data/data/<pkg>/files/)
// /storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/myAppData/
// 2. 创建目录 (myAppData)
fs.root.getDirectory('files', {
create: true
}, function(dirEntry) {
console.log('目录创建/获取成功:', dirEntry.fullPath);
useshujuStore().setstoragePath(dirEntry.fullPath)
// this.privateStoragePath = dirEntry.fullPath;
// 3. 在目录中创建文件 (userInfo.json)
// dirEntry.getFile('userInfo.json', {
// create: true
// }, function(fileEntry) {
// console.log('文件创建/获取成功:', fileEntry.fullPath);
// 4. 创建文件写入对象
// fileEntry.createWriter(function(writer) {
// writer.onwrite = function(e) {
// console.log('写入完成!');
// };
// writer.onerror = function(e) {
// console.error('写入失败:', e.message);
// };
// // 5. 写入内容
// const content = JSON.stringify({
// name: 'uni-app',
// version: '3.0'
// });
// writer.write(content);
// }, function(e) {
// console.error('获取写入对象失败:', e.message);
// });
// }, function(e) {
// console.error('获取文件失败:', e.message);
// });
// }, function(e) {
// console.error('获取目录失败:', e.message);
// });
}, function(e) {
console.error('请求文件系统失败:', e.message);
});
})
}
// 从URL提取文件名
generateFileName(url) {
// try {
// const urlParts = url.split('/');
// const datePart = urlParts[urlParts.length - 2].replace(/-/g, '');
// const fileName = urlParts[urlParts.length - 1];
// return datePart + fileName;
// } catch (error) {
// console.error('文件名生成错误:', error);
// // 备用方案:使用时间戳
// return Date.now() + '.jpg';
// }
// 提取原始文件名
let fileName = url.substring(url.lastIndexOf('/') + 1);
// 去除查询参数(如果有)
if (fileName.includes('?')) {
fileName = fileName.substring(0, fileName.indexOf('?'));
}
// 提取日期部分并格式化
const dateMatch = url.match(/\/(\d{4}-\d{2}-\d{2})\//);
if (dateMatch) {
const datePart = dateMatch[1].replace(/-/g, '');
// 将日期部分添加到文件名前面
fileName = datePart + fileName;
}
return fileName;
}
// 获取项目文件夹路径
getProjectFolderPath(projectId) {
return `${useshujuStore().storagePath}project${projectId}/`;
}
// 检查文件是否存在
async fileExists(filePath) {
return new Promise((resolve) => {
plus.io.resolveLocalFileSystemURL(filePath, () => {
resolve(true);
}, () => {
resolve(false);
});
});
}
// 下载并保存图片
async saveNetworkImage(imageUrl, projectId) {
try {
// 生成文件名和路径
const projectPath = this.getProjectFolderPath(projectId);
// console.error('保存图片lj', filePath)
// 获取文件系统
const fs = await this.requestFileSystem();
// 获取或创建项目目录
const dirEntry = await this.getDirectory(fs, projectId);
// 格式化文件名
const fileName = this.generateFileName(imageUrl);
// 检查文件是否已存在
console.error(`文件${fileName}`)
const filePath = projectPath + fileName;
const fileExists = await this.checkFileExists(dirEntry, fileName);
if (fileExists) {
console.error(`文件 ${fileName} 已存在,无需重复保存`)
return filePath;
}
console.error(`文件1${fileExists}`)
const tempFilePath = await this.downloadFile(imageUrl, fileName);
const savedPath = await this.saveFileToDirectory(dirEntry, tempFilePath, fileName);
return savedPath;
// const tempFilePath = await this.downloadFile(imageUrl, filePath);
// // 检查文件是否已存在
// const exists = await this.fileExists(filePath);
// console.error('保存图片lj1111111', exists)
// if (exists) {
// return {
// success: false,
// message: '文件已存在',
// path: filePath
// };
// }
// 确保项目目录存在
// await this.ensureDirectoryExists(projectPath);
// console.error('保存图片0', imageUrl, filePath)
// 下载文件
// const downloadResult = await this.downloadFile(imageUrl, filePath);
// return {
// success: true,
// message: '保存成功',
// // path: filePath,
// fileName: fileName
// };
} catch (error) {
console.error('保存图片失败:', error);
return {
success: false,
message: '保存失败: ' + error.message
};
}
}
// 下载文件
// async downloadFile(url, filePath) {
// console.error('保存图片', url, filePath)
// return new Promise((resolve, reject) => {
// const downloadTask = plus.downloader.createDownload(url, {
// filename: filePath
// }, (download, status) => {
// if (status === 200) {
// resolve(download);
// } else {
// reject(new Error(`下载失败,状态码: ${status}`));
// }
// });
// downloadTask.start();
// });
// }
async downloadFile(url, fileName) {
console.error('保存图片', url, fileName)
return new Promise((resolve, reject) => {
uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
resolve(res.tempFilePath);
} else {
reject(`下载失败,状态码: ${res.statusCode}`);
}
},
fail: (error) => {
reject(error);
}
});
});
}
// 清空项目文件夹
async clearProjectFolder(projectId) {
try {
const projectPath = this.getProjectFolderPath(projectId);
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(projectPath, (entry) => {
entry.removeRecursively(() => {
resolve({
success: true,
message: '文件夹清空成功'
});
}, (error) => {
reject(new Error('清空失败: ' + error.message));
});
}, () => {
resolve({
success: true,
message: '文件夹不存在,无需清空'
});
});
});
} catch (error) {
return {
success: false,
message: '清空失败: ' + error.message
};
}
}
// 获取项目文件夹中的文件列表
async getProjectFiles(projectId) {
try {
const projectPath = this.getProjectFolderPath(projectId);
return new Promise((resolve) => {
plus.io.resolveLocalFileSystemURL(projectPath, (entry) => {
const reader = entry.createReader();
reader.readEntries((entries) => {
const files = entries.map(entry => ({
name: entry.name,
path: entry.fullPath,
isDirectory: entry.isDirectory,
size: entry.size || 0
}));
resolve(files);
}, () => {
resolve([]);
});
}, () => {
resolve([]);
});
});
} catch (error) {
console.error('获取文件列表失败:', error);
return [];
}
}
// 请求文件系统
requestFileSystem() {
return new Promise((resolve, reject) => {
plus.io.requestFileSystem(plus.io.PUBLIC_DOCUMENTS, (fs) => {
resolve(fs);
}, (error) => {
reject(error);
});
});
}
// 创建或获取目录
async getDirectory(fs, projectId) {
const dirName = `files/project${projectId}`;
return new Promise((resolve, reject) => {
fs.root.getDirectory(dirName, {
create: true
}, (dirEntry) => {
resolve(dirEntry);
}, (error) => {
reject(error);
});
});
}
// 检查文件是否存在
async checkFileExists(dirEntry, fileName) {
return new Promise((resolve, reject) => {
dirEntry.getFile(fileName, {
create: false
}, (fileEntry) => {
resolve(true); // 文件存在
}, (error) => {
resolve(false); // 文件不存在
});
});
}
// // 下载文件
// downloadFile(url, fileName) {
// return new Promise((resolve, reject) => {
// uni.downloadFile({
// url: url,
// success: (res) => {
// if (res.statusCode === 200) {
// resolve(res.tempFilePath);
// } else {
// reject(`下载失败,状态码: ${res.statusCode}`);
// }
// },
// fail: (error) => {
// reject(error);
// }
// });
// });
// }
// 保存文件到指定目录
// 保存文件到指定目录
async saveFileToDirectory(dirEntry, tempFilePath, fileName) {
return new Promise((resolve, reject) => {
// 获取目录路径
const dirPath = dirEntry.fullPath;
// 使用5+ API的移动文件方法
plus.io.resolveLocalFileSystemURL(tempFilePath, (tempEntry) => {
// 目标文件路径
const targetPath = dirPath + fileName;
// 移动文件到目标位置
tempEntry.moveTo(dirEntry, fileName, (movedEntry) => {
resolve(movedEntry.fullPath);
}, (error) => {
// 如果移动失败,尝试复制然后删除原文件
tempEntry.copyTo(dirEntry, fileName, (copiedEntry) => {
// 删除临时文件
tempEntry.remove(() => {
resolve(copiedEntry.fullPath);
}, (removeError) => {
console.warn('删除临时文件失败:', removeError);
resolve(copiedEntry.fullPath);
});
}, (copyError) => {
reject(copyError);
});
});
}, (error) => {
reject(error);
});
});
}
}
export default new FileManager();

View File

@ -132,10 +132,10 @@ const requestObj = {
_this.methodstr = 'DELETE'
// 当 expression 不匹配任何 case 时执行的代码
}
uni.showLoading({
title: '加载中...',
duration: 15000 // 可根据实用场景设置时间
})
// uni.showLoading({
// title: '加载中...',
// duration: 15000 // 可根据实用场景设置时间
// })
uni.request({
url,
@ -146,7 +146,7 @@ const requestObj = {
timeout: timeout,
success(res) {
// debugger
uni.hideLoading()
// uni.hideLoading()
// console.log('55dfdsfsd5', res.data)
res.data.code = res.data.code == 'ok' ? 200 : res.data.code
const data = res.data as Response
@ -180,13 +180,13 @@ const requestObj = {
}
},
fail(err) {
uni.hideLoading()
// uni.hideLoading()
console.log('fail', err)
uni.showToast({ title: '网络错误', icon: 'none' })
reject({ message: '网络错误' })
},
complete() {
uni.hideLoading()
// uni.hideLoading()
_this.isLock = false
}
})

View File

@ -0,0 +1,93 @@
import useshujuStore from '@/store/usershuju'
class PermissionManager {
constructor() {
this.storagePermission = 'android.permission.WRITE_EXTERNAL_STORAGE';
}
// 检查权限
checkPermission(permission) {
return new Promise((resolve) => {
if (plus.os.name.toLowerCase() !== 'android') {
resolve(true);
return;
}
plus.android.requestPermissions([permission], (result) => {
resolve(result.granted && result.granted.length > 0);
}, (error) => {
console.error('权限检查错误:', error);
resolve(false);
});
});
}
// 申请存储权限
async requestStoragePermission() {
if (plus.os.name.toLowerCase() !== 'android') {
return true;
}
return new Promise((resolve) => {
plus.android.requestPermissions([this.storagePermission], (result) => {
if (result.deniedAlways.length > 0) {
// 权限被永久拒绝
this.showPermissionDialog('存储权限被永久拒绝,请到应用设置中开启权限');
resolve(false);
} else if (result.deniedPresent.length > 0) {
// 权限被临时拒绝
this.showPermissionDialog('需要存储权限来保存文件');
resolve(false);
} else if (result.granted.length > 0) {
// 权限被允许
console.log('存储权限已获取');
resolve(true);
}
}, (error) => {
console.error('权限申请错误:', error);
resolve(false);
});
});
}
// 显示权限提示对话框
showPermissionDialog(message) {
uni.showModal({
title: '权限提示',
content: message,
confirmText: '去设置',
success: (res) => {
if (res.confirm) {
this.openAppSettings();
}
}
});
}
// 打开应用设置页面
openAppSettings() {
if (plus.os.name.toLowerCase() === 'android') {
const Intent = plus.android.importClass('android.content.Intent');
const Settings = plus.android.importClass('android.provider.Settings');
const Uri = plus.android.importClass('android.net.Uri');
const mainActivity = plus.android.runtimeMainActivity();
const intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
const uri = Uri.fromParts('package', mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
// 检查并申请存储权限
async ensureStoragePermission() {
const hasPermission = await this.checkPermission(this.storagePermission);
if (!hasPermission) {
return await this.requestStoragePermission();
}
return true;
}
}
export default new PermissionManager();

View File

@ -24,8 +24,12 @@ let storageNodeKeys = [
constant.androidappVersion,
constant.networkType,
constant.activeprojectid,
constant.activeprojetname,
constant.xiangmushuju,
constant.gongsishuju
constant.gongsishuju,
constant.storagePath,
constant.pageloadingtext,
constant.pageloading
]
const storage = {

View File

@ -40,16 +40,20 @@ async function processNewData(newDataList, results) {
if (!newDataList || newDataList.length === 0) return;
for (const item of newDataList) {
let oldimgUrl = ''; //旧的图片
let oldvoiceUrl = ''; //旧的录音
try {
// 1. 先上传图片并获取服务器URL
const serverImgUrls = await uploadMultipleImages(item.imgUrl);
if (serverImgUrls) {
oldimgUrl = JSON.parse(JSON.stringify(item.imgUrl))
// 2. 更新本地表中的图片URL为服务器返回的URL
await updateLocalDataImage(item.uuid, serverImgUrls, 'projectxianchangtable');
}
// 1. 先上传录音并获取服务器URL
const servervoiceUrl = await uploadMultiplevoiceUrl(item.voiceUrl);
if (servervoiceUrl) {
oldvoiceUrl = JSON.parse(JSON.stringify(item.voiceUrl))
// 2. 更新本地表中的录音URL为服务器返回的URL
await updateLocalDatavoiceUrl(item.uuid, servervoiceUrl, 'projectxianchangtable');
@ -65,6 +69,30 @@ async function processNewData(newDataList, results) {
// 4. 新增成功后删除本地SQLite数据
if (insertResult.success) {
await deleteLocalData(item.uuid, 'projectxianchangtable');
if (oldimgUrl) {
uni.removeSavedFile({
filePath: oldimgUrl,
success: () => {
console.log('临时图片删除成功');
},
fail: (err) => {
console.error('临时图片删除失败:' + oldimgUrl, err);
}
});
}
if (oldvoiceUrl) {
uni.removeSavedFile({
filePath: oldvoiceUrl,
success: () => {
console.log('临时录音删除成功');
},
fail: (err) => {
console.error('临时录音删除失败:' + oldvoiceUrl, err);
}
});
}
results.success.push({
id: item.uuid,
@ -681,7 +709,7 @@ function groupDataByPadStatus(dataList) {
* @param {Array} padStatusList - 要查询的padstatus值数组[2,3,4]
* @returns {Promise<Array>} 查询到的数据列表
*/
async function queryxianchangLocalDataByPadStatus(padStatusList, projectId = "") {
export async function queryxianchangLocalDataByPadStatus(padStatusList, projectId = "") {
return new Promise((resolve, reject) => {
if (!padStatusList || padStatusList.length === 0) {
resolve([]);
@ -810,16 +838,20 @@ async function fcxwtprocessNewData(newDataList, results) {
if (!newDataList || newDataList.length === 0) return;
for (const item of newDataList) {
let oldimgUrl = ''; //旧的图片
let oldvoiceUrl = ''; //旧的录音
try {
// 1. 先上传图片并获取服务器URL
const serverImgUrls = await uploadMultipleImages(item.imgUrl);
if (serverImgUrls) {
oldimgUrl = JSON.parse(JSON.stringify(item.imgUrl))
// 2. 更新本地表中的图片URL为服务器返回的URL
await updateLocalDataImage(item.uuid, serverImgUrls, 'fcxwttable');
}
// 1. 先上传录音并获取服务器URL
const servervoiceUrl = await uploadMultiplevoiceUrl(item.voiceUrl);
if (servervoiceUrl) {
oldvoiceUrl = JSON.parse(JSON.stringify(item.voiceUrl))
// 2. 更新本地表中的录音URL为服务器返回的URL
await updateLocalDatavoiceUrl(item.uuid, servervoiceUrl, 'fcxwttable');
@ -837,7 +869,29 @@ async function fcxwtprocessNewData(newDataList, results) {
console.log('复查新问题正在删除');
await deleteLocalData(item.uuid, 'fcxwttable');
if (oldimgUrl) {
uni.removeSavedFile({
filePath: oldimgUrl,
success: () => {
console.log('临时图片删除成功');
},
fail: (err) => {
console.error('临时图片删除失败:' + oldimgUrl, err);
}
});
}
if (oldvoiceUrl) {
uni.removeSavedFile({
filePath: oldvoiceUrl,
success: () => {
console.log('临时录音删除成功');
},
fail: (err) => {
console.error('临时录音删除失败:' + oldvoiceUrl, err);
}
});
}
results.success.push({
id: item.uuid,
serverId: insertResult.data.uuid,
@ -866,19 +920,35 @@ async function fcxwtcallAddServerApi(data) {
console.log('复查新问题一批量处理1');
if (data.locations) {
data.locations = JSON.parse(data.locations)
}
console.log('复查新问题一批量处理2');
if (data.records) {
data.records = JSON.parse(data.records)
}
console.log('复查新问题一批量处理3');
if (data.materialActivityFiles) {
data.materialActivityFiles = JSON.parse(data.materialActivityFiles)
}
console.log('复查新问题一批量处理4');
if (data.locations == "[]") {
data.locations = null;
} else {
data.locations = JSON.parse(data.locations)
}
console.log(`复查新问题提交`, JSON.stringify(data));
}
console.log('复查新问题一批量处理2', data.locations);
if (data.records) {
if (data.records == "[]") {
data.records = null;
} else {
data.records = JSON.parse(data.records)
}
}
console.log('复查新问题一批量处理3', data.records);
if (data.materialActivityFiles) {
if (data.materialActivityFiles == "[]") {
data.materialActivityFiles = null;
} else {
data.materialActivityFiles = JSON.parse(data.materialActivityFiles)
}
}
data.attachmentJson = null;
console.log('复查新问题一批量处理4', data.materialActivityFiles);
console.log(`复查新问题提交`, data);
return new Promise((resolve, reject) => {
uni.request({
@ -980,16 +1050,20 @@ async function fcprocessNewData(newDataList, results) {
if (!newDataList || newDataList.length === 0) return;
for (const item of newDataList) {
let oldimgUrl = ''; //旧的图片
let oldvoiceUrl = ''; //旧的录音
try {
// 1. 先上传图片并获取服务器URL
const serverImgUrls = await uploadMultipleImages(item.imgUrl);
if (serverImgUrls) {
oldimgUrl = JSON.parse(JSON.stringify(item.imgUrl))
// 2. 更新本地表中的图片URL为服务器返回的URL
await updateLocalDataImage(item.uuid, serverImgUrls, 'fctable');
}
// 1. 先上传录音并获取服务器URL
const servervoiceUrl = await uploadMultiplevoiceUrl(item.voiceUrl);
if (servervoiceUrl) {
oldvoiceUrl = JSON.parse(JSON.stringify(item.voiceUrl))
// 2. 更新本地表中的录音URL为服务器返回的URL
await updateLocalDatavoiceUrl(item.uuid, servervoiceUrl, 'fctable');
@ -1005,7 +1079,29 @@ async function fcprocessNewData(newDataList, results) {
// 4. 新增成功后删除本地SQLite数据
if (insertResult.success) {
await deleteLocalData(item.uuid, 'fctable');
if (oldimgUrl) {
uni.removeSavedFile({
filePath: oldimgUrl,
success: () => {
console.log('临时图片删除成功');
},
fail: (err) => {
console.error('临时图片删除失败:' + oldimgUrl, err);
}
});
}
if (oldvoiceUrl) {
uni.removeSavedFile({
filePath: oldvoiceUrl,
success: () => {
console.log('临时录音删除成功');
},
fail: (err) => {
console.error('临时录音删除失败:' + oldvoiceUrl, err);
}
});
}
results.success.push({
id: item.uuid,
serverId: insertResult.data.uuid,
@ -1036,20 +1132,14 @@ export const exampleUsage = async (projectId = '') => {
const tableExists = await dbUtils.isTable('xiaofangdb', 'projectxianchangtable')
console.log('现场表是否存在', tableExists)
if (!tableExists) {
return;
return {
success: false,
message: `现场表不存在!`
}
}
// 1. 先查询本地现场数据表中padstatus为2、3、4的数据
const xianchanglocalData = await queryxianchangLocalDataByPadStatus([2, 3, 4], projectId);
// if (!xianchanglocalData || xianchanglocalData.length === 0) {
// uni.showToast({
// title: '没有需要处理的现场数据',
// icon: 'none'
// });
// return;
// }
if (xianchanglocalData || xianchanglocalData.length > 0) {
console.log('查询的现场数据待处理数据:', xianchanglocalData);
@ -1059,16 +1149,16 @@ export const exampleUsage = async (projectId = '') => {
// 3. 显示处理结果
if (xianchangresult.failed.length === 0) {
uni.showToast({
title: `全部现场数据处理成功,共${xianchangresult.success.length}`,
icon: 'success'
});
// uni.showToast({
// title: `全部现场数据处理成功,共${xianchangresult.success.length}条`,
// icon: 'success'
// });
} else {
uni.showModal({
title: '现场数据处理结果',
content: `成功: ${xianchangresult.success.length}条, 失败: ${xianchangresult.failed.length}`,
showCancel: false
});
// uni.showModal({
// title: '现场数据处理结果',
// content: `成功: ${xianchangresult.success.length}条, 失败: ${xianchangresult.failed.length}条`,
// showCancel: false
// });
// 可以在这里记录或显示失败详情
xianchangresult.failed.forEach(failedItem => {
@ -1099,16 +1189,16 @@ export const exampleUsage = async (projectId = '') => {
// 3. 显示处理结果
if (fcxwtresult.failed.length === 0) {
uni.showToast({
title: `全部复查新问题数据处理成功,共${fcxwtresult.success.length}`,
icon: 'success'
});
// uni.showToast({
// title: `全部复查新问题数据处理成功,共${fcxwtresult.success.length}条`,
// icon: 'success'
// });
} else {
uni.showModal({
title: '复查新问题数据处理结果',
content: `成功: ${fcxwtresult.success.length}条, 失败: ${fcxwtresult.failed.length}`,
showCancel: false
});
// uni.showModal({
// title: '复查新问题数据处理结果',
// content: `成功: ${fcxwtresult.success.length}条, 失败: ${fcxwtresult.failed.length}条`,
// showCancel: false
// });
// 可以在这里记录或显示失败详情
fcxwtresult.failed.forEach(failedItem => {
@ -1140,16 +1230,16 @@ export const exampleUsage = async (projectId = '') => {
// 3. 显示处理结果
if (fcresult.failed.length === 0) {
uni.showToast({
title: `全部复查数据处理成功,共${fcresult.success.length}`,
icon: 'success'
});
// uni.showToast({
// title: `全部复查数据处理成功,共${fcresult.success.length}条`,
// icon: 'success'
// });
} else {
uni.showModal({
title: '复查数据处理结果',
content: `成功: ${fcresult.success.length}条, 失败: ${fcresult.failed.length}`,
showCancel: false
});
// uni.showModal({
// title: '复查数据处理结果',
// content: `成功: ${fcresult.success.length}条, 失败: ${fcresult.failed.length}条`,
// showCancel: false
// });
// 可以在这里记录或显示失败详情
fcresult.failed.forEach(failedItem => {
@ -1160,11 +1250,18 @@ export const exampleUsage = async (projectId = '') => {
}
}
return {
success: true,
message: `提交成功!`
};
} catch (error) {
console.error('处理异常:', error);
return {
success: false,
message: `提交异常${error}`
};
uni.showToast({
title: '查询或处理失败',
icon: 'none'

View File

@ -187,6 +187,8 @@ const processProjectDownloads = async (projectData, shujuStore) => {
shujuStore.setxiangmushuju(projectData);
if (projectData.length > 0) {
shujuStore.setactiveprojectid(projectData[0].projectId);
shujuStore.setactiveprojetname(projectData[0].name);
}
// 使用并发控制处理项目下载
@ -227,18 +229,22 @@ const executeConcurrentDownloads = async (projectData, shujuStore, concurrency =
await new Promise(resolve => setTimeout(resolve, delay));
}
// // 并行执行公司下载和分布列表下载
// const [companyResult, distributionResult] = await Promise.allSettled([
// // shujuStore.canyudwDownload(project.projectId),
// shujuStore.fenbulistDownload(project.projectId)
// ]);
// 并行执行公司下载和分布列表下载
const [companyResult, distributionResult] = await Promise.allSettled([
shujuStore.canyudwDownload(project.projectId),
const [distributionResult] = await Promise.allSettled([
// shujuStore.canyudwDownload(project.projectId),
shujuStore.fenbulistDownload(project.projectId)
]);
const success = companyResult.status === 'fulfilled' &&
const success =
distributionResult.status === 'fulfilled';
if (!success) {
console.error(`项目 ${project.projectId} 下载失败:`, {
company: companyResult.status,
company: 200,
distribution: distributionResult.status
});
}
@ -246,7 +252,7 @@ const executeConcurrentDownloads = async (projectData, shujuStore, concurrency =
return {
projectId: project.projectId,
success,
companyError: companyResult.status === 'rejected' ? companyResult.reason : null,
// companyError: companyResult.status === 'rejected' ? companyResult.reason : null,
distributionError: distributionResult.status === 'rejected' ? distributionResult.reason : null
};

View File

@ -0,0 +1,148 @@
// sqlite.js 新增同步方法
import {
getCurrentInstance,
onMounted
} from 'vue'
import useshujuStore from '@/store/usershuju'
import dbUtils from '@/uni_modules/zjy-sqlite-manage/components/zjy-sqlite-manage/dbUtils.js'
/**
* 异步批量同步项目一级数据
* @param {string} table - 表名
* @param {Array} list - 数据列表
* @param {string} proid - 项目ID
*/
//下载单个项目的 现场数据
export const syncsprojectxcdownloadData = async (proid) => {
const shujuStore = useshujuStore();
try {
// // 1. 异步获取本地数据
// const projectst1localData = await dbUtils.getDataListAll('xiaofangdb', 'projectst1table', {
// projectId: proid
// });
// 3. 并行处理数据插入和后续操作 单个项目下载现场数据
const results = await Promise.all([
projectxianchangDataInsertion(proid, shujuStore),
]);
const [insertionResult] = results;
return {
success: true,
updatedCount: insertionResult.insertedCount,
secondaryTasks: insertionResult.secondaryTasks,
message: `同步完成: 更新${insertionResult.insertedCount}条数据,触发${insertionResult.secondaryTasks}个二级任务`
};
} catch (err) {
console.error('一级数据同步失败:', err);
return {
success: false,
error: err.message
};
}
};
/**
* 异步处理数据插入和二级数据下载
*/
const projectxianchangDataInsertion = async (proid, shujuStore) => {
try {
const secondaryTasks = await triggerxianchangaryDownloads(proid, shujuStore);
return {
insertedCount: 0,
secondaryTasks: secondaryTasks
};
} catch (error) {
console.error('现场数据插入失败:', error);
throw new Error(`数据插入失败: ${error.message}`);
}
};
/**
* 异步触发二级数据下载优化版
*/
const triggerxianchangaryDownloads = async (proid, shujuStore) => {
try {
const projectst1localData = await dbUtils.getDataListAll('xiaofangdb', 'projectst1table', {
projectId: proid
});
// console.log('本地项目下1级数据数量:', currentData.length);
if (projectst1localData.length === 0) {
return 0;
}
// 使用Promise.all并行处理所有二级数据下载
const downloadPromises = projectst1localData.map((item, index) =>
downloadSecondaryData(item, proid, shujuStore, index)
);
// 限制并发数量,避免同时发起过多请求
const results = await throttlePromises(downloadPromises, 3);
return results.filter(result => result.success).length;
} catch (error) {
console.error('现场数据下载失败:', error);
return 0;
}
};
/**
* 异步下载单个项目的二级数据
*/
const downloadSecondaryData = async (item, proid, shujuStore, index) => {
try {
// console.log(`处理第${index + 1}个项目的二级数据:`, item.key, proid);
// 并行执行二级数据下载不使用setTimeout延迟
const [xianchangResult] = await Promise.all([
shujuStore.xianchanglistDownload(item.key, proid)
]);
return {
success: true,
xianchang: xianchangResult
};
} catch (error) {
console.error(`项目id为${proid}的现场数据下载失败:`, error);
return {
success: false,
error: error.message
};
}
};
/**
* Promise并发控制
*/
const throttlePromises = async (promises, concurrency = 3) => {
const results = [];
const executing = new Set();
for (const promise of promises) {
// 如果达到并发限制,等待其中一个完成
if (executing.size >= concurrency) {
await Promise.race(executing);
}
const p = promise.then(result => {
executing.delete(p);
return result;
});
executing.add(p);
results.push(p);
}
// 等待所有剩余任务完成
return Promise.all(results);
};

View File

@ -174,7 +174,7 @@ const downloadSecondaryData = async (item, proid, shujuStore, index) => {
// 并行执行二级数据下载不使用setTimeout延迟
const [fenxiangResult, xianchangResult] = await Promise.all([
shujuStore.fenxianglistDownload(item.key, proid),
shujuStore.xianchanglistDownload(item.key, proid)
// shujuStore.xianchanglistDownload(item.key, proid)
]);
return {