jy-safe-app/pages/apply/subPages/BS/safeCheckSign_Demo_Sub.vue

561 lines
20 KiB
Vue
Raw Normal View History

2025-10-14 15:17:30 +08:00
<!-- <button>检查记录确认</button> -->
<template>
<view class="page-wrap">
<view class="card">
<uni-card margin="0" :is-shadow="true">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules"
ref="wForm" errorType="border-bottom">
<u-form-item label="检查类型" prop="Nav_CheckType.NAME" borderBottom>
<u--input v-model="model.Nav_CheckType.NAME" border="none" slot="right"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查层级" prop="Nav_CheckTypeLevel.Nav_Enums.NAME" borderBottom>
<u--input v-model="model.Nav_CheckTypeLevel.Nav_Enums.NAME" border="none" slot="right"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查时间" prop="CREATE_TIME" borderBottom>
<u--input v-model="model.CREATE_TIME" border="none" slot="right" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查区域" prop="RiskAreaNAME" borderBottom>
<u--input v-model="model.RiskAreaNAME" border="none" slot="right" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查项目分类" prop="CheckProjectCategoryNAME" borderBottom>
<u--input v-model="model.CheckProjectCategoryNAME" border="none" slot="right"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="附件" prop="NAME" borderBottom>
<navigator slot="right" inputAlign="right"
url='blob:http://localhost:8080/c74abf3f-e581-4270-b1dc-c670633f3575'>12345.doc
</navigator>
<navigator slot="right" inputAlign="right"
url='blob:http://localhost:8080/c74abf3f-e581-4270-b1dc-c670633f3575'>12345.doc
</navigator>
</u-form-item>
</u--form>
<!-- <u-datetime-picker :show="showCheckDate" mode="datetime" v-model="dataModel.ACTIVITY_TIME"
@confirm="handleCheckDate" @close="showCheckDate = false;"
@cancel="showCheckDate = false;"></u-datetime-picker> -->
</uni-card>
</view>
<u-sticky offset-top="20">
<view class="sub-form">
<view class="sub-form-wrap">
<view class="sub-form-btns">
<view class="sub-form-btn" @click="handleAdd">
<u-icon class="icon" name="plus" color="#2979ff" size="14"></u-icon>
<u--text type="primary" text="新增"></u--text>
</view>
</view>
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="subDataModel"
errorType="border-bottom" ref="sForm">
<uni-collapse :border="false" accordion>
<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
v-for="(item, index) in model.Nav_ListSafeCheckDetail">
<uni-collapse-item :title="index + 1 + '. ' + item.CHECKCONTENT">
<view slot="right-icon" class="row-action"></view>
<view slot="value" class="row-action">
<text @click.stop="handleOkRow">
<u--text type="primary" text="确认"></u--text>
</text>
<text @click.stop="handleDelRowBefore(index)">
<u--text type="error" text="删除"></u--text>
</text>
</view>
<u-form-item label="检查区域" prop="Nav_CheckArea.NAME" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item['Nav_CheckArea'].NAME"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查内容" prop="CHECKCONTENT" borderBottom>
<label>{{item.CHECKCONTENT}}</label>
<u--input disabled disabledColor="#fff" v-model="item.CHECKCONTENT"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查项目" prop="Nav_CheckProject.NAME" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item['Nav_CheckProject'].NAME"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查问题描述" prop="listCheckDetailQuestion" borderBottom
@click="handleShowSheet({title: '检查问题描述', name: 'listCheckDetailQuestion', formIndex: index ,subData: item,data:model})">
<!-- 下拉图标 -->
<u--input disabledColor="#fff" v-model="item.listCheckDetailQuestion"
border="none" inputAlign="right"></u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="问题等级" prop="QUESTION_LEVELShow" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item.QUESTION_LEVELShow"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="整改建议与措施" prop="DEMAND" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item.DEMAND" border="none"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="检查人员" prop="checkerNames" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item.checkerNames"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="隐患地点" prop="ADDRESS" borderBottom>
<u--input disabledColor="#fff" v-model="item.ADDRESS" border="none"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="隐患原因" prop="listCheckDetailReason" borderBottom
@click="handleShowSheet({title: '隐患原因', name: 'listCheckDetailReason', formIndex: index})">
<!-- 下拉图标 -->
<u--input disabledColor="#fff" v-model="item.listCheckDetailReason"
border="none" inputAlign="right"></u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="附件" prop="DEMAND" borderBottom>
<!-- <u--input disabled disabledColor="#fff" v-model="item.ADDRESS"
border="none" inputAlign="right"></u--input> -->
</u-form-item>
</uni-collapse-item>
</uni-card>
</uni-collapse>
</u--form>
</view>
</view>
</u-sticky>
<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" title="确认删除?"></u-modal>
<!-- <query-selector :show="showPopup" :lists="userLists" @close="handleClosePopup" @search="handleSearchUser"-->
<!-- @select="handleSelectedUser" />-->
<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
@close="closePicker" @cancel="closePicker" keyName="NAME"></u-picker>
<button type="primary" v-if='isLoadOK && tableKey === 1' @click="FullCheckUpdate">提交</button>
</view>
</template>
<script>
import {
guid,
initFilter,
extendRule,
extendInclude,
extendGroupRule,
initFilterGroup,
extendFilterGroup,
extendFilterGroupGroupRules
} from '../../../../utils/common'
import {
GetUserCheckInfoBS057,
FullCheckUpdateBS057,
orderPagedRiskReason,
GetCheckDetailDESCREPTION
} from '../../../../services/apply/subPages/BS/safeCheck'
// import '@/utils/showMsg.js'
import UButton from '../../../../uni_modules/uview-ui/components/u-button/u-button.vue'
export default {
components: {
UButton
},
data() {
return {
tableKey: '0',
TaskID: '',
model: {
ID: '',
TaskID: '',
Nav_CheckType: {},
Nav_CheckTypeLevel: {
Nav_Enums: {}
},
Nav_ListSafeCheckDetail: [{
Nav_CheckArea: {},
Nav_CheckProject: {},
checkerNames: '',
Nav_ListCheckDetailReason: [{}],
listCheckDetailReason: '',
CHECKCONTENT: '空',
Nav_ListCheckDetailQuestion: [{
Nav_Question: [],
}],
listCheckDetailQuestion: '',
QUESTION_LEVELShow: ''
}] //子表
},
isAudit: true,
isLoadOK: false,
lists: [],
comPickerInfo: {
showSheet: false,
columns: [],
title: '',
dataIndex: undefined,
formIndex: undefined,
name: ''
},
// subForms: [{
// title: '检查详情',
// listCheckDetailReason: '',
// // checkContent: '',
// // checkProblem: '',
// // problemLevel: '',
// // riskPosition: ''
// }],
subDataModel: {
Nav_CheckArea: {},
Nav_CheckProject: {},
checkerNames: '',
Nav_ListCheckDetailReason: [{}],
listCheckDetailReason: '',
CHECKCONTENT: '空',
Nav_ListCheckDetailQuestion: [{
Nav_Question: [],
}],
listCheckDetailQuestion: '',
QUESTION_LEVELShow: ''
},
showCheckDate: false,
showPopup: false,
showDelModalIndex: undefined,
rules: {
'activityTopic': {
type: 'string',
required: true,
trigger: ['blur', 'change']
}
},
}
},
onLoad(option) {
this.model.ID = option.ID
this.model.TaskID = option.taskID
this.TaskID = option.taskID
this.tableKey = option.tableKey
this.loadData()
},
methods: {
handleOkRow() {
console.log('ok row')
},
handleDelRowBefore(index) {
this.showDelModalIndex = index
},
confirmDel() {
this.model.Nav_ListSafeCheckDetail.splice(this.showDelModalIndex, 1)
this.showDelModalIndex = undefined
},
handleAdd() {
this.model.Nav_ListSafeCheckDetail.unshift(this.subDataModel)
},
handleTab(t) {
this.currentTab = t
},
FullCheckUpdate() {
const ele = this.$refs
ele['wForm'].validate().then(res => {
const orgId = uni.getStorageSync('orgId')
this.model.Nav_ListSafeCheckDetail[0].Nav_ListCheckDetailUser[0].SAFECHECKSTATE = 80;
this.model.TaskID = this.TaskID
debugger
FullCheckUpdateBS057(this.model).then(res => {
uni.$showMsgFunc('操作成功!', () => {
if (this.tableKey == null || this.tableKey == 0) {
uni.navigateTo({
url: 'safeCheckIndex'
})
} else {
uni.navigateBack()
}
}, 'success', 1000)
})
}).catch(err => {
console.log('校验失败', err)
})
},
loadData() {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "CODE", 1)
extendRule(json, 'ID', 1, this.model.ID);
extendInclude(json, "Nav_CheckType");
extendInclude(json, "Nav_CheckTypeLevel.Nav_Enums");
extendInclude(json, "Nav_ListCheckRiskArea");
extendInclude(json, "Nav_ListCheckRiskArea.Nav_RiskArea");
extendInclude(json, "Nav_ListCheckProject");
extendInclude(json, "Nav_ListCheckProject.Nav_CheckProject");
extendInclude(json, "Nav_ListCheckProjectCategory");
extendInclude(json, "Nav_ListCheckProjectCategory.Nav_CheckProjectCategory");
extendInclude(json, "Nav_Files.Nav_ImgFile");
extendInclude(json, "Nav_ListSafeCheckDetail");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_CheckArea");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_CheckProject");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_CheckQuestion");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_ListCheckDetailQuestion.Nav_Question");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_ListCheckDetailReason.Nav_RiskReason");
extendInclude(json, "Nav_ListSafeCheckDetail.Nav_Files.Nav_ImgFile");
json.IgnoreDataRule = true
GetUserCheckInfoBS057(json).then(res => {
if (res.Nav_ListSafeCheckDetail != undefined && res.Nav_ListSafeCheckDetail.length > 0) {
let checkerNames = ''
for (let i = 0; i < res.Nav_ListSafeCheckDetail.length; i++) {
// this.subForms.push({
// title: '检查详情' + (this.subForms.length + 1),
// listCheckDetailReason: '',
// })
//检查人
checkerNames = ''
for (let j = 0; j < res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailUser
.length; j++) {
checkerNames += '' + res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailUser[j]
.Nav_User.NAME
}
res.Nav_ListSafeCheckDetail[i].checkerNames = checkerNames.substring(1)
res.Nav_ListSafeCheckDetail[i].QUESTION_LEVEL = null //问题等级
//检查问题描述 显示 默认的 无 或者加载显示
if (res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion != null) {
if (res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion.length == 1) {
if (res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion[0]
.Nav_Question != undefined) {
res.Nav_ListSafeCheckDetail[i].listCheckDetailQuestion = res
.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion[0].Nav_Question
.DESCREPTION
}
} else {
let DESCREPTION = ''
for (let i = 0; i < res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion
.length; i++) {
if (res.Nav_ListSafeCheckDetail[i].Nav_ListCheckDetailQuestion[0]
.Nav_Question != undefined) {
DESCREPTION += '' + res.Nav_ListSafeCheckDetail[i]
.Nav_ListCheckDetailQuestion[i].Nav_Question
.DESCREPTION
}
}
res.Nav_ListSafeCheckDetail[i].listCheckDetailQuestion = DESCREPTION.substring(
1)
}
}
}
}
this.model = res
//数据组装
let strRiskAreaNAME = ''
if (res.Nav_ListCheckRiskArea && res.Nav_ListCheckRiskArea.length > 0) {
for (let i = 0; i < res.Nav_ListCheckRiskArea.length; i++) {
strRiskAreaNAME += (strRiskAreaNAME.length > 0 ? "," : "") + res.Nav_ListCheckRiskArea[
i].Nav_RiskArea.NAME;
}
}
let CheckProjectCategoryNAME = ''
if (res.Nav_ListCheckProjectCategory && res.Nav_ListCheckProjectCategory.length > 0) {
for (let i = 0; i < res.Nav_ListCheckProjectCategory.length; i++) {
CheckProjectCategoryNAME += (CheckProjectCategoryNAME.length > 0 ? "," : "") + res
.Nav_ListCheckProjectCategory[i].Nav_CheckProjectCategory.NAME;
}
}
this.model.RiskAreaNAME = strRiskAreaNAME
this.model.CheckProjectCategoryNAME = CheckProjectCategoryNAME
this.isLoadOK = true
})
},
//下拉数据加载
async handleShowSheet(p) {
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "", 0)
let dataSelect = []
if (p.name === 'listCheckDetailReason') {
// extendOrder(json, "NUM", "0")
// NAME
dataSelect = await orderPagedRiskReason(json).then(res => {
return res
})
} else if (p.name == 'listCheckDetailQuestion') {
let theItems = p.subData
extendInclude(json, "Nav_Main")
extendFilterGroupGroupRules(json, 'SAFE_CHECK_ID', 1, p.subData.SAFE_CHECK_ID)
extendFilterGroupGroupRules(json, 'CHECKCONTENT', 1, p.subData.CHECKCONTENT)
extendFilterGroupGroupRules(json, 'DEPARTMENT_ID', 1, p.data.DEPARTMENTID)
extendFilterGroupGroupRules(json, 'CHECK_PROJECT_ID', 1, p.subData.CHECK_PROJECT_ID)
extendFilterGroupGroupRules(json, 'RISK_AREA_ID', 1, p.subData.RISK_AREA_ID)
extendFilterGroupGroupRules(json, 'CHECK_PROJECT_CATEGORY_ID', 1, p.subData
.CHECK_PROJECT_CATEGORY_ID)
dataSelect = await GetCheckDetailDESCREPTION(json).then(res => {
//数据组装
if (res != undefined && res.length > 0) {
for (let i = 0; i < res.length; i++) {
res[i].NAME = res[i].DESCREPTION
}
}
return res
})
}
if (dataSelect.length) {
this.comPickerInfo = {
showSheet: true,
title: p.title,
name: p.name,
formIndex: p.formIndex,
columns: [dataSelect]
}
} else {
// 暂无数据
}
},
onConfirmPicker(e) {
const {
name,
formIndex
} = this.comPickerInfo
if (name == 'listCheckDetailReason') {
// listCheckDetailReason
this.model.Nav_ListSafeCheckDetail[formIndex].listCheckDetailReason = e.value[0].NAME
let selectReason = e.value[0]
selectReason.RISK_REASON_ID = selectReason.ID
selectReason.ID = guid()
selectReason.CHECK_DETAIL_ID = this.model.Nav_ListSafeCheckDetail[formIndex].ID;
if (this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailReason == undefined) {
this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailReason = []
this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailReason.push(selectReason)
} else {
this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailReason[0] = selectReason
}
} else if (name == 'listCheckDetailQuestion') {
// 检查问题
this.model.Nav_ListSafeCheckDetail[formIndex].listCheckDetailQuestion = e.value[0].NAME
// if (this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailQuestion == undefined) {
// this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailQuestion = []
// this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailQuestion.push(e.value[0])
// } else {
// this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailQuestion[0] = e.value[0]
// }
// 数据处理
let checkDetailChoose = e.value[0]
checkDetailChoose.SAFE_CHECK_QUESTION_ID = checkDetailChoose.ID;
checkDetailChoose.ID = guid()
checkDetailChoose.SAFE_CHECK_ID = this.model.Nav_ListSafeCheckDetail[formIndex].SAFE_CHECK_ID;
checkDetailChoose.SAFE_CHECK_DETAIL_ID = this.model.Nav_ListSafeCheckDetail[formIndex].ID;
this.model.Nav_ListSafeCheckDetail[formIndex].Nav_ListCheckDetailQuestion[0] = checkDetailChoose
if (e.value[0].ID != '55555555-5555-5555-5555-555555555555') {
//问题等级 QUESTION_LEVELShow QUESTION_LEVEL
// this.model.Nav_ListSafeCheckDetail[formIndex].QUESTION_LEVELShow = '问题等级枚举' + e.value[0].Nav_Main.QUESTION_LEVEL
this.model.Nav_ListSafeCheckDetail[formIndex].QUESTION_LEVELShow = e.value[0].Nav_Main
.QUESTION_LEVE_DESCRIPTION
this.model.Nav_ListSafeCheckDetail[formIndex].QUESTION_LEVEL = e.value[0].Nav_Main.QUESTION_LEVEL
//整改建议与措施
this.model.Nav_ListSafeCheckDetail[formIndex].DEMAND = e.value[0].DEMAND
} else {
//问题等级 QUESTION_LEVELShow QUESTION_LEVEL
this.model.Nav_ListSafeCheckDetail[formIndex].QUESTION_LEVELShow = ''
.QUESTION_LEVEL
this.model.Nav_ListSafeCheckDetail[formIndex].QUESTION_LEVEL = null
//整改建议与措施
this.model.Nav_ListSafeCheckDetail[formIndex].DEMAND = ''
}
}
this.comPickerInfo.showSheet = false
},
closePicker() {
this.comPickerInfo = {
showSheet: false,
columns: [],
title: '',
name: '',
formIndex: undefined
}
},
},
computed: {},
// onNavigationBarButtonTap(e) {
// this.subForms.push({
// title: '检查详情' + (this.subForms.length + 1),
// Nav_ListCheckDetailReason: '',
// })
// }
}
</script>
<style scoped>
.page-wrap {
padding: 16px 16px 72px;
}
.card {
margin-bottom: 18px;
}
.sub-form {
margin-bottom: 16px;
}
.upload-title {
color: #303133;
font-size: 15px;
line-height: 22px;
padding: 8px 0;
}
.page-wrap>>>.u-upload__button {
margin-bottom: 0;
}
.row-action {
display: flex;
}
.row-action text {
margin-left: 10px;
}
.sub-form-btns {
padding: 4px 2px;
}
.sub-form-btn {
display: flex;
}
.sub-form-btn .icon {
margin-right: 4px;
}
.btnEnable {
background: #E6E6E6;
color: #303133;
}
.bottom {
position: fixed;
bottom: 0;
display: block;
margin-left: auto;
margin-right: auto;
padding-left: 14px;
padding-right: 14px;
box-sizing: border-box;
font-size: 18px;
text-align: center;
text-decoration: none;
line-height: 2.55555556;
border-radius: 5px;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
color: #000;
background-color: #f8f8f8;
cursor: pointer;
color: #fff;
background-color: #007aff;
width: 92%;
margin-bottom: 5px;
z-index: 999;
}
</style>