123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- <template>
- <view>
- <!-- 顶部 -->
- <cu-custom bgColor="bg-blue" :isBack="true">
- <block slot="backText">编辑监理日志</block>
- <block slot="content"></block>
- <block slot="right">
- <view class=" flex justify-center">
- <template v-if="dateList[0].taskStatus == '0' || dateList[0].taskStatus == '1'">
- <button @click="repeal()" class="margin-top-ssm cu-btn line-blue round text-white" style="width: 130rpx;height: 66rpx;padding: 0;">废除</button>
- </template>
- <template v-else>
- <button @click="save(2)" class="margin-top-ssm cu-btn line-blue round text-white" style="width: 130rpx;height: 66rpx;padding: 0;">上报</button>
- </template>
-
- <button class="margin-top-ssm cu-btn round line-blue text-white">
- <button class="cu-btn line-blue" style="padding:0 20rpx 0 10rpx" @click="save(1)">
- <text class="text-white">预览</text>
- </button>
- <template v-if="!(dateList[0].taskStatus == '0' || dateList[0].taskStatus == '1')">
- <text class="bg-white" style="width: 1rpx;height: 30rpx;"></text>
- <button class=" cu-btn line-blue" style="padding:0 10rpx 0 20rpx" @click="save()">
- <text class="text-white">保存</text>
- </button>
- </template>
- </button>
- </view>
- </block>
- </cu-custom>
- <view v-for="(data,index) in dateList" :key="index">
- <form>
- <view class="cu-form-group_1 flex justify-between">
- <view>
- <text class="title">日志{{index+1}}</text>
- <button class="cu-btn round sm margin-left-sm" @click="addNow(index)" v-if="!(data.taskStatus==0 || data.taskStatus==1)">复制当前</button>
- </view>
- <button class="cu-btn round sm" @click="delOne(index)" v-if="!(data.taskStatus==0 || data.taskStatus==1)&&(index != 0)">删除</button>
- </view>
- <template v-if="project && project.contract_type == 1">
- <checkbox-group @change="checkboxChange($event,index,1)" class="block" style="padding: 0 10px;background-color: #FFFFFF;">
- <view>单位</view>
- <template v-for="(item,index2) in constructi2onList">
- <view style="padding-top: 10px;">
- <checkbox v-if="item.contractorUnitName" :value='item.id' class='round' :class="item.checked?'checked':''" :checked="item.checked" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" style="transform:scale(0.82)"></checkbox>
- <text style="margin-left: 20rpx;">{{item.contractorUnitName}}</text>
- </view>
- </template>
- </checkbox-group>
- <checkbox-group @change="checkboxChange($event,index,2)" class="block" style="padding: 0 10px;background-color: #FFFFFF;">
- <view>合同段</view>
- <template v-for="(item,index2) in contractIdDataList">
- <span style="padding-top: 10px;margin-right: 30rpx;">
- <checkbox v-if="item.contractNumber" :value='item.id' class='round' :class="item.checked?'checked':''" :checked="item.checked" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" style="transform:scale(0.82)"></checkbox>
- <text style="margin-left: 10rpx;">{{item.contractNumber}}</text>
- </span>
- </template>
- </checkbox-group>
- </template>
- <view class="cu-form-group_1">
- <view class="title">日期</view>
- <input placeholder-style="color:#AEAEAE" placeholder="请输入" disabled="" v-model="data.date" name="input"></input>
- </view>
- <view class="cu-form-group_1">
- <view class="title">天气</view>
- <input placeholder-style="color:#AEAEAE" placeholder="请输入" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.weather" name="input"></input>
- </view>
- <view class="cu-form-group_1">
- <view class="title">编号</view>
- <input placeholder-style="color:#AEAEAE" placeholder="请输入" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.serialNumber" name="input"></input>
- </view>
- <view class="cu-form-group_1">
- <view class="title">安全专监</view>
- <input placeholder-style="color:#AEAEAE" placeholder="请输入" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.securityUserName" name="input"></input>
- </view>
- </form>
- <form>
- <view class="cu-form-group_2">
- <view class="title">施工"三类人员"到岗情况</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.sanleirenyuan" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">施工现场安全状况</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.accidentContent" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">危险性较大工程施工安全措施落实情况</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.acceptance" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">施工临时用电安全措施落实情况</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.problem" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">重大安全隐患、危险源安全监控措施落实情况</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.problemRectify" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">存在的安全隐患及处理措施</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.danger" placeholder="请输入"></textarea>
- </view>
- </view>
- <view class="cu-form-group_2">
- <view class="title">其他有关事项记录</view>
- <view>
- <textarea placeholder-style="color:#AEAEAE" maxlength="-1" :disabled="(data.taskStatus==0)||(data.taskStatus==1)" v-model="data.dangerRectify" placeholder="请输入"></textarea>
- </view>
- </view>
- </form>
- </view>
- <view class="cu-bar bg-white tabbar" style="border: none;"></view>
- <view class="cu-bar bg-white tabbar border shop" style="position: fixed;bottom: 0;left: 0;width: 100%;border-top: 1rpx solid #EAEAEA;">
- <view class="flex solid-bottom padding justify-between" style="width: 100%;">
- <text></text>
- <button class="cu-btn round" @click="addOne" v-if="!(dateList[0].taskStatus == '0' || dateList[0].taskStatus == '1')">新增</button>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- dotStyle: {
- color: 'black'
- },
- project: "",
- time: "",
- constructionList: [],
- supervisionList: [],
- modalShow: false,
- // data: {
- // },
- dateList:[{
- pageNumber:1,
- recorderId:uni.getStorageSync("userInfo").id,
- contractId:uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).contractId,
- }],
-
- updateOrInsert: 0, //0为新增 , 1为编辑
- upId: null,
-
-
- constructi2onList:[],
- contractIdDataList:[],
-
- contractId : uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).contractId,
- project:uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id),
- recorderId:uni.getStorageSync("userInfo").id,
- }
- },
- async onLoad(e) {
- this.dateList[0].date = e.time;
- this.project = uni.getStorageSync("porject" + "_" + uni.getStorageSync("userInfo").id);
- this.updateOrInsert = e.type;
- this.upId = e.id;
-
- if(this.project.contract_type == 1){
- await this.getcontractInfoListByContract();
- }
-
- //console.log(this.constructi2onList)
- //debugger
-
- if (this.updateOrInsert == 1) { //获取日志信息进行绑定
- //this.findData(this.upId);
- this.getDataByDate(e.time);
- } else {
- //获取合同段的地址,根据地址获取温度和天气
- var that = this;
- var cityName = uni.getStorageSync("porject" + "_" + uni.getStorageSync("userInfo").id).project_place;
- that.http.request("/app/diary/getWeather", {
- projectId:that.project.id,
- contractId:that.contractId,
- date:e.time
- }).then((res) => {
- //that.$set(that.data,'averageTemperature',res.tempSection);
- that.$set(that.dateList[0], 'weather', res.weather);
- //that.data.averageTemperature =res.tempSection;
- //that.data.weather = res.weather
- })
-
- //获取上一个审核人
- this.getReviewer(e.time);
- }
-
- uni.$on('report',this.reportSuccess)
- },
- onUnload(){
-
- uni.$off('report',this.reportSuccess)
- },
- methods: {
- showdialog() {
- this.modalShow = !this.modalShow;
- },
- datechange(e) {
- this.data.startTime = e.fullDate
- this.showdialog();
- },
- navTo(value) {
- uni.navigateTo({
- url: "/pages/constructionLog/personnel/personnel?type=" + value
- })
- },
- //获取该日志的数据,编辑
- findData(id) {
- var that = this;
- that.http.request('/app/supersecurity/getDataById', {
- id: id
- }).then((result) => {
- that.data = result.data;
- that.$delete(that.data, 'prefix');
- })
- },
-
- save(type) {
- if(!this.verification()){
- uni.showToast({
- title: '至少需要填写一项内容',
- icon:'none',
- duration: 2000
- });
- return;
- }
- // this.data.contractId = this.project.contractId;
- // this.data.recorderId = uni.getStorageSync("userInfo").id;
- for (let j = 0; j < this.dateList.length; j++) {
- if (this.constructi2onList && this.constructi2onList.length > 0) {
- var arr = [];
- for (var i = 0; i < this.constructi2onList.length; i++) {
- if(this.constructi2onList[i].checked){
- arr.push(this.constructi2onList[i].id)
- }
- }
- this.dateList[j].constructionUnits = arr.join(',');
- } else {
- this.dateList[j].constructionUnits = null;
- }
- if (this.contractIdDataList && this.contractIdDataList.length > 0) {
- var arr = [];
- for (var i = 0; i < this.contractIdDataList.length; i++) {
- if(this.contractIdDataList[i].checked){
- arr.push(this.contractIdDataList[i].id)
- }
- }
- this.dateList[j].contractIds = arr.join(',');
- } else {
- this.dateList[j].contractIds = null;
- }
- }
- //this.http.request('/app/supersecurity/addEntity.json', JSON.stringify(this.dateList), 1).then((res) => {
- this.http.request('/app/supersecurity/addEntity.json', {voStr:JSON.stringify(this.dateList),storeName:uni.getStorageSync("storeName")}).then((res) => {
- if (res.result == "1") {
- //this.data.id = res.data.id;
- let urlArr = [];
- for (let i = 0; i < res.datas.length; i++) {
- this.dateList[i].id = res.datas[i].id;
- this.dateList[i].outUrl = res.datas[i].outUrl;
- urlArr.push(res.datas[i].outUrl);
- }
- this.$prompt.none(res.msg);
- setTimeout(()=> {
- if (type == 1) {
- //跳去预览
- uni.navigateTo({
- url: "/pages/view/preview/preview?previews=" + urlArr.join(',')
- })
- }else if(type == 2){
- getApp().globalData.diary = res.datas[0];
- uni.navigateTo({
- url:"/pages/dataReport/dailyReport?urlName="+"supersecurity"+"&isZJ="+"0"
- })
- } else {
- uni.navigateBack({
- delta: 1
- })
- }
- }, 500)
- } else {
- this.$prompt.Error("保存失败,"+res.msg);
- }
- })
- },
-
- radioChange(event,type){
- //console.log(event.target.value,type);
- this.data[type] = event.target.value;
- },
-
- verification(){
- let verify = true;
- for (let i = 0; i < this.dateList.length; i++) {
- if(!this.dateList[i].serialNumber && !this.dateList[i].sanleirenyuan &&
- !this.dateList[i].buildContent && !this.dateList[i].accidentContent &&
- !this.dateList[i].acceptance && !this.dateList[i].problem &&
- !this.dateList[i].problemRectify && !this.dateList[i].danger &&
- !this.dateList[i].dangerRectify
- ){
- verify = false;
- }else{
- verify = true;
- }
- }
- return verify;
- },
-
- addOne(){
- this.dateList.push({
- date:this.dateList[0].date,//日期
- weather:this.dateList[0].weather,//天气
- pageNumber:this.dateList[this.dateList.length-1].pageNumber+1,
- recorderId:this.dateList[0].recorderId,
- contractId:this.dateList[0].contractId
- })
- },
- addNow(index){
- let addObj = Object.assign({},this.dateList[index]);
- addObj.pageNumber = addObj.pageNumber+1;
- addObj.id = '';
- for (let i = index+1; i < this.dateList.length; i++) {
- this.dateList[i].pageNumber += 1;
- }
- this.dateList.splice(index+1,0,addObj);
- //console.log(this.dateList)
- },
- delOne(index){
- uni.showModal({
- title: '删除',
- content: '是否删除 日志'+(index+1)+' ?'+'删除后无法还原',
- success:(res) => {
- if (res.confirm) {
- //console.log('用户点击确定');
-
- //没保存过直接删
- if(!this.dateList[index].id){
- this.dateList.splice(index,1);
- return;
- }
- //保存过的需要请求
- this.http.request('/app/supersecurity/del', {
- id: this.dateList[index].id,
- }).then((result) => {
- if(result.result ==1){
- this.dateList.splice(index,1);
- }else{
- this.$prompt.Error("删除失败");
- }
- })
- } else if (res.cancel) {
- //console.log('用户点击取消');
- }
- }
- });
- },
- getDataByDate(date){
- this.http.request('/app/supersecurity/getDataByDate', {
- date: date,
- recorderId:this.recorderId,
- contractId:this.contractId,
- }).then((result) => {
- if(result.result ==1){
- for (let i = 0; i < result.datas.length; i++) {
- result.datas[i].contractId = this.contractId;
- }
- this.dateList =result.datas;
- var items,values;
- if(this.dateList[0].constructionUnits){
- items= this.constructi2onList;
- values = this.dateList[0].constructionUnits.split(",");
- this.setChecked(items,values)
- }
- if(this.dateList[0].contractIds){
- values = this.dateList[0].contractIds.split(",");
- items= this.contractIdDataList;
- this.setChecked(items,values)
- }
-
- }else{
-
- }
- })
- },
- getPageNumber(){
- let max = 1;
- for (let i = 0; i < this.dateList.length; i++) {
- if(this.dateList[i].pageNumber > max){
- max = this.dateList[i].pageNumber;
- }
- }
- return max+1;
- },
-
- getReviewer(date){
- //获取上一个审核人
- this.http.request("/app/supersecurity/getReviewer", {
- projectId:this.project.id,
- contractId:this.contractId,
- date:date
- }).then((res) => {
- if(res.data && this.dateList[0]){
- this.$set(this.dateList[0], 'securityUserName', res.data);
- }
- })
- },
-
- async getcontractInfoListByContract(){
- let result = await this.http.request('/app/parameterLog/getcontractInfoListByContract',{
- contractId:this.contractId,
- })
- if(result.result == '1'){
- this.constructi2onList = [];
- this.contractIdDataList = [];
- for (var i = 0; i < result.datas.length; i++) {
- this.constructi2onList.push({
- id:result.datas[i].id,
- contractorUnitName:result.datas[i].contractorUnitName,
- checked:false,
- })
- this.contractIdDataList.push({
- id:result.datas[i].id,
- contractNumber:result.datas[i].contractNumber,
- checked:false,
- })
- }
- }else{
-
- }
- },
-
- checkboxChange(e,index,type){
- //console.log(e.detail.value)
- let items = []
- if(type == 1){
- items = this.constructi2onList
- }else if(type == 2){
- items = this.contractIdDataList
- }
-
- let values = e.detail.value
-
- this.setChecked(items,values)
- },
-
- setChecked(items,values){
- for (let i = 0, lenI = items.length; i < lenI; ++i) {
- items[i].checked = false
-
- for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
- if (items[i].id === values[j]) {
- //console.log(values[j])
- items[i].checked = true
- break
- }
- }
- }
- },
- repeal(){
- let { account } = uni.getStorageSync('userInfo')
- uni.showModal({
- title: '废除',
- content: '是否废除任务?',
- success:(res) => {
- if (res.confirm) {
- this.http.request('/app/task/repeal', {
- taskId: this.dateList[0].taskId,
- opUserName: account ? account : '',
- }).then((result) => {
- if(result.result ==1){
- this.$prompt.none("废除成功");
- this.getDataByDate(this.dateList[0].date);
- }else{
- this.$prompt.Error("废除失败");
- }
- })
- } else if (res.cancel) {
- //console.log('用户点击取消');
- }
- }
- });
- },
- reportSuccess(){
- //上报成功,刷新
- this.getDataByDate(this.dateList[0].date);
- }
-
- },
- onShow() {
-
- },
- }
- </script>
- <style>
- .solid-top-type {
- border-top: 0px solid #eee;
- }
- .cu-form-group_1 {
- display: flex;
- align-items: center;
- padding: 0 22rpx;
- background-color: #fff;
- border-bottom: 2rpx solid #EAEAEA;
- height: 88rpx;
- }
- .cu-form-group_1 .title {
- font-size: 30rpx;
- color: #101010;
- width: 154rpx;
- }
- .cu-form-group_1 input {
- font-size: 30rpx;
- color: #8a8a8a;
- }
- .cu-form-group_2 {
- padding: 22rpx;
- background-color: #fff;
- border-bottom: 2rpx solid #EAEAEA;
- }
- .cu-form-group_2 .title {
- font-size: 30rpx;
- color: #101010;
- padding-bottom: 18rpx;
- }
- .cu-form-group_2 textarea {
- font-size: 30rpx;
- color: #8a8a8a;
- width: 100%;
- }
- .cu-modal.show {
- overflow-y: auto;
- pointer-events: auto;
- }
- </style>
|