提交 09d732e8 authored 作者: JaxBBLL's avatar JaxBBLL

feat: change upload comp

上级 c528b6d4
import table from '../sqllite/table' import table from "../sqllite/table";
import _Path from '@/constant/ioPath' import _Path from "@/constant/ioPath";
import ioUtil from '@/utils/ioUtil' import ioUtil from "@/utils/ioUtil";
import SqlliteDbUtil from '@/utils/sqllitedb' import SqlliteDbUtil from "@/utils/sqllitedb";
import userApi from '@/api/user' import userApi from "@/api/user";
import hoistwayApi from '@/api/hoistway' import hoistwayApi from "@/api/hoistway";
import assRoomApi from '@/api/assRoom.js' import assRoomApi from "@/api/assRoom.js";
import hoistwayjson from '../../baseData/hoistway.json' import hoistwayjson from "../../baseData/hoistway.json";
import userjson from '../../baseData/user.json' import userjson from "../../baseData/user.json";
import assroomjson from '../../baseData/assroom.json' import assroomjson from "../../baseData/assroom.json";
import fileImport from '@/utils/fileImport.js' import fileImport from "@/utils/fileImport.js";
export default { export default {
// app初始化
async init() {
uni.showLoading({
title: "正在初始化...",
});
// 初始化目录
await this.initDir();
// 初始化数据库
// cookie.set('initDB', true)
await this.initSqlLite();
// app初始化 // 导入用戶文件文件
async init() { // await this.importFileData();
await userApi.saveBatch(userjson);
await hoistwayApi.saveBatch(hoistwayjson);
await assRoomApi.saveBatch(assroomjson);
// 初始化完成通知首页
uni.$emit("initDone", "ok");
uni.hideLoading();
},
uni.showLoading({ // 检查文件导入
title: '正在初始化...', async importFileData() {
}) // 解压缩需要导入的zip,导入后删除
// 初始化目录 try {
await this.initDir() console.log("解压导入开始....");
// 初始化数据库 console.log("导入基础数据开始");
// cookie.set('initDB', true) await fileImport.importBaseFile();
await this.initSqlLite() console.log("导入基础数据结束!");
console.log("解压导入完成....");
} catch (e) {
console.log(e.message);
uni.showToast({
icon: "none",
title: e.message,
});
uni.hideLoading();
}
},
// 导入用戶文件文件 ////////// 初始化数据库////////////
// await this.importFileData(); async initSqlLite() {
await userApi.saveBatch(userjson) console.log("初始化数据库开始...");
// await hoistwayApi.saveBatch(hoistwayjson) let sqllitedb = null;
// await assRoomApi.saveBatch(assroomjson) try {
// 初始化完成通知首页 // 创建打开数据库,已经存在表则跳过
uni.$emit("initDone", "ok") sqllitedb = await SqlliteDbUtil.initSqlliteDB();
uni.hideLoading() console.log(sqllitedb, "是否存在");
}, // console.log('创建用户表...')
await sqllitedb.createTable(table.userName, table.user);
await sqllitedb.createTable(
table.inspectionRecordName,
table.inspectionRecord
); // 巡检记录表
await sqllitedb.createTable(table.assRoomName, table.assRoom); // 机房、井道信息表
await sqllitedb.createTable(table.assBuildingName, table.assBuilding); // 楼宇信息
} catch (e) {
console.log(e.message);
} finally {
return;
// 关闭数据库
if (sqllitedb) {
await sqllitedb.closeDB();
}
// 初始化完成后重启APP/退出APP
uni.showToast({
icon: "none",
title: "初始化完毕即将重新加载...",
duration: 3000,
});
let that = this;
setTimeout(function () {
that.restartApp();
}, 3000);
}
},
// 检查文件导入 // 初始化目录
async importFileData() { async initDir() {
// 解压缩需要导入的zip,导入后删除 try {
try { const _www = _Path.getPrivateWWW();
console.log('解压导入开始....') const _doc = _Path.getPrivateDOC();
console.log('导入基础数据开始') const _download = _Path.getDownloads();
await fileImport.importBaseFile() const _temp = _Path.getTempPath();
console.log('导入基础数据结束!') const wwwEntry = await ioUtil.getFileEntry(_www);
console.log('解压导入完成....') const docEntry = await ioUtil.getFileEntry(_doc);
} catch (e) { const downloadEntry = await ioUtil.getFileEntry(_download);
console.log(e.message)
uni.showToast({
icon: 'none',
title: e.message
})
uni.hideLoading()
}
},
////////// 初始化数据库//////////// if (downloadEntry) {
async initSqlLite() { await ioUtil.createDir(downloadEntry.fullPath, "base");
console.log('初始化数据库开始...') await ioUtil.createDir(downloadEntry.fullPath, "export");
let sqllitedb = null await ioUtil.createDir(downloadEntry.fullPath, "import");
try { await ioUtil.createDir(downloadEntry.fullPath, "doc");
// 创建打开数据库,已经存在表则跳过 await ioUtil.createDir(downloadEntry.fullPath, "error");
sqllitedb = await SqlliteDbUtil.initSqlliteDB() }
console.log(sqllitedb,'是否存在')
// console.log('创建用户表...')
await sqllitedb.createTable(table.userName, table.user)
await sqllitedb.createTable(table.inspectionRecordName, table.inspectionRecord)// 巡检记录表
await sqllitedb.createTable(table.assRoomName, table.assRoom) // 机房、井道信息表
await sqllitedb.createTable(table.assBuildingName, table.assBuilding) // 楼宇信息
} catch (e) {
console.log(e.message)
} finally {
return
// 关闭数据库
if (sqllitedb) {
await sqllitedb.closeDB()
}
// 初始化完成后重启APP/退出APP
uni.showToast({
icon: 'none',
title: '初始化完毕即将重新加载...',
duration: 3000
})
let that = this
setTimeout(function () {
that.restartApp()
}, 3000)
}
},
// 初始化目录 // 获取设备名称
async initDir() { uni.getSystemInfo({
try { success: async function (e) {
const _www = _Path.getPrivateWWW() const deviceData = {
const _doc = _Path.getPrivateDOC() deviceId: e.deviceId,
const _download = _Path.getDownloads() brand: e.deviceBrand,
const _temp = _Path.getTempPath() deviceModel: e.deviceModel,
const wwwEntry = await ioUtil.getFileEntry(_www) };
const docEntry = await ioUtil.getFileEntry(_doc) const deviceFilePath = downloadEntry.fullPath + "name.txt";
const downloadEntry = await ioUtil.getFileEntry(_download) await ioUtil.removeExistFile(deviceFilePath);
await ioUtil.writeFile(
"name.txt",
downloadEntry,
JSON.stringify(deviceData)
);
},
});
if (downloadEntry) { // 文件目录
await ioUtil.createDir(downloadEntry.fullPath, 'base') if (docEntry) {
await ioUtil.createDir(downloadEntry.fullPath, 'export') await ioUtil.createDir(docEntry.fullPath, "file");
await ioUtil.createDir(downloadEntry.fullPath, 'import') }
await ioUtil.createDir(downloadEntry.fullPath, 'doc')
await ioUtil.createDir(downloadEntry.fullPath, 'error')
}
// 获取设备名称
uni.getSystemInfo({
success: async function (e) {
const deviceData = {
deviceId: e.deviceId,
brand: e.deviceBrand,
deviceModel: e.deviceModel,
}
const deviceFilePath = downloadEntry.fullPath + 'name.txt'
await ioUtil.removeExistFile(deviceFilePath)
await ioUtil.writeFile('name.txt', downloadEntry, JSON.stringify(deviceData))
},
});
// 文件目录
if (docEntry) {
await ioUtil.createDir(docEntry.fullPath, 'file')
}
// 临时目录 // 临时目录
let tempEntry = await ioUtil.getFileEntry(_temp) let tempEntry = await ioUtil.getFileEntry(_temp);
if (!tempEntry) { if (!tempEntry) {
await ioUtil.createDir(_temp) await ioUtil.createDir(_temp);
tempEntry = await ioUtil.createDir(_Path.getTempParent(), 'inspectTemp') tempEntry = await ioUtil.createDir(
} _Path.getTempParent(),
await ioUtil.createDir(tempEntry.fullPath, 'db') "inspectTemp"
} catch (e) { );
console.log(e.message) }
} await ioUtil.createDir(tempEntry.fullPath, "db");
}, } catch (e) {
console.log(e.message);
}
},
// 重启app // 重启app
restartApp() { restartApp() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (plus.os.name.toLowerCase() === 'android') { if (plus.os.name.toLowerCase() === "android") {
plus.runtime.restart(); plus.runtime.restart();
} }
// #endif // #endif
}, },
// 退出app // 退出app
exitApp() { exitApp() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (plus.os.name.toLowerCase() === 'android') { if (plus.os.name.toLowerCase() === "android") {
plus.runtime.quit(); plus.runtime.quit();
} else { } else {
const threadClass = plus.ios.importClass("NSThread"); const threadClass = plus.ios.importClass("NSThread");
const mainThread = plus.ios.invoke(threadClass, "mainThread"); const mainThread = plus.ios.invoke(threadClass, "mainThread");
plus.ios.invoke(mainThread, "exit"); plus.ios.invoke(mainThread, "exit");
// 或者如下 // 或者如下
// plus.ios.import('UIApplication').sharedApplication().performSelector('exit'); // plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
} }
// #endif // #endif
} },
} };
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
class="add-btn" class="add-btn"
@click="chooseImage" @click="chooseImage"
> >
+
</view> </view>
<view <view
v-for="(item, index) in images" v-for="(item, index) in images"
...@@ -117,9 +116,8 @@ export default { ...@@ -117,9 +116,8 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped lang="scss">
.upload-container { .upload-container {
padding: 10px;
} }
.image-list { .image-list {
display: flex; display: flex;
...@@ -127,41 +125,56 @@ export default { ...@@ -127,41 +125,56 @@ export default {
} }
.image-item { .image-item {
position: relative; position: relative;
width: 80px; width: 72px;
height: 80px; height: 72px;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px;
} }
.image { .image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 5px; box-sizing: border-box;
} }
.delete-icon { .delete-icon {
position: absolute; position: absolute;
top: -10px; top: -6.4px;
right: -10px; right: -6.4px;
font-size: 20px; background-color: #ff4d4f;
color: red; color: #fff;
background-color: white; width: 12.8px;
height: 12.8px;
border-radius: 50%; border-radius: 50%;
width: 24px;
height: 24px;
text-align: center; text-align: center;
line-height: 24px; line-height: 12.8px;
font-size: 9.6px;
} }
.add-btn { .add-btn {
width: 80px; position: relative;
height: 80px; width: 72px;
height: 72px;
border: 1px dashed #ccc; border: 1px dashed #ccc;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
color: #ccc;
cursor: pointer; cursor: pointer;
margin-right: 10px; margin-right: 10px;
box-sizing: border-box;
&::before {
position: absolute;
content: "";
width: 30px;
height: 2px;
background-color: #ccc;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
}
&::after {
position: absolute;
content: "";
width: 2px;
height: 30px;
background-color: #ccc;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
}
} }
.tip { .tip {
font-size: 12px; font-size: 12px;
......
...@@ -29,15 +29,19 @@ ...@@ -29,15 +29,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item" v-if="'photos' in item"> <view class="form-item" v-if="'photos' in item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -56,7 +60,7 @@ ...@@ -56,7 +60,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
></template ></template
> </view > </view
...@@ -69,12 +73,14 @@ ...@@ -69,12 +73,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -329,8 +335,9 @@ export default { ...@@ -329,8 +335,9 @@ export default {
} }
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -38,15 +38,19 @@ ...@@ -38,15 +38,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item" v-if="'photos' in item"> <view class="form-item" v-if="'photos' in item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -65,7 +69,7 @@ ...@@ -65,7 +69,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view> </view>
</template></view </template></view
><custom-popup ><custom-popup
...@@ -77,12 +81,14 @@ ...@@ -77,12 +81,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -348,8 +354,9 @@ export default { ...@@ -348,8 +354,9 @@ export default {
margin: 0 12px; margin: 0 12px;
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -27,15 +27,19 @@ ...@@ -27,15 +27,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -54,7 +58,7 @@ ...@@ -54,7 +58,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view> </view>
</template></view </template></view
><custom-popup ><custom-popup
...@@ -66,6 +70,7 @@ ...@@ -66,6 +70,7 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
...@@ -73,6 +78,7 @@ import mixin from "./mixin"; ...@@ -73,6 +78,7 @@ import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -303,8 +309,9 @@ export default { ...@@ -303,8 +309,9 @@ export default {
} }
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -37,15 +37,19 @@ ...@@ -37,15 +37,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item" v-if="'photos' in item"> <view class="form-item" v-if="'photos' in item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -64,7 +68,7 @@ ...@@ -64,7 +68,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
></view ></view
><custom-popup ><custom-popup
...@@ -76,12 +80,14 @@ ...@@ -76,12 +80,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -324,8 +330,9 @@ export default { ...@@ -324,8 +330,9 @@ export default {
margin: 0 12px; margin: 0 12px;
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -6,13 +6,17 @@ ...@@ -6,13 +6,17 @@
<text class="form-label" <text class="form-label"
><text class="required"></text>{{ item.label }}</text ><text class="required"></text>{{ item.label }}</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label"><text class="required"></text>现场照片</text> <text class="form-label"><text class="required"></text>现场照片</text>
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -29,7 +33,7 @@ ...@@ -29,7 +33,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view> </view </view> </view
><custom-popup ><custom-popup
ref="customPopup" ref="customPopup"
...@@ -40,6 +44,7 @@ ...@@ -40,6 +44,7 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
...@@ -47,6 +52,7 @@ import mixin from "./mixin"; ...@@ -47,6 +52,7 @@ import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -235,8 +241,9 @@ export default { ...@@ -235,8 +241,9 @@ export default {
} }
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<view class="flex items-center ml-30"> <view class="flex items-center ml-30">
<button class="v-btn" @click="onAddCabinet">+</button> <button class="v-btn" @click="onAddCabinet">+</button>
<button <button
v-show="item.cabinets.length > 1"
class="v-btn v-btn-danger ml-10" class="v-btn v-btn-danger ml-10"
@click="onRemoveCabinet(idx)" @click="onRemoveCabinet(idx)"
> >
...@@ -97,15 +98,19 @@ ...@@ -97,15 +98,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item" v-if="'photos' in item"> <view class="form-item" v-if="'photos' in item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -124,7 +129,7 @@ ...@@ -124,7 +129,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
> >
</template> </view </template> </view
...@@ -138,6 +143,7 @@ ...@@ -138,6 +143,7 @@
<script> <script>
import NumberInput from "@/components/NumberInput/index.vue"; import NumberInput from "@/components/NumberInput/index.vue";
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
...@@ -145,6 +151,7 @@ export default { ...@@ -145,6 +151,7 @@ export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
NumberInput, NumberInput,
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -306,13 +313,10 @@ export default { ...@@ -306,13 +313,10 @@ export default {
continue; continue;
} else if (item.inspectionResult === 1) { } else if (item.inspectionResult === 1) {
// 如果 inspectionResult 为 1,检查 conclusion 和 photos // 如果 inspectionResult 为 1,检查 conclusion 和 photos
if ( const isAllFull = item.cabinets.every((cabinet) => {
!item.conclusion || return cabinet.deviceId && cabinet.UpositonS && cabinet.UpositonE;
item.photos.length === 0 || });
!item.deviceId || if (!item.conclusion || !isAllFull || cabinet.photos.length > 0) {
!item.UpositonS ||
!item.UpositonE
) {
return false; return false;
} }
} else { } else {
...@@ -363,7 +367,9 @@ export default { ...@@ -363,7 +367,9 @@ export default {
}; };
this.itemData.detail[this.currentIndex].cabinets.push(newCabinet); this.itemData.detail[this.currentIndex].cabinets.push(newCabinet);
}, },
onRemoveCabinet() {}, onRemoveCabinet(idx) {
this.itemData.detail[this.currentIndex].cabinets.splice(idx, 1);
},
}, },
}; };
</script> </script>
...@@ -394,8 +400,9 @@ export default { ...@@ -394,8 +400,9 @@ export default {
margin: 0 12px; margin: 0 12px;
} }
.conclusion { .conclusion {
// color: #c7c7c7; &.no-text {
// font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -26,15 +26,19 @@ ...@@ -26,15 +26,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -53,7 +57,7 @@ ...@@ -53,7 +57,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
> </view > </view
><custom-popup ><custom-popup
...@@ -65,12 +69,14 @@ ...@@ -65,12 +69,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
mixins: [mixin], mixins: [mixin],
...@@ -333,8 +339,9 @@ export default { ...@@ -333,8 +339,9 @@ export default {
} }
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -38,15 +38,19 @@ ...@@ -38,15 +38,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item" v-if="'photos' in item"> <view class="form-item" v-if="'photos' in item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -65,7 +69,7 @@ ...@@ -65,7 +69,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
></view ></view
><custom-popup ><custom-popup
...@@ -77,12 +81,14 @@ ...@@ -77,12 +81,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -332,8 +338,9 @@ export default { ...@@ -332,8 +338,9 @@ export default {
margin: 0 12px; margin: 0 12px;
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -27,15 +27,19 @@ ...@@ -27,15 +27,19 @@
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
> >
<text class="conclusion" @click="showPopup(index)">{{ <text
item.conclusion || "请输入情况摘要" :class="['conclusion', { 'no-text': !item.conclusion }]"
}}</text> @click="showPopup(index)"
>
{{ item.conclusion || "请输入情况摘要" }}</text
>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>现场照片</text ><text class="required">*</text>现场照片</text
> >
<view class="photo-box"> <CommonUpload v-model="item.photos" :max-count="5"> </CommonUpload>
<!-- <view class="photo-box">
<view class="photo-container"> <view class="photo-container">
<view <view
v-for="(photo, itemIndex) in item && item.photos" v-for="(photo, itemIndex) in item && item.photos"
...@@ -54,7 +58,7 @@ ...@@ -54,7 +58,7 @@
<view class="photo-limit" <view class="photo-limit"
>请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view >请对检查项进行拍照留存(限5张)。发现“异常、告警”时,需拍照留存。</view
> >
</view> </view> -->
</view></template </view></template
> </view > </view
><custom-popup ><custom-popup
...@@ -66,12 +70,14 @@ ...@@ -66,12 +70,14 @@
</template> </template>
<script> <script>
import CommonUpload from "@/components/CommonUpload/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
CommonUpload,
customPopup, customPopup,
}, },
props: { props: {
...@@ -303,8 +309,9 @@ export default { ...@@ -303,8 +309,9 @@ export default {
} }
} }
.conclusion { .conclusion {
color: #c7c7c7; &.no-text {
font-size: 11.2px; color: #c7c7c7;
}
.have { .have {
color: #000; color: #000;
} }
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
<view class="bar"> <view class="bar">
<view class="title"> 巡检进度 </view> <view class="title"> 巡检进度 </view>
<view class="dai"> <view class="dai">
待巡检 <text class="num">{{ 11 - inspectionNumber }}</text 待巡检
<text class="num">{{ listData.length - inspectionNumber }}</text
>个机房</view >个机房</view
> >
<view class="yi"> <view class="yi">
...@@ -251,12 +252,12 @@ export default { ...@@ -251,12 +252,12 @@ export default {
this.value = this.options.value || "1"; this.value = this.options.value || "1";
}, },
onShow() { onShow() {
this.getRoomList();
if (this.uid) { if (this.uid) {
this.getDetails(this.uid); this.getDetails(this.uid);
} else { } else {
this.init(); this.getRoomList().then((res) => {
this.init(res);
});
} }
// this.startDialogData.text = [ // this.startDialogData.text = [
// `请到“${this.name}”后;`, // `请到“${this.name}”后;`,
...@@ -268,20 +269,22 @@ export default { ...@@ -268,20 +269,22 @@ export default {
}, },
methods: { methods: {
getRoomList() { getRoomList() {
assRoomApi.selectRoomList(1).then((res) => { return assRoomApi.selectRoomList(1).then((res) => {
console.log("机房列表", res); console.log("机房列表", res);
return res;
}); });
}, },
init() { init(baseList) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let list = pad_all_inspection_position.rows.map((item, index) => { let list = baseList.map((item, index) => {
return { return {
name: item.dictLabel, id: item.id,
name: item.roomName,
value: item.dictValue, value: item.dictValue,
jfType: item.jfType, jfType: item.roomFeature, // 机房类型枚举:1.汇聚机房,2.屏蔽机房,3.UPS机房,4.数据机房
isVaild: false, // 校验通过 isVaild: false, // 校验通过
status: item.status, status: 0,
statusLable: item.statusLable, statusLable: "未巡检",
}; };
}); });
this.listData = this.deepClone(list); this.listData = this.deepClone(list);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论