Browse Source

若干bug

V1.0
tianq 3 years ago
parent
commit
01b4e37d72
  1. 2
      src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/index.vue
  2. 844
      src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/record.vue
  3. 2
      src/views/modules/shequzhili/tuceng/anquan/shebei/index.vue
  4. 910
      src/views/modules/shequzhili/tuceng/anquan/shebei/record.vue
  5. 113
      src/views/modules/shequzhili/tuceng/anquan/yinhuan/addForm.vue
  6. 4
      src/views/modules/shequzhili/tuceng/anquan/yinhuan/index.vue
  7. 12
      src/views/modules/shequzhili/tuceng/anquan/yinhuan/record.vue
  8. 2
      src/views/modules/shequzhili/tuceng/chengshiguanli/index.vue
  9. 2
      src/views/modules/shequzhili/tuceng/gonggongfuwu/index.vue
  10. 2
      src/views/modules/shequzhili/tuceng/yingji/changsuo/index.vue
  11. 2
      src/views/modules/shequzhili/tuceng/yingji/wuzi/index.vue
  12. 903
      src/views/modules/shequzhili/tuceng/yingji/wuzi/record.vue
  13. 3
      src/views/modules/shequzhili/tuceng/yingji/zizuzhi/addForm.vue
  14. 2
      src/views/modules/shequzhili/tuceng/yingji/zizuzhi/index.vue
  15. 2
      src/views/modules/shequzhili/tuceng/zhonghe/shebei/index.vue
  16. 896
      src/views/modules/shequzhili/tuceng/zhonghe/shebei/record.vue

2
src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/index.vue

@ -52,7 +52,7 @@
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

844
src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/record.vue

@ -1,423 +1,423 @@
<template> <template>
<div class="m-record"> <div class="m-record">
<h3>检查记录</h3> <h3>检查记录</h3>
<div> <div>
<!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'"> <!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'">
<el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button> <el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button>
</div> --> </div> -->
<div class="m-table-item"> <div class="m-table-item">
<el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%"> <el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%">
<el-table-column label="序号" type="index" align="center" width="50"></el-table-column> <el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="patrolTime" label="检查时间" align="center" width="200px"> <el-table-column prop="patrolTime" label="检查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.patrolTime" v-model="scope.row.patrolTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.patrolTime }}</div> <div v-else class="div-content">{{ scope.row.patrolTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="staffId" label="检查人员" align="center" width="200px"> <el-table-column prop="staffId" label="检查人员" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.staffId" v-model="scope.row.staffId"
placeholder="请选择" placeholder="请选择"
class="input-width" class="input-width"
@change="handleChangeStaff(scope.row)" @change="handleChangeStaff(scope.row)"
clearable clearable
> >
<el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.staffName }}</div> <div v-else class="div-content">{{ scope.row.staffName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="mobile" label="联系电话" align="center" width="200px"> <el-table-column prop="mobile" label="联系电话" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-if="scope.row.isEdit" type="number" v-model="scope.row.mobile" placeholder="请输入" class="input-width" clearable disabled></el-input> <el-input v-if="scope.row.isEdit" type="number" v-model="scope.row.mobile" placeholder="请输入" class="input-width" clearable disabled></el-input>
<div v-else class="div-content">{{ scope.row.mobile }}</div> <div v-else class="div-content">{{ scope.row.mobile }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="result" label="检查结果" align="center" width="200px"> <el-table-column prop="result" label="检查结果" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-if="scope.row.isEdit" v-model="scope.row.result" placeholder="请选择" class="input-width" size="small" clearable> <el-select v-if="scope.row.isEdit" v-model="scope.row.result" placeholder="请选择" class="input-width" size="small" clearable>
<el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.result == 1 ? '正常' : '异常' }}</div> <div v-else class="div-content">{{ scope.row.result == 1 ? '正常' : '异常' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="detailed" label="隐患明细" align="center" width="200px"> <el-table-column prop="detailed" label="隐患明细" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="text" type="text"
v-model="scope.row.detailed" v-model="scope.row.detailed"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
maxlength="500" maxlength="500"
clearable clearable
></el-input> ></el-input>
<div v-else class="div-content">{{ scope.row.detailed }}</div> <div v-else class="div-content">{{ scope.row.detailed }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="imgList" label="图片列表" align="center"> <el-table-column prop="imgList" label="图片列表" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.isEdit"> <div v-if="scope.row.isEdit">
<el-upload <el-upload
:disabled="scope.row.imgList.length == 3" :disabled="scope.row.imgList.length == 3"
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
class="avatar-uploader" class="avatar-uploader"
:action="uploadUrl" :action="uploadUrl"
:data="{ customerId: customerId }" :data="{ customerId: customerId }"
:show-file-list="true" :show-file-list="true"
:limit="3" :limit="3"
:file-list="scope.row.imgList" :file-list="scope.row.imgList"
:on-success="res => handleImgSuccess(res, scope.row)" :on-success="res => handleImgSuccess(res, scope.row)"
:on-remove="res => handleImgRemove(res, scope.row)" :on-remove="res => handleImgRemove(res, scope.row)"
list-type="picture" list-type="picture"
:before-upload="beforeImgUpload" :before-upload="beforeImgUpload"
> >
<i class="el-icon-plus avatar-uploader-icon"></i> <i class="el-icon-plus avatar-uploader-icon"></i>
最多三张图片 最多三张图片
</el-upload> </el-upload>
</div> </div>
<div v-else class="div-content"> <div v-else class="div-content">
<el-image <el-image
v-if="scope.row.imgList.length > 0" v-if="scope.row.imgList.length > 0"
style="width: 100px; height: 50px" style="width: 100px; height: 50px"
:src="scope.row.imgList[0]" :src="scope.row.imgList[0]"
fit="cover" fit="cover"
:preview-src-list="scope.row.imgList" :preview-src-list="scope.row.imgList"
></el-image> ></el-image>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="reviewTime" label="拟复查时间" align="center" width="200px"> <el-table-column prop="reviewTime" label="拟复查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.reviewTime" v-model="scope.row.reviewTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.reviewTime }}</div> <div v-else class="div-content">{{ scope.row.reviewTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120"> <el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
<el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button> <el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button>
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button> <el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit"> <el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改 修改
</el-button> </el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)"> <el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button> <el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button>
</el-popconfirm> </el-popconfirm>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { requestPost, requestGet } from '@/js/dai/request'; import { requestPost, requestGet } from '@/js/dai/request';
export default { export default {
props: { props: {
id: { id: {
type: String, type: String,
default: '' default: ''
}, },
info: { info: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
}, },
formType: { formType: {
type: String, type: String,
default: '' default: ''
}, },
source: { source: {
//manage visiual //manage visiual
type: String, type: String,
default: 'manage' default: 'manage'
} }
}, },
data() { data() {
return { return {
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
customerId: localStorage.getItem('customerId'), customerId: localStorage.getItem('customerId'),
btnDisabled: false, btnDisabled: false,
btnType: 'cancle', btnType: 'cancle',
isEdit: false, isEdit: false,
tableData: [], tableData: [],
tempRow: {}, tempRow: {},
optionResult: [ optionResult: [
{ {
label: '异常', label: '异常',
value: '0' value: '0'
}, },
{ {
label: '正常', label: '正常',
value: '1' value: '1'
} }
], ],
optionStaff: [ optionStaff: [
// { // {
// label: "", // label: "",
// value: "inspectStaffId", // value: "inspectStaffId",
// }, // },
] ]
}; };
}, },
computed: { computed: {
allowOperate() { allowOperate() {
const { const {
info: { agencyId } info: { agencyId }
} = this; } = this;
return agencyId && agencyId == this.$store.state.user.agencyId; return agencyId && agencyId == this.$store.state.user.agencyId;
} }
}, },
watch: { watch: {
id: { id: {
handler(val) { handler(val) {
if (val.length > 0) { if (val.length > 0) {
this.btnDisabled = false; this.btnDisabled = false;
// this.getList(); // this.getList();
} else this.btnDisabled = true; } else this.btnDisabled = true;
}, },
immediate: true immediate: true
} }
}, },
created() { created() {
this.getOptionStaff(); this.getOptionStaff();
if (this.id) { if (this.id) {
this.getList(); this.getList();
} else { } else {
this.handleAdd(); this.handleAdd();
} }
}, },
methods: { methods: {
beforeImgUpload(file) { beforeImgUpload(file) {
console.log(file); console.log(file);
const isLt1M = file.size / 1024 / 1024 < 10; const isLt1M = file.size / 1024 / 1024 < 10;
const srcType = file.type; const srcType = file.type;
const format = file.name.split('.').pop(); const format = file.name.split('.').pop();
if (!isLt1M) { if (!isLt1M) {
this.$message.error('上传文件大小不能超过 10MB!'); this.$message.error('上传文件大小不能超过 10MB!');
return false; return false;
} }
if (srcType.indexOf('image') == -1) { if (srcType.indexOf('image') == -1) {
this.$message.error('仅限图片格式'); this.$message.error('仅限图片格式');
return false; return false;
} }
return true; return true;
}, },
handleImgSuccess(res, row) { handleImgSuccess(res, row) {
if (res.code === 0 && res.msg === 'success') { if (res.code === 0 && res.msg === 'success') {
row.imgList.push(res.data.url); row.imgList.push(res.data.url);
this.computeImgShowList(row); this.computeImgShowList(row);
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}, },
computeImgShowList(row) { computeImgShowList(row) {
row.imgShowList = row.imgList.map(url => { row.imgShowList = row.imgList.map(url => {
return { name: '', url }; return { name: '', url };
}); });
}, },
handleImgRemove(file, row) { handleImgRemove(file, row) {
let url = file.url || file.response.data.url; let url = file.url || file.response.data.url;
if (url) { if (url) {
row.imgList = row.imgList.filter(item => item !== url); row.imgList = row.imgList.filter(item => item !== url);
this.computeImgShowList(row); this.computeImgShowList(row);
} }
}, },
getRowClass({ rowIndex, columnIndex }) { getRowClass({ rowIndex, columnIndex }) {
if (rowIndex === 0) { if (rowIndex === 0) {
return 'background: #2195fe; color: #fff;'; return 'background: #2195fe; color: #fff;';
} }
}, },
handleChange(row, type) { handleChange(row, type) {
if (type == 'cancle') { if (type == 'cancle') {
row = { ...this.tempRow }; row = { ...this.tempRow };
row.isEdit = false; row.isEdit = false;
if (this.btnType == 'add') this.tableData.pop(); if (this.btnType == 'add') this.tableData.pop();
this.getList(); this.getList();
} else { } else {
this.tempRow = { ...row }; this.tempRow = { ...row };
row.isEdit = true; row.isEdit = true;
} }
this.btnType = type; this.btnType = type;
this.isEdit = !this.isEdit; this.isEdit = !this.isEdit;
}, },
handleChangeStaff(row) { handleChangeStaff(row) {
const { staffId } = row; const { staffId } = row;
const { optionStaff } = this; const { optionStaff } = this;
let item = optionStaff.find(item => item.value == staffId); let item = optionStaff.find(item => item.value == staffId);
if (item) { if (item) {
row.staffName = item.name; row.staffName = item.name;
row.mobile = item.mobile; row.mobile = item.mobile;
} }
}, },
async getOptionStaff() { async getOptionStaff() {
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`; let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`;
const { data, code, msg } = await requestPost(url, {}); const { data, code, msg } = await requestPost(url, {});
if (code === 0) { if (code === 0) {
this.optionStaff = data || []; this.optionStaff = data || [];
} else { } else {
this.$message.error('请求工作人员数据失败!'); this.$message.error('请求工作人员数据失败!');
} }
}, },
async handleEdit(row) { async handleEdit(row) {
// if (row.result == '0' && row.reviewTime == '') { // if (row.result == '0' && row.reviewTime == '') {
// this.$message.error(''); // this.$message.error('');
// } else { // } else {
// if (this.id) { // if (this.id) {
// console.log('id'); // console.log('id');
// if (this.btnType == 'add') this.save(row); // if (this.btnType == 'add') this.save(row);
// else this.edit(row); // else this.edit(row);
// } else { // } else {
// this.$message.error(''); // this.$message.error('');
// } // }
// } // }
if (this.id) { if (this.id) {
console.log('有id'); console.log('有id');
if (this.btnType == 'add') this.save(row); if (this.btnType == 'add') this.save(row);
else this.edit(row); else this.edit(row);
} else { } else {
this.$message.error('请先保存上方信息'); this.$message.error('请先保存上方信息');
} }
}, },
handleAdd() { handleAdd() {
this.btnType = 'add'; this.btnType = 'add';
this.isEdit = true; this.isEdit = true;
const item = { const item = {
isEdit: true, isEdit: true,
enterpriseId: this.id, enterpriseId: this.id,
patrolTime: '', patrolTime: '',
staffId: '', staffId: '',
staffName: '', staffName: '',
mobile: '', mobile: '',
result: '', result: '',
reviewTime: '', reviewTime: '',
imgList: [] imgList: []
}; };
this.computeImgShowList(item); this.computeImgShowList(item);
this.tableData.push(item); if (!this.disabled) { this.tableData.push(item); }
}, },
async save(row) { async save(row) {
const params = { const params = {
enterpriseId: this.id, enterpriseId: this.id,
...row ...row
}; };
const url = `/actual/base/enterprise/addorupdate-patrol`; const url = `/actual/base/enterprise/addorupdate-patrol`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.btnType = 'cancle'; this.btnType = 'cancle';
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async edit(row) { async edit(row) {
const params = { const params = {
...row ...row
}; };
const url = `/actual/base/enterprise/addorupdate-patrol`; const url = `/actual/base/enterprise/addorupdate-patrol`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async del(row) { async del(row) {
const url = `/actual/base/enterprise/del-patrol/${row.patrolId}`; const url = `/actual/base/enterprise/del-patrol/${row.patrolId}`;
const { data, code, msg } = await requestPost(url); const { data, code, msg } = await requestPost(url);
if (code === 0) { if (code === 0) {
this.$message.success('删除成功'); this.$message.success('删除成功');
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async getList() { async getList() {
const url = `/actual/base/enterprise/patrollist/${this.id}`; const url = `/actual/base/enterprise/patrollist/${this.id}`;
console.log('getList---------------------------------------------------------------------------', url); console.log('getList---------------------------------------------------------------------------', url);
const { data, code, msg } = await requestPost(url); const { data, code, msg } = await requestPost(url);
if (code === 0) { if (code === 0) {
console.log('data', data); console.log('data', data);
this.tableData = data.list.map(item => { this.tableData = data.list.map(item => {
this.computeImgShowList(item); this.computeImgShowList(item);
return { return {
...item, ...item,
isEdit: false isEdit: false
}; };
}); });
this.handleAdd(); this.handleAdd();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/assets/scss/buttonstyle.scss'; @import '@/assets/scss/buttonstyle.scss';
@import '@/assets/scss/modules/management/list-main.scss'; @import '@/assets/scss/modules/management/list-main.scss';
.mt10 { .mt10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
.input-width { .input-width {
width: 170px; width: 170px;
} }
</style> </style>

2
src/views/modules/shequzhili/tuceng/anquan/shebei/index.vue

@ -30,7 +30,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

910
src/views/modules/shequzhili/tuceng/anquan/shebei/record.vue

@ -1,456 +1,456 @@
<template> <template>
<div class="m-record"> <div class="m-record">
<h3>检查记录</h3> <h3>检查记录</h3>
<div> <div>
<!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'"> <!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'">
<el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button> <el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button>
</div> --> </div> -->
<div class="m-table-item"> <div class="m-table-item">
<el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%"> <el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%">
<el-table-column label="序号" type="index" align="center" width="50"></el-table-column> <el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="inspectTime" label="检查时间" align="center" width="200px"> <el-table-column prop="inspectTime" label="检查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectTime" v-model="scope.row.inspectTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.inspectTime }}</div> <div v-else class="div-content">{{ scope.row.inspectTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px"> <el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectStaffId" v-model="scope.row.inspectStaffId"
placeholder="请选择" placeholder="请选择"
class="input-width" class="input-width"
@change="handleChangeStaff(scope.row)" @change="handleChangeStaff(scope.row)"
clearable clearable
> >
<el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectStaffName }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px"> <el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="number" type="number"
v-model="scope.row.inspectStaffMobile" v-model="scope.row.inspectStaffMobile"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
clearable clearable
disabled disabled
></el-input> ></el-input>
<div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectResult" label="检查结果" align="center" width="200px"> <el-table-column prop="inspectResult" label="检查结果" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable> <el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable>
<el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div> <div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="detailed" prop="detailed"
label="隐患明细" label="隐患明细"
align="center" align="center"
width="200px" width="200px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="text" type="text"
v-model="scope.row.detailed" v-model="scope.row.detailed"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
maxlength="500" maxlength="500"
clearable clearable
></el-input> ></el-input>
<div v-else class="div-content"> <div v-else class="div-content">
{{ scope.row.detailed }} {{ scope.row.detailed }}
</div> </div>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column prop="imgList" label="图片列表" align="center" width="150px"> <el-table-column prop="imgList" label="图片列表" align="center" width="150px">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.isEdit"> <div v-if="scope.row.isEdit">
<el-upload <el-upload
:disabled="scope.row.imgList.length == 3" :disabled="scope.row.imgList.length == 3"
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
class="avatar-uploader" class="avatar-uploader"
:action="uploadUrl" :action="uploadUrl"
:data="{ customerId: customerId }" :data="{ customerId: customerId }"
:show-file-list="true" :show-file-list="true"
:limit="3" :limit="3"
:file-list="scope.row.imgShowList" :file-list="scope.row.imgShowList"
:on-success="res => handleImgSuccess(res, scope.row)" :on-success="res => handleImgSuccess(res, scope.row)"
:on-remove="res => handleImgRemove(res, scope.row)" :on-remove="res => handleImgRemove(res, scope.row)"
list-type="picture" list-type="picture"
:before-upload="beforeImgUpload" :before-upload="beforeImgUpload"
> >
<i class="el-icon-plus avatar-uploader-icon"></i> <i class="el-icon-plus avatar-uploader-icon"></i>
最多三张图片 最多三张图片
</el-upload> </el-upload>
</div> </div>
<div v-else class="div-content"> <div v-else class="div-content">
<el-image <el-image
v-if="scope.row.imgList.length > 0" v-if="scope.row.imgList.length > 0"
style="width: 100px; height: 50px" style="width: 100px; height: 50px"
:src="scope.row.imgList[0]" :src="scope.row.imgList[0]"
fit="cover" fit="cover"
:preview-src-list="scope.row.imgList" :preview-src-list="scope.row.imgList"
></el-image> ></el-image>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px"> <el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.nextInspectTime" v-model="scope.row.nextInspectTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.nextInspectTime }}</div> <div v-else class="div-content">{{ scope.row.nextInspectTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120"> <el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
<el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button> <el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button>
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button> <el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit"> <el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改 修改
</el-button> </el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)"> <el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button> <el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button>
</el-popconfirm> </el-popconfirm>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { requestPost, requestGet } from '@/js/dai/request'; import { requestPost, requestGet } from '@/js/dai/request';
export default { export default {
props: { props: {
id: { id: {
type: String, type: String,
default: '' default: ''
}, },
info: { info: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
}, },
formType: { formType: {
type: String, type: String,
default: '' default: ''
}, },
source: { source: {
//manage visiual //manage visiual
type: String, type: String,
default: 'manage' default: 'manage'
} }
}, },
data() { data() {
return { return {
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
customerId: localStorage.getItem('customerId'), customerId: localStorage.getItem('customerId'),
btnDisabled: false, btnDisabled: false,
btnType: 'cancle', btnType: 'cancle',
isEdit: false, isEdit: false,
tableData: [], tableData: [],
tempRow: {}, tempRow: {},
optionResult: [ optionResult: [
{ {
label: '异常', label: '异常',
value: '0' value: '0'
}, },
{ {
label: '正常', label: '正常',
value: '1' value: '1'
} }
], ],
optionStaff: [ optionStaff: [
// { // {
// label: "", // label: "",
// value: "inspectStaffId", // value: "inspectStaffId",
// }, // },
] ]
}; };
}, },
computed: { computed: {
allowOperate() { allowOperate() {
const { const {
info: { agencyId } info: { agencyId }
} = this; } = this;
return agencyId && agencyId == this.$store.state.user.agencyId; return agencyId && agencyId == this.$store.state.user.agencyId;
} }
}, },
watch: { watch: {
id: { id: {
handler(val) { handler(val) {
console.log('val------points', val); console.log('val------points', val);
if (val.length > 0) { if (val.length > 0) {
this.btnDisabled = false; this.btnDisabled = false;
// this.getList(); // this.getList();
} else this.btnDisabled = true; } else this.btnDisabled = true;
}, },
immediate: true immediate: true
} }
}, },
created() { created() {
console.log('id', this.id); console.log('id', this.id);
this.getOptionStaff(); this.getOptionStaff();
if (this.id) { if (this.id) {
this.getList(); this.getList();
} else { } else {
this.handleAdd(); this.handleAdd();
} }
}, },
methods: { methods: {
beforeImgUpload(file) { beforeImgUpload(file) {
console.log(file); console.log(file);
const isLt1M = file.size / 1024 / 1024 < 10; const isLt1M = file.size / 1024 / 1024 < 10;
const srcType = file.type; const srcType = file.type;
const format = file.name.split('.').pop(); const format = file.name.split('.').pop();
if (!isLt1M) { if (!isLt1M) {
this.$message.error('上传文件大小不能超过 10MB!'); this.$message.error('上传文件大小不能超过 10MB!');
return false; return false;
} }
if (srcType.indexOf('image') == -1) { if (srcType.indexOf('image') == -1) {
this.$message.error('仅限图片格式'); this.$message.error('仅限图片格式');
return false; return false;
} }
return true; return true;
}, },
handleImgSuccess(res, row) { handleImgSuccess(res, row) {
console.log('handleImgSuccess', res); console.log('handleImgSuccess', res);
if (res.code === 0 && res.msg === 'success') { if (res.code === 0 && res.msg === 'success') {
row.imgList.push(res.data.url); row.imgList.push(res.data.url);
this.computeImgShowList(row); this.computeImgShowList(row);
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}, },
computeImgShowList(row) { computeImgShowList(row) {
row.imgShowList = row.imgList.map(url => { row.imgShowList = row.imgList.map(url => {
return { name: '', url }; return { name: '', url };
}); });
}, },
handleImgRemove(file, row) { handleImgRemove(file, row) {
console.log('handleImgRemove', file); console.log('handleImgRemove', file);
let url = file.url || file.response.data.url; let url = file.url || file.response.data.url;
if (url) { if (url) {
row.imgList = row.imgList.filter(item => item !== url); row.imgList = row.imgList.filter(item => item !== url);
this.computeImgShowList(row); this.computeImgShowList(row);
} }
}, },
getRowClass({ rowIndex, columnIndex }) { getRowClass({ rowIndex, columnIndex }) {
if (rowIndex === 0) { if (rowIndex === 0) {
return 'background: #2195fe; color: #fff;'; return 'background: #2195fe; color: #fff;';
} }
}, },
handleChange(row, type) { handleChange(row, type) {
console.log('type----', type); console.log('type----', type);
if (type == 'cancle') { if (type == 'cancle') {
row = { ...this.tempRow }; row = { ...this.tempRow };
row.isEdit = false; row.isEdit = false;
if (this.btnType == 'add') this.tableData.pop(); if (this.btnType == 'add') this.tableData.pop();
this.getList(); this.getList();
console.log('row----', row); console.log('row----', row);
} else { } else {
this.tempRow = { ...row }; this.tempRow = { ...row };
row.isEdit = true; row.isEdit = true;
} }
this.btnType = type; this.btnType = type;
this.isEdit = !this.isEdit; this.isEdit = !this.isEdit;
}, },
handleChangeStaff(row) { handleChangeStaff(row) {
const { inspectStaffId } = row; const { inspectStaffId } = row;
const { optionStaff } = this; const { optionStaff } = this;
let item = optionStaff.find(item => item.value == inspectStaffId); let item = optionStaff.find(item => item.value == inspectStaffId);
if (item) { if (item) {
row.inspectStaffName = item.name; row.inspectStaffName = item.name;
row.inspectStaffMobile = item.mobile; row.inspectStaffMobile = item.mobile;
} }
}, },
async getOptionStaff() { async getOptionStaff() {
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`; let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`;
const { data, code, msg } = await requestPost(url, {}); const { data, code, msg } = await requestPost(url, {});
if (code === 0) { if (code === 0) {
this.optionStaff = data || []; this.optionStaff = data || [];
} else { } else {
this.$message.error('请求工作人员数据失败!'); this.$message.error('请求工作人员数据失败!');
} }
}, },
async handleEdit(row) { async handleEdit(row) {
// if (row.result == '0' && row.reviewTime == '') { // if (row.result == '0' && row.reviewTime == '') {
// this.$message.error(''); // this.$message.error('');
// } else { // } else {
// if (this.id) { // if (this.id) {
// console.log('id'); // console.log('id');
// if (this.btnType == 'add') this.save(row); // if (this.btnType == 'add') this.save(row);
// else this.edit(row); // else this.edit(row);
// } else { // } else {
// this.$message.error(''); // this.$message.error('');
// } // }
// } // }
if (this.id) { if (this.id) {
console.log('有id'); console.log('有id');
if (this.btnType == 'add') this.save(row); if (this.btnType == 'add') this.save(row);
else this.edit(row); else this.edit(row);
} else { } else {
this.$message.error('请先保存上方信息'); this.$message.error('请先保存上方信息');
} }
}, },
handleAdd() { handleAdd() {
this.btnType = 'add'; this.btnType = 'add';
this.isEdit = true; this.isEdit = true;
const item = { const item = {
isEdit: true, isEdit: true,
// id: this.id, // id: this.id,
inspectTime: '', inspectTime: '',
inspectStaffId: '', inspectStaffId: '',
inspectStaffName: '', inspectStaffName: '',
inspectStaffMobile: '', inspectStaffMobile: '',
inspectResult: '', inspectResult: '',
imgList: [], imgList: [],
nextInspectTime: '' nextInspectTime: ''
}; };
this.computeImgShowList(item); this.computeImgShowList(item);
this.tableData.push(item); if (!this.disabled) { this.tableData.push(item); }
}, },
async save(row) { async save(row) {
console.log(row, this.id); console.log(row, this.id);
const params = { const params = {
equipmentId: this.id, equipmentId: this.id,
...row ...row
}; };
const url = `/actual/base/safetyEquipmentInspectRecord/save`; const url = `/actual/base/safetyEquipmentInspectRecord/save`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.btnType = 'cancle'; this.btnType = 'cancle';
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async edit(row) { async edit(row) {
console.log(row, this.id); console.log(row, this.id);
const params = { const params = {
...row ...row
}; };
const url = `/actual/base/safetyEquipmentInspectRecord/update`; const url = `/actual/base/safetyEquipmentInspectRecord/update`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async del(row) { async del(row) {
let arr = [row.id]; let arr = [row.id];
const url = `/actual/base/safetyEquipmentInspectRecord/delete`; const url = `/actual/base/safetyEquipmentInspectRecord/delete`;
const { data, code, msg } = await requestPost(url, arr); const { data, code, msg } = await requestPost(url, arr);
if (code === 0) { if (code === 0) {
this.$message.success('删除成功'); this.$message.success('删除成功');
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async getList() { async getList() {
const params = { const params = {
equipmentId: this.id, equipmentId: this.id,
pageNo: 1, pageNo: 1,
pageSize: 10000 pageSize: 10000
}; };
const url = `/actual/base/safetyEquipmentInspectRecord/page`; const url = `/actual/base/safetyEquipmentInspectRecord/page`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.tableData = data.list.map(item => { this.tableData = data.list.map(item => {
this.computeImgShowList(item); this.computeImgShowList(item);
return { return {
...item, ...item,
isEdit: false isEdit: false
}; };
}); });
this.handleAdd(); this.handleAdd();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/assets/scss/buttonstyle.scss'; @import '@/assets/scss/buttonstyle.scss';
@import '@/assets/scss/modules/management/list-main.scss'; @import '@/assets/scss/modules/management/list-main.scss';
.mt10 { .mt10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
.input-width { .input-width {
width: 170px; width: 170px;
} }
</style> </style>

113
src/views/modules/shequzhili/tuceng/anquan/yinhuan/addForm.vue

@ -17,7 +17,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="隐患场所" prop="dangerPlaceName"> <el-form-item label="隐患场所" prop="dangerPlaceName">
<el-input v-model="formData.dangerPlaceName" class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input> <el-input v-model="formData.dangerPlaceName" class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -42,34 +42,38 @@
placeholder="请输入" placeholder="请输入"
></el-input> ></el-input>
<div v-if="pageType != 'view'"> <div v-if="pageType != 'view'" style="margin-top:10px">
<!-- :data="{ customerId: customerId }" --> <!-- :data="{ customerId: customerId }" -->
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
class="avatar-uploader" class="avatar-uploader"
:action="uploadUrl" :action="uploadUrl"
:data="{ customerId: customerId }"
:show-file-list="true" :show-file-list="true"
:limit="3"
:file-list="formData.imgList" :file-list="formData.imgList"
:on-success="res => handleImgSuccess(res, formData)" :on-preview="handleImgPreview"
:on-remove="res => handleImgRemove(res, formData)" :on-success="handleImgSuccess"
list-type="picture" :on-remove="handleImgRemove"
:on-exceed="handleImgExceed"
:before-upload="beforeImgUpload" :before-upload="beforeImgUpload"
list-type="picture-card"
:limit="3"
> >
<i class="el-icon-plus avatar-uploader-icon"></i> <i class="el-icon-plus avatar-uploader-icon"></i>
最多三张图片 最多三张图片
</el-upload> </el-upload>
</div> </div>
<!-- {{ formData.imgList }} -->
<div class="div-content" v-if="pageType != 'add'"> <!-- <div class="div-content" v-if="pageType != 'add'">
<el-image <el-image
v-if="formData.imgList.length > 0" v-if="formData.imgList.length > 0"
style="width: 100px; height: 50px" style="width: 100px; height: 50px"
:src="formData.imgList[0]" :src="formData.imgList[0].url"
fit="cover" fit="cover"
:preview-src-list="formData.imgList" :preview-src-list="formData.imgList.url"
></el-image> ></el-image>
</div> </div> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -226,7 +230,7 @@ export default {
} }
}; };
return { return {
detailIdcopy:this.detailId, detailIdcopy: this.detailId,
btnDisable: false, btnDisable: false,
user: '', user: '',
agencyId: '', agencyId: '',
@ -260,7 +264,8 @@ export default {
searchValue: '', searchValue: '',
searchOptions: [], searchOptions: [],
resultList: [], resultList: [],
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2' uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
customerId: localStorage.getItem('customerId')
}; };
}, },
watch: {}, watch: {},
@ -283,6 +288,59 @@ export default {
}, },
methods: { methods: {
// handleImgSuccess(res, row) {
// if (res.code === 0 && res.msg === 'success') {
// row.imgList.push(res.data.url);
// this.computeImgShowList(row);
// } else {
// this.$message.error(res.msg);
// }
// },
handleImgSuccess(res, file, fileList) {
console.log('handleImgSuccess', file);
if (res.code === 0 && res.msg === 'success') {
let format = file.name.split('.').pop();
let srcType = file.raw.type;
let type = 'file';
console.log('==============================srcType: ', srcType);
if (srcType.indexOf('image') != -1) {
type = 'image';
} else if (srcType.indexOf('video') != -1) {
type = 'video';
}
this.formData.imgList.push({
format,
name: file.name,
size: file.size,
type,
url: res.data.url
});
console.log(this.formData.imgList);
} else {
this.$message.error(res.msg);
}
},
handleImgRemove(file) {
console.log('handleImgRemove', file);
if (file.response) {
let index = this.formData.imgList.findIndex(item => item.url == file.response.data.url);
this.formData.imgList.splice(index, 1);
} else if (file.url) {
let index = this.formData.imgList.findIndex(item => item.url == file.url);
this.formData.imgList.splice(index, 1);
}
},
handleImgPreview(file) {
console.log(file);
window.open(file.url || file.response.data.url);
},
handleImgExceed() {
this.$message({
type: 'warning',
message: '文件数量最多不超过三个'
});
},
async loadGrid() { async loadGrid() {
const url = '/gov/org/customergrid/gridoption'; const url = '/gov/org/customergrid/gridoption';
let params = { let params = {
@ -303,6 +361,9 @@ export default {
if (code === 0) { if (code === 0) {
console.log('详情数据', data); console.log('详情数据', data);
this.formData = { ...data }; this.formData = { ...data };
this.formData.imgList = this.formData.imgList.map(item => {
return { url: item, name: "" };
});
this.initMap(); this.initMap();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
@ -340,6 +401,9 @@ export default {
async save() { async save() {
console.log('this.formData', this.formData); console.log('this.formData', this.formData);
this.formData.imgList = this.formData.imgList.map(item => {
return item.url;
});
var url = ''; var url = '';
var params = {}; var params = {};
if (this.pageType == 'add') { if (this.pageType == 'add') {
@ -465,21 +529,14 @@ export default {
this.formData.longitude = lonlat[0]; this.formData.longitude = lonlat[0];
this.formData.location = selPosition.address + selPosition.name; this.formData.location = selPosition.address + selPosition.name;
}, },
handleImgSuccess(res, row) {
if (res.code === 0 && res.msg === 'success') { // handleImgRemove(file, row) {
row.imgList.push(res.data.url); // let url = file.url || file.response.data.url;
this.computeImgShowList(row); // if (url) {
} else { // row.imgList = row.imgList.filter(item => item !== url);
this.$message.error(res.msg); // this.computeImgShowList(row);
} // }
}, // },
handleImgRemove(file, row) {
let url = file.url || file.response.data.url;
if (url) {
row.imgList = row.imgList.filter(item => item !== url);
this.computeImgShowList(row);
}
},
beforeImgUpload(file) { beforeImgUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10; const isLt1M = file.size / 1024 / 1024 < 10;

4
src/views/modules/shequzhili/tuceng/anquan/yinhuan/index.vue

@ -42,7 +42,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"
@ -159,7 +159,7 @@ export default {
placeTypeList: [], // placeTypeList: [], //
tableData: [], tableData: [],
resultArray: [{ value: '0', label: '合格' }, { value: '1', label: '不合格' }], resultArray: [{ value: '0', label: '合格' }, { value: '1', label: '不合格' }],
handleStateArray: [{ value: '0', label: '待处理' }, { value: '1', label: '处理完成' }], handleStateArray: [{ value: '0', label: '待处理' }, { value: '1', label: '已处理' },{ value: '2', label: '处理中' }],
pageNo: 1, pageNo: 1,
pageSize: window.localStorage.getItem('pageSize') || 20, pageSize: window.localStorage.getItem('pageSize') || 20,
total: 1, total: 1,

12
src/views/modules/shequzhili/tuceng/anquan/yinhuan/record.vue

@ -113,8 +113,12 @@ export default {
value: '0' value: '0'
}, },
{ {
label: '处理完成', label: '处理',
value: '1' value: '1'
},
{
label: '处理中',
value: '2'
} }
], ],
optionStaff: [ optionStaff: [
@ -251,7 +255,6 @@ export default {
} else { } else {
this.$message.error('请先保存上方信息'); this.$message.error('请先保存上方信息');
} }
}, },
handleAdd() { handleAdd() {
@ -266,7 +269,9 @@ export default {
handleTime: '' handleTime: ''
}; };
// this.computeImgShowList(item); // this.computeImgShowList(item);
this.tableData.push(item); if (!this.disabled) {
this.tableData.push(item);
}
}, },
async save(row) { async save(row) {
@ -332,6 +337,7 @@ export default {
isEdit: false isEdit: false
}; };
}); });
this.handleAdd(); this.handleAdd();
} else { } else {
this.$message.error(msg); this.$message.error(msg);

2
src/views/modules/shequzhili/tuceng/chengshiguanli/index.vue

@ -36,7 +36,7 @@
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

2
src/views/modules/shequzhili/tuceng/gonggongfuwu/index.vue

@ -28,7 +28,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

2
src/views/modules/shequzhili/tuceng/yingji/changsuo/index.vue

@ -28,7 +28,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

2
src/views/modules/shequzhili/tuceng/yingji/wuzi/index.vue

@ -37,7 +37,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

903
src/views/modules/shequzhili/tuceng/yingji/wuzi/record.vue

@ -1,454 +1,451 @@
<template> <template>
<div class="m-record"> <div class="m-record">
<h3>检查记录</h3> <h3>检查记录</h3>
<div> <div>
<!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'"> <!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'">
<el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button> <el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button>
</div> --> </div> -->
<div class="m-table-item"> <div class="m-table-item">
<el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%"> <el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%">
<el-table-column label="序号" type="index" align="center" width="50"></el-table-column> <el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="inspectTime" label="检查时间" align="center" width="200px"> <el-table-column prop="inspectTime" label="检查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectTime" v-model="scope.row.inspectTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.inspectTime }}</div> <div v-else class="div-content">{{ scope.row.inspectTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px"> <el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectStaffId" v-model="scope.row.inspectStaffId"
placeholder="请选择" placeholder="请选择"
class="input-width" class="input-width"
@change="handleChangeStaff(scope.row)" @change="handleChangeStaff(scope.row)"
clearable clearable
> >
<el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectStaffName }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px"> <el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="number" type="number"
v-model="scope.row.inspectStaffMobile" v-model="scope.row.inspectStaffMobile"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
clearable clearable
disabled disabled
></el-input> ></el-input>
<div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectResult" label="检查结果" align="center" width="200px"> <el-table-column prop="inspectResult" label="检查结果" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable> <el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable>
<el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div> <div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="detailed" prop="detailed"
label="隐患明细" label="隐患明细"
align="center" align="center"
width="200px" width="200px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="text" type="text"
v-model="scope.row.detailed" v-model="scope.row.detailed"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
maxlength="500" maxlength="500"
clearable clearable
></el-input> ></el-input>
<div v-else class="div-content"> <div v-else class="div-content">
{{ scope.row.detailed }} {{ scope.row.detailed }}
</div> </div>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column prop="imgList" label="图片列表" align="center" width="150px"> <el-table-column prop="imgList"
<template slot-scope="scope"> label="图片列表"
<div v-if="scope.row.isEdit"> align="center"
<el-upload width="150px">
:disabled="scope.row.imgList.length == 3" <template slot-scope="scope">
:headers="$getElUploadHeaders()" <div v-if="scope.row.isEdit">
class="avatar-uploader" <el-upload :headers="$getElUploadHeaders()" class="avatar-uploader"
:action="uploadUrl" :action="uploadUrl"
:data="{ customerId: customerId }" :data="{ customerId: customerId }"
:show-file-list="true" :show-file-list="true"
:limit="3" :limit="3"
:file-list="scope.row.imgList" :file-list="scope.row.imgShowList"
:on-success="res => handleImgSuccess(res, scope.row)" :on-success="(res) => handleImgSuccess(res, scope.row)"
:on-remove="res => handleImgRemove(res, scope.row)" :on-remove="(res) => handleImgRemove(res, scope.row)"
list-type="picture" list-type="picture"
:before-upload="beforeImgUpload" :before-upload="beforeImgUpload">
> <i class="el-icon-plus avatar-uploader-icon"></i> 最多三张图片
<i class="el-icon-plus avatar-uploader-icon"></i> </el-upload>
最多三张图片 </div>
</el-upload>
</div> <div v-else
class="div-content">
<div v-else class="div-content"> <el-image v-if="scope.row.imgList.length > 0"
<el-image style="width: 100px; height: 50px"
v-if="scope.row.imgList.length > 0" :src="scope.row.imgList[0]"
style="width: 100px; height: 50px" fit="cover"
:src="scope.row.imgList[0]" :preview-src-list="scope.row.imgList"></el-image>
fit="cover" </div>
:preview-src-list="scope.row.imgList" </template>
></el-image> </el-table-column>
</div>
</template> <el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px">
</el-table-column> <template slot-scope="scope">
<el-date-picker
<el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px"> v-if="scope.row.isEdit"
<template slot-scope="scope"> v-model="scope.row.nextInspectTime"
<el-date-picker type="date"
v-if="scope.row.isEdit" class="input-width"
v-model="scope.row.nextInspectTime" value-format="yyyy-MM-dd"
type="date" placeholder="选择日期"
class="input-width" ></el-date-picker>
value-format="yyyy-MM-dd" <div v-else class="div-content">{{ scope.row.nextInspectTime }}</div>
placeholder="选择日期" </template>
></el-date-picker> </el-table-column>
<div v-else class="div-content">{{ scope.row.nextInspectTime }}</div>
</template> <el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120">
</el-table-column> <template slot-scope="scope">
<template v-if="scope.row.isEdit">
<el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120"> <el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button>
<template slot-scope="scope"> <el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
<template v-if="scope.row.isEdit"> </template>
<el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button> <template v-else>
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button> <el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
</template> 修改
<template v-else> </el-button>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit"> <el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
修改 <el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button>
</el-button> </el-popconfirm>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)"> </template>
<el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button> </template>
</el-popconfirm> </el-table-column>
</template> </el-table>
</template> </div>
</el-table-column> </div>
</el-table> </div>
</div> </template>
</div>
</div> <script>
</template> import { requestPost, requestGet } from '@/js/dai/request';
export default {
<script> props: {
import { requestPost, requestGet } from '@/js/dai/request'; id: {
export default { type: String,
props: { default: ''
id: { },
type: String, info: {
default: '' type: Object,
}, default: () => ({})
info: { },
type: Object, disabled: {
default: () => ({}) type: Boolean,
}, default: false
disabled: { },
type: Boolean, formType: {
default: false type: String,
}, default: ''
formType: { },
type: String, source: {
default: '' //manage visiual
}, type: String,
source: { default: 'manage'
//manage visiual }
type: String, },
default: 'manage' data() {
} return {
}, uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
data() { customerId: localStorage.getItem('customerId'),
return {
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', btnDisabled: false,
customerId: localStorage.getItem('customerId'), btnType: 'cancle',
isEdit: false,
btnDisabled: false, tableData: [],
btnType: 'cancle', tempRow: {},
isEdit: false,
tableData: [], optionResult: [
tempRow: {}, {
label: '异常',
optionResult: [ value: '0'
{ },
label: '异常', {
value: '0' label: '正常',
}, value: '1'
{ }
label: '正常', ],
value: '1' optionStaff: [
} // {
], // label: "",
optionStaff: [ // value: "inspectStaffId",
// { // },
// label: "", ]
// value: "inspectStaffId", };
// }, },
]
}; computed: {
}, allowOperate() {
const {
computed: { info: { agencyId }
allowOperate() { } = this;
const { return agencyId && agencyId == this.$store.state.user.agencyId;
info: { agencyId } }
} = this; },
return agencyId && agencyId == this.$store.state.user.agencyId; watch: {
} id: {
}, handler(val) {
watch: { console.log('val------points', val);
id: { if (val.length > 0) {
handler(val) { this.btnDisabled = false;
console.log('val------points', val); // this.getList();
if (val.length > 0) { } else this.btnDisabled = true;
this.btnDisabled = false; },
// this.getList(); immediate: true
} else this.btnDisabled = true; }
}, },
immediate: true
} created() {
}, console.log('id', this.id);
this.getOptionStaff();
created() { if (this.id) {
console.log('id', this.id); this.getList();
this.getOptionStaff(); } else {
if (this.id) { this.handleAdd();
this.getList(); }
} else { },
this.handleAdd();
} methods: {
}, beforeImgUpload(file) {
console.log(file);
methods: { const isLt1M = file.size / 1024 / 1024 < 10;
beforeImgUpload(file) { const srcType = file.type;
console.log(file); const format = file.name.split('.').pop();
const isLt1M = file.size / 1024 / 1024 < 10;
const srcType = file.type; if (!isLt1M) {
const format = file.name.split('.').pop(); this.$message.error('上传文件大小不能超过 10MB!');
return false;
if (!isLt1M) { }
this.$message.error('上传文件大小不能超过 10MB!'); if (srcType.indexOf('image') == -1) {
return false; this.$message.error('仅限图片格式');
} return false;
if (srcType.indexOf('image') == -1) { }
this.$message.error('仅限图片格式'); return true;
return false; },
}
return true; handleImgSuccess(res, row) {
}, console.log('handleImgSuccess', res);
if (res.code === 0 && res.msg === 'success') {
handleImgSuccess(res, row) { row.imgList.push(res.data.url);
console.log('handleImgSuccess', res); this.computeImgShowList(row);
if (res.code === 0 && res.msg === 'success') { } else {
row.imgList.push(res.data.url); this.$message.error(res.msg);
this.computeImgShowList(row); }
} else { },
this.$message.error(res.msg);
} computeImgShowList(row) {
}, row.imgShowList = row.imgList.map(url => {
return { name: '', url };
computeImgShowList(row) { });
row.imgShowList = row.imgList.map(url => { },
return { name: '', url };
}); handleImgRemove(file, row) {
}, console.log('handleImgRemove', file);
let url = file.url || file.response.data.url;
handleImgRemove(file, row) { if (url) {
console.log('handleImgRemove', file); row.imgList = row.imgList.filter(item => item !== url);
let url = file.url || file.response.data.url; this.computeImgShowList(row);
if (url) { }
row.imgList = row.imgList.filter(item => item !== url); },
this.computeImgShowList(row);
} getRowClass({ rowIndex, columnIndex }) {
}, if (rowIndex === 0) {
return 'background: #2195fe; color: #fff;';
getRowClass({ rowIndex, columnIndex }) { }
if (rowIndex === 0) { },
return 'background: #2195fe; color: #fff;';
} handleChange(row, type) {
}, console.log('type----', type);
if (type == 'cancle') {
handleChange(row, type) { row = { ...this.tempRow };
console.log('type----', type); row.isEdit = false;
if (type == 'cancle') { if (this.btnType == 'add') this.tableData.pop();
row = { ...this.tempRow }; this.getList();
row.isEdit = false; console.log('row----', row);
if (this.btnType == 'add') this.tableData.pop(); } else {
this.getList(); this.tempRow = { ...row };
console.log('row----', row); row.isEdit = true;
} else { }
this.tempRow = { ...row }; this.btnType = type;
row.isEdit = true; this.isEdit = !this.isEdit;
} },
this.btnType = type;
this.isEdit = !this.isEdit; handleChangeStaff(row) {
}, const { inspectStaffId } = row;
const { optionStaff } = this;
handleChangeStaff(row) { let item = optionStaff.find(item => item.value == inspectStaffId);
const { inspectStaffId } = row; if (item) {
const { optionStaff } = this; row.inspectStaffName = item.name;
let item = optionStaff.find(item => item.value == inspectStaffId); row.inspectStaffMobile = item.mobile;
if (item) { }
row.inspectStaffName = item.name; },
row.inspectStaffMobile = item.mobile;
} async getOptionStaff() {
}, let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`;
const { data, code, msg } = await requestPost(url, {});
async getOptionStaff() {
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`; if (code === 0) {
const { data, code, msg } = await requestPost(url, {}); this.optionStaff = data || [];
} else {
if (code === 0) { this.$message.error('请求工作人员数据失败!');
this.optionStaff = data || []; }
} else { },
this.$message.error('请求工作人员数据失败!');
} async handleEdit(row) {
}, // if (row.result == '0' && row.reviewTime == '') {
// this.$message.error('');
async handleEdit(row) { // } else {
// if (row.result == '0' && row.reviewTime == '') { // if (this.id) {
// this.$message.error(''); // console.log('id');
// } else { // if (this.btnType == 'add') this.save(row);
// if (this.id) { // else this.edit(row);
// console.log('id'); // } else {
// if (this.btnType == 'add') this.save(row); // this.$message.error('');
// else this.edit(row); // }
// } else { // }
// this.$message.error(''); if (this.id) {
// } console.log('有id');
// } if (this.btnType == 'add') this.save(row);
if (this.id) { else this.edit(row);
console.log('有id'); } else {
if (this.btnType == 'add') this.save(row); this.$message.error('请先保存上方信息');
else this.edit(row); }
} else { },
this.$message.error('请先保存上方信息');
} handleAdd() {
}, this.btnType = 'add';
this.isEdit = true;
handleAdd() {
this.btnType = 'add'; const item = {
this.isEdit = true; isEdit: true,
id: this.id,
const item = { inspectTime: '',
isEdit: true, inspectStaffId: '',
id: this.id, inspectStaffName: '',
inspectTime: '', inspectStaffMobile: '',
inspectStaffId: '', inspectResult: '',
inspectStaffName: '', imgList: [],
inspectStaffMobile: '', nextInspectTime: ''
inspectResult: '', };
imgList: [], this.computeImgShowList(item);
nextInspectTime: '' if (!this.disabled) { this.tableData.push(item); }
}; },
this.computeImgShowList(item);
this.tableData.push(item); async save(row) {
}, const params = {
equipmentId: this.id,
async save(row) { ...row
const params = { };
equipmentId: this.id, const url = `/actual/base/emergencyEquipment/inspect-save`;
...row const { data, code, msg } = await requestPost(url, params);
}; if (code === 0) {
const url = `/actual/base/emergencyEquipment/inspect-save`; this.$message.success('保存成功');
const { data, code, msg } = await requestPost(url, params); row.isEdit = false;
if (code === 0) { this.isEdit = false;
this.$message.success('保存成功'); this.btnType = 'cancle';
row.isEdit = false; this.getList();
this.isEdit = false; } else {
this.btnType = 'cancle'; return this.$message.error(res.msg);
this.getList(); }
} else { },
return this.$message.error(res.msg);
} async edit(row) {
}, const params = {
...row
async edit(row) { };
const params = { const url = `/actual/base/emergencyEquipment/inspect-update`;
...row const { data, code, msg } = await requestPost(url, params);
}; if (code === 0) {
const url = `/actual/base/emergencyEquipment/inspect-update`; this.$message.success('保存成功');
const { data, code, msg } = await requestPost(url, params); row.isEdit = false;
if (code === 0) { this.isEdit = false;
this.$message.success('保存成功'); this.getList();
row.isEdit = false; } else {
this.isEdit = false; this.$message.error(msg);
this.getList(); }
} else { },
this.$message.error(msg);
} async del(row) {
}, let arr = [row.id];
const url = `/actual/base/emergencyEquipment/inspect-delete`;
async del(row) { const { data, code, msg } = await requestPost(url, arr);
let arr = [row.id];
const url = `/actual/base/emergencyEquipment/inspect-delete`; if (code === 0) {
const { data, code, msg } = await requestPost(url, arr); this.$message.success('删除成功');
this.getList();
if (code === 0) { } else {
this.$message.success('删除成功'); this.$message.error(msg);
this.getList(); }
} else { },
this.$message.error(msg);
} async getList() {
}, const params = {
equipmentId: this.id,
async getList() { pageNo: 1,
const params = { pageSize: 10000
equipmentId: this.id, };
pageNo: 1, const url = `/actual/base/emergencyEquipment/inspect-page`;
pageSize: 10000 const { data, code, msg } = await requestPost(url, params);
};
const url = `/actual/base/emergencyEquipment/inspect-page`; if (code === 0) {
const { data, code, msg } = await requestPost(url, params); this.tableData = data.list.map(item => {
this.computeImgShowList(item);
if (code === 0) { return {
this.tableData = data.list.map(item => { ...item,
this.computeImgShowList(item); isEdit: false
return { };
...item, });
isEdit: false this.handleAdd();
}; } else {
}); this.$message.error(msg);
this.handleAdd(); }
} else { }
this.$message.error(msg); }
} };
} </script>
}
}; <style lang="scss" scoped>
</script> @import '@/assets/scss/buttonstyle.scss';
@import '@/assets/scss/modules/management/list-main.scss';
<style lang="scss" scoped>
@import '@/assets/scss/buttonstyle.scss'; .mt10 {
@import '@/assets/scss/modules/management/list-main.scss'; margin-bottom: 10px;
}
.mt10 { .input-width {
margin-bottom: 10px; width: 170px;
} }
.input-width {
width: 170px;
}
</style> </style>

3
src/views/modules/shequzhili/tuceng/yingji/zizuzhi/addForm.vue

@ -280,7 +280,8 @@ export default {
categoryList: [{ required: true, message: '服务事项不能为空', trigger: 'blur' }], categoryList: [{ required: true, message: '服务事项不能为空', trigger: 'blur' }],
principalName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }], principalName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
principalPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }], principalPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
address: [{ required: true, message: '地址不能为空', trigger: 'blur' }] address: [{ required: true, message: '地址不能为空', trigger: 'blur' }],
organizationCreatedTime: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
// longitude: [ // longitude: [
// { required: true, message: "", trigger: "blur" }, // { required: true, message: "", trigger: "blur" },
// ], // ],

2
src/views/modules/shequzhili/tuceng/yingji/zizuzhi/index.vue

@ -34,7 +34,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

2
src/views/modules/shequzhili/tuceng/zhonghe/shebei/index.vue

@ -38,7 +38,7 @@
<div class="m-table"> <div class="m-table">
<div class="div_btn"> <div class="div_btn">
<el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button> <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-button class="diy-button--white" size="small" @click="handleExportModule('room')">下载模板</el-button>
<el-upload <el-upload
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
ref="upload" ref="upload"

896
src/views/modules/shequzhili/tuceng/zhonghe/shebei/record.vue

@ -1,449 +1,449 @@
<template> <template>
<div class="m-record"> <div class="m-record">
<h3>检查记录</h3> <h3>检查记录</h3>
<div> <div>
<!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'"> <!-- <div class="u-table-btn1 mt10" v-if="formType != 'view'">
<el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button> <el-button size="small" class="diy-button--blue" :disabled="btnDisabled || disabled" @click="handleAdd">新增</el-button>
</div> --> </div> -->
<div class="m-table-item"> <div class="m-table-item">
<el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%"> <el-table :data="tableData" class="resi-table" row-key="id" border style="width: 100%">
<el-table-column label="序号" type="index" align="center" width="50"></el-table-column> <el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
<el-table-column prop="inspectTime" label="检查时间" align="center" width="200px"> <el-table-column prop="inspectTime" label="检查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectTime" v-model="scope.row.inspectTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.inspectTime }}</div> <div v-else class="div-content">{{ scope.row.inspectTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px"> <el-table-column prop="inspectStaffId" label="检查人员" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select <el-select
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.inspectStaffId" v-model="scope.row.inspectStaffId"
placeholder="请选择" placeholder="请选择"
class="input-width" class="input-width"
@change="handleChangeStaff(scope.row)" @change="handleChangeStaff(scope.row)"
clearable clearable
> >
<el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionStaff" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectStaffName }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px"> <el-table-column prop="inspectStaffMobile" label="联系电话" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="number" type="number"
v-model="scope.row.inspectStaffMobile" v-model="scope.row.inspectStaffMobile"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
clearable clearable
disabled disabled
></el-input> ></el-input>
<div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div> <div v-else class="div-content">{{ scope.row.inspectStaffMobile }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inspectResult" label="检查结果" align="center" width="200px"> <el-table-column prop="inspectResult" label="检查结果" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable> <el-select v-if="scope.row.isEdit" v-model="scope.row.inspectResult" placeholder="请选择" class="input-width" size="small" clearable>
<el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option> <el-option v-for="subItem in optionResult" :key="subItem.value" :label="subItem.label" :value="subItem.value"></el-option>
</el-select> </el-select>
<div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div> <div v-else class="div-content">{{ scope.row.inspectResult == 1 ? '正常' : '异常' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="detailed" prop="detailed"
label="隐患明细" label="隐患明细"
align="center" align="center"
width="200px" width="200px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
type="text" type="text"
v-model="scope.row.detailed" v-model="scope.row.detailed"
placeholder="请输入" placeholder="请输入"
class="input-width" class="input-width"
maxlength="500" maxlength="500"
clearable clearable
></el-input> ></el-input>
<div v-else class="div-content"> <div v-else class="div-content">
{{ scope.row.detailed }} {{ scope.row.detailed }}
</div> </div>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column prop="imgList" label="图片列表" align="center" width="150px"> <el-table-column prop="imgList" label="图片列表" align="center" width="150px">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.isEdit"> <div v-if="scope.row.isEdit">
<el-upload <el-upload
:disabled="scope.row.imgList.length == 3" :disabled="scope.row.imgList.length == 3"
:headers="$getElUploadHeaders()" :headers="$getElUploadHeaders()"
class="avatar-uploader" class="avatar-uploader"
:action="uploadUrl" :action="uploadUrl"
:data="{ customerId: customerId }" :data="{ customerId: customerId }"
:show-file-list="true" :show-file-list="true"
:limit="3" :limit="3"
:file-list="scope.row.imgShowList" :file-list="scope.row.imgShowList"
:on-success="res => handleImgSuccess(res, scope.row)" :on-success="res => handleImgSuccess(res, scope.row)"
:on-remove="res => handleImgRemove(res, scope.row)" :on-remove="res => handleImgRemove(res, scope.row)"
list-type="picture" list-type="picture"
:before-upload="beforeImgUpload" :before-upload="beforeImgUpload"
> >
<i class="el-icon-plus avatar-uploader-icon"></i> <i class="el-icon-plus avatar-uploader-icon"></i>
最多三张图片 最多三张图片
</el-upload> </el-upload>
</div> </div>
<div v-else class="div-content"> <div v-else class="div-content">
<el-image <el-image
v-if="scope.row.imgList.length > 0" v-if="scope.row.imgList.length > 0"
style="width: 100px; height: 50px" style="width: 100px; height: 50px"
:src="scope.row.imgList[0]" :src="scope.row.imgList[0]"
fit="cover" fit="cover"
:preview-src-list="scope.row.imgList" :preview-src-list="scope.row.imgList"
></el-image> ></el-image>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px"> <el-table-column prop="nextInspectTime" label="拟复查时间" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker <el-date-picker
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
v-model="scope.row.nextInspectTime" v-model="scope.row.nextInspectTime"
type="date" type="date"
class="input-width" class="input-width"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
></el-date-picker> ></el-date-picker>
<div v-else class="div-content">{{ scope.row.nextInspectTime }}</div> <div v-else class="div-content">{{ scope.row.nextInspectTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120"> <el-table-column v-if="!disabled" fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="scope.row.isEdit"> <template v-if="scope.row.isEdit">
<el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button> <el-button @click="handleEdit(scope.row)" type="text" size="small" class="btn-color-edit">保存</el-button>
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button> <el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit"> <el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改 修改
</el-button> </el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)"> <el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button> <el-button slot="reference" type="text" size="small" class="btn-color-del" style="margin-left: 10px">删除</el-button>
</el-popconfirm> </el-popconfirm>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { requestPost, requestGet } from '@/js/dai/request'; import { requestPost, requestGet } from '@/js/dai/request';
export default { export default {
props: { props: {
id: { id: {
type: String, type: String,
default: '' default: ''
}, },
info: { info: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
}, },
formType: { formType: {
type: String, type: String,
default: '' default: ''
}, },
source: { source: {
//manage visiual //manage visiual
type: String, type: String,
default: 'manage' default: 'manage'
} }
}, },
data() { data() {
return { return {
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
customerId: localStorage.getItem('customerId'), customerId: localStorage.getItem('customerId'),
btnDisabled: false, btnDisabled: false,
btnType: 'cancle', btnType: 'cancle',
isEdit: false, isEdit: false,
tableData: [], tableData: [],
tempRow: {}, tempRow: {},
optionResult: [ optionResult: [
{ {
label: '异常', label: '异常',
value: '0' value: '0'
}, },
{ {
label: '正常', label: '正常',
value: '1' value: '1'
} }
], ],
optionStaff: [ optionStaff: [
// { // {
// label: "", // label: "",
// value: "inspectStaffId", // value: "inspectStaffId",
// }, // },
] ]
}; };
}, },
computed: { computed: {
allowOperate() { allowOperate() {
const { const {
info: { agencyId } info: { agencyId }
} = this; } = this;
return agencyId && agencyId == this.$store.state.user.agencyId; return agencyId && agencyId == this.$store.state.user.agencyId;
} }
}, },
watch: { watch: {
id: { id: {
handler(val) { handler(val) {
console.log('val------points', val); console.log('val------points', val);
if (val.length > 0) { if (val.length > 0) {
this.btnDisabled = false; this.btnDisabled = false;
// this.getList(); // this.getList();
} else this.btnDisabled = true; } else this.btnDisabled = true;
}, },
immediate: true immediate: true
} }
}, },
created() { created() {
console.log('id', this.id); console.log('id', this.id);
this.getOptionStaff(); this.getOptionStaff();
if (this.id) { if (this.id) {
this.getList(); this.getList();
} else { } else {
this.handleAdd(); this.handleAdd();
} }
}, },
methods: { methods: {
beforeImgUpload(file) { beforeImgUpload(file) {
console.log(file); console.log(file);
const isLt1M = file.size / 1024 / 1024 < 10; const isLt1M = file.size / 1024 / 1024 < 10;
const srcType = file.type; const srcType = file.type;
const format = file.name.split('.').pop(); const format = file.name.split('.').pop();
if (!isLt1M) { if (!isLt1M) {
this.$message.error('上传文件大小不能超过 10MB!'); this.$message.error('上传文件大小不能超过 10MB!');
return false; return false;
} }
if (srcType.indexOf('image') == -1) { if (srcType.indexOf('image') == -1) {
this.$message.error('仅限图片格式'); this.$message.error('仅限图片格式');
return false; return false;
} }
return true; return true;
}, },
handleImgSuccess(res, row) { handleImgSuccess(res, row) {
console.log('handleImgSuccess', res); console.log('handleImgSuccess', res);
if (res.code === 0 && res.msg === 'success') { if (res.code === 0 && res.msg === 'success') {
row.imgList.push(res.data.url); row.imgList.push(res.data.url);
this.computeImgShowList(row); this.computeImgShowList(row);
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}, },
computeImgShowList(row) { computeImgShowList(row) {
row.imgShowList = row.imgList.map(url => { row.imgShowList = row.imgList.map(url => {
return { name: '', url }; return { name: '', url };
}); });
}, },
handleImgRemove(file, row) { handleImgRemove(file, row) {
console.log('handleImgRemove', file); console.log('handleImgRemove', file);
let url = file.url || file.response.data.url; let url = file.url || file.response.data.url;
if (url) { if (url) {
row.imgList = row.imgList.filter(item => item !== url); row.imgList = row.imgList.filter(item => item !== url);
this.computeImgShowList(row); this.computeImgShowList(row);
} }
}, },
getRowClass({ rowIndex, columnIndex }) { getRowClass({ rowIndex, columnIndex }) {
if (rowIndex === 0) { if (rowIndex === 0) {
return 'background: #2195fe; color: #fff;'; return 'background: #2195fe; color: #fff;';
} }
}, },
handleChange(row, type) { handleChange(row, type) {
console.log('type----', type); console.log('type----', type);
if (type == 'cancle') { if (type == 'cancle') {
row = { ...this.tempRow }; row = { ...this.tempRow };
row.isEdit = false; row.isEdit = false;
if (this.btnType == 'add') this.tableData.pop(); if (this.btnType == 'add') this.tableData.pop();
this.getList(); this.getList();
console.log('row----', row); console.log('row----', row);
} else { } else {
this.tempRow = { ...row }; this.tempRow = { ...row };
row.isEdit = true; row.isEdit = true;
} }
this.btnType = type; this.btnType = type;
this.isEdit = !this.isEdit; this.isEdit = !this.isEdit;
}, },
handleChangeStaff(row) { handleChangeStaff(row) {
const { inspectStaffId } = row; const { inspectStaffId } = row;
const { optionStaff } = this; const { optionStaff } = this;
let item = optionStaff.find(item => item.value == inspectStaffId); let item = optionStaff.find(item => item.value == inspectStaffId);
if (item) { if (item) {
row.inspectStaffName = item.name; row.inspectStaffName = item.name;
row.inspectStaffMobile = item.mobile; row.inspectStaffMobile = item.mobile;
} }
}, },
async getOptionStaff() { async getOptionStaff() {
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`; let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`;
const { data, code, msg } = await requestPost(url, {}); const { data, code, msg } = await requestPost(url, {});
if (code === 0) { if (code === 0) {
this.optionStaff = data || []; this.optionStaff = data || [];
} else { } else {
this.$message.error('请求工作人员数据失败!'); this.$message.error('请求工作人员数据失败!');
} }
}, },
async handleEdit(row) { async handleEdit(row) {
if (row.result == '0' && row.reviewTime == '') { if (row.result == '0' && row.reviewTime == '') {
this.$message.error('拟复查时间不能为空'); this.$message.error('拟复查时间不能为空');
} else { } else {
if (this.id) { if (this.id) {
console.log('有id'); console.log('有id');
if (this.btnType == 'add') this.save(row); if (this.btnType == 'add') this.save(row);
else this.edit(row); else this.edit(row);
} else { } else {
this.$message.error('请先保存上方信息'); this.$message.error('请先保存上方信息');
} }
} }
}, },
handleAdd() { handleAdd() {
this.btnType = 'add'; this.btnType = 'add';
this.isEdit = true; this.isEdit = true;
const item = { const item = {
isEdit: true, isEdit: true,
// id: this.id, // id: this.id,
inspectTime: '', inspectTime: '',
inspectStaffId: '', inspectStaffId: '',
inspectStaffName: '', inspectStaffName: '',
inspectStaffMobile: '', inspectStaffMobile: '',
inspectResult: '', inspectResult: '',
imgList: [], imgList: [],
nextInspectTime: '' nextInspectTime: ''
}; };
this.computeImgShowList(item); this.computeImgShowList(item);
this.tableData.push(item); if (!this.disabled) { this.tableData.push(item); }
}, },
async save(row) { async save(row) {
console.log(row, this.id); console.log(row, this.id);
const params = { const params = {
equipmentId: this.id, equipmentId: this.id,
...row ...row
}; };
const url = `/actual/base/monitoringEquipmentInspectRecord/save`; const url = `/actual/base/monitoringEquipmentInspectRecord/save`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.btnType = 'cancle'; this.btnType = 'cancle';
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async edit(row) { async edit(row) {
console.log(row, this.id); console.log(row, this.id);
const params = { const params = {
...row ...row
}; };
const url = `/actual/base/monitoringEquipmentInspectRecord/update`; const url = `/actual/base/monitoringEquipmentInspectRecord/update`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.$message.success('保存成功'); this.$message.success('保存成功');
row.isEdit = false; row.isEdit = false;
this.isEdit = false; this.isEdit = false;
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async del(row) { async del(row) {
let arr = [row.id]; let arr = [row.id];
const url = `/actual/base/monitoringEquipmentInspectRecord/delete`; const url = `/actual/base/monitoringEquipmentInspectRecord/delete`;
const { data, code, msg } = await requestPost(url, arr); const { data, code, msg } = await requestPost(url, arr);
if (code === 0) { if (code === 0) {
this.$message.success('删除成功'); this.$message.success('删除成功');
this.getList(); this.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async getList() { async getList() {
const params = { const params = {
equipmentId: this.id, equipmentId: this.id,
pageNo: 1, pageNo: 1,
pageSize: 10000 pageSize: 10000
}; };
const url = `/actual/base/monitoringEquipmentInspectRecord/page`; const url = `/actual/base/monitoringEquipmentInspectRecord/page`;
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.tableData = data.list.map(item => { this.tableData = data.list.map(item => {
this.computeImgShowList(item); this.computeImgShowList(item);
return { return {
...item, ...item,
isEdit: false isEdit: false
}; };
}); });
this.handleAdd(); this.handleAdd();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/assets/scss/buttonstyle.scss'; @import '@/assets/scss/buttonstyle.scss';
@import '@/assets/scss/modules/management/list-main.scss'; @import '@/assets/scss/modules/management/list-main.scss';
.mt10 { .mt10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
.input-width { .input-width {
width: 170px; width: 170px;
} }
</style> </style>

Loading…
Cancel
Save