添加巡检计划

This commit is contained in:
jiayu 2024-07-24 11:05:08 +08:00
parent 20f0604e39
commit 90b4c2b210
8 changed files with 1131 additions and 78 deletions

View File

@ -3,7 +3,7 @@
<view class="g-picker-value" @click="showPicker">
<!-- <u-input v-model="value" disabled disabledColor="#fff" :inputAlign="inputAlign" :placeholder="placeholder" style="pointer-events: none">
</u-input> -->
<text v-if="value">{{value}}</text>
<text class="_value" v-if="value">{{value}}</text>
<text class="_placeholder" v-else>{{placeholder}}</text>
<!-- <u-icon v-if="!disabled" name="arrow-right" color="#c0c4cc"></u-icon> -->
</view>
@ -199,6 +199,10 @@
}
}
}
._value {
word-break: break-all;
line-height: 36rpx;
}
._placeholder {
color: rgb(192, 196, 204);
font-size: 14px;

View File

@ -2722,6 +2722,20 @@
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/projectEnd/InspectionRoute/inspectionPointDetail",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path" : "pages/projectEnd/InspectionRoute/editInspectionPlan",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
// "subPackages":[{

View File

@ -0,0 +1,667 @@
<template>
<view>
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
{{pageTitle}}
</view>
</headers>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 50 + 'px'}">
<view class="type flex">
<view class="name"><text class="star">*</text>路线名称</view>
<input class="inpuStyle" v-model="form.routeName" placeholder="请输入"></input>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>分包单位</view>
<g-picker style="flex: 1" v-model="enterpriseName" :columns="enterpriseList" :filter="{label: 'enterpriseName', value: 'id'}" input-align="left" @confirm="handleChangeEnterprise"></g-picker>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>巡检人员</view>
<g-picker style="flex: 1" v-model="inspectUserName" :columns="chargerList" :filter="{label: 'realName', value: 'userId'}" input-align="left" @confirm="handleChangeCharger"></g-picker>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>通知人员</view>
<g-picker style="flex: 1" v-model="noticeUserName" :columns="accountList" :filter="{label: 'workerName', value: 'userId'}" input-align="left" @confirm="handleChangeAccount"></g-picker>
</view>
<view class="type flex">
<view class="name large-2"><text class="star">*</text>计划检查时间</view>
<picker mode="date" :value="form.startTime" @change="startTimeChange">
<view v-if="!form.startTime" style="color: #c0c4cc; font-size: 28rpx;">开始时间</view>
<view v-else class="uni-input">{{form.startTime}}</view>
</picker>
<span style="color: gray;margin:0 12rpx"></span>
<picker mode="date" :value="form.endTime" @change="endTimeChange">
<view v-if="!form.endTime" style="color: #c0c4cc; font-size: 28rpx;">结束时间</view>
<view v-else class="uni-input">{{form.endTime}}</view>
</picker>
</view>
<view class="type flex">
<view class="name large-2"><text class="star">*</text>检查频次</view>
<input disabled="true" v-model="form.frequencyNum" />
<picker mode="selector" :range="frequencyOptions" @change="handleChangeFrequency" filterable>
<view class="picker">
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!form.frequencyType">
请选择
</view>
<view style="flex-shrink: 0; white-space: nowrap;" v-else>
{{frequencyOptions[form.frequencyType - 1]}}
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
</view>
</view>
</picker>
</view>
<view class="dy_form">
<view class="dy_head">
<view class="head_left">
<image class="ic" src="@/static/icon/form.svg"></image>
<text class="title">动态表单</text>
</view>
<button @click="addFormInput" class="add_btn" size="mini" type="primary" plain="true"><u-icon style="margin-right: 8rpx;" size="16" name="plusempty" color="#007aff"></u-icon>新增项</button>
</view>
<view class="dy_content" v-for="(item, index) in dyFormData" :key="index">
<view class="c_colum">
<button @click="delFormInput(index)" class="del_btn" size="mini" type="warn" plain="true">删除<u-icon style="margin-left: 8rpx;" size="16" name="closeempty" color="#e64340"></u-icon></button>
</view>
<view class="c_body">
<label for="pointId">巡检点</label>
<picker id="pointId" class="c_picker" mode="selector" :range="inspectPointList" range-key="checkingPointName" @change="(e)=> handleInspectPoint(e, item)" filterable>
<view class="picker">
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!item.checkingPointId">
请选择
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
</view>
<view class="c_picker_value" v-else>
{{item.checkingPointName}}
<u-icon style="margin-left: 8rpx;" name="arrow-right"></u-icon>
</view>
</view>
</picker>
<label for="sortId">排序</label>
<input type="number" id="sortId" class="c_input" v-model="item.sort" placeholder="数字越大排序越靠后" />
</view>
</view>
</view>
</view>
<button style="visibility: hidden;">占位用</button>
<button class="save-btn" type="primary" @click="save">保存</button>
</view>
</template>
<script>
import gPicker from "@/components/g-picker/g-picker.vue"
import dateTimePiccker from '@/components/dateTimePicker/index.vue'
import deepClone from "../../../uview-ui/libs/function/deepClone";
export default {
components: {
gPicker,
dateTimePiccker
},
data() {
return {
editId: "",
coordType: "gcj02",
standOptions: [30, 50, 100, 200, 300],
mobileTopHeight: 0,
projectSn: '',
userInfo: {},
pointAreaList: [],
areaData: {},
enterpriseData: {},
chargerList: [],
enterpriseList: [],
accountList: [],
inspectPointList: [],
pageTitle: "新增巡检计划",
checkEnterpriseName: "",
enterpriseName: "",
inspectUserName: "",
noticeUserName: "",
form: {
routeName: "",
position: "",
// qualityRegionId: "", // ID
enterpriseId: "", //
inspectUserIds: "", //
noticeUserIds: "", //
startTime: "",
endTime: "",
frequencyType: 1,
frequencyNum: 1,
standArea: 100, //
latitude: "", //
longitude: "", //
addr: "", //
},
dyFormData: [{
sort: null,
checkingPointId: null,
checkingPointName: null
}],
frequencyOptions: ["次", "次/日", "次/周", "次/月", "次/年"]
}
},
onLoad(option) {
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.editId = ""
this.init();
//
if(option.id) {
this.pageTitle = "编辑巡检计划"
this.editId = option.id;
} else {
// this.getPointAreaFn();
}
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo',res)
console.log(res)
}
})
console.log('this.mobileTopHeight',this.mobileTopHeight)
},
methods: {
//
init() {
this.getEnterpriseList();
this.getAccountList();
this.getPointList();
},
//
getData() {
return new Promise((resolve, reject) => {
console.info("getData", new Date().getTime())
this.sendRequest({
url: 'xmgl/checkingPoint/queryById',
method: 'get',
data: {
id: this.editId
},
success: (res) => {
if(res.code === 200) {
this.form = res.result
//
const obj = this.pointAreaList.find(item => item.id === this.form.qualityRegionId)
this.areaData = obj || {}
//
this.enterpriseList = this.areaData.enterpriseInfos || [];
const eObj = this.enterpriseList.filter(item => this.form.enterpriseId.includes(item.id))
this.enterpriseName = eObj.map(item => item.enterpriseName).join(',')
//
this.chargerList = this.areaData.systemUsers.filter((item) => {
return this.form.enterpriseId.includes(item.enterpriseId);
}) || [];
this.inspectUserName = this.chargerList.filter(item => this.form.inspectUserIds.includes(item.userId)).map(item => item.realName).join(',')
let tempArr = JSON.parse(this.form.template) || []
tempArr.forEach(item => item.isRequired = item.isRequired ? "1" : "2")
//
this.dyFormData = tempArr
console.info(eObj, 'eObj', this.dyFormData, tempArr)
resolve(res)
}
console.log(res, 'xiangqing');
},
fail: (err) => {
reject(err)
}
})
})
},
//
getPointAreaFn() {
return new Promise((resolve, reject) => {
console.info("getPointAreaFn", new Date().getTime())
let requestData = {
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/qualityRegion/notTreeList',
method: 'post',
data: requestData,
success: (res) => {
console.log(res);
this.pointAreaList = res.result;
console.info("getPointAreaFn处理结束", new Date().getTime())
resolve(res)
},
fail: (err) => {
reject(err)
}
})
})
},
//
getEnterpriseList() {
return new Promise((resolve, reject) => {
let requestData = {
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/enterpriseInfo/list',
method: 'post',
data: requestData,
success: (res) => {
console.log(res);
this.enterpriseList = res.result;
resolve(res)
},
fail: (err) => {
reject(err)
}
})
})
},
//
getAccountList() {
return new Promise((resolve, reject) => {
let requestData = {
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/systemUser/getProjectChilderSystemUserList',
method: 'post',
data: requestData,
success: (res) => {
console.log(res);
let data = res.result;
data.forEach(item => {
item.workerName = item.workerName || item.userId;
item.realName = item.realName || item.userId;
})
this.accountList = data;
resolve(res)
},
fail: (err) => {
reject(err)
}
})
})
},
//
getPointList() {
return new Promise((resolve, reject) => {
let requestData = {
pageNo: 10,
pageSize: -1,
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/checkingPoint/selectPage',
method: 'post',
data: requestData,
success: (res) => {
this.inspectPointList = res.result.records || [];
resolve(res)
},
fail: (err) => {
reject(err)
}
})
})
},
//
handleChangeRegion(e) {
let index = e.detail.value;
let findItem = this.pointAreaList[index];
this.form.qualityRegionId = findItem.id;
this.form.enterpriseId = "";
this.form.inspectUserIds = "";
this.enterpriseData = {};
console.log(findItem);
this.areaData = findItem;
this.chargerList = findItem.systemUsers;
this.enterpriseList = findItem.enterpriseInfos;
console.info(this.enterpriseList, 'enlist')
},
//
handleChangeEnterprise(e,values,labels) {
this.form.enterpriseId = values.join(',');
this.$nextTick(() => {
if(this.form.enterpriseId) {
const list = deepClone(this.accountList)
this.chargerList = list.filter((item) => {
return this.form.enterpriseId.includes(item.enterpriseId);
});
if (this.form.inspectUserIds) {
this.form.inspectUserIds = "";
this.inspectUserName = "";
}
} else {
this.chargerList = [];
this.form.inspectUserIds = "";
this.inspectUserName = "";
}
})
},
//
handleChangeCharger(e,values,labels) {
this.form.inspectUserIds = values.join(',');
},
//
handleChangeAccount(e,values,labels) {
this.form.noticeUserIds = values.join(',');
},
//
handleChangeFrequency(e) {
console.info(e,'eee')
this.form.frequencyType = e.detail.value + 1;
},
handleInspectPoint(e, data) {
let item = this.inspectPointList[e.detail.value]
data.checkingPointId = item.id;
data.checkingPointName = item.checkingPointName
console.info(e, '----', data)
},
addFormInput() {
this.dyFormData.push({
sort: null,
checkingPointId: null,
checkingPointName: null
})
},
delFormInput(i) {
this.dyFormData.splice(i, 1);
},
startTimeChange(e) {
console.info(e, 'ee')
this.form.startTime = e.detail.value
},
endTimeChange(e) {
this.form.endTime = e.detail.value
},
save() {
const res = this.verify();
if(!res) return;
//
const params = { ...this.form };
params.projectSn = this.projectSn;
params.createUserId = this.userInfo.userId;
params.createUserName = this.userInfo.account;
let newDyForm = this.deepClone(this.dyFormData);
newDyForm.forEach(item => {
item.isRequired = item.isRequired == "1" ? true : false
})
params.template = JSON.stringify(newDyForm);
let apiUrl = 'xmgl/xzCheckingRoute/add';
let msg = "添加成功"
//
if(this.editId) {
apiUrl = "xmgl/xzCheckingRoute/edit"
msg = "保存成功";
}
this.sendRequest({
url: apiUrl,
method: 'post',
data: params,
success: res => {
console.info(res,'res')
if (res.code == 200) {
uni.showToast({
title: msg
})
setTimeout(() => {
uni.redirectTo({
url: '/pages/projectEnd/InspectionRoute/inspectionPlan'
})
}, 1200)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}
})
},
//
deepClone (obj) {
if([null, undefined, NaN, false].includes(obj)) return obj;
if(typeof obj !== "object" && typeof obj !== 'function') {
return obj;
}
var o = Object.prototype.toString.call(obj) === '[object Array]' ? [] : {};
for(let i in obj) {
if(obj.hasOwnProperty(i)){
o[i] = typeof obj[i] === "object" ? this.deepClone(obj[i]) : obj[i];
}
}
return o;
},
verify() {
if(!this.form.routeName) {
uni.showToast({
title: '请输入路线名称',
icon: 'none'
})
return false
}
if(!this.form.enterpriseId) {
uni.showToast({
title: '请选择分包单位',
icon: 'none'
})
return false
}
if(!this.form.inspectUserIds) {
uni.showToast({
title: '请选择巡检人员',
icon: 'none'
})
return false
}
if(!this.form.noticeUserIds) {
uni.showToast({
title: '请选择通知人员',
icon: 'none'
})
return false
}
if(!this.form.startTime || !this.form.endTime) {
uni.showToast({
title: '请输入计划检查时间',
icon: 'none'
})
return false
}
if(!this.dyFormData.length) {
uni.showToast({
title: '请添加巡检路线',
icon: 'none'
})
return false
}
const bool = this.dyFormData.some(item => {
if(!item.sort || !item.checkingPointId) {
return true
}
})
if(bool) {
uni.showToast({
title: '请输入巡检内容',
icon: 'none'
})
return false
}
return true
}
}
}
</script>
<style lang="less">
.fixedheader{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
.headerName{
z-index: 1;
}
}
.flex {
display: flex;
align-items: center;
}
.flex2 {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex3 {
display: flex;
}
.content {
width: 100%;
box-sizing: border-box;
padding: 20px 30rpx;
}
.type {
font-size: 30rpx;
line-height: 40px;
margin-bottom: 8px;
/* border-bottom: 1px solid rgba(194, 194, 194, 0.2); */
}
.type .name {
margin-right: 6px;
width: 185rpx;
text-align: left;
white-space: nowrap;
&.large {
width: 300rpx;
}
&.large-2 {
width: 240rpx;
}
}
.uni-input {
line-height: 32px;
}
.textarea {
width: calc(79% - 32px);
border-radius: 5px;
border: 1px solid rgba(42, 43, 91, 0.3);
padding: 8px 15px;
box-sizing: border-box;
height: 50px;
}
.inpuStyle {
// width: calc(80% - 35px);
flex: 1;
border-radius: 5px;
// border: 1px solid rgba(42, 43, 91, 0.3);
// padding: 8px 15px;
box-sizing: border-box;
height: 35px;
color: #000;
}
.areaStyle {
width: calc(80% - 35px);
color: #000;
line-height: 35rpx;
height: 35px;
display: flex;
align-items: center;
}
.dy_form {
display: flex;
flex-direction: column;
width: 100%;
.dy_head {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
.head_left {
display: flex;
align-items: center;
.ic {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
}
.title {
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
font-weight: 600;
}
}
.add_btn {
margin: 0;
}
}
.dy_content {
display: flex;
flex-direction: column;
margin-bottom: 40rpx;
.c_colum {
display: flex;
// justify-content: space-between;
justify-content: flex-end;
align-items: center;
// border-bottom: solid 1px rgba(187, 187, 187, 0.14);
.text {
color: rgba(16, 16, 16, 1);
font-size: 32rpx;
}
.del_btn {
margin: 0;
}
}
.c_body {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 32rpx;
.c_input {
flex: 1;
border: 2rpx solid rgba(220, 224, 231, 0.4);
border-radius: 6rpx;
height: 72rpx;
padding: 0 12rpx;
margin-right: 24rpx;
&:last-child {
margin-right: 0;
}
}
.c_picker {
width: 180rpx;
margin-right: 24rpx;
.c_picker_value {
flex-shrink: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
}
.save-btn {
width: 100%;
position: fixed;
bottom: 0;
}
</style>

View File

@ -139,7 +139,7 @@
}]
}
},
async onLoad(option) {
onLoad(option) {
let that = this;
uni.$on('locationSuccessEvent',function(data){
console.log('监听到事件来自 locationSuccessEvent', data);
@ -156,11 +156,11 @@
//
if(option.id) {
this.pageTitle = "编辑巡检点"
this.editId = option.id;
await this.getPointAreaFn();
await this.getData()
this.init();
} else {
await this.getPointAreaFn();
this.getPointAreaFn();
this.mapGetLocation();
}
},
@ -176,9 +176,14 @@
console.log('this.mobileTopHeight',this.mobileTopHeight)
},
methods: {
//
async init() {
await this.getPointAreaFn();
await this.getData()
},
//
getData() {
new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
console.info("getData", new Date().getTime())
this.sendRequest({
url: 'xmgl/checkingPoint/queryById',
@ -223,7 +228,7 @@
},
//
getPointAreaFn() {
new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
console.info("getPointAreaFn", new Date().getTime())
let requestData = {
projectSn: this.projectSn,

View File

@ -12,19 +12,19 @@
</view>
<view class="problemData">
<view class="dataBox1 dataStyle">
<view class="num">{{totalNum}}</view>
<view class="num">{{taskStatus.notStart}}</view>
<view class="text">未开始</view>
</view>
<view class="dataBox2 dataStyle">
<view class="num">{{totalNum}}</view>
<view class="num">{{taskStatus.run}}</view>
<view class="text">进行中</view>
</view>
<view class="dataBox4 dataStyle">
<view class="num">{{totalNum}}</view>
<view class="text"></view>
<view class="num">{{taskStatus.overdue}}</view>
<view class="text"></view>
</view>
<view class="dataBox3 dataStyle">
<view class="num">{{totalNum}}</view>
<view class="num">{{taskStatus.complete}}</view>
<view class="text">已巡检</view>
</view>
</view>
@ -67,10 +67,17 @@
total: 0,
page: 1,
getGoId: -1,
taskStatus: {
complete: 0,
notStart: 0,
overdue: 0,
run: 0
}
}
},
onLoad(option) {
this.getGoId = option.id;
this.getData()
},
mounted() {
this.getTime();
@ -99,6 +106,18 @@
this.nowTime = `${year}-${mounth}-${day} ${hours}:${minutes}:${seconds}`
}, 1000)
},
getData() {
this.sendRequest({
url: 'xmgl/xzCheckingRouteTask/countMyTaskInspectStatus',
method: 'post',
success: res => {
console.info(res,'res')
if (res.code == 200) {
this.taskStatus = res.result;
}
}
})
},
jumpPage(page) {
console.log(page, 'page');
uni.navigateTo({

View File

@ -106,34 +106,6 @@
</view>
</view>
<!-- <view class="titleItem">查询类型</view>
<view class="screenItem">
<view class="screenText" v-for="(item,index) in searchTypeList" :key="index"
@click="searchItem(item,index)" :class="{active:chekItm==index}">
{{item.name}}
</view>
</view>
<view class="titleItem">问题等级</view>
<view class="screenItem">
<view class="screenText" v-for="(item,index) in issueLevelList" :key="index"
@click="searchItem(item,index)" :class="{active:chekItm2==index}">
{{item.name}}
</view>
</view>
<view class="titleItem">状态</view>
<view class="screenItem">
<view class="screenText" v-for="(item,index) in statusList" :key="index"
@click="searchItem(item,index)" :class="{active:chekItm3==index}">
{{item.name}}
</view>
</view>
<view class="titleItem">紧急程度</view>
<view class="screenItem">
<view class="screenText" v-for="(item,index) in urgencyList" :key="index"
@click="searchItem(item,index)" :class="{active:chekItm4==index}">
{{item.name}}
</view>
</view> -->
<view class="titleItem">巡检人员</view>
<view class="screenItem">
<view v-for="(item, index) in displayedItems1" :key="index" class="screenText"
@ -182,46 +154,12 @@
收起
</view>
</view>
<!-- <view class="titleItem">检查人</view>
<view class="screenItem">
<view v-for="(item, index) in displayedItems4" :key="index" class="screenText"
@click="searchItem(item,index)" :class="{active:chekItm8==index}">
{{ item.name }}
</view>
<view v-if="!isExpanded4" @click="expandItems(4)" class="screenText">
查看更多
<image src="/static/icon-down-ccc.png"
style="width: 10px;height: 5px;margin-left: 5px;">
</image>
</view>
<view v-else @click="collapseItems(4)" class="screenTextClose">
收起
</view>
</view>
<view class="titleItem">检查区域 <span class="regionText">
<picker @click="$refs.locationTree._show()" :disabled="true">
<view v-if="checkPointName==''" style="margin-left: 140px;color: gray;">
请选择
</view>
<view v-else>
<view style="width: 98%;text-align: center" class="ellipsis">{{checkPointName}}
</view>
</view>
</picker>
</span></span>
<image src="/static/icon-right-ccc.png"
style="width: 5px;height: 10px;display: inline-block;margin-bottom: 4px;"></image>
</view> -->
<view class="line"></view>
<view class="footerBtn">
<view class="foterLeft" @click="resettingBtn">
重置
</view>
<!-- <view class="foterRight" @click="screenShow=false">
完成
</view> -->
<view class="foterRight" @click="closeRed">
查看{{ listNum }}条记录
</view>
@ -244,6 +182,7 @@
},
data() {
return {
popupShow: false,
mobileTopHeight: 0,
listNum: 0,
listData: [],
@ -1033,6 +972,11 @@
this.listData = []
this.getListData(false)
},
handleAdd() {
uni.navigateTo({
url: "/pages/projectEnd/InspectionRoute/editInspectionPlan"
})
}
},
}
</script>

View File

@ -0,0 +1,400 @@
<template>
<view>
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
{{pageTitle}}
</view>
</headers>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 50 + 'px'}">
<view class="type flex">
<view class="name"><text class="star">*</text>巡检点名称</view>
<!-- <input class="inpuStyle" v-model="form.checkingPointName" placeholder="请输入"></input> -->
<view class="value">{{form.checkingPointName}}</view>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>巡检点位置</view>
<!-- <input class="inpuStyle" v-model="form.position" placeholder="请输入"></input> -->
<view class="value">{{form.position}}</view>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>所属区域</view>
<!-- <picker mode="selector" :range="pointAreaList" range-key="regionName" @change="handleChangeRegion" filterable>
<view class="picker">
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!form.qualityRegionId">
请选择
</view>
<view class="" v-else>
{{areaData.regionName}}
</view>
</view>
</picker> -->
<view class="value">{{areaData.regionName}}</view>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>责任企业</view>
<!-- <g-picker style="flex: 1" v-model="enterpriseName" :columns="enterpriseList" :filter="{label: 'enterpriseName', value: 'id'}" input-align="left" @confirm="handleChangeEnterprise"></g-picker> -->
<view class="value">{{enterpriseName}}</view>
</view>
<view class="type flex">
<view class="name"><text class="star">*</text>责任人</view>
<!-- <g-picker style="flex: 1" v-model="inspectUserName" :columns="chargerList" :filter="{label: 'realName', value: 'userId'}" input-align="left" @confirm="handleChangeCharger"></g-picker> -->
<view class="value">{{inspectUserName}}</view>
</view>
<view class="type flex">
<view class="name large"><text class="star">*</text>最低巡检时长</view>
<!-- <input v-model="form.minInspectTime" type="number" placeholder="请输入" /> -->
<view class="value">{{form.minInspectTime}}分钟</view>
</view>
<view class="type flex">
<view class="name">巡检点定位</view>
<view v-if="form.addr" class="areaStyle">
{{form.addr}}
</view>
</view>
<view class="type flex">
<view class="name large-2"><text class="star">*</text>自定义范围</view>
<!-- <picker mode="selector" :range="standOptions" @change="handleChangeStandArea" filterable>
<view class="picker">
<view class="" style="color: #c0c4cc; font-size: 28rpx;" v-if="!form.standArea">
请选择
</view>
<view class="" v-else>
{{form.standArea}}
</view>
</view>
</picker> -->
<view class="value">{{form.standArea}}</view>
</view>
<view class="dy_form">
<view class="dy_head">
<view class="head_left">
<image class="ic" src="@/static/icon/form.svg"></image>
<text class="title">动态表单</text>
</view>
</view>
<view class="dy_content" v-for="(item, index) in dyFormData" :key="index">
<view class="c_colum">
<!-- <input v-model="item.title" /> -->
<view>{{item.title}}</view>
</view>
<view class="c_body">
<input disabled="true" class="c_input" v-model="item.value" :placeholder="`请输入${item.title}`" />
<radio-group>
<radio disabled="true" style="margin-right: 12rpx;" value="1" :checked="item.isRequired == '1'">必填</radio>
<radio disabled="true" value="2" :checked="item.isRequired == '2'">非必填</radio>
</radio-group>
</view>
</view>
</view>
</view>
<button style="visibility: hidden;">占位用</button>
<button class="save-btn" type="primary" @click="save">保存</button>
</view>
</template>
<script>
import gPicker from "@/components/g-picker/g-picker.vue"
export default {
components: {
gPicker
},
data() {
return {
editId: "",
standOptions: [30, 50, 100, 200, 300],
mobileTopHeight: 0,
projectSn: '',
userInfo: {},
pointAreaList: [],
areaData: {},
enterpriseData: {},
chargerList: [],
enterpriseList: [],
pageTitle: "巡检点详情",
checkEnterpriseName: "",
enterpriseName: "",
inspectUserName: "",
form: {
checkingPointName: "",
position: "",
qualityRegionId: "", // ID
enterpriseId: "", //
inspectUserIds: "", //
noticeUserIds: "", //
startTime: "",
endTime: "",
frequencyType: 1,
frequencyNum: 1,
minInspectTime: undefined,
standArea: 100, //
latitude: "", //
longitude: "", //
addr: "", //
},
dyFormData: [{
title: "表单标题",
name: "",
isRequired: "1",
value: "",
}]
}
},
onLoad(option) {
let that = this;
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.editId = ""
//
if(option.id) {
this.editId = option.id;
this.init();
}
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo',res)
console.log(res)
}
})
console.log('this.mobileTopHeight',this.mobileTopHeight)
},
methods: {
//
async init() {
await this.getPointAreaFn();
await this.getData()
},
//
getData() {
return new Promise((resolve, reject) => {
console.info("getData", new Date().getTime())
this.sendRequest({
url: 'xmgl/checkingPoint/queryById',
method: 'get',
data: {
id: this.editId
},
success: (res) => {
if(res.code === 200) {
this.form = res.result
//
const obj = this.pointAreaList.find(item => item.id === this.form.qualityRegionId)
this.areaData = obj || {}
//
this.enterpriseList = this.areaData.enterpriseInfos || [];
const eObj = this.enterpriseList.filter(item => this.form.enterpriseId.includes(item.id))
this.enterpriseName = eObj.map(item => item.enterpriseName).join(',')
//
this.chargerList = this.areaData.systemUsers.filter((item) => {
return this.form.enterpriseId.includes(item.enterpriseId);
}) || [];
this.inspectUserName = this.chargerList.filter(item => this.form.inspectUserIds.includes(item.userId)).map(item => item.realName).join(',')
let tempArr = JSON.parse(this.form.template) || []
tempArr.forEach(item => item.isRequired = item.isRequired ? "1" : "2")
//
this.dyFormData = tempArr
console.info(eObj, 'eObj', this.dyFormData, tempArr)
resolve(res)
}
console.log(res, 'xiangqing');
},
fail: (err) => {
reject(err)
}
})
})
},
//
getPointAreaFn() {
return new Promise((resolve, reject) => {
console.info("getPointAreaFn", new Date().getTime())
let requestData = {
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/qualityRegion/notTreeList',
method: 'post',
data: requestData,
success: (res) => {
console.log(res);
this.pointAreaList = res.result;
console.info("getPointAreaFn处理结束", new Date().getTime())
resolve(res)
},
fail: (err) => {
reject(err)
}
})
})
}
}
}
</script>
<style lang="less">
.fixedheader{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
.headerName{
z-index: 1;
}
}
.flex {
display: flex;
align-items: center;
}
.flex2 {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex3 {
display: flex;
}
.content {
width: 100%;
box-sizing: border-box;
padding: 20px 30rpx;
}
.type {
font-size: 30rpx;
line-height: 40px;
margin-bottom: 8px;
/* border-bottom: 1px solid rgba(194, 194, 194, 0.2); */
}
.type .name {
margin-right: 6px;
width: 185rpx;
text-align: left;
white-space: nowrap;
&.large {
width: 300rpx;
}
&.large-2 {
width: 240rpx;
}
}
.type .value {
text-align: right;
color: #000;
flex: 1;
}
.uni-input {
line-height: 32px;
}
.textarea {
width: calc(79% - 32px);
border-radius: 5px;
border: 1px solid rgba(42, 43, 91, 0.3);
padding: 8px 15px;
box-sizing: border-box;
height: 50px;
}
.inpuStyle {
width: calc(80% - 35px);
border-radius: 5px;
// border: 1px solid rgba(42, 43, 91, 0.3);
padding: 8px 15px;
box-sizing: border-box;
height: 35px;
color: #000;
}
.areaStyle {
// width: calc(80% - 35px);
flex: 1;
color: #000;
line-height: 35rpx;
height: 35px;
display: flex;
align-items: center;
text-align: right;
}
.dy_form {
display: flex;
flex-direction: column;
width: 100%;
.dy_head {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
.head_left {
display: flex;
align-items: center;
.ic {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
}
.title {
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
font-weight: 600;
}
}
.add_btn {
margin: 0;
}
}
.dy_content {
display: flex;
flex-direction: column;
margin-bottom: 40rpx;
.c_colum {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: solid 1px rgba(187, 187, 187, 0.14);
padding: 0 0 16rpx 16rpx;
.text {
color: rgba(16, 16, 16, 1);
font-size: 32rpx;
}
.del_btn {
margin: 0;
}
}
.c_body {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 32rpx;
.c_input {
flex: 1;
border: 2rpx solid rgba(220, 224, 231, 0.4);
border-radius: 6rpx;
height: 72rpx;
padding: 0 12rpx;
margin-right: 52rpx;
}
}
}
}
.save-btn {
width: 100%;
position: fixed;
bottom: 0;
}
</style>

View File

@ -53,8 +53,8 @@
<view class="d_text" @click="saveImage(url_config+'image/'+item.qrCode)">下载二维码</view>
</view>
<view class="btn_wrap">
<view class="common_btn primary" @click="handleEdit(item)"><image class="b_ic" src="@/static/icon/edit.svg"></image></view>
<view class="common_btn danger" @click="handleDel(item)"><image class="b_ic" src="@/static/icon/delete.svg"></image></view>
<view class="common_btn primary" @click.stop="handleEdit(item)"><image class="b_ic" src="@/static/icon/edit.svg"></image></view>
<view class="common_btn danger" @click.stop="handleDel(item)"><image class="b_ic" src="@/static/icon/delete.svg"></image></view>
</view>
</view>
</view>
@ -193,9 +193,9 @@
}
})
},
goDetails(obj) {
goDetails(data) {
uni.navigateTo({
url: './details?id=' + obj.id + '&type=' + obj.status
url: `/pages/projectEnd/InspectionRoute/inspectionPointDetail?id=${data.id}`
})
},
handleAdd() {