xfgczlglpt_pad_app/src/pages/zhixing/xianchang.vue

1200 lines
41 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="zhixing-container" style="margin: 20rpx;margin-top: 220rpx; min-height: 300px; ">
<view class="zhixing_top" style="display: flex; flex-direction: column;">
<view style="display: flex; flex-direction: row;margin-bottom: 10px; margin-left: 10px;">
<view class="querybox" style=" margin-right:20px;">
<view class="querybox_title" style="display: flex; flex-direction: row;">
<view style="color: #ca4341; margin-right:5px;">*</view>
<view>项目</view>
</view>
<csr-uni-data-select :filterable="true" v-model="queryParams.projectId" placeholder="请选择项目" dataKey="codename"
dataValue="projectId" :localdata="shujuStore.xiangmushuju" @change="changexiangmu" :clear="false"
style="width: 300px;"></csr-uni-data-select>
</view>
<view class="querybox">
<view class="querybox_title" style="display: flex; flex-direction: row;">
<view style="color: #ca4341; margin-right:5px;">*</view>
<view>抽查结论:</view>
</view>
<csr-uni-data-select :filterable="false" v-model="queryParams.resultType" placeholder="请选择抽查结论"
dataKey="lablename" dataValue="value" :localdata="chouchajielunlist" @change="getlistinfo" :clear="true"
style="width:200px;"></csr-uni-data-select>
</view>
<view class="querybox">
<u-button style="width:80px; float: left;margin-left: 20px;" type="primary" text="查询" @click="getlistinfo()"
size="small"></u-button>
</view>
<view class="querybox" style="margin-left: 30px;">
<u-checkbox v-model:checked="chyffshow" @change="clicktableshow()">
<view class="u-flex" style="font-size: 14px; color: #333;">
<text>显示查验方法</text>
</view>
</u-checkbox>
<u-checkbox v-model:checked="chyssshow" style="margin-left:30px;" @change="clicktableshow()">
<view class="u-flex" style="font-size: 14px; color: #333;">
<text>显示查验数量</text>
</view>
</u-checkbox>
</view>
</view>
<view style="margin-top: 10px; margin-bottom: 10px;">
<u-button style="width:80px; float: left;" type="error" text="删除查验点" :disabled="activenum!=1"
@click="shanchujiancha()" size="small"></u-button>
<u-button style="width:80px; float: left;margin-left: 20px;" type="primary" text="编辑检查点"
:disabled="activenum!=1" @click="bianji()" size="small"></u-button>
<u-button style="width:80px; float: left;margin-left: 20px;" type="warning" text="复查" @click="fucha(null)"
:disabled="activenum!=1" size="small"></u-button>
<u-button style="width:100px; float: left;margin-left: 20px;" type="primary" text="复查发现新问题"
:disabled="activenum!=1" @click="fuchfxxwt(null)" size="small"></u-button>
<!-- <u-button style="width:80px; float: left; margin-left:10px;" type="success" text="整改" :disabled="activenum!=1"
@click="zhenggai()" size="small"></u-button> -->
</view>
</view>
<u-tabs :list="tabslist1" lineWidth="60" v-if="tabsshow" style="margin-bottom: 10px;" :current="currentvalue"
:activeStyle="{
color: '#303133',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" @change="tabsonChange"></u-tabs>
<view class="zhixing_center" style="display: flex; flex-direction: row; width: 100%;">
<view
style=" width:19%;margin-right: 1%; padding: 10px; height: 440px; max-height: 440; overflow-y: auto; border:1px solid #e4e7ed ">
<view style=" float: right; " @click="qingchu()">
<u-icon label="清除" size="20" labelColor="#3c9cff" color="#3c9cff" name="reload"></u-icon>
</view>
<u-tree style="float: left;" :data="treelist" v-if="treelist.length>0" key-field="id" label-field="code"
children-field="children" selectable selected-bg-color=" #e5e5e5">
<template #content="{ node }">
<view class="custom-content" @click="treechange(node)" style=" padding: 6px 0 6px 0 !important;">
<text class="custom-label" style="font-size: 12px;">{{ node.code }}</text>
</view>
</template>
</u-tree>
</view>
<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&&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">
<template #default="{ row, index }">
<view
style="width: 100%; height: auto !important; display: flex; flex-direction: column; justify-content: left; ">
<view v-if="row.phaseTypes"
style="margin-bottom:6px; display: flex; flex-direction: row; justify-content: left;">
<u-text v-for="(item1,index1) in row.phaseTypes" :key="index1" :text="item1" type="primary"
decoration="underline" @click="chytypebox(row,item1)"></u-text>
</view>
<view>{{row.checkContent}}</view>
</view>
</template>
</u-table-column>
<u-table-column prop="checkMethod" width="150" label="查验方法" headerAlign="center" v-if="chyffshow">
<template #default="{ row, index }">
<view style="height: auto !important;">
{{row.checkMethod}}
</view>
</template>
</u-table-column>
<u-table-column prop="checkScope" width="100" label="查验数量" headerAlign="center" v-if="chyssshow">
<template #default="{ row, index }">
<view style="height: auto !important;">
{{row.checkScope||'全数查验'}}
</view>
</template>
</u-table-column>
<u-table-column prop="tableLevel4Code" width="100" label="问题编码" headerAlign="center">
<template #default="{ row, index }">
<view style="height: auto !important;">
<u-text :text="row.tableLevel4Code" type="primary" decoration="underline"
@click="openright(row)"></u-text>
</view>
</template>
</u-table-column>
<u-table-column prop="parentNo" width="100" label="原问题" headerAlign="center">
</u-table-column>
<u-table-column prop="buildingName" width="100" label="建筑物" headerAlign="center" />
<u-table-column prop-="location" width="180" :headerEllipsis="false" align="center" label="查验位置/对象"
headerAlign="center">
<template #default="{ row, index }">
<view v-if="row.locationInfos" style="display: flex; flex-direction: column;">
<view v-for="(item1,index1) in row.locationInfos" :key="index1">{{item1}}
</view>
</view>
</template>
</u-table-column>
<u-table-column prop="checkPoint" width="100" :headerEllipsis="false" align="center" label="抽查部位"
headerAlign="center">
</u-table-column>
<u-table-column prop="resultTypeInfo" width="100" :headerEllipsis="false" align="center" label="抽查结论"
headerAlign="center">
</u-table-column>
<u-table-column prop="issue" width="150" label="问题描述" headerAlign="center" />
<u-table-column prop="standard" width="100" :headerEllipsis="false" align="center" label="违反规范"
headerAlign="center">
</u-table-column>
<!-- <u-table-column prop="term" width="100" :headerEllipsis="false" align="center" label="违反条款"
headerAlign="center">
</u-table-column> -->
<u-table-column prop="issueTypeInfo" width="100" :headerEllipsis="false" align="center" label="问题类型"
headerAlign="center">
</u-table-column>
<u-table-column prop="" width="80" :headerEllipsis="false" label="问题图片" align="center" headerAlign="center">
<template #default="{ row, index }">
<u-tag v-if="row.imgNum!=0" @click="showimg(row)" :text="row.imgNum" type="primary" size="mini"></u-tag>
</template>
</u-table-column>
<!-- <u-table-column prop="rectifyCompanyName" width="100" :headerEllipsis="false" align="center" label="整改责任单位"
headerAlign="center">
</u-table-column>
<u-table-column prop="expectDeadLineDate" width="100" :headerEllipsis="false" align="center" label="要求完成时间"
headerAlign="center">
</u-table-column>
<u-table-column prop="deadLineWarning" width="100" :headerEllipsis="false" align="center" label="进度预警"
headerAlign="center">
</u-table-column> -->
<u-table-column prop="status" width="100" :headerEllipsis="false" align="center" label="整改状态"
headerAlign="center">
<template #default="{ row, index }">
<!-- 0=无1=待整改2=待复查3=合格[已整改]-->
<u-tag v-if="row.status&&row.status!='0'"
:text="row.status=='1'?'待整改':row.status=='2'?'待复查':row.status=='3'?'已整改':''"
:type="row.status=='1'?'error':row.status=='3'?'success':row.status=='2'?'primary':''"
size="mini"></u-tag>
</template>
</u-table-column>
<u-table-column prop="records" width="130" :headerEllipsis="false" align="center" label="现场记录"
headerAlign="center">
<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; ">
<view>{{recordsformatStr(item1.info,item1.resultInfo)}}
</view>
</view>
</view>
</template>
</u-table-column>
<u-table-column prop="materialActivityFiles" width="130" :headerEllipsis="false" align="center" label="现场验收"
headerAlign="center">
<template #default="{ row, index }">
<!-- "resultType": 0 //0-无 1-合格 2-不合格 3-不涉及 -->
<view v-if="row.materialActivityFiles" style="display: flex; flex-direction: column;">
<view v-for="(item1,index1) in row.materialActivityFiles" :key="index1">
{{item1.fileName}}{{item1.resultType==0?'':item1.resultType==1?'合格':item1.resultType==2?'不合格':'不涉及'}}
</view>
</view>
</template>
</u-table-column>
<u-table-column prop="attachmentName" width="150" :headerEllipsis="false" align="center" label="附表"
headerAlign="center">
<template #default="{ row, index }">
<view style="height: auto !important;">
<view v-if="!row.attachmentName"></view>
<view v-else>{{row.attachmentName}}</view>
<!-- <u-text v-else :text="row.attachmentName" type="primary" decoration="underline"></u-text> -->
</view>
</template>
</u-table-column>
<u-table-column prop="checkerName" width="100" :headerEllipsis="false" align="center" label="检查人"
headerAlign="center">
</u-table-column>
<u-table-column prop="updateTime" width="150" :headerEllipsis="false" align="center" label="检查时间"
headerAlign="center">
</u-table-column>
<u-table-column prop="createBy" width="80" label="制单" align="center" headerAlign="center" />
<u-table-column prop="createTime" width="150" label="创建时间" align="center" headerAlign="center">
<template #default=" { row, index }">
{{row.createTime?$dayjs(row.createTime).format("YYYY-MM-DD HH:mm"):''}}
</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"
@confirm="() => imgboxshow = false">
<view class="slot-content"
style="width: 100%;min-height: 280px; max-height:280px; margin-bottom: 30px; overflow-y: auto;">
<u-album :urls="imgurlslist" style="margin-top: 20px;" autoWrap showMore multipleSize="100"
rowCount="5"></u-album>
</view>
</u-modal>
<!-- 编辑 -->
<uni-drawer ref="showright" mode="right" :width="750" :mask-click="true">
<scroll-view scroll-y="true" style="height: 100%;">
<AddEditnr style="width:97%;" :objitem="rowitem" :sjnum="sjnum" @sahnchuevent="sahnchuevent"
@righteventclose="closeright" @shaunxian="getlistinfo()" @fc="fucha" @fcxwt="fuchfxxwt" />
</scroll-view>
</uni-drawer>
<!-- 复查发现新问题 -->
<u-modal content="" :closeOnClickOverlay="true" title="复查发现新问题" :showConfirmButton="false" :showCancelButton="false"
cancelText="取消" confirmText="保存" width="850px" :show="fuchaxwtshow" confirmColor="#42b983" cancelColor="#ca4341">
<view class="slot-content">
<scroll-view scroll-y="true" style="width:800px;height:500px;">
<view style="width:100%;display: flex; flex-direction: column;align-items: left; border-top:1px solid #eee;">
<FuchaxwtEditnr style="width:97%;" :objitem="rowitem" :sjnum="sjnum" @tkeventclose="closefuchaxwt"
@shaunxian="getlistinfo()" />
</view>
</scroll-view>
</view>
</u-modal>
<!-- 复查 -->
<u-modal content="" :closeOnClickOverlay="true" title="复查" :showConfirmButton="false" :showCancelButton="false"
cancelText="取消" confirmText="保存" width="850px" :show="fuchashow" confirmColor="#42b983" cancelColor="#ca4341">
<view class="slot-content">
<scroll-view scroll-y="true" style="width:800px; height:500px;">
<view style="width:100%;display: flex; flex-direction: column;align-items: left; border-top:1px solid #eee;">
<FuchaEditnr style="width:97%;" :objitem="rowitem" :sjnum="sjnum" @tkeventclose="closefucha"
@shaunxian="getlistinfo()" />
</view>
</scroll-view>
</view>
</u-modal>
<!-- 整改 -->
<u-modal content="" :closeOnClickOverlay="true" title="整改" :showConfirmButton="false" :showCancelButton="false"
cancelText="取消" confirmText="保存" width="850px" :show="zhenggaishow" confirmColor="#42b983" cancelColor="#ca4341">
<view class="slot-content">
<scroll-view scroll-y="true" style="height:500px;">
<view style="display: flex; flex-direction: column;align-items: left; border-top:1px solid #eee;">
<ZhenggaiEditnr :objitem="rowitem" :sjnum="sjnum" @tkeventclose="closezhenggai"
@shaunxian="getlistinfo()" />
</view>
</scroll-view>
</view>
</u-modal>
<!-- 施工阶段内容 -->
<u-modal content="" :closeOnClickOverlay="true" title="施工阶段" confirmText="关闭" width="400px" :show="chytypeboxshow"
@confirm="() => chytypeboxshow = false">
<view class="slot-content biangengcontent" style="width: 100%;">
<scroll-view scroll-y="true"
style="height:150px;display: flex;flex-direction: column; align-items: center; justify-content: center; ">
<view style="width: 100%;border-top:1px solid #eee;">
<view style="margin-top: 15px;">
{{chytypeboxnei}}
</view>
</view>
</scroll-view>
</view>
</u-modal>
<UniMenu />
<!-- color="#2f7d09" textColor="#2f7d09" -->
<zero-loading v-if="shujuStore.pageloading" :maskOpacity="0.5" color="#c41818" textColor="#c41818" :mask="true"
:showText="true" :text="shujuStore.pageloadingtext" type="wobble"></zero-loading>
</view>
</template>
<script>
import {
getsafety_hazardInfo,
getxmdwdefaultconditionlist,
getloginfo,
delsafety_hazard,
getcheckTableIdtree,
getexecutionprojectlist,
setprojectcurrent,
setcontractcurrent,
getprojectcurrent,
getcontractcurrent
} from "@/apis/zhixing"
import {
getevaluationIdinfo
} from "@/apis/wenjuan"
import {
getthstatus
} from "@/apis/hetong"
import {
parseObjectToArray
} from "@/utils/util"
import UniMenu from '@/components/uni-menu/uni-menu.vue'
import comboxMore from '@/components/wl-combox-more/combox-more.vue'
import useUserStore from '@/store/user';
import CustomPicker from '@/components/custom-search-picker/index.vue';
import AddEditnr from '@/pages/zhixing/addxianchang.vue';
import FuchaxwtEditnr from '@/pages/zhixing/fuchaxwt.vue';
import FuchaEditnr from '@/pages/zhixing/fucha.vue';
import ZhenggaiEditnr from '@/pages/zhixing/zhenggai.vue';
import useshujuStore from '@/store/usershuju';
export default {
components: {
UniMenu,
comboxMore,
CustomPicker,
AddEditnr,
FuchaxwtEditnr,
FuchaEditnr,
ZhenggaiEditnr,
},
data() {
return {
// upurl: import.meta.env.VITE_APP_BASE_PRE + '/safety_hazard/table/img',
// httpurl: import.meta.env.VITE_APP_BASE_PRE,
// upurl: 'http://219.146.89.198:19388' + '/safety_hazard/table/img',
// httpurl: 'http://219.146.89.198:19380/prod-api',
shujuStore: useshujuStore(),
userStore: useUserStore(),
isbutclick: false,
chouchajielunlist: [{
lablename: '合格',
value: 1,
}, {
lablename: '不合格',
value: 2,
},
{
lablename: '不涉及',
value: 3,
}
],
statistic: '',
columns: [
],
tabslist1: [
],
tableshow: true,
chyffshow: false, //查验方法
chyssshow: false, //查验数量
chytypeboxshow: false,
chytypeboxnei: '',
checkedkeys: [0],
expandedkeys: [0],
acyivetree: [],
biangenshow: false,
imgboxshow: false,
imgurlslist: [],
tableData: [],
bglslist: [],
queryParams: {
// pageNum: 1,
// pageSize: 10,
// notShowNoInvolved: false, //不显示不涉及
// showActivityCheckOnly: false, //仅显示现场检查项
projectId: null, //项目主键
resultType: null, //查验结果(0:未选择 1:符合 2:不符合 3:不涉及)
standardTableLevel1Id: null, //查验表一级编码主键
parentId: null,
// standardTableLevel2Id: null, //查验表二级编码主键
// reasonable: false,
},
infolist: [],
activeitem: null,
rowitem: null,
activenum: 0,
activenumlist: 0,
sjnum: 0,
pjmodaltitle: '非火灾高危单位',
pjmodalshow: false,
pjtableInfolist: [],
treelist: [],
xththlist: [],
contractId: '',
xmdwlist: [],
fuchaxwtshow: false, //复查发现新问题
fuchashow: false, //复查
zhenggaishow: false, //复查
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
const shujuStore = useshujuStore();
return shujuStore.activeprojectid
},
nick() {
// debugger
// return userStore.username
const userStore = useUserStore();
return userStore.name
},
imageSrc() {
const userStore = useUserStore();
return userStore.avatar
},
username() {
// debugger
// return userStore.username
const userStore = useUserStore();
return userStore.username
},
avatar() {
//debugger
const userStore = useUserStore();
return userStore.avatar
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50
}
},
// // 监听页面返回
// onBackPress() {
// //debugger
// uni.redirectTo({
// url: '/pages/index/index'
// });
// // 阻止界面返回默认操作, 这一步主要是为了防止界面出现异常uniapp有对onBackPress的详细讲解
// return true;
// },
onShow() {
},
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(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(); //获取查验列表
}
},
methods: {
parseObjectToArray,
async getjctree() {
//请求树
this.treelist = await this.$dbUtils.getDataListAll('xiaofangdb', 'projectst2table', {
projectId: this.queryParams.projectId,
standardTableLevel1Id: this.queryParams.standardTableLevel1Id
});
// console.log('二级', JSON.stringify(this.treelist))
// getcheckTableIdtree().then((res) => {
// // debugger
// this.treelist = res.data;
// this.sjnum = Math.random();
// });
},
// 合并单元格方法三:自动合并相同值的单元格
spanMethodWithColspan({
row,
column,
rowIndex,
columnIndex
}) {
if (column.prop === 'checkContent') {
// 计算相同地区的连续行数
const currentValue = row[column.prop]
let startIndex = rowIndex
let endIndex = rowIndex
//console.log('currentValue', this.tableData)
// 向前找到开始位置
while (startIndex > 0 && this.tableData[startIndex - 1][column.prop] === currentValue) {
startIndex--
}
// 向后找到结束位置
while (endIndex < this.tableData.length - 1 && this.tableData[endIndex + 1][column.prop] ===
currentValue) {
endIndex++
}
const spanCount = endIndex - startIndex + 1
if (spanCount > 1) {
if (rowIndex === startIndex) {
// 第一行显示合并的单元格
return {
rowspan: spanCount,
colspan: 1
}
} else {
// 其他行隐藏
return {
rowspan: 0,
colspan: 0
}
}
}
}
// if (column.prop === 'attachmentType') {
// // 计算相同地区的连续行数
// const currentValue = row[column.prop]
// // if (currentValue == '0') return
// let startIndex = rowIndex
// let endIndex = rowIndex
// //console.log('currentValue', this.tableData)
// // 向前找到开始位置
// while (startIndex > 0 && this.tableData[startIndex - 1][column.prop] === currentValue && currentValue !==
// '0') {
// startIndex--
// }
// // 向后找到结束位置
// while (endIndex < this.tableData.length - 1 && this.tableData[endIndex + 1][column.prop] ===
// currentValue && currentValue !==
// '0') {
// endIndex++
// }
// const spanCount = endIndex - startIndex + 1
// if (spanCount > 1) {
// if (rowIndex === startIndex) {
// // 第一行显示合并的单元格
// return {
// rowspan: spanCount,
// colspan: 1
// }
// } else {
// // 其他行隐藏
// return {
// rowspan: 0,
// colspan: 0
// }
// }
// }
// }
return {
rowspan: 1,
colspan: 1
}
},
locationreload() {
uni.reload();
},
clicktableshow() {
this.tableshow = false;
setTimeout(() => {
this.tableshow = true;
}, 100)
},
fuchfxxwt(e) {
// 复查发现新问题
if (e) {
this.activeitem = e;
}
if (!this.activeitem.tableLevel4Id) {
this.$modal.msgError("请先创建检查点!");
return;
}
this.rowitem = this.activeitem;
this.activeitemtableLevel4Id = this.activeitem.tableLevel4Id;
this.sjnum = Math.random();
this.fuchaxwtshow = true;
},
chytypebox(row, type) {
//查验类型内容展示
let list = JSON.parse(row.phaseTypesControlInfo);
let item = list.find(item => item.phaseType == type);
this.chytypeboxnei = item ? item.standardControlLevel3Name : null; // 如果找到了返回text否则返回null;
this.chytypeboxshow = true;
},
fucha(e) {
// 复查
if (e) {
this.activeitem = e;
}
if (!this.activeitem.tableLevel4Id) {
this.$modal.msgError("请先创建检查点!");
return;
}
this.rowitem = this.activeitem;
this.activeitemtableLevel4Id = this.activeitem.tableLevel4Id;
this.sjnum = Math.random();
this.fuchashow = true;
},
zhenggai(e) {
// 整改
if (e) {
this.activeitem = e;
}
if (!this.activeitem.tableLevel4Id) {
this.$modal.msgError("请先创建检查点!");
return;
}
this.rowitem = this.activeitem;
this.activeitemtableLevel4Id = this.activeitem.tableLevel4Id;
this.sjnum = Math.random();
this.zhenggaishow = true;
},
closefuchaxwt(e) {
if (e) {
this.activeitem = e;
}
// 复查发现新问题 关闭
this.rowitem = null;
this.activeitemtableLevel4Id = 0;
this.fuchaxwtshow = false;
this.$refs.showright.close();
this.getlistinfo(); //获取检查列表
},
closefucha() {
// 复查 关闭
this.rowitem = null;
this.activeitemtableLevel4Id = 0;
this.fuchashow = false;
this.$refs.showright.close();
this.getlistinfo(); //获取检查列表
},
closezhenggai() {
// 整改 关闭
this.rowitem = null;
this.activeitemtableLevel4Id = 0;
this.zhenggaishow = false;
this.$refs.showright.close();
this.getlistinfo(); //获取检查列表
},
hideKeyboard() {
uni.hideKeyboard()
},
biangenls() {
//变更日志
this.getbglslist();
//获取变更日志
},
showimg(item) {
if (!item.imgNum) return;
this.imgurlslist = JSON.parse(item.imgUrlbase64list);
// debugger
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;
if (!this.activeitem.tableLevel4Id) {
this.$modal.msgError("无检查点暂不能删除!");
return false;
}
this.$modal.confirm('确定要删除信息吗?').then(() => {
// debugger
//padstatus 0--没有tableLevel4Id 1--有tableLevel4Id 2--需要新增的 3--需要修改的 4--删除的
let newpadstatus = "4";
const escapedImgUrl = typeof newpadstatus === 'string' ?
`'${newpadstatus.replace(/'/g, "''")}'` // 转义单引号
:
newpadstatus;
const setClauses = [`padstatus=${newpadstatus}`];
// 构建完整SQL语句
const sql =
`UPDATE projectxianchangtable SET ${setClauses.join(', ')} WHERE uuid=${this.activeitem.uuid}`;
plus.sqlite.executeSql({
name: 'xiaofangdb',
sql: sql,
// args: [serverImgUrls, id],
success: (res) => {
console.log(`查验状态更新成功ID: ${this.activeitem.uuid}`, newpadstatus);
vm.getlistinfo();
vm.$modal.msgSuccess("删除成功!");
},
fail: (error) => {
console.error(`查验状态更新失败ID: ${this.activeitem.uuid}`, error);
}
});
//this.activenumlist
// this.activeitem.checkTableId
// let checkTableIds = this.activenumlist
// delsafety_hazard(checkTableIds).then((res) => {
// // debugger
// this.$modal.msgSuccess("删除成功!");
// setTimeout(() => {
// this.getlistinfo(); //获取检查列表
// }, 300);
// })
});
},
clearSelection() {
//清空选中项
this.$refs.pageTable?.clearSelection();
this.activeitem = null;
this.activenum = 0;
},
handleSelectionChange(selection) {
// debugger
// let del_row = selection.shift();
// this.$refs.pageTable.toggleRowSelection(del_row, false);
// console.log('当前选中的行:', JSON.stringify(selection));
//this.$refs.pageTable.toggleAllSelection(false);
// this.$refs.pageTable.clearSelection();
// this.$refs.pageTable.toggleRowSelection(selection.index, true);
this.activenumlist = [];
this.activenum = selection.length;
// this.activenumlist=selection.map
for (let s of selection) {
if (s.tableLevel4Id) {
this.activenumlist.push(s.tableLevel4Id)
} else {
//this.$refs.pageTable.toggleRowSelection(s, false);
// this.$refs.pageTable.clearSelection()
// / this.$modal.msgError("此项没有检查点!");
}
}
if (selection.length > 1) {
// debugger
// this.$modal.msgError("只能选一个!");
this.activeitem = null;
// this.$refs.pageTable.toggleRowSelection(selection.detail.index[selection.detail.index.length - 1], false);
// this.$refs.pageTable.toggleAllSelection(true);
// this.$refs.pageTable.clearSelection();
return;
}
if (selection.length == 0) {
this.activeitem = null;
this.isbutclick = false;
} else {
// this.activeitem = this.tableData[selection.detail.index[selection.detail.index.length - 1]];
this.activeitem = selection[0];
}
if (this.activeitem) {
//debugger
if (this.activeitem.tableLevel4Id == null) {
this.isbutclick = false;
} else {
this.isbutclick = true;
}
}
// this.$refs.pageTable.clearSelection();
},
tabsonChange(e) {
// 标签索引改变时触发(disabled时不会触发)
this.queryParams.standardTableLevel1Id = e.key;
this.qingchu();
console.error('标签索引改变时触发:', e);
},
async changexiangmu(e) {
// debugger
if (this.queryParams.projectId) {
this.shujuStore.setactiveprojectid(this.queryParams.projectId);
this.shujuStore.setactiveprojetname(e.name);
}
if (this.queryParams.projectId) {
this.$dbUtils.getDataListAll('xiaofangdb', 'projectst1table', {
projectId: this.queryParams.projectId
}, {
byName: 'sortNum',
byType: 'asc'
}).then(async (data) => {
// shujuStore.setgongsishuju(data);
console.error('项目下1级数据:', data);
this.currentvalue = 0;
this.tabslist1 = data;
this.tabsshow = false;
setTimeout(() => {
this.tabsshow = true;
}, 100)
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() {
//获取检查列表
this.activenumlist = [];
this.activenum = 0;
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);
for (let xx of datalist) {
if (xx.phaseTypes) {
xx.phaseTypes = JSON.parse(xx.phaseTypes);
}
if (xx.locationInfos) {
xx.locationInfos = JSON.parse(xx.locationInfos);
}
if (xx.records) {
xx.records = JSON.parse(xx.records);
}
if (xx.materialActivityFiles) {
xx.materialActivityFiles = JSON.parse(xx.materialActivityFiles);
}
}
this.tableData = datalist;
console.error('查验列表:', datalist);
},
halechange() {
//查询
this.getlistinfo(); //获取检查列表
},
banhaoselectionEvent(selection, selectObj) {
console.log('selectionEvent:', selection, selectObj)
},
handleLongPress() {
this.$modal.msgError("只能选一个!");
},
openright(item) {
// /debugger
// uni.navigateTo({
// url: `/pages/zhixing/addjianchabiao?isedit=1&projectid=${this.activeitem.projectId}&checkTableId=${this.activeitem.checkTableId}&id1=${this.activeitem.standardCheckTable1Id}&id2=${this.activeitem.standardCheckTable2Id}&id3=${this.activeitem.standardCheckTable3Id}&id4=${this.activeitem.standardCheckTable4Id}&projectName=${this.queryParams.projectname}`,
// })
item.isedit = 1;
// item.projectid = item.projectId;
// item.projectName = this.queryParams.projectname;
// item.id1 = item.standardCheckTable1Id;
// item.id2 = item.standardCheckTable2Id;
// item.id3 = item.standardCheckTable3Id;
// item.id4 = item.standardCheckTable4Id;
this.rowitem = item;
this.sjnum = Math.random();
this.$refs.showright.open();
},
bianji() {
if (!this.activeitem.tableLevel4Id) {
this.activeitem.isedit = 0;
} else {
this.activeitem.isedit = 1;
}
this.rowitem = this.activeitem;
this.sjnum = Math.random();
this.$refs.showright.open();
},
closeright() {
// debugger
this.rowitem = null;
this.$refs.showright.close();
this.getlistinfo(); //获取检查列表
},
sahnchuevent(e) {
//删除
this.activenumlist = [];
this.activenumlist.push(e)
this.$refs.showright.close();
this.shanchujiancha();
},
treechange(em, d) {
// debugger
this.queryParams.standardTableLevel2Id = em.id;
this.getlistinfo(); //获取检查列表
},
qingchu() {
this.queryParams.standardTableLevel2Id = null;
this.treelist = [];
this.getlistinfo(); //获取检查列表
}
}
}
</script>
<style lang="scss" scoped>
.zhixing_top {
width: 100%;
display: flex;
flex-direction: column;
.querybox {
display: flex;
flex-direction: row;
align-items: center;
.querybox_title {
font-size: 13px;
text-align: right;
justify-content: end;
}
}
}
::v-deep .infotable {
.xincellclass {}
.u-table-header {
z-index: 0;
}
.u-table-cell {
.u-table-cell_content {
padding: 0rpx 16rpx 0rpx 16rpx;
white-space: normal;
text-align: left;
}
}
}
::v-deep .uni-table {
// tr:first-child {
// th:nth-of-type(1) {
// /* 你的样式 */
// .uni-table-checkbox {
// display: none !important;
// }
// //
// }
// }
.frisytr {
.uni-table-checkbox {
display: none !important;
}
}
.checkbox__inner {
z-index: 0 !important;
}
}
::v-deep .biangengcontent {
.uni-steps__column-title {
color: #666 !important;
}
.uni-steps__column-desc {
color: #666 !important;
}
}
::v-deep .mewtable2 {
.u-table__header {
.u-checkbox {
// display: none !important;
visibility: hidden !important;
}
.u-table__cell {
//justify-content: center !important;
min-height: 50px !important;
}
.u-table__rows {
::v-deep .u-table__cell {
//justify-content: center !important;
// min-height: 50px !important;
height: auto !important;
}
}
}
.u-table__body {
.u-table__rows {
border-bottom: 1px solid #dadbde !important;
.u-table__cell {
z-index: 0 !important;
}
}
}
}
</style>