Browse Source

bug

feature
tianqian 2 years ago
parent
commit
0c995bcc27
  1. 239
      src/views/dataBoard/sida/cpts/fw02gxxq.vue
  2. 194
      src/views/dataBoard/sida/cpts/fw03zr.vue
  3. 2
      src/views/dataBoard/sida/cpts/fwBarOption01.js
  4. 2
      src/views/dataBoard/sida/cpts/fwBarOption04.js
  5. 2
      src/views/dataBoard/sida/cpts/fwBarOption05.js
  6. 1
      src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/addForm.vue
  7. 8
      src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/record.vue
  8. 887
      src/views/modules/shequzhili/tuceng/anquan/shebei/record.vue
  9. 8
      src/views/modules/shequzhili/tuceng/anquan/yinhuan/record.vue
  10. 9
      src/views/modules/shequzhili/tuceng/yingji/wuzi/record.vue
  11. 10
      src/views/modules/shequzhili/tuceng/zhonghe/shebei/record.vue

239
src/views/dataBoard/sida/cpts/fw02gxxq.vue

@ -1,7 +1,8 @@
<template>
<div class="m-zyqd">
<div class="pieMain pieMain3">
<div class="pie"><screen-echarts-frame @myChartMethod="pieInitOk" ref="pieChart"></screen-echarts-frame></div>
<div class="pie"><screen-echarts-frame @myChartMethod="pieInitOk" ref="pieChart"></screen-echarts-frame>
</div>
<div class="legend">
<div class="legend-row" :key="'pie' + item.name" v-for="item in pieData" @click="handleClickItem(item)">
<div class="name">{{ item.name }}</div>
@ -15,32 +16,35 @@
</div>
</template>
<script>
import screenEchartsFrame from '@/views/dataBoard/cpts/screen-echarts-frame/index';
// import { pieOption } from './fwqdPieOption.js';
import { requestPostBi } from '@/js/dai/request-bipass';
export default {
props: {
orgId: {
type: String,
default: ''
import screenEchartsFrame from '@/views/dataBoard/cpts/screen-echarts-frame/index';
// import { pieOption } from './fwqdPieOption.js';
import {
requestPostBi
} from '@/js/dai/request-bipass';
export default {
props: {
orgId: {
type: String,
default: ''
},
searchDate: Array
},
searchDate: Array
},
data() {
return {
showNoData: false,
timer: null,
pieChart: '',
pieOption: {
color: ['#1A95FF', '#FF6138', '#2adcea', '#2cc4ad', '#7377f5', '#32de66', '#8155d4', '#c7ea48', '#ef47c2', 'd43349'],
tooltip: {
trigger: 'item'
},
series: [
{
data() {
return {
showNoData: false,
timer: null,
pieChart: '',
pieOption: {
color: ['#1A95FF', '#FF6138', '#2adcea', '#2cc4ad', '#7377f5', '#32de66', '#8155d4', '#c7ea48',
'#ef47c2', 'd43349'
],
tooltip: {
trigger: 'item'
},
series: [{
name: '',
type: 'pie',
radius: [40, 130],
radius: [70, 130],
center: ['50%', '50%'],
// roseType: 'area',
itemStyle: {
@ -48,15 +52,22 @@ export default {
},
avoidLabelOverlap: false,
labelLine: {
show: false
show: true,
length: 50
},
label: {
normal: {
position: 'inner',
show: true,
formatter: '{d}%',
formatter: '{title|{b}}\n{d}%',
fontSize: 24,
color: '#FFFFFF'
color: '#FFFFFF',
rich: {
title: {
fontSize: 12,
height: 25,
},
}
}
},
emphasis: {
@ -67,111 +78,105 @@ export default {
}
},
data: []
}
]
},
pieInitState: false,
pieData: [],
info: []
};
},
components: {
screenEchartsFrame
},
mounted() {
this.init();
},
watch: {
currentTab() {
this.setPieData();
}]
},
pieInitState: false,
pieData: [],
info: []
};
},
orgId() {
components: {
screenEchartsFrame
},
mounted() {
this.init();
}
},
methods: {
async init() {
await this.getInfo();
this.getPie();
},
//
async getInfo() {
let url = 'common_demand_response';
this.$refs.pieChart.showLoading();
const { data, code, msg } = await requestPostBi(
url,
{
watch: {
currentTab() {
this.setPieData();
},
orgId() {
this.init();
}
},
methods: {
async init() {
await this.getInfo();
this.getPie();
},
//
async getInfo() {
let url = 'common_demand_response';
this.$refs.pieChart.showLoading();
const {
data,
code,
msg
} = await requestPostBi(url, {
queryParam: {
org_id: this.orgId,
start_date: this.searchDate[0],
end_date: this.searchDate[1]
}
},
{
}, {
// mockId: 69366649,
});
this.$refs.pieChart.hideLoading();
if (code === 0) {
if (data && Array.isArray(data) && data.length > 0) {
this.info = data;
}
} else {
this.$message.error(msg);
}
);
this.$refs.pieChart.hideLoading();
if (code === 0) {
if (data && Array.isArray(data) && data.length > 0) {
this.info = data;
}
} else {
this.$message.error(msg);
}
},
selItem(selItem, selIndex) {
this.tabList.forEach((element, index) => {
if (index === selIndex) {
element.sel = true;
},
selItem(selItem, selIndex) {
this.tabList.forEach((element, index) => {
if (index === selIndex) {
element.sel = true;
} else {
element.sel = false;
}
});
},
pieInitOk() {
this.pieInitState = true;
},
getPie() {
if (this.pieInitState) {
console.log('d');
this.setPieData();
} else {
element.sel = false;
setTimeout(() => {
this.getPie();
}, 500);
}
});
},
pieInitOk() {
this.pieInitState = true;
},
getPie() {
if (this.pieInitState) {
console.log('d');
this.setPieData();
} else {
setTimeout(() => {
this.getPie();
}, 500);
},
setPieData() {
let data = [...this.info];
data = JSON.parse(JSON.stringify(data).replace(/parent_type_name/g, 'name'));
data = JSON.parse(JSON.stringify(data).replace(/common_demand_num/g, 'value'));
this.pieData = data;
this.iniPieChart();
},
//
async iniPieChart() {
this.$refs.pieChart.clear();
// pieChart
this.pieOption.series[0].name = this.currentTab;
this.pieOption.series[0].data = this.pieData;
this.$refs.pieChart.setOption(this.pieOption);
}
},
setPieData() {
let data = [...this.info];
data = JSON.parse(JSON.stringify(data).replace(/parent_type_name/g, 'name'));
data = JSON.parse(JSON.stringify(data).replace(/common_demand_num/g, 'value'));
this.pieData = data;
this.iniPieChart();
},
//
async iniPieChart() {
this.$refs.pieChart.clear();
// pieChart
this.pieOption.series[0].name = this.currentTab;
this.pieOption.series[0].data = this.pieData;
this.$refs.pieChart.setOption(this.pieOption);
}
}
};
};
</script>
<style lang="scss" src="@/assets/scss/dataBoard/renfang/index.scss" scoped></style>
<style scoped lang="scss">
/deep/.pieMain3 {
.legend {
.legend-row {
margin-top: 10px !important;
/deep/.pieMain3 {
.legend {
.legend-row {
margin-top: 10px !important;
}
}
}
}
</style>
</style>

194
src/views/dataBoard/sida/cpts/fw03zr.vue

@ -15,14 +15,15 @@
</el-col>
</el-row>
<div class="tablist">
<div v-for="item in tabList" :key="item" :class="['item', { 'item-sel': currentTab == item }]" @click="changTab(item)">{{ item }}</div>
<div v-for="item in tabList" :key="item" :class="['item', { 'item-sel': currentTab == item }]"
@click="changTab(item)">{{ item }}</div>
</div>
<div>
<div class="linecharts" v-if="resiCategoryData.length > 0">
<div class="item" :key="index" v-for="(item, index) in resiCategoryData">
<div class="item" :key="index" v-for="(item, index) in resiCategoryData">
<div>{{ ('0' + (index + 1)).substr(-2) }}.</div>
<div class="item-name">{{ item.name }}</div>
<div class="item-progress"><b :style="{ width: + '0%' }"></b></div>
<div class="item-progress"><b :style="{ 'width': item.per }"></b></div>
<div class="item-count">
<b>{{ item.count }}</b>
</div>
@ -40,111 +41,114 @@
</div>
</template>
<script>
import screenEchartsFrame from '@/views/dataBoard/cpts/screen-echarts-frame/index';
import { requestPostBi } from '@/js/dai/request-bipass';
export default {
props: {
orgId: {
type: String,
default: ''
import screenEchartsFrame from '@/views/dataBoard/cpts/screen-echarts-frame/index';
import {
requestPostBi
} from '@/js/dai/request-bipass';
export default {
props: {
orgId: {
type: String,
default: ''
},
searchDate: Array
},
searchDate: Array
},
data() {
return {
lineData1: [],
lineData2: [],
resiCategoryData: [],
showNoData: false,
timer: null,
pieChart: '',
pieOption: {},
pieInitState: false,
pieData: [],
tabList: ['服务次数排名', '服务人数排名'],
currentTab: '服务次数排名',
info: {}
};
},
components: {
screenEchartsFrame
},
mounted() {
this.init();
},
watch: {},
methods: {
changTab(item) {
this.currentTab=item
if (item == '服务次数排名') {
this.resiCategoryData = [...this.lineData1];
} else {
this.resiCategoryData = [...this.lineData2];
}
data() {
return {
lineData1: [],
lineData2: [],
resiCategoryData: [],
showNoData: false,
timer: null,
pieChart: '',
pieOption: {},
pieInitState: false,
pieData: [],
tabList: ['服务次数排名', '服务人数排名'],
currentTab: '服务次数排名',
info: {}
};
},
async init() {
this.getResiCategoryData();
components: {
screenEchartsFrame
},
handleClickItem(item) {
// const { type, name } = item;
// this.$router.push({
// path: '/dataBoard/renfang/resi-analyze',
// query: {
// org_id: this.orgId,
// type,
// type_category: this.currentTab,
// type_name: name
// }
// });
mounted() {
this.init();
},
selItem(selItem, selIndex) {
this.tabList.forEach((element, index) => {
if (index === selIndex) {
element.sel = true;
watch: {},
methods: {
changTab(item) {
this.currentTab = item
if (item == '服务次数排名') {
this.resiCategoryData = [...this.lineData1];
this.total = this.total1
} else {
element.sel = false;
this.resiCategoryData = [...this.lineData2];
this.total = this.total2
}
});
},
async getResiCategoryData() {
let url = 'service_search_person';
const { data, code, msg } = await requestPostBi(
url,
{
},
async init() {
this.getResiCategoryData();
},
handleClickItem(item) {
// const { type, name } = item;
// this.$router.push({
// path: '/dataBoard/renfang/resi-analyze',
// query: {
// org_id: this.orgId,
// type,
// type_category: this.currentTab,
// type_name: name
// }
// });
},
selItem(selItem, selIndex) {
this.tabList.forEach((element, index) => {
if (index === selIndex) {
element.sel = true;
} else {
element.sel = false;
}
});
},
async getResiCategoryData() {
let url = 'service_search_person';
const {
data,
code,
msg
} = await requestPostBi(url, {
queryParam: {
org_id: this.orgId,
start_date: this.searchDate[0],
end_date: this.searchDate[1]
}
},
{
}, {
// mockId: 60031937,
}
);
if (code === 0) {
this.info = data[0];
console.log(this.info);
this.lineData1 = this.info.child_service_num.map(item => {
return {
name: item.common_service_type_name,
count: item.service_num
};
});
console.log(this.lineData1);
this.lineData2 = this.info.child_service_person_num.map(item => {
return {
name: item.common_service_type_name,
count: item.service_person_num
};
});
this.resiCategoryData = [...this.lineData1];
} else {
this.$message.error(msg);
if (code === 0) {
this.info = data[0];
this.lineData1 = this.info.child_service_num.map(item => {
return {
name: item.common_service_type_name,
count: item.service_num,
per: (item.service_num / this.info.service_total * 100).toFixed(2) + '%'
};
});
this.lineData2 = this.info.child_service_person_num.map(item => {
return {
name: item.common_service_type_name,
count: item.service_person_num,
per: (item.service_person_num / this.info.service_person_total * 100).toFixed(2) + '%'
};
});
this.resiCategoryData = [...this.lineData1];
console.log(this.resiCategoryData)
} else {
this.$message.error(msg);
}
}
}
}
};
};
</script>
<style lang="scss" src="@/assets/scss/dataBoard/renfang/index.scss" scoped></style>
<style lang="scss" src="@/assets/scss/dataBoard/renfang/index.scss" scoped></style>

2
src/views/dataBoard/sida/cpts/fwBarOption01.js

@ -53,7 +53,7 @@ export function pieOption() {
}],
yAxis: [{
type: 'value',
max: 1000,
splitNumber: 5,
splitLine: {
show: true,

2
src/views/dataBoard/sida/cpts/fwBarOption04.js

@ -53,7 +53,7 @@ export function pieOption() {
}],
yAxis: [{
type: 'value',
max: 1000,
splitNumber: 5,
splitLine: {
show: true,

2
src/views/dataBoard/sida/cpts/fwBarOption05.js

@ -53,7 +53,7 @@ export function pieOption() {
}],
yAxis: [{
type: 'value',
max: 1000,
splitNumber: 5,
splitLine: {
show: true,

1
src/views/modules/shequzhili/tuceng/anquan/anquanxuncha/addForm.vue

@ -341,6 +341,7 @@ export default {
if (code === 0) {
this.$message.success('操作成功');
this.detailIdcopy=data.enterpriseId;
// this.handleCancle();
// // this.resetData();
// this.$emit('handleComfirm');

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

@ -119,10 +119,11 @@
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template>
<template v-else>
<!-- v-if="formType == 'edit'" -->
<el-button @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改
</el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-popconfirm 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-popconfirm>
</template>
@ -202,6 +203,7 @@ export default {
watch: {
id: {
handler(val) {
console.log("ddddddddddddd",val)
if (val.length > 0) {
this.btnDisabled = false;
// this.getList();
@ -343,10 +345,12 @@ export default {
},
async save(row) {
const params = {
...row,
enterpriseId: this.id,
...row
};
console.log("params",params)
const url = `/actual/base/enterprise/addorupdate-patrol`;
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {

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

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

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

@ -54,11 +54,12 @@
<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>
</template>
<!-- v-if="formType == 'edit'" -->
<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 @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改
</el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-popconfirm 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-popconfirm>
</template>
@ -273,7 +274,8 @@ export default {
async save(row) {
const params = {
...row
...row,
hiddenDangerRecordId: this.id,
};
const url = `/actual/base/hiddenDangerRecord/saveProcess`;
const { data, code, msg } = await requestPost(url, params);

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

@ -138,10 +138,11 @@
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template>
<template v-else>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
<!-- v-if="formType == 'edit'" -->
<el-button @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改
</el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-popconfirm 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-popconfirm>
</template>
@ -369,8 +370,8 @@ export default {
async save(row) {
const params = {
equipmentId: this.id,
...row
...row,
equipmentId: this.id
};
const url = `/actual/base/emergencyEquipment/inspect-save`;
const { data, code, msg } = await requestPost(url, params);

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

@ -139,10 +139,11 @@
<el-button @click="handleChange(scope.row, 'cancle')" type="text" size="small" class="btn-color-edit">取消</el-button>
</template>
<template v-else>
<el-button v-if="formType == 'edit'" @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
<!-- v-if="formType == 'edit'" -->
<el-button @click="handleChange(scope.row, 'edit')" type="text" size="small" :disabled="disabled" class="btn-color-edit">
修改
</el-button>
<el-popconfirm v-if="formType == 'edit'" title="删除之后无法恢复,确认删除?" @onConfirm="del(scope.row)" @confirm="del(scope.row)">
<el-popconfirm 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-popconfirm>
</template>
@ -363,8 +364,9 @@ export default {
async save(row) {
console.log(row, this.id);
const params = {
equipmentId: this.id,
...row
...row,
equipmentId: this.id
};
const url = `/actual/base/monitoringEquipmentInspectRecord/save`;
const { data, code, msg } = await requestPost(url, params);

Loading…
Cancel
Save