6 changed files with 1331 additions and 38 deletions
@ -0,0 +1,779 @@ |
|||||
|
<template> |
||||
|
<el-dialog title="提示" :visible.sync="dialogVisible" width="1370px" :before-close="handleCancle"> |
||||
|
<span slot="title"> |
||||
|
<span v-if="pageType == 'add'">新增</span> |
||||
|
<span v-if="pageType == 'edit'">修改</span> |
||||
|
<span v-if="pageType == 'view'">查看</span> |
||||
|
<span v-if="pageType == 'patrol'">巡查记录</span> |
||||
|
</span> |
||||
|
<div> |
||||
|
<div class="dialog-h-content scroll-h div_form"> |
||||
|
<el-form :inline="true" :model="formData" ref="form" :rules="dataRule" :label-width="'90px'" |
||||
|
v-if="pageType != 'patrol'"> |
||||
|
<el-row> |
||||
|
<el-col :span="6"> |
||||
|
<!-- <el-form-item label="所属组织" prop="agencyId"> |
||||
|
<el-input v-model.trim="formData.agencyId" :disabled="disabled" |
||||
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> --> |
||||
|
|
||||
|
<el-form-item label="所属组织" prop="agencyId"> |
||||
|
<el-cascader class="list_item_width_1" size="small" ref="myCascader" |
||||
|
:disabled="disabled" v-model.trim="formData.agencyId" :options="orgOptions" |
||||
|
:props="orgOptionProps" :show-all-levels="false" @change="handleChangeAgency" |
||||
|
clearable></el-cascader> |
||||
|
</el-form-item> |
||||
|
|
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="企业名称" prop="name"> |
||||
|
<el-input v-model.trim="formData.name" :disabled="disabled" class="list_item_width_1" |
||||
|
size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="4.5"> |
||||
|
<el-form-item label="九小场所" prop="nineSmallPlacesFlag"> |
||||
|
<el-radio-group v-model="formData.nineSmallPlacesFlag" :disabled="disabled" |
||||
|
size="small"> |
||||
|
<el-radio :label="1">是</el-radio> |
||||
|
<el-radio :label="0">否</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="7.5" v-if="formData.nineSmallPlacesFlag === 1"> |
||||
|
<el-form-item label="九小场所分类" prop="nineSmallPlacesCategory" label-width="150px"> |
||||
|
<el-select v-model.trim="formData.nineSmallPlacesCategory" :disabled="disabled" |
||||
|
placeholder="请选择" class="list_item_width_1" size="small"> |
||||
|
<el-option v-for="item in placeTypeList" :label="item.label" :value="item.value" |
||||
|
:key="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="规模" prop="scale"> |
||||
|
<el-input v-model.trim="formData.scale" :disabled="disabled" class="list_item_width_1" |
||||
|
size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="负责人" prop="chargePerson"> |
||||
|
<el-input v-model.trim="formData.chargePerson" :disabled="disabled" |
||||
|
class="list_item_width_1" size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="联系电话" prop="mobile"> |
||||
|
<el-input v-model.trim="formData.mobile" :disabled="disabled" class="list_item_width_1" |
||||
|
size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="18"> |
||||
|
<el-form-item label="企业地址" prop="address" style="display: block"> |
||||
|
<el-select v-model.trim="formData.address" :disabled="disabled" filterable remote |
||||
|
:reserve-keyword="true" placeholder="请输入关键词" :remote-method="remoteMethod" |
||||
|
:loading="loading" @keyup.enter.native="remoteMethod(formData.location)"> |
||||
|
<el-option v-for="(item, index) in searchOptions" |
||||
|
@click.native="handleClickKey(index)" :key="item.value" :label="item.label" |
||||
|
:value="item.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<div id="app_event" class="div_map"></div> |
||||
|
</el-form> |
||||
|
<el-form :inline="false" :model="formData" ref="form2" :label-width="'90px'" v-if="pageType == 'patrol'" |
||||
|
style="margin-left: 50px;"> |
||||
|
<div class="div_btn"> |
||||
|
<el-button size="small" type="primary " @click="patrolAddd()">新增</el-button> |
||||
|
</div> |
||||
|
<!-- 巡查记录新增 --> |
||||
|
<el-form :inline="true" :model="patrolForm" ref="form3" :rules="patrolRule" :label-width="'105px'" |
||||
|
v-if="patrolAdd"> |
||||
|
<el-row> |
||||
|
<el-col :span="16"> |
||||
|
<el-form-item label="巡查时间" prop="checkTime"> |
||||
|
<el-date-picker class="list_item_width_1" size="small" |
||||
|
v-model.trim="patrolForm.checkTime" type="datetime" |
||||
|
value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd HH:mm:ss" |
||||
|
placeholder="选择日期"></el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="16"> |
||||
|
<el-form-item label="检查人员" prop="checkPersonsIdList"> |
||||
|
<el-select v-model.trim="patrolForm.checkPersonsIdList" :disabled="disabled" |
||||
|
placeholder="请选择" class="list_item_width_1" size="small" multiple> |
||||
|
<el-option v-for="item in stafflist" :label="item.name" :value="item.staffId" |
||||
|
:key="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="18"> |
||||
|
<el-form-item label="检查结论" prop="checkResultFlag"> |
||||
|
<el-select v-model.trim="patrolForm.checkResultFlag" :disabled="disabled" |
||||
|
placeholder="请选择" class="list_item_width_1" size="small" @change="handelChangeCheckResultFlag"> |
||||
|
<el-option v-for="item in resultArray" :label="item.label" :value="item.value" |
||||
|
:key="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="18" v-if="patrolForm.checkResultFlag === '0'"> |
||||
|
<el-form-item label="拟复查时间" prop="reviewTime"> |
||||
|
<el-date-picker class="list_item_width_1" size="small" |
||||
|
v-model.trim="patrolForm.reviewTime" type="datetime" |
||||
|
value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd HH:mm:ss" |
||||
|
placeholder="选择日期"></el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row v-if="checkResultFlag == 0 && patrolForm.checkResultFlag =='0'"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item :label="`${checkResultFlag == 0?'未更改隐患':'隐患明细'}`" prop="hiddenDange" :class="{ 'inputRequirt': true, 'inputRequirtSave': messageFlag }" style="white-space: nowrap;overflow: hidden;"> |
||||
|
<el-checkbox-group v-model="hiddenDangeArr" size="small"> |
||||
|
<el-col v-for="option in checkboxOptions" :key="option.value"> |
||||
|
<el-checkbox :label="option.value" >{{ |
||||
|
option.hazardDesc }}</el-checkbox> |
||||
|
</el-col> |
||||
|
</el-checkbox-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row v-if="patrolForm.checkResultFlag === '0'"> |
||||
|
<el-col :span="18" v-for="(item, indexC) in inputList" :key="indexC" |
||||
|
:style="{'margin-left': indexC === 0 ? '0px' : '106px'}" |
||||
|
> |
||||
|
<el-form-item :label="`${indexC === 0 ?'隐患明细':''}`" class="input-container"> |
||||
|
<el-input v-model="inputList[indexC].hazardDesc" rows="3" placeholder="请输入隐患信息" size="small" |
||||
|
class="list_item_width_1"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-button @click="removeInput(indexC)" v-if="inputList.length > 1" |
||||
|
class="remove-button"> |
||||
|
<el-icon name="minus"></el-icon> |
||||
|
</el-button> |
||||
|
<el-button @click="addInput" v-if="indexC === inputList.length - 1"> |
||||
|
<el-icon name="plus"></el-icon> |
||||
|
</el-button> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row v-if="(checkResultFlag === 1 || tableData.length === 0) && patrolForm.checkResultFlag === '0'"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item label="整改意见" prop="principalName" |
||||
|
style="white-space: nowrap;overflow: hidden;"> |
||||
|
<el-input v-model="patrolForm.rectificationOpinion" rows="3" size="small" |
||||
|
placeholder="请输入整改意见"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="6"> |
||||
|
<el-form-item label="附件"> |
||||
|
<upload-image :defaultFileList="fileList" :limit="3" |
||||
|
@change="onChangeFileList"></upload-image> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="18"> |
||||
|
<el-form-item label="备注" prop="remark"> |
||||
|
<el-input v-model.trim="patrolForm.remark" :disabled="disabled" |
||||
|
class="list_item_width_1" size="small" clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<!-- 巡查记录新增end --> |
||||
|
<el-row v-for="(item, index) in tableData" :key="index" :gutter="20" style="margin-bottom: 20px;" |
||||
|
v-if="tableData"> |
||||
|
<el-row style="margin-top: 20px;"> |
||||
|
<el-col :span="24"> |
||||
|
<el-tag type="primary" effect="plain" class="custom-tag">●</el-tag>{{item.checkTime}} |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-row style="margin-top: 15px;"> |
||||
|
<el-col :span="6" style="padding-left: 65px;"> <span style="color: #888; ">检查人员:</span> {{ |
||||
|
item.checkPersons }}</el-col> |
||||
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">检查结论:</span> {{ |
||||
|
item.checkResultFlag === 1?'合格':'不合格' }}</el-col> |
||||
|
<el-col :span="6" style="padding-left: 65px;" v-if="item.checkResultFlag !== 1"><span style="color: #888; ">拟复查时间: </span> {{ |
||||
|
item.reviewTime || '--' }}</el-col> |
||||
|
</el-row> |
||||
|
<el-row style="margin-top: 15px;"> |
||||
|
<el-col :span="24" style="padding-left: 65px;"><span |
||||
|
style="color: #888; ">{{item.flag?'已整改隐患':'隐患明细'}}: </span> |
||||
|
<div v-if="item.hiddenDangeList"> |
||||
|
<p style="margin-left: 60px;" |
||||
|
v-for="(itemC,index) in item.hiddenDangeList.filter(item=>item.hazardStatus ==1)"> |
||||
|
{{index+1}}.{{itemC.hazardDesc}}</p> |
||||
|
</div> |
||||
|
<span v-else>--</span> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row style="margin-top: 15px;" v-if="item.flag"> |
||||
|
<el-col :span="24" style="padding-left: 65px;"><span style="color: #888; ">未整改隐患: </span> |
||||
|
<div v-if="item.hiddenDangeList"> |
||||
|
<p style="margin-left: 60px;" |
||||
|
v-for="(itemC,index) in item.hiddenDangeList.filter(item=>item.hazardStatus == 0)"> |
||||
|
{{index+1}}.{{itemC.hazardDesc}}</p> |
||||
|
</div> |
||||
|
<span v-else>--</span> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row style="margin-top: 15px;" v-else> |
||||
|
<el-col :span="24" style="padding-left: 65px;"><span style="color: #888; ">整改要求: </span> |
||||
|
<p style="margin-left: 60px;"> |
||||
|
{{index+1}}.{{item.hiddenDangeList.find(item=>item.hazardStatus == 2).hazardDesc}} |
||||
|
</p> |
||||
|
</el-col> |
||||
|
|
||||
|
</el-row> |
||||
|
<el-row style="margin-top: 15px;"> |
||||
|
<el-col :span="6" style="padding-left: 65px;"> |
||||
|
<span style="color: #888; ">附件: </span> |
||||
|
<span v-for="(itemI,indexI) in item.attachmentUrls" :key="itemI.fileName" |
||||
|
style="margin-right:10px;cursor:pointer" |
||||
|
@click="handelCLickImage(itemI.attachmentUrl)">{{ |
||||
|
itemI.fileName }} |
||||
|
</span> |
||||
|
<div class="imagePreview" v-if="preViewImageFlag" @click="preViewImageFlag = false"> |
||||
|
<img :src="preViewImage" alt=""> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">备注: </span>{{ |
||||
|
item.remark || '--' }}</el-col> |
||||
|
</el-row> |
||||
|
</el-row> |
||||
|
<div style="width:100%;height:300px;display:flex;align-items:center;justify-content: center;" |
||||
|
v-if="tableData.length === 0&& !patrolAdd"> |
||||
|
<span>暂无数据~</span> |
||||
|
</div> |
||||
|
|
||||
|
</el-form> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="handleCancle" size="small">取消</el-button> |
||||
|
<el-button @click="handleComfirm" size="small" type="primary">确定</el-button> |
||||
|
</span> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { isMobile } from '@/utils/validate'; |
||||
|
import { mapGetters } from 'vuex'; |
||||
|
import { Loading } from 'element-ui'; // 引入Loading服务 |
||||
|
import { requestPost, requestGet } from '@/js/dai/request'; |
||||
|
import daiMap from '@/utils/dai-map'; |
||||
|
import nextTick from 'dai-js/tools/nextTick'; |
||||
|
// import UploadImage from '@/views/modules/plugins/rent/rentcontractinfo-add-or-update' |
||||
|
import UploadImage from '@/views/modules/plugins/rent/upload-image.vue' |
||||
|
let loading; // 加载动画 |
||||
|
let map; |
||||
|
var search; |
||||
|
var markers; |
||||
|
var infoWindowList; |
||||
|
var geocoder; // 新建一个正逆地址解析类 |
||||
|
|
||||
|
export default { |
||||
|
props: { |
||||
|
dialogVisible: { |
||||
|
type: Boolean, |
||||
|
default: '' |
||||
|
}, |
||||
|
defaultData: { |
||||
|
type: Object, |
||||
|
default: null |
||||
|
}, |
||||
|
pageType: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
detailId: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
disabled: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
checkResultFlag:{ |
||||
|
type:Number, |
||||
|
default:0 |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
let checkMObile = (rule, value, callback) => { |
||||
|
if (value === '') { |
||||
|
callback(new Error('请输入联系电话')); |
||||
|
} else { |
||||
|
if (!isMobile(value)) { |
||||
|
callback(new Error('联系电话格式不正确')); |
||||
|
} |
||||
|
callback(); |
||||
|
} |
||||
|
}; |
||||
|
let orgOptionProps = { |
||||
|
multiple: false, |
||||
|
value: 'agencyId', |
||||
|
label: 'agencyName', |
||||
|
children: 'subAgencyList', |
||||
|
checkStrictly: true |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
orgOptions:[], |
||||
|
orgOptionProps, |
||||
|
inputList: [{ hazardDesc: '',hazardStatus:'0' }],//隐患输入框 |
||||
|
fileList:[], |
||||
|
patrolAdd: false, |
||||
|
checkboxOptions: [], |
||||
|
hiddenDangeArr:[], |
||||
|
|
||||
|
tableData: [], |
||||
|
btnDisable: false, |
||||
|
user: '', |
||||
|
agencyId: '', |
||||
|
gridList: [], //所属网格list--场所区域 |
||||
|
placeTypeList: [], //场所类型 |
||||
|
resultArray: [{ value: '1', label: '合格' }, { value: '0', label: '不合格' }], |
||||
|
stafflist: [], |
||||
|
formData: { |
||||
|
agencyId:'', |
||||
|
name:'', |
||||
|
address:'', |
||||
|
scale:'', |
||||
|
chargePerson:'', |
||||
|
mobile:'', |
||||
|
nineSmallPlacesFlag:'', |
||||
|
nineSmallPlacesCategory:'' |
||||
|
}, |
||||
|
dataRule: { |
||||
|
agencyId: [{ required: true, message: '所属组织不能为空', trigger: 'blur' }], |
||||
|
name: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }], |
||||
|
address: [{ required: true, message: '企业地址不能为空', trigger: 'blur' }], |
||||
|
scale: [{ required: true, message: '规模不能为空', trigger: 'blur' }], |
||||
|
chargePerson: [{ required: true, message: '负责人不能为空', trigger: 'blur' }], |
||||
|
mobile: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }], |
||||
|
nineSmallPlacesCategory: [{ required: true, message: '九小场所类型不能为空', trigger: 'blur' }], |
||||
|
nineSmallPlacesFlag: [{ required: true, message: '九小场所不能为空', trigger: 'blur' }], |
||||
|
}, |
||||
|
patrolForm:{ |
||||
|
companyId:null, |
||||
|
checkTime:null, |
||||
|
checkPersonsIdList:null, |
||||
|
checkResultFlag:null, |
||||
|
attachmentUrls:[], |
||||
|
reviewTime:null, |
||||
|
hiddenDangeList:null, |
||||
|
remark:null, |
||||
|
}, |
||||
|
patrolRule:{ |
||||
|
checkTime: [{ required: true, message: '巡查时间不能为空', trigger: 'blur' }], |
||||
|
checkPersonsIdList: [{ required: true, message: '检查人员不能为空', trigger: 'blur' }], |
||||
|
checkResultFlag: [{ required: true, message: '检查结论不能为空', trigger: 'blur' }], |
||||
|
reviewTime: [{ required: true, message: '拟复查时间不能为空', trigger: 'blur' }], |
||||
|
}, |
||||
|
//地图 |
||||
|
loading: false, |
||||
|
searchOptions: [], |
||||
|
preViewImage:null, |
||||
|
preViewImageFlag:false, |
||||
|
messageFlag:false |
||||
|
}; |
||||
|
}, |
||||
|
watch: {}, |
||||
|
components: { UploadImage }, |
||||
|
created() {}, |
||||
|
async mounted() { |
||||
|
this.getOrgTreeList(); |
||||
|
this.user = this.$store.state.user; |
||||
|
this.agencyId = this.user.agencyId; |
||||
|
this.startLoading(); |
||||
|
this.loadplaceType() |
||||
|
if (this.pageType != 'add' && this.pageType != 'patrol') { |
||||
|
this.getDetail(); |
||||
|
}else if(this.pageType == 'patrol') { |
||||
|
this.getCompanyDetail() |
||||
|
this.getStafflist() |
||||
|
}else { |
||||
|
this.initMap(); |
||||
|
} |
||||
|
await this.endLoading(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
handelChangeCheckResultFlag(val){ |
||||
|
if(val == 1){ |
||||
|
this.hiddenDangeArr = [] |
||||
|
delete this.patrolRule.reviewTime |
||||
|
}else{ |
||||
|
this.hiddenDangeArr = this.checkboxOptions.map(item=>item.value) |
||||
|
this.$set(this.patrolRule,'reviewTime',[{ required: true, message: '拟复查时间不能为空', trigger: 'blur' }]) |
||||
|
} |
||||
|
}, |
||||
|
handelCLickImage(url){ |
||||
|
this.preViewImageFlag = true; |
||||
|
this.preViewImage = url; |
||||
|
}, |
||||
|
handleChangeAgency(val) { |
||||
|
this.formData.agencyId = val.length ? val[val.length - 1] : val[0]; |
||||
|
}, |
||||
|
getOrgTreeList() { |
||||
|
this.$http |
||||
|
.post('/gov/org/customeragency/agencygridtree', {}) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} else { |
||||
|
// 递归处理树形结构数据,只保留 level 为 "district"、"street" 和 "community" 的节点 |
||||
|
this.orgOptions = this.filterOrgTree(res.data); |
||||
|
console.log('获取组织树成功111', this.orgOptions); |
||||
|
} |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
return this.$message.error('网络错误'); |
||||
|
}); |
||||
|
}, |
||||
|
filterOrgTree(treeData) { |
||||
|
const filteredTree = { ...treeData }; // 复制树形结构对象,避免直接修改原始数据 |
||||
|
// 过滤当前节点的子节点 |
||||
|
if (filteredTree.subAgencyList && filteredTree.subAgencyList.length > 0) { |
||||
|
filteredTree.subAgencyList = filteredTree.subAgencyList.map(node => { |
||||
|
// 对当前节点的子节点递归调用 filterOrgTree 方法 |
||||
|
const filteredNode = this.filterOrgTree(node); |
||||
|
if (filteredNode.level === 'community') { |
||||
|
filteredNode.subAgencyList = null; |
||||
|
} |
||||
|
return filteredNode; |
||||
|
}).filter(node => { |
||||
|
// 只保留 level 为 "district"、"street" 和 "community" 的节点 |
||||
|
return ["district", "street", "community"].includes(node.level); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
return filteredTree; |
||||
|
}, |
||||
|
addInput() { |
||||
|
if (this.inputList.some(item => item.hazardDesc.trim() === '')) { |
||||
|
} else { |
||||
|
this.inputList.push({ hazardDesc: '', hazardStatus: '0' }); |
||||
|
} |
||||
|
}, |
||||
|
removeInput(index) { |
||||
|
this.inputList.splice(index, 1); // 删除对应索引的输入框 |
||||
|
}, |
||||
|
onChangeFileList(e, rowIndex = 0) { |
||||
|
console.log('onChangeFileList', e) |
||||
|
if (e.length > 0) { |
||||
|
this.fileList = [] |
||||
|
e.forEach(item => { |
||||
|
let ob = { |
||||
|
fileType: item.raw.type, |
||||
|
fileUrl: item.response.data.url, |
||||
|
attachmentUrl:item.response.data.url, |
||||
|
fileName:item.response.data.fileName |
||||
|
} |
||||
|
this.fileList.push(ob) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
patrolAddd(){ |
||||
|
this.patrolAdd=true |
||||
|
}, |
||||
|
//场所类型 |
||||
|
async loadplaceType() { |
||||
|
const url = '/sys/dict/data/dictlist'; |
||||
|
let params = { |
||||
|
dictType: "nine_small_places" |
||||
|
}; |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
if (code === 0) { |
||||
|
this.placeTypeList = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
// 巡查记录 |
||||
|
async getCompanyDetail(){ |
||||
|
const url = `/actual/base/companyInfo/showRecord`; |
||||
|
let { data, code, msg } = await requestPost(url,{id:this.detailId}); |
||||
|
if (code === 0) { |
||||
|
data.forEach(item=>{ |
||||
|
if(!item.hiddenDangeList){ |
||||
|
item.flag = true; |
||||
|
}else{ |
||||
|
item.flag = item.hiddenDangeList.findIndex(item=>item.hazardStatus === 2) === -1; |
||||
|
} |
||||
|
}) |
||||
|
if(data[0].hiddenDangeList){ |
||||
|
this.checkboxOptions = data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,value:item.id,hazardStatus:0})); |
||||
|
this.fileList = data[0].attachmentUrls; |
||||
|
console.log(this.fileList); |
||||
|
} |
||||
|
|
||||
|
this.tableData = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
// 获取组织工作人员 |
||||
|
getStafflist() { |
||||
|
let parms = { |
||||
|
orgId: this.$store.state.user.agencyId, |
||||
|
orgType: "agency", |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
}; |
||||
|
this.$http.post("data/aggregator/org/stafflist", parms).then((resp) => { |
||||
|
this.stafflist = resp.data.data.staffList; |
||||
|
}); |
||||
|
}, |
||||
|
async getDetail() { |
||||
|
const url = `/actual/base/companyInfo/companyDetail/${this.detailId}`; |
||||
|
const { data, code, msg } = await requestPost(url); |
||||
|
if (code === 0) { |
||||
|
console.log('详情数据', data); |
||||
|
this.formData = { ...data }; |
||||
|
this.initMap(); |
||||
|
if(!data.latitude){ |
||||
|
this.remoteMethod(data.address,true) |
||||
|
} |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleComfirm() { |
||||
|
if(this.pageType === 'add' || this.pageType === 'edit'){ |
||||
|
this.$refs['form'].validate(valid => { |
||||
|
if (valid){ |
||||
|
this.save(); |
||||
|
} |
||||
|
}); |
||||
|
}else if(this.pageType === 'patrol'){ |
||||
|
this.$refs['form3'].validate(valid => { |
||||
|
if (valid){ |
||||
|
if(this.checkboxOptions.length > 0 && this.hiddenDangeArr.length === 0){ |
||||
|
this.messageFlag = true; |
||||
|
return |
||||
|
}else{ |
||||
|
this.messageFlag = false; |
||||
|
} |
||||
|
this.save(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
this.save(); |
||||
|
}, |
||||
|
async save() { |
||||
|
console.log('this.formData', this.formData); |
||||
|
var url = ''; |
||||
|
var params = {}; |
||||
|
if (this.pageType == 'add') { |
||||
|
url = '/actual/base/companyInfo/saveCompanyInfo'; |
||||
|
params = { ...this.formData }; |
||||
|
} else if (this.pageType == 'edit'){ |
||||
|
url = '/actual/base/companyInfo/updateCompany'; |
||||
|
params = { ...this.formData }; |
||||
|
}else if(this.pageType == 'patrol'){ |
||||
|
url = '/actual/base/companyInfo/addRecord'; |
||||
|
params = { ...this.patrolForm }; |
||||
|
console.log(this.hiddenDangeArr); |
||||
|
this.checkboxOptions.forEach(item => { |
||||
|
if(this.hiddenDangeArr.findIndex(itemC=>itemC === item.value) == -1){ |
||||
|
item.hazardStatus = '1'; |
||||
|
}else{ |
||||
|
item.hazardStatus = '0'; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
for (let i in this.inputList) { |
||||
|
let option = this.inputList[i]; |
||||
|
if (this.patrolForm.checkResultFlag === '1') { |
||||
|
option.hazardStatus = '1'; |
||||
|
} else if (this.patrolForm.checkResultFlag === '0') { |
||||
|
option.hazardStatus = '0'; |
||||
|
} |
||||
|
} |
||||
|
params.hiddenDangeList = [ |
||||
|
...this.inputList.filter(item => item.hazardDesc.trim() !== ''), |
||||
|
...this.checkboxOptions |
||||
|
]; |
||||
|
params.companyId = this.detailId; |
||||
|
params.attachmentUrls = this.fileList; |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
if (code === 0) { |
||||
|
this.$message.success('操作成功'); |
||||
|
this.handleCancle(); |
||||
|
} else if (code >= 8000) { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleCancle() { |
||||
|
this.resetData(); |
||||
|
this.$emit('handleClose'); |
||||
|
}, |
||||
|
resetData() { |
||||
|
let form = this.pageType === 'add' ||this.pageType === 'edit'||this.pageType === 'view'?'form':this.pageType === 'patrol'?'form2':'form'; |
||||
|
this.$refs[form].resetFields(); |
||||
|
}, |
||||
|
// 开启加载动画 |
||||
|
startLoading() { |
||||
|
loading = Loading.service({ |
||||
|
lock: true, // 是否锁定 |
||||
|
text: '正在加载……', // 加载中需要显示的文字 |
||||
|
background: 'rgba(0,0,0,.7)' // 背景颜色 |
||||
|
}); |
||||
|
}, |
||||
|
// 结束加载动画 |
||||
|
endLoading() { |
||||
|
// clearTimeout(timer); |
||||
|
if (loading) { |
||||
|
loading.close(); |
||||
|
} |
||||
|
}, // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
||||
|
initMap() { |
||||
|
let { latitude, longitude } = this.$store.state.user; |
||||
|
|
||||
|
if (this.formData.latitude && this.formData.longitude) { |
||||
|
latitude = this.formData.latitude; |
||||
|
longitude = this.formData.longitude; |
||||
|
} |
||||
|
if (!latitude || latitude == '' || latitude == '0') { |
||||
|
latitude = 39.9088810666821; |
||||
|
longitude = 116.39743841556731; |
||||
|
} |
||||
|
|
||||
|
this.$nextTick(() => { |
||||
|
map = new daiMap( |
||||
|
document.getElementById('app_event'), |
||||
|
{ latitude, longitude }, |
||||
|
{ |
||||
|
zoom: 16.2, // 设置地图缩放级别 |
||||
|
pitch: 43.5, // 设置俯仰角 |
||||
|
rotation: 45 // 设置地图旋转角度 |
||||
|
} |
||||
|
); |
||||
|
// 监听地图平移结束 |
||||
|
map.on('dragend', e => { |
||||
|
if (!this.disabled) { |
||||
|
this.handleMoveCenter(e); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
map.setCenter(latitude, longitude); |
||||
|
if (this.formData.latitude) { |
||||
|
map.setMarker(latitude, longitude); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
async handleMoveCenter() { |
||||
|
//修改地图中心点 |
||||
|
const { lat, lng } = map.getCenter(); |
||||
|
this.formData.latitude = lat; |
||||
|
this.formData.longitude = lng; |
||||
|
map.setMarker(lat, lng); |
||||
|
|
||||
|
let { msg, data } = await map.getAddress(lat, lng); |
||||
|
if (msg == 'success') { |
||||
|
this.formData.address = data.address; |
||||
|
this.searchOptions = []; |
||||
|
} |
||||
|
}, |
||||
|
async remoteMethod(query,flag) { |
||||
|
if (query !== '') { |
||||
|
this.loading = true; |
||||
|
const { msg, data } = await map.searchNearby(query); |
||||
|
this.loading = false; |
||||
|
this.resultList = []; |
||||
|
|
||||
|
if (msg == 'success' && data.resultList && data.resultList.length > 0) { |
||||
|
if (data.resultList && data.resultList.length > 0) { |
||||
|
this.resultList = data.resultList; |
||||
|
this.searchOptions = this.resultList.map(item => { |
||||
|
return { value: `${item.id}`, label: `${item.address + item.name}` }; |
||||
|
}); |
||||
|
if(flag){ |
||||
|
this.handleClickKey(0) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
this.searchOptions = [ |
||||
|
{ |
||||
|
value: '0', |
||||
|
label: '未检索到结果' |
||||
|
} |
||||
|
]; |
||||
|
} |
||||
|
} else { |
||||
|
this.searchOptions = []; |
||||
|
} |
||||
|
}, |
||||
|
handleClickKey(index) { |
||||
|
let selPosition = this.resultList[index]; |
||||
|
let lonlat = selPosition.lonlat.split(' '); |
||||
|
map.setCenter(lonlat[1], lonlat[0]); |
||||
|
map.setMarker(lonlat[1], lonlat[0]); |
||||
|
this.formData.latitude = lonlat[1]; |
||||
|
this.formData.longitude = lonlat[0]; |
||||
|
this.formData.address = selPosition.address + selPosition.name; |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import '@/assets/scss/modules/management/form-main.scss'; |
||||
|
@import '@/assets/scss/modules/management/form.scss'; |
||||
|
@import '@/assets/scss/modules/visual/a_customize.scss'; |
||||
|
.el-dialog__body { |
||||
|
padding: 30px 80px; |
||||
|
} |
||||
|
.div_btn { |
||||
|
display: flex; |
||||
|
} |
||||
|
.custom-tag { |
||||
|
font-size: 16px; /* 设置圆点大小 */ |
||||
|
border: none; /* 去掉边框 */ |
||||
|
} |
||||
|
.imagePreview { |
||||
|
width:100vw; |
||||
|
height:100vh; |
||||
|
position: fixed; |
||||
|
top: 0; |
||||
|
right: 0; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
z-index:5000; |
||||
|
background-color: rgba(12, 12, 12, 0.1); |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
.inputRequirt { |
||||
|
position: relative; |
||||
|
min-width: 300px; |
||||
|
} |
||||
|
.inputRequirt::after { |
||||
|
content: '*'; |
||||
|
color: #f56c6c; |
||||
|
position: absolute; |
||||
|
left: 8px; |
||||
|
top: 10px; |
||||
|
} |
||||
|
.inputRequirtSave::before { |
||||
|
content: '请选择未更改隐患'; |
||||
|
color: #f56c6c; |
||||
|
position: absolute; |
||||
|
left: 104px; |
||||
|
bottom: -1px; |
||||
|
width: 300px; |
||||
|
} |
||||
|
|
||||
|
</style> |
@ -0,0 +1,514 @@ |
|||||
|
<template> |
||||
|
<div class="g-main"> |
||||
|
<div> |
||||
|
<div class="m-search"> |
||||
|
<el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'105px'"> |
||||
|
<div> |
||||
|
<el-form-item label="企业名称" prop="name"> |
||||
|
<el-input v-model.trim="formData.name" class="u-item-width-normal" size="small" |
||||
|
clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="规模" prop="scale"> |
||||
|
<el-select v-model.trim="formData.scale" placeholder="请选择" class="u-item-width-normal" |
||||
|
size="small" clearable> |
||||
|
<el-option v-for="item in scaleList" :key="item.value" :label="item.label" |
||||
|
:value="item.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="负责人" prop="chargePerson"> |
||||
|
<el-input v-model.trim="formData.chargePerson" class="u-item-width-normal" size="small" |
||||
|
clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="联系电话" prop="linkPerson"> |
||||
|
<el-input v-model.trim="formData.mobile" class="u-item-width-normal" size="small" |
||||
|
clearable placeholder="请输入"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="九小场所" prop="nineSmallPlacesFlag"> |
||||
|
<el-select v-model.trim="formData.nineSmallPlacesFlag" placeholder="请选择" class="u-item-width-normal" |
||||
|
size="small"> |
||||
|
<el-option v-for="item in nineArray" :key="item.value" :label="item.label" |
||||
|
:value="item.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="九小场所分类" prop="nineSmallPlacesCategory"> |
||||
|
<el-select v-model.trim="formData.nineSmallPlacesCategory" placeholder="请选择" class="u-item-width-normal" |
||||
|
size="small" clearable> |
||||
|
<el-option v-for="item in placeTypeList" :label="item.label" :value="item.value" |
||||
|
:key="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="最新检查时间" prop="orderDate"> |
||||
|
<el-date-picker class="u-item-width-normal" size="small" |
||||
|
v-model.trim="formData.orderDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd HH:mm:ss" |
||||
|
placeholder="选择日期"></el-date-picker> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="最新检查结果" prop="checkResultFlag"> |
||||
|
<el-select v-model.trim="formData.checkResultFlag" placeholder="请选择" size="small" |
||||
|
clearable class="u-item-width-normal"> |
||||
|
<el-option v-for="item in resultArray" :key="item.value" :label="item.label" |
||||
|
:value="item.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-row> |
||||
|
<el-col :span="24" align="right"> |
||||
|
<el-button style="margin-left: 30px" size="small" type="primary " |
||||
|
@click="handleSearch">查询</el-button> |
||||
|
<el-button style="margin-left: 10px" size="small" class="diy-button--white" |
||||
|
@click="resetSearch">重置</el-button> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</div> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
<div class="m-table"> |
||||
|
<div class="div_btn"> |
||||
|
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> |
||||
|
<el-button class="diy-button--white" size="small" |
||||
|
@click="handleExportModule('room')">下载模板</el-button> |
||||
|
<el-upload :headers="$getElUploadHeaders()" ref="upload" class="upload-btn" action="uploadUlr" |
||||
|
:limit="1" :accept="'.xls,.xlsx'" :with-credentials="true" :show-file-list="false" |
||||
|
:auto-upload="true" :on-progress="handleProgress" :on-success="handleExcelSuccess" |
||||
|
:before-upload="beforeExcelUpload" :http-request="uploadHttpRequest" |
||||
|
style="display: inline-block;margin:0px 10px"> |
||||
|
<el-button size="small" class="diy-button--white" :loading="importLoading">导入</el-button> |
||||
|
</el-upload> |
||||
|
|
||||
|
<el-button @click="handleExport" class="diy-button--white" size="small">导出</el-button> |
||||
|
</div> |
||||
|
<el-table :data="tableData" border class="m-table-item" style="width: 100%" |
||||
|
:height="maxTableHeight"> |
||||
|
<!-- <el-table-column label="" fixed="left" type="selection" align="center" width="50" /> --> |
||||
|
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> |
||||
|
<el-table-column prop="name" align="center" label="企业名称" |
||||
|
:show-overflow-tooltip="true"></el-table-column> |
||||
|
<el-table-column prop="address" align="center" label="企业地址" :show-overflow-tooltip="true"> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column prop="scale" label="规模" width="140" align="center" |
||||
|
:show-overflow-tooltip="true" /> |
||||
|
<el-table-column prop="chargePerson" align="center" label="负责人" |
||||
|
:show-overflow-tooltip="true"></el-table-column> |
||||
|
<el-table-column prop="mobile" align="center" :show-overflow-tooltip="true" |
||||
|
label="联系电话"></el-table-column> |
||||
|
<el-table-column prop="orderDate" align="center" label="最新检查时间" |
||||
|
:show-overflow-tooltip="true"></el-table-column> |
||||
|
<el-table-column prop="checkResultFlag" align="center" label="最新检查结果" |
||||
|
:show-overflow-tooltip="true"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span> |
||||
|
{{scope.row.checkResultFlag=='1'?'合格':scope.row.checkResultFlag=='0'?'不合格':'--'}} |
||||
|
</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column fixed="right" label="操作" align="center" width="250"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button @click="handleAdd(scope.row, 'view')" type="text" size="small">查看</el-button> |
||||
|
<!-- v-if="scope.row.latitude && agencyId == scope.row.agencyId" --> |
||||
|
<el-button |
||||
|
style="margin-right: 10px" @click="handleAdd(scope.row, 'edit')" size="small" |
||||
|
type="text"> |
||||
|
{{scope.row.latitude?'编辑':'待完善'}} |
||||
|
</el-button> |
||||
|
<el-button style="margin-right: 10px" @click="handleAdd(scope.row, 'patrol')" size="small" |
||||
|
type="text"> |
||||
|
巡查记录 |
||||
|
</el-button> |
||||
|
<!-- v-if="agencyId == scope.row.agencyId" --> |
||||
|
<el-button @click="handleDel(scope.row)" type="text" |
||||
|
size="small" class="">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<div> |
||||
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||
|
:current-page.sync="pageNo" :page-sizes="[20, 50, 100, 200]" :page-size="parseInt(pageSize)" |
||||
|
layout="sizes, prev, pager, next, total" :total="total"></el-pagination> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div> |
||||
|
<addForm v-if="dialogVisible" :dialogVisible="dialogVisible" :pageType="pageType" :disabled="disabled" |
||||
|
:detailId="detailId" :checkResultFlag="checkResultFlag" @handleClose="handleClose" @handleOk="handleOk" |
||||
|
@dialogOk="handleEditSuccess" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { requestPost } from '@/js/dai/request'; |
||||
|
import nextTick from 'dai-js/tools/nextTick'; |
||||
|
import { mapGetters } from 'vuex'; |
||||
|
import addForm from './addForm.vue'; |
||||
|
import axios from 'axios'; |
||||
|
|
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
dialogVisible: false, |
||||
|
importLoading: false, |
||||
|
disabled: false, |
||||
|
user: '', |
||||
|
agencyId: '', |
||||
|
formData: { |
||||
|
orderDate:'', |
||||
|
checkResultFlag:'', |
||||
|
nineSmallPlacesCategory:'', |
||||
|
nineSmallPlacesFlag:'', |
||||
|
mobile:'', |
||||
|
linkPerson:'', |
||||
|
chargePerson:'', |
||||
|
scale:'', |
||||
|
address:'', |
||||
|
name:'' |
||||
|
}, |
||||
|
pageType: 'list', // 列表list 新增add 处理dispose 详情info |
||||
|
gridList: [], //所属网格list--场所区域 |
||||
|
placeTypeList: [], //场所类型 |
||||
|
tableData: [], |
||||
|
resultArray: [{ value: '1', label: '合格' }, { value: '0', label: '不合格' }], |
||||
|
nineArray: [{ value: '1', label: '是' }, { value: '0', label: '否' }], |
||||
|
equipmentCategoryCodeArray: [], |
||||
|
pageNo: 1, |
||||
|
pageSize:20, |
||||
|
total: 1, |
||||
|
detailId: '', |
||||
|
checkResultFlag:false, |
||||
|
scaleList:[] |
||||
|
}; |
||||
|
}, |
||||
|
components: { addForm }, |
||||
|
created() { }, |
||||
|
computed: { |
||||
|
maxTableHeight() { |
||||
|
return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeigh : this.clientHeight - 410; |
||||
|
}, |
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
watch: {}, |
||||
|
mounted() { |
||||
|
this.user = this.$store.state.user; |
||||
|
this.agencyId = this.user.agencyId; |
||||
|
this.loadGrid(); |
||||
|
this.loadplaceType(); |
||||
|
this.loadCategory(); |
||||
|
this.getTableData(); |
||||
|
this.loadScale() |
||||
|
}, |
||||
|
methods: { |
||||
|
handleSearch(val) { |
||||
|
console.log(this.formData); |
||||
|
this.pageNo = 1; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
async loadGrid() { |
||||
|
const url = '/gov/org/customergrid/gridoption'; |
||||
|
let params = { |
||||
|
agencyId: this.agencyId, |
||||
|
purpose: 'query' |
||||
|
}; |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
if (code === 0) { |
||||
|
this.gridList = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
//获取规模 |
||||
|
async loadScale () { |
||||
|
const url = "/sys/dict/data/dictlist" |
||||
|
let params = { |
||||
|
dictType: 'scale' |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.scaleList = data |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
//场所类型 |
||||
|
async loadplaceType() { |
||||
|
const url = '/sys/dict/data/dictlist'; |
||||
|
let params = { |
||||
|
dictType: "nine_small_places" |
||||
|
}; |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
if (code === 0) { |
||||
|
this.placeTypeList = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
//设备类型 |
||||
|
async loadCategory() { |
||||
|
const url = '/sys/dict/data/dictlist'; |
||||
|
|
||||
|
let params = { |
||||
|
dictType: 'safety_equipment_category' |
||||
|
}; |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
if (code === 0) { |
||||
|
this.equipmentCategoryCodeArray = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
async handleExport() { |
||||
|
// 导出 |
||||
|
const url = '/actual/base/companyInfo/export'; |
||||
|
const { pageSize, pageNo, formData } = this; |
||||
|
axios({ |
||||
|
url: window.SITE_CONFIG['apiURL'] + url, |
||||
|
method: 'post', |
||||
|
data: { |
||||
|
pageSize, |
||||
|
pageNo, |
||||
|
...formData |
||||
|
}, |
||||
|
responseType: 'blob' |
||||
|
}) |
||||
|
.then(res => { |
||||
|
let fileName = window.decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); |
||||
|
console.log('filename', fileName); |
||||
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }); |
||||
|
var url = window.URL.createObjectURL(blob); |
||||
|
var aLink = document.createElement('a'); |
||||
|
aLink.style.display = 'none'; |
||||
|
aLink.href = url; |
||||
|
aLink.setAttribute('download', fileName); |
||||
|
document.body.appendChild(aLink); |
||||
|
aLink.click(); |
||||
|
document.body.removeChild(aLink); //下载完成移除元素 |
||||
|
window.URL.revokeObjectURL(url); //释放掉blob对象 |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
console.log('获取导出情失败', err); |
||||
|
return this.$message.error('网络错误'); |
||||
|
}); |
||||
|
}, |
||||
|
handleAdd(row, type) { |
||||
|
if (row.id) { |
||||
|
this.detailId = row.id; |
||||
|
this.checkResultFlag = row.checkResultFlag; |
||||
|
} |
||||
|
this.pageType = type; |
||||
|
if (type == 'view') { |
||||
|
this.disabled = true; |
||||
|
} else { |
||||
|
this.disabled = false; |
||||
|
} |
||||
|
this.dialogVisible = true; |
||||
|
}, |
||||
|
handleClose() { |
||||
|
this.dialogVisible = false; |
||||
|
this.pageType = 'list'; |
||||
|
this.detailId = ''; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
handleOk() { |
||||
|
this.pageType = 'list'; |
||||
|
this.detailId = ''; |
||||
|
this.pageNo = 1; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
handleEditSuccess() { |
||||
|
this.handleClose(); |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
async handleDel(rowData) { |
||||
|
let message = '确认删除?'; |
||||
|
this.$confirm(message, '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}) |
||||
|
.then(() => { |
||||
|
this.del(rowData.id); |
||||
|
}) |
||||
|
.catch(err => { }); |
||||
|
}, |
||||
|
async del(id) { |
||||
|
const url = `/actual/base/companyInfo/delete`; |
||||
|
const { data, code, msg } = await requestPost(url, {id}); |
||||
|
if (code === 0) { |
||||
|
this.$message.success('删除成功!'); |
||||
|
this.getTableData(); |
||||
|
} else { |
||||
|
this.$message.error('操作失败!'); |
||||
|
} |
||||
|
}, |
||||
|
async getTableData() { |
||||
|
const url = '/actual/base/companyInfo/page'; |
||||
|
// const url = 'http://yapi.elinkservice.cn/mock/330/actual/base/enterprise/list'; |
||||
|
const { pageSize, pageNo, formData } = this; |
||||
|
const { data, code, msg } = await requestPost(url, { |
||||
|
pageSize, |
||||
|
pageNo, |
||||
|
...formData |
||||
|
}); |
||||
|
if (code === 0) { |
||||
|
this.total = data.total || 0; |
||||
|
this.tableData = data.list |
||||
|
? data.list.map(item => { |
||||
|
return item; |
||||
|
}) |
||||
|
: []; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
handleSizeChange(val) { |
||||
|
this.pageSize = val; |
||||
|
window.localStorage.setItem('pageSize', val); |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
handleCurrentChange(val) { |
||||
|
this.pageNo = val; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
resetSearch() { |
||||
|
this.formData = { |
||||
|
equipmentName: '', |
||||
|
equipmentCategoryCode: '', |
||||
|
principalName: '', |
||||
|
contactNum: '', |
||||
|
address: '' |
||||
|
}; |
||||
|
this.pageNo = 1; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
async handleExportModule() { |
||||
|
let url = '/actual/base/companyInfo/downloadImportTemplate'; |
||||
|
let params = {}; |
||||
|
await this.$http({ |
||||
|
method: 'GET', |
||||
|
url, |
||||
|
responseType: 'blob', |
||||
|
data: params |
||||
|
}) |
||||
|
.then(res => { |
||||
|
// this.download(res.data, title + '.xls') |
||||
|
if (res.headers['content-disposition']) { |
||||
|
let fileName = window.decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); |
||||
|
console.log('filename', fileName); |
||||
|
let blob = new Blob([res.data], { |
||||
|
type: 'application/vnd.ms-excel' |
||||
|
}); |
||||
|
var url = window.URL.createObjectURL(blob); |
||||
|
var aLink = document.createElement('a'); |
||||
|
aLink.style.display = 'none'; |
||||
|
aLink.href = url; |
||||
|
aLink.setAttribute('download', fileName); |
||||
|
document.body.appendChild(aLink); |
||||
|
aLink.click(); |
||||
|
document.body.removeChild(aLink); //下载完成移除元素 |
||||
|
window.URL.revokeObjectURL(url); //释放掉blob对象 |
||||
|
} else this.$message.error('下载失败'); |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
console.log('err', err); |
||||
|
return this.$message.error('网络错误'); |
||||
|
}); |
||||
|
}, |
||||
|
handleExcelSuccess(res, file) { |
||||
|
if (res.code === 0 && res.msg === 'success') { |
||||
|
console.log('resss---ppp', res); |
||||
|
} else { |
||||
|
this.$message.error(res.msg); |
||||
|
} |
||||
|
}, |
||||
|
handleProgress(event, file, fileList) { |
||||
|
console.log('percentage', file.percentage); |
||||
|
}, |
||||
|
|
||||
|
beforeExcelUpload(file) { |
||||
|
console.log('file', file); |
||||
|
const isType = file.type === 'application/vnd.ms-excel'; |
||||
|
const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
||||
|
const fileType = isType || isTypeComputer; |
||||
|
const isLt1M = file.size / 1024 / 1024 < 10; |
||||
|
if (!fileType) { |
||||
|
this.$message.error('上传文件只能是xls/xlsx格式!'); |
||||
|
} |
||||
|
|
||||
|
if (!isLt1M) { |
||||
|
this.$message.error('上传文件大小不能超过 10MB!'); |
||||
|
} |
||||
|
return fileType && isLt1M; |
||||
|
}, |
||||
|
|
||||
|
async uploadHttpRequest(file) { |
||||
|
this.importLoading = true; |
||||
|
this.importBtnTitle = '正在上传中...'; |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
dangerouslyUseHTMLString: true, |
||||
|
message: "导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度", |
||||
|
duration: 3000 |
||||
|
}); |
||||
|
let than = this; |
||||
|
document.getElementById('clickA').addEventListener('click', function () { |
||||
|
than.$router.replace('/main/importRecord-index'); |
||||
|
}); |
||||
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
||||
|
formData.append('file', file.file); //添加文件对象 |
||||
|
// formData.append('code', ''); //添加文件对象 |
||||
|
await this.$http |
||||
|
.post('/actual/base/companyInfo/import', formData) |
||||
|
.then(res => { |
||||
|
console.log('res-up', res); |
||||
|
if (res.data.code == 0 && res.data.msg == 'success') { |
||||
|
console.log(res.data.data); |
||||
|
const data = res.data.data; |
||||
|
|
||||
|
this.dataList = [ |
||||
|
...Object.keys(data.option.exist).map(k => { |
||||
|
return { |
||||
|
index: k, |
||||
|
srcField: data.option.exist[k], |
||||
|
exist: true, |
||||
|
field: data.option.exist[k] |
||||
|
}; |
||||
|
}), |
||||
|
...Object.keys(data.option.notExist).map(k => { |
||||
|
return { |
||||
|
index: k, |
||||
|
srcField: data.option.notExist[k], |
||||
|
exist: false, |
||||
|
field: '' |
||||
|
}; |
||||
|
}) |
||||
|
]; |
||||
|
this.importOption = data.option; |
||||
|
this.importCode = data.code; |
||||
|
this.fileData = file; |
||||
|
} else this.$message.error(res.data.msg); |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
console.log('失败', err); |
||||
|
file.onError(); //上传失败的文件会从文件列表中删除 |
||||
|
// this.$message.error('导入失败') |
||||
|
}); |
||||
|
this.importLoading = false; |
||||
|
this.importBtnTitle = '导入'; |
||||
|
this.$refs.upload.clearFiles(); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import '@/assets/scss/modules/management/list-main.scss'; |
||||
|
|
||||
|
.m-search { |
||||
|
.u-item-width-normal { |
||||
|
width: 200px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue