qa-prevention-gwj-first-app/pages/application/high-risk-work/electricity/apply/detail.vue

930 lines
31 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view >
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" >
<block slot="backText">返回</block>
<block slot="content">临时用电安全作业申请</block>
</cu-custom>
<scroll-view scroll-y="false" >
<view class="form">
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">编号</view>
<input name="input" ref="CHECK_NO" :disabled="true" v-model="pd.CHECK_NO" placeholder="请输入编号"></input>
</view>
<view class="cu-form-group">
<view class="title">用电单位:</view>
<input name="input" ref="ELECTRICITY_UNIT" :disabled="forbidEdit" v-model="pd.ELECTRICITY_UNIT" placeholder="请输入用电单位"></input>
</view>
<view class="cu-form-group">
<view class="title">用电原因:</view>
<input name="input" ref="WORK_CONTENT" :disabled="forbidEdit" v-model="pd.WORK_CONTENT" placeholder="请输入用电原因"></input>
</view>
<view class="cu-form-group">
<view class="title">用电地点:</view>
<input name="input" ref="WORK_PLACE" :disabled="forbidEdit" v-model="pd.WORK_PLACE" placeholder="请输入用电地点"></input>
</view>
<view class="cu-form-group">
<view class="title">地点坐标:</view>
<button class="cu-btn bg-green shadow" v-if="!forbidEdit" @tap="showMapModal">定位</button>
</view>
<view class="cu-form-group" v-if="pd.WORK_LONGITUDE">
<view class="title">经度:</view>
<view>{{pd.WORK_LONGITUDE}}</view>
</view>
<view class="cu-form-group" v-if="pd.WORK_LATITUDE">
<view class="title">纬度:</view>
<view>{{pd.WORK_LATITUDE}}</view>
</view>
<view class="cu-form-group">
<view class="title">用电设备及功率:</view>
<input name="input" ref="EQUIPMENT_POWER" :disabled="forbidEdit" v-model="pd.EQUIPMENT_POWER" placeholder="请输入用电设备及功率"></input>
</view>
<view class="cu-form-group ">
<view class="title">用电开始时间</view>
<ruiDatePicker v-if="!forbidEdit"
:start="dateBegin !== '' ? dateBegin : todayDate"
:end="pd.WORK_END_DATE !== '' ? pd.WORK_END_DATE : '2100-12-31'"
fields="minute"
:value="pd.WORK_START_DATE?pd.WORK_START_DATE:''"
@change="changeStartDate"
></ruiDatePicker>
<view v-else>{{pd.WORK_START_DATE}}</view>
</view>
<view class="cu-form-group">
<view class="title">用电结束时间</view>
<ruiDatePicker v-if="!forbidEdit"
:start="pd.WORK_START_DATE !== '' ? pd.WORK_START_DATE : todayDate"
:end="dateEnd !== '' ? dateEnd : '2100-12-31'"
fields="minute"
:value="pd.WORK_END_DATE?pd.WORK_END_DATE:''"
@change="changeEndDate"
></ruiDatePicker>
<view v-else>{{pd.WORK_END_DATE}}</view>
</view>
<view class="cu-form-group" @click="workOperatorSelectShow" v-if="!forbidEdit">
<view class="title">作业人员:</view>
<text class="right_icon" v-show="pd.WORK_OPERATOR_NAME.length !== 0">
<text v-for="item in pd.WORK_OPERATOR_NAME">{{item}}、</text>
</text>
<text class="right_icon" v-show="pd.WORK_OPERATOR_NAME.length === 0">请选择</text>
</view>
<!--<view class="cu-form-group" v-else>
<view class="title">作业人员:</view>
<input name="input" ref="WORK_OPERATOR_NAME" :disabled="forbidEdit" v-model="pd.WORK_OPERATOR_NAME"></input>
</view>-->
<view class="cu-form-group" v-if="pd.WORK_OPERATOR_NAME.length !== 0">
<uni-table border stripe emptyText="暂无更多数据" style="flex:1;margin: 20upx 0">
<uni-tr>
<uni-td>姓名</uni-td>
<uni-td>作业证号</uni-td>
</uni-tr>
<uni-tr v-for="(item,index) in pd.WORK_OPERATOR_NAME" :key="item">
<uni-td>{{ pd.WORK_OPERATOR_NAME[index] }}</uni-td>
<uni-td>{{ pd.WORK_OPERATOR_NUMBER[index] }}</uni-td>
</uni-tr>
</uni-table>
</view>
<view class="cu-form-group">
<view class="title">计量电费确认:</view>
<picker @change="meteringBillChange" :value="metering_bill_index" :range="meteringBillList" range-key="NAME">
<view class="picker">
{{ pd.METERING_BILL_NAME ? pd.METERING_BILL_NAME : '请选择' }}
</view>
</picker>
</view>
<view class="cu-form-group" v-if="pd.APPLY_STATUS && pd.APPLY_STATUS > 1">
<view class="title">电源接入点:</view>
<input name="input" ref="ACCESS_POINT" :disabled="forbidEdit" v-model="pd.ACCESS_POINT" placeholder="请输入电源接入点"></input>
</view>
<view class="cu-form-group" v-if="pd.APPLY_STATUS && pd.APPLY_STATUS > 1">
<view class="title">危险性分析:</view>
<input name="input" ref="RISK_ANALYSIS" :disabled="forbidEdit" v-model="pd.RISK_ANALYSIS" placeholder="请输入危险性分析"></input>
</view>
</view>
<view class="wui-form-list" style="padding-top: 20upx;">
<view class="wui-title" style="margin-left: 20upx;">
<text class="text-semi">安全防护措施</text>
</view>
<view class="wui-table" style="padding: 0 20upx;">
<uni-table name='measuresList' border stripe emptyText="暂无更多数据" >
<!-- 表头行 -->
<uni-tr>
<uni-th align="center" style="font-weight: bold;">主要安全措施</uni-th>
<uni-th align="center" style="font-weight: bold;width: 100px">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in measuresList" :key="item.BUS_ELECTRICITY_MEASURES_ID">
<uni-td>{{item.PROTECTIVE_MEASURES}}</uni-td>
<uni-td align="center">
<radio-group class="wui-radio-group wui-radio-col">
<view class="group" style="margin-bottom: 10px">
<radio class='radio' :disabled="forbidEdit" value="-1" :checked="item.STATUS=='-1'" @click="changeRadio(index,'-1')">
<text class="wui-pl10">不合格</text>
</radio>
</view>
<view class="group" style="margin-bottom: 10px">
<radio class='radio' :disabled="forbidEdit" value="1" :checked="item.STATUS=='1'" @click="changeRadio(index,'1')">
<text class="wui-pl10">合&nbsp;&nbsp;&nbsp;&nbsp;格</text>
</radio>
</view>
<view class="group">
<radio class='radio' :disabled="forbidEdit" value="2" :checked="item.STATUS=='2'" @click="changeRadio(index,'2')">
<text class="wui-pl10">不涉及</text>
</radio>
</view>
</radio-group>
</uni-td>
</uni-tr>
</uni-table>
</view>
<view class="cu-form-textarea" style="border: none;">
<view class="cu-form-title">其他措施:</view>
<textarea maxlength="255" v-model="pd.OTHER_PROTECTIVE_MEASURES"></textarea>
</view>
<!-- <view class="wui-table" style="padding: 0 20upx;">
<uni-table name='measuresList' border stripe emptyText="暂无更多数据" >
<uni-tr>
<uni-th align="center" style="font-weight: bold;">主要安全措施</uni-th>
<uni-th align="center" style="font-weight: bold;width: 100px">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in measuresList" :key="item.BUS_ELECTRICITY_MEASURES_ID">
<uni-td>{{item.PROTECTIVE_MEASURES}}</uni-td>
<uni-td align="center">
<radio-group class="wui-radio-group">
<view class="group" v-if="item.STATUS=='-1'">
<radio class='radio' value="-1" checked>
<text class="wui-pl10">不合格</text></radio>
</view>
<view class="group" v-if="item.STATUS=='1'">
<radio class='radio' value="1" checked>
<text class="wui-pl10">合格</text></radio>
</view>
<view class="group" v-if="item.STATUS=='2'">
<radio class='radio' value="2" checked>
<text class="wui-pl10">不涉及</text></radio>
</view>
</radio-group>
</uni-td>
</uni-tr>
</uni-table>
</view> -->
</view>
<view class="cu-form-group" v-if="!forbidEdit">
<view class="title">运维保障部门</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="optDeptTree('assure')">{{pd.ASSURE_DEPARTMENT_NAME?pd.ASSURE_DEPARTMENT_NAME:'请选择'}}</view>
</view>
<tki-tree ref="tkiTree_assure"
:selectParent=true
:range="treeNode"
rangeKey="name"
@confirm="assuretreeConfirm"
@cancel="cancelDeptTree"></tki-tree>
</view>
<view class="cu-form-group" v-else>
<view class="title">运维保障部门:</view>
<input name="input" ref="ASSURE_DEPARTMENT_NAME" :disabled="forbidEdit" v-model="pd.ASSURE_DEPARTMENT_NAME" placeholder="请输入运维保障部门"></input>
</view>
<view class="cu-form-group" v-if="!forbidEdit">
<view class="title">运维保障人</view>
<picker @change="PickerAssure" :value="assureindex" :range="assureUserList" range-key="NAME" :disabled="assureUserList.length == 0" @click="isBlankList('assure')">
<view class="picker">
{{pd.ASSURE_USER_NAME?pd.ASSURE_USER_NAME:'请选择'}}
</view>
</picker>
</view>
<view class="cu-form-group" v-else>
<view class="title">运维保障人:</view>
<input name="input" ref="ASSURE_USER_NAME" :disabled="forbidEdit" v-model="pd.ASSURE_USER_NAME" placeholder="请输入运维保障部门"></input>
</view>
<view class="cu-form-group" v-if="!forbidEdit">
<view class="title">审批人部门</view>
<view class="picker-tree-box">
<view class="picker-tree" @tap="optDeptTree('approve')">{{pd.APPROVE_DEPARTMENT_NAME?pd.APPROVE_DEPARTMENT_NAME:'请选择'}}</view>
</view>
<tki-tree ref="tkiTree_approve"
:selectParent=true
:range="treeNode"
rangeKey="name"
@confirm="approvetreeConfirm"
@cancel="cancelDeptTree"></tki-tree>
</view>
<view class="cu-form-group" v-else>
<view class="title">审批人部门:</view>
<input name="input" ref="APPROVE_DEPARTMENT_NAME" :disabled="forbidEdit" v-model="pd.APPROVE_DEPARTMENT_NAME" placeholder="请输入审批人部门"></input>
</view>
<view class="cu-form-group" v-if="!forbidEdit">
<view class="title">审批人</view>
<picker @change="PickerApprove" :value="approveindex" :range="approveUserList" range-key="NAME" :disabled="approveUserList.length == 0" @click="isBlankList('approve')">
<view class="picker">
{{pd.APPROVE_USER_NAME?pd.APPROVE_USER_NAME:'请选择'}}
</view>
</picker>
</view>
<view class="cu-form-group" v-else>
<view class="title">审批人:</view>
<input name="input" ref="APPROVE_USER_NAME" :disabled="forbidEdit" v-model="pd.APPROVE_USER_NAME" placeholder="请输入审批人"></input>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">安全措施确认人签字</view>
<button v-if="!forbidEdit" class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
</view>
<view class="wui-sign-box" v-show="(imgList && imgList.length > 0) || (initImgList && initImgList.length > 0)">
<view class="sign-title">
签字照片:
</view>
<view class="wui-sign-cotent" v-if="imgList && imgList.length > 0">
<view class="sign-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" data-type="0" :data-url="imgList[index].filePath">
<image :src="imgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initImgList && initImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initImgList[index].filePath">
<image :src="initImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
<writing-board @confirm="subCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
<view class="wui-form-list">
<view class="wui-sign">
<view class="title">作业单位</view>
<button v-if="!forbidEdit" class="cu-btn bg-green shadow" @tap="showModal" data-target="workModal">手写签字</button>
</view>
<view class="wui-sign-box" v-show="(workImgList && workImgList.length > 0) || (initWorkImgList && initWorkImgList.length > 0)">
<view class="sign-title">
签字照片:
</view>
<view class="wui-sign-cotent" v-if="workImgList && workImgList.length > 0">
<view class="sign-img" v-for="(item,index) in workImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="workImgList[index].filePath">
<image :src="workImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
<view class="wui-sign-cotent" v-else-if="initWorkImgList && initWorkImgList.length > 0">
<view class="sign-img" v-for="(item,index) in initWorkImgList" :key="index" @tap="ViewImage" data-type="0" :data-url="initWorkImgList[index].filePath">
<image :src="initWorkImgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='workModal'?'show':''">
<writing-board @confirm="workSubCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button v-if="!forbidEdit" class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'1')">提交</button>
<!-- <button v-if="!forbidEdit" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit,'0')">暂存</button>-->
<button v-if="forbidEdit" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goback)">返回</button>
</view>
<view class="padding flex flex-direction"></view>
<uni-popup ref="cityMore" type="bottom" :maskClick="false">
<more-select
title="选择作业人员"
:cityData="workOperatorDepartmentList"
@closeCity="workOperatorSelectHide('close')"
@queryCity="workOperatorSelectHide('query')"
@switchCity="switchCity"
@chooseCity="chooseCity"
:cityIndex="cityIndex"
:cityIdArr="pd.WORK_OPERATOR_ID"
:maxCount="99"
></more-select>
</uni-popup>
</scroll-view>
</view>
</template>
<script>
import {
basePath,corpinfoId,deptId,loginUser,formatDate,loginSession,baseImgPath
} from '@/common/tool.js'
import tkiTree from '@/components/select-tree/select-tree.vue'
import writingBoard from '@/components/writing-board/writing-board.vue'
import gcoord from '@/common/gcoord.js'
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue'
import moreSelect from '@/components/more-select/more-select.vue'
import uniPopup from '@/components/more-select/uni-popup/uni-popup.vue'
export default {
components: {
tkiTree,ruiDatePicker,writingBoard, moreSelect, uniPopup
},
data() {
return {
baseImgPath:baseImgPath,
isUps:false,
forbidEdit:true,// 禁止修改
msg:'add',
noClick:true,
treeNode:[],//部门下拉数据
pd:{
WORK_LONGITUDE: '',
WORK_LATITUDE: '',
// WORK_LONGITUDE: '119.65772151947023',
// WORK_LATITUDE: '39.93767832107088',
WORK_START_DATE: '',
WORK_END_DATE: '',
WORK_OPERATOR_ID: [],
WORK_OPERATOR_NAME: [],
WORK_OPERATOR_NUMBER: [],
METERING_BILL: '',
METERING_BILL_NAME: '',
},// 数据
measuresList:[],
rules:[
{name:'CHECK_NO',message:'请输入编号'},
{name:'ELECTRICITY_UNIT',message:'请输入用电单位'},
{name:'WORK_CONTENT',message:'请输入用电原因'},
{name:'WORK_PLACE',message:'请输入用电地点'},
// {name:'WORK_LONGITUDE',message:'请选择地点坐标'},
// {name:'WORK_LATITUDE',message:'请选择地点坐标'},
{name:'WORK_OPERATOR_ID',message:'请输入作业人员'},
{name:'METERING_BILL',message:'请选择计量电费确认'},
{name:'EQUIPMENT_POWER',message:'请输入用电设备及功率'},
{name:'WORK_START_DATE',message:'请选择工作开始时间'},
{name:'WORK_END_DATE',message:'请选择工作结束时间'},
{name:'ASSURE_USER_ID',message:'请选择运维保障人'},
{name:'APPROVE_USER_ID',message:'请选择审批人'}
],
todayDate:'',
dateBegin: '',
dateEnd: '',
modalName:null,
imgList:[],// 上传时使用照片
workImgList:[],// 上传时使用照片
assureUserList:[],
assureindex:-1,
approveUserList:[],
approveindex:-1,
initImgList:[], // 初始化安全措施照片
initWorkImgList:[], // 初始化作业单位,
meteringBillList: [{ NAME: '是', ID: '1', }, { NAME: '否', ID: '0', }],
metering_bill_index: -1,
workOperatorDepartmentList: [],
cityIndex: 0
}
},
watch: {
'pd.WORK_START_DATE': {
handler(val) {
this.dateEnd = this.addDays(val, 15)
}
},
'pd.WORK_END_DATE': {
handler(val) {
this.dateBegin = this.addDays(val, -15)
}
}
},
onLoad(event){
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.pd.ELECTRICITY_ID = event.ELECTRICITY_ID;
if(this.pd.ELECTRICITY_ID){
this.msg="edit";
this.getData();
}else {
// 主要安全措施
this.getMeasures()
// 初始化作业负责人
this.pd.APPLY_DEPARTMENT_ID = loginUser.DEPARTMENT_ID;
this.pd.APPLY_DEPARTMENT_NAME = loginUser.DEPARTMENT_NAME;
this.pd.APPLY_USER_ID = loginUser.USER_ID;
this.pd.APPLY_USER_NAME = loginUser.NAME;
// 安全措施确认人
this.pd.CONFIRM_DEPARTMENT_ID = loginUser.DEPARTMENT_ID;
this.pd.CONFIRM_DEPARTMENT_NAME = loginUser.DEPARTMENT_NAME;
this.pd.CONFIRM_USER_ID = loginUser.USER_ID;
this.pd.CONFIRM_USER_NAME = loginUser.NAME;
// 作业人
this.pd.WORK_DEPARTMENT_ID = loginUser.DEPARTMENT_ID;
this.pd.WORK_DEPARTMENT_NAME = loginUser.DEPARTMENT_NAME;
this.pd.WORK_USER_ID = loginUser.USER_ID;
this.pd.WORK_USER_NAME = loginUser.NAME;
this.forbidEdit = false;
this.pd.OTHER_PROTECTIVE_MEASURES = ''
this.pd.WORK_OPERATOR_ID = []
this.pd.WORK_OPERATOR_NAME = []
// this.pd.WORK_LONGITUDE = '119.65772151947023'
// this.pd.WORK_LATITUDE = '39.93767832107088'
this.createWorkNumber()
}
// 初始化现场作业负责人
this.getDept();
loginSession();
},
methods: {
//跳转事件
goToDetail(e) {
uni.navigateTo({
url: '/pages/application/high-risk-work/electricity/electricity-gas/gas-list?ELECTRICITY_ID='+e
});
},
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/electricity/goEdit',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
ELECTRICITY_ID: _this.pd.ELECTRICITY_ID,
},
success: (res) => {
if ("success" === res.data.result) {
uni.hideLoading();
_this.pd = res.data.pd; //参数map
if(_this.pd.APPLY_STATUS != '-1'){
_this.initImgList.push({filePath:baseImgPath + _this.pd.CONFIRM_USER_SIGNER_PATH})
_this.initWorkImgList.push({filePath:baseImgPath + _this.pd.WORK_USER_SIGNER_PATH})
}
if (!_this.pd.WORK_OPERATOR_ID) {
_this.$set(_this.pd, 'WORK_OPERATOR_ID', [])
} else {
_this.pd.WORK_OPERATOR_ID = _this.pd.WORK_OPERATOR_ID.split(',')
}
if (!_this.pd.WORK_OPERATOR_NAME) {
_this.$set(_this.pd, 'WORK_OPERATOR_NAME', [])
} else {
_this.pd.WORK_OPERATOR_NAME = _this.pd.WORK_OPERATOR_NAME.split(',')
}
if (!_this.pd.WORK_OPERATOR_NUMBER) {
_this.$set(_this.pd, 'WORK_OPERATOR_NUMBER', [])
} else {
_this.pd.WORK_OPERATOR_NUMBER = _this.pd.WORK_OPERATOR_NUMBER.split(',')
}
// _this.pd = Object.assign(_this.pd,
// {
// "CONFIRM_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[0],
// "AUDIT_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[1],
// "APPROVE_USER_MEASURES": _this.pd.OTHER_PROTECTIVE_MEASURES.split(";_;")[2]
// })
// _this.pd.OTHER_PROTECTIVE_MEASURES = ''
_this.measuresList = res.data.measuresList
if(_this.pd.APPLY_STATUS < 2){
_this.forbidEdit = false;
}
} else if ("exception" === res.data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
},
fail: (res) => {
uni.hideLoading();
uni.showToast({
title: '错误',
duration: 2000
});
}
});
},
createWorkNumber() {
var _this = this;
uni.request({
url: basePath + '/app/serialnumber/add',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
TYPE: 'YD',
CORPINFO_ID: corpinfoId
},
success: (res) => {
if ("success" === res.data.result) {
this.$set(_this.pd, 'CHECK_NO', res.data.pd.NUMBER) //参数map
}
}
});
},
getMeasures(){
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/electricity/getMeasures',
method: 'POST',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.measuresList = res.data.measuresList
} else if ("exception" == data.result) {
uni.showToast({
title: '错误',
duration: 2000
});
}
}
});
},
changeRadio(i,value){
if(!this.forbidEdit){
this.measuresList[i].STATUS=value
}
},
goSubmit(STATUS){
var _this = this;
let required = true
if(STATUS==1) {
this.rules.map(({name,message}) => {
if (!this.pd[name]) {
uni.showToast({
icon: 'none',
title: message,
duration: 1500
});
required = false
}
})
if (!required) {
return
}
for (let i = 0; i < this.measuresList.length; i++) {
const measures = this.measuresList[i]
if(!measures.STATUS){
uni.showToast({
icon: 'none',
title: '第'+(i+1)+'项未勾选',
duration: 1500
});
return;
}
}
if(this.imgList.length == 0){
uni.showToast({
icon: 'none',
title: '安全措施确认人未进行签字',
duration: 1500
});
return
}
if(this.workImgList.length == 0){
uni.showToast({
icon: 'none',
title: '作业单位负责人未进行签字',
duration: 1500
});
return
}
var startTime = Date.parse(this.pd.WORK_START_DATE + ':00')
var endTime = Date.parse(this.pd.WORK_END_DATE + ':00')
if ((endTime - startTime) > (15 * 24 * 60 * 60 * 1000)) {
uni.showToast({
icon: 'none',
title: '作业申请用时不能超过15天',
duration: 1500
});
return false
}
}
uni.showLoading({
title: '请稍候'
})
let imgArr = [];
let img = new Object();
img.name = 'img';
img.uri = this.imgList[0].filePath;
imgArr.push(img);
let workImg = new Object();
workImg.name = 'workImg';
workImg.uri = this.workImgList[0].filePath;
imgArr.push(workImg);
const formData={}
Object.keys(this.pd).map(key => {
formData[key]=this.pd[key]
})
formData.CORPINFO_ID=corpinfoId
formData.CREATOR=loginUser.USER_ID
formData.OPERATOR=loginUser.USER_ID
formData.ACTION_USER=loginUser.NAME
formData.APPLY_STATUS=STATUS
console.info(this.measuresList)
formData.measuresList = JSON.stringify(this.measuresList)
uni.uploadFile({
url: basePath+'/app/electricity/'+_this.msg,
// filePath: this.imgList[0].filePath,
files:imgArr,
name: 'FFILE',
formData: formData,
success: (res) => {
uni.showToast({
icon:'none',
title: '保存成功',
duration: 2000
});
_this.goback()
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
},
getDept() {
var _this = this;
uni.request({
url: basePath + '/app/sys/listTree',//部门下拉接口
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID : corpinfoId,
},
success: (res) => {
if("success" == res.data.result){
_this.treeNode=eval(res.data.zTreeNodes);
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
uni.request({
url: basePath + '/app/relevantunit/listAllTree',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CORPINFO_ID: corpinfoId,
},
success: (res) => {
if ("success" === res.data.result) {
_this.workOperatorDepartmentList = JSON.parse(res.data.varList);
} else {
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
});
},
//获取人员列表
getUserList(dept,list,i){
//发送 post 请求
var _this=this
uni.request({
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
url: basePath+'/app/sys/listUser',
data: {DEPARTMENT_ID:dept, NOMAIN:'1',tm:new Date().getTime()},
success: function(res){
if("success" == res.data.result){
if(i>-1) {
_this[list][i] = [];
_this[list][i] = res.data.userList;
_this.$forceUpdate();//强制刷新
}else{
_this[list]=res.data.userList;
}
}else{
uni.showToast({
title: res.data.message,
duration: 2000
});
}
}
})
},
// 显示树形选择器
optDeptTree(type) {
this.isUps=true
if (type == 'approve') { this.$refs.tkiTree_approve._show(); }
else if (type == 'assure') { this.$refs.tkiTree_assure._show(); }
},
// 取消回调事件
cancelDeptTree(e) {
this.isUps=false;
},
PickerAssure(e) {
this.assureindex = e.detail.value;
this.pd.ASSURE_USER_ID=this.assureUserList[this.assureindex].USER_ID;
this.pd.ASSURE_USER_NAME=this.assureUserList[this.assureindex].NAME;
this.$forceUpdate();//强制刷新
},
assuretreeConfirm(e) {
this.isUps=false;
this.pd.ASSURE_DEPARTMENT_ID=e[0].id;
this.pd.ASSURE_DEPARTMENT_NAME=e[0].name;
this.$forceUpdate();//强制刷新
this.getUserList(e[0].id,'assureUserList');
},
PickerApprove(e) {
this.approveindex = e.detail.value;
this.pd.APPROVE_USER_ID=this.approveUserList[this.approveindex].USER_ID;
this.pd.APPROVE_USER_NAME=this.approveUserList[this.approveindex].NAME;
this.$forceUpdate();//强制刷新
},
approvetreeConfirm(e) {
this.isUps=false;
this.pd.APPROVE_DEPARTMENT_ID=e[0].id;
this.pd.APPROVE_DEPARTMENT_NAME=e[0].name;
this.$forceUpdate();//强制刷新
this.getUserList(e[0].id,'approveUserList');
},
isBlankList(userType) {
switch(userType) {
case 'assure':
if(this.assureUserList.length == 0) {
uni.showToast({
icon: 'none',
title: '请先选择运维保障人部门',
duration: 1500
})
}
break
case 'approve':
if(this.approveUserList.length == 0) {
uni.showToast({
icon: 'none',
title: '请先选择作业人部门',
duration: 1500
})
}
break
}
},
/*
*手写板
*/
showModal(e) {
this.modalName = e.currentTarget.dataset.target
},
hideModal(e) {
this.modalName = null
},
//完成
subCanvas(e) {
this.imgList.splice(0,this.imgList.length);
console.info(e)
this.imgList.push(e);
this.pd.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
workSubCanvas(e) {
this.workImgList.splice(0,this.workImgList.length);
console.info(e)
this.workImgList.push(e);
this.pd.WORK_SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
ViewImage(e) {
let files =[];
files.push(e.currentTarget.dataset.url)
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
},
changeStartDate(e) {
this.pd.WORK_START_DATE = e
this.$forceUpdate();//强制刷新
},
changeEndDate(e) {
this.pd.WORK_END_DATE = e
this.$forceUpdate();//强制刷新
},
//日期加上天数后的新日期.
addDays(date,days){
var nd = new Date(date);
nd = nd.valueOf();
nd = nd + days * 24 * 60 * 60 * 1000;
nd = new Date(nd);
return formatDate(nd, 'yyyy-MM-dd hh:mm');
},
/**
* 作业人员选择
*/
workOperatorSelectShow() {
this.$refs.cityMore.open();
},
workOperatorSelectHide(type) {
if(type === 'close') {
this.pd.WORK_OPERATOR_ID = []
this.pd.WORK_OPERATOR_NAME = []
}
this.$refs.cityMore.close();
},
switchCity(index){
this.cityIndex = index
},
chooseCity(item){
if(this.pd.WORK_OPERATOR_ID.indexOf(item.id) == -1){
this.pd.WORK_OPERATOR_ID.push(item.id)
this.pd.WORK_OPERATOR_NAME.push(item.name)
this.pd.WORK_OPERATOR_NUMBER.push(item.number)
}else {
this.pd.WORK_OPERATOR_ID.splice(this.pd.WORK_OPERATOR_ID.indexOf(item.id),1)
this.pd.WORK_OPERATOR_NAME.splice(this.pd.WORK_OPERATOR_NAME.indexOf(item.name),1)
this.pd.WORK_OPERATOR_NUMBER.splice(this.pd.WORK_OPERATOR_NUMBER.indexOf(item.name),1)
}
},
meteringBillChange(e){
this.metering_bill_index = e.detail.value;
this.$set(this.pd,'METERING_BILL_NAME',this.meteringBillList[e.detail.value].NAME)
this.$set(this.pd,'METERING_BILL',this.meteringBillList[e.detail.value].ID)
},
/** 坐标定位 */
showMapModal() {
var _this = this
uni.navigateTo({
url: '/pages/map/map',
events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
acceptDataFromOpenedPage: function (e) {
// console.log(e.data)
// console.info(e.data.longitue)
_this.$set( _this.pd, 'WORK_LONGITUDE', e.data.longitue )
_this.$set( _this.pd, 'WORK_LATITUDE', e.data.latitude )
// _this.pd.WORK_LONGITUDE = e.data.longitue;
// _this.pd.WORK_LATITUDE = e.data.latitude;
// console.info(_this.pd)
}
},
})
},
goback(){
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上二级页面
prePage.$vm.initflag = true; // A 页面 init方法 为true
uni.navigateBack({delta: 1});
uni.hideLoading();
}
}
}
</script>
<style>
</style>