Commit f654b080 authored by liuyuping's avatar liuyuping

'trainimg'

parent 45dae4ce
......@@ -22,4 +22,12 @@ export function dangerJobReportEnterprise(params) {//企业分页
method: 'get',
params
})
}
export function postDangerJobReport(data) {
return requestFile({
url: '/api/dangerJobReport',
method: 'post',
data
})
}
\ No newline at end of file
......@@ -26,7 +26,6 @@ export function postHwapproval(data) {
})
}
<<<<<<< HEAD
export function findUploadEnterprise() {
return request({
url: '/api/enterpriseCertificate/findUploadEnterprise',
......@@ -48,6 +47,4 @@ export function dangerJobReport(params) {
params
})
}
=======
>>>>>>> 5d2f8010b5e0a42edca437d25d499712d91d7834
import request from '@/utils/request'
import requestFile from '@/utils/requestfile'
import qs from 'qs'
// 查询企业
/**
* @param {
* name: 企业名称
* page: 页码
* size: 每页显示的数目
* sort: 排序
* } params
*/
export function searchEnterprise(params) {
return request({
url: 'api/trainImage/pageEnterprise',
method: 'get',
params
})
}
// 查询影像
/**
* @param {
* enterpriseId: 企业id
* page: 页码
* size: 每页显示的数目
* sort: 排序
* } params
*/
export function searchTrainImage(params) {
return request({
url: 'api/trainImage/pageTrainImage',
method: 'get',
params
})
}
/**
* 培训影像管理统计分析
* @returns
*/
export function analyzeTrainImg() {
return request({
url: 'api/trainImage/analyze',
method: 'get'
})
}
/**
* department string
* endTime yyyy-MM-dd HH:mm:ss
* industry string
* page num
* size num
* sort
* startTime yyyy-MM-dd HH:mm:ss
* train false
* @param {*} params
*/
// 统计企业列表、每个企业的总参与人次 权限标识: trainImage:analyze
export function trainImageAnalyze1(params) {
return request({
url: 'api/trainImage/analyze1',
method: 'get',
params
})
}
/**
*
*/
// 统计参与培训企业总数量、总参与人次、未参与培训的企业数量 权限标识: trainImage:analyze
export function trainImageAnalyze2(params) {
return request({
url: 'api/trainImage/analyze2',
method: 'get',
params
})
}
/**
* page
* size
* 获取所有应急行业主管部门
*/
export function getThIndustryChargeDept(params) {
return request({
url: 'api/thIndustryChargeDept',
method: 'get',
params
})
}
/**
* page
* size
* 获取所有行业
*/
export function getAllIndustry(params) {
return request({
url: 'api/thIndustry',
method: 'get',
params
})
}
......@@ -68,6 +68,10 @@ const hwapprovalstatistics = () => import('../views/hwapproval/hwapprovalstatist
const hwapprovalsearch = () => import('../views/hwapproval/findapproval.vue')
const hwapprovals = () => import('../views/hwapproval/hwapprovals.vue')
const trainimageenter = () => import('../views/trainimage/index.vue')
const trainimg = () => import('../views/trainimage/trainimg.vue')
const trainstatistics = () => import('../views/trainimage/statistics.vue')
Vue.use(Router)
export const constantRouterMap = [
......@@ -511,7 +515,26 @@ export const constantRouterMap = [
component: hwapprovals,
name: '危险作业备案列表',
meta: { title: '危险作业备案列表' }
},
{
path: 'trainimage/trainimage',
component: trainimageenter,
name: '企业培训影像管理',
meta: { title: '企业培训影像管理' }
},
{
path: 'trainimage/trainimgstatic',
component: trainstatistics,
name: '培训影像统计',
meta: { title: '培训影像统计' }
},
{
path: 'trainimage/trainimg/:name',
component: trainimg,
name: '培训影像',
meta: { title: '培训影像' }
}
]
},
{
......
<template>
<div class="enter-safe-manage-wrapper">
<div class="enter-safe-tools-wrapper">
<!-- <el-select
v-model="queryEnter"
multiple
filterable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option
v-for="item in enterList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select> -->
<el-input
v-model="searchEnterName"
placeholder="请输入企业名称"
......
......@@ -9,26 +9,36 @@
<el-input v-model="hdSearchInfo" placeholder="请输入隐患信息" />
</el-col>
<el-col :span="8">
<el-button type="success" size="medium" @click="searchLikeEnterInfo">搜索</el-button>
<el-button type="success" size="medium" @click="searchLikeEnterInfo"
>搜索</el-button
>
</el-col>
<el-col :span="4">
<el-popover
placement="bottom"
trigger="click"
>
<el-popover placement="bottom" trigger="click">
<el-date-picker
v-model="hdAnalyzeChosenDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
end-placeholder="结束日期"
>
</el-date-picker>
<br/>
<br />
<div style="height: 10px;"></div>
<el-button type="info" @click="exportStatus">隐患整改</el-button>
<el-button type="warning" @click="exportNoStatus">隐患未整改</el-button>
<el-button type="danger" @click="exportOvertime">超期未整改</el-button>
<el-button type="primary" @click="exportHDAnalyze" :disabled="loadingHDAnalyzeExcel" v-loading="loadingHDAnalyzeExcel">导出隐患分析</el-button>
<el-button type="warning" @click="exportNoStatus"
>隐患未整改</el-button
>
<el-button type="danger" @click="exportOvertime"
>超期未整改</el-button
>
<el-button
type="primary"
@click="exportHDAnalyze"
:disabled="loadingHDAnalyzeExcel"
v-loading="loadingHDAnalyzeExcel"
>导出隐患分析</el-button
>
<el-button slot="reference" type="primary">导出</el-button>
</el-popover>
</el-col>
......@@ -42,60 +52,39 @@
>
<el-table-column type="expand">
<template slot-scope="props">
<el-table
:data="props.row.hdlist"
>
<el-table-column
label="序号"
prop="hdOrder"
width="60"
/>
<el-table-column
label="检查日期"
prop="hdInspectDate"
width="90"
/>
<el-table :data="props.row.hdlist">
<el-table-column label="序号" prop="hdOrder" width="60" />
<el-table-column label="检查日期" prop="hdInspectDate" width="90" />
<el-table-column
label="检查专家"
prop="hdInspectExpert"
width="70"
/>
<el-table-column
label="隐患名称"
prop="hdName"
width="360"
/>
<el-table-column
label="隐患图片"
width="80"
>
<template
slot-scope="scope1"
>
<el-table-column label="隐患名称" prop="hdName" width="360" />
<el-table-column label="隐患图片" width="80">
<template slot-scope="scope1">
<el-image
v-if="scope1.row.hdPic"
style="width: 50px; height: 50px"
:src="'data:image/jpg;base64,' + scope1.row.hdPic"
:preview-src-list="['data:image/jpg;base64,' + scope1.row.hdPic]"
:preview-src-list="[
'data:image/jpg;base64,' + scope1.row.hdPic
]"
/>
</template>
</el-table-column>
<el-table-column
label="隐患等级"
width="70"
>
<el-table-column label="隐患等级" width="70">
<template slot-scope="scope">
<div>{{ scope.row.hdLevel === 1 ? '一般隐患' : '重大隐患' }}</div>
<div>
{{ scope.row.hdLevel === 1 ? "一般隐患" : "重大隐患" }}
</div>
</template>
</el-table-column>
<el-table-column
label="隐患描述"
width="140"
>
<template
slot-scope="scope1"
>
<span>{{ scope1.row.hdDesc === 'null' ? '' : scope1.row.hdDesc }}</span>
<el-table-column label="隐患描述" width="140">
<template slot-scope="scope1">
<span>{{
scope1.row.hdDesc === "null" ? "" : scope1.row.hdDesc
}}</span>
</template>
</el-table-column>
<el-table-column
......@@ -115,37 +104,35 @@
prop="hdRectificationDate"
width="90"
/>
<el-table-column
label="验收人"
width="70"
>
<el-table-column label="验收人" width="70">
<template slot-scope="scope1">
<span>{{ scope1.row.hdAcceptancePerson === 'null' ? '' : scope1.row.hdAcceptancePerson }}</span>
<span>{{
scope1.row.hdAcceptancePerson === "null"
? ""
: scope1.row.hdAcceptancePerson
}}</span>
</template>
</el-table-column>
<el-table-column
label="隐患状态"
width="90"
>
<el-table-column label="隐患状态" width="90">
<template slot-scope="scope">
<div>{{ scope.row.hdStatus === 0 ? '整改中' : '整改完成' }}</div>
<div>
{{ scope.row.hdStatus === 0 ? "整改中" : "整改完成" }}
</div>
</template>
</el-table-column>
<el-table-column
label="整改图片"
width="80"
>
<template
slot-scope="scope1"
>
<el-table-column label="整改图片" width="80">
<template slot-scope="scope1">
<el-image
v-if="scope1.row.hdRectificationPic"
style="width: 50px; height: 50px"
:src="'data:image/jpg;base64,' + scope1.row.hdRectificationPic"
:preview-src-list="['data:image/jpg;base64,' + scope1.row.hdRectificationPic]"
:src="
'data:image/jpg;base64,' + scope1.row.hdRectificationPic
"
:preview-src-list="[
'data:image/jpg;base64,' + scope1.row.hdRectificationPic
]"
/>
</template>
</el-table-column>
<!-- <el-table-column
label="整改照片"
......@@ -160,40 +147,42 @@
size="mini"
type="warning"
@click="editdg($event, scope.$index, scope.row)"
>编辑</el-button>
>编辑</el-button
>
<el-button
size="mini"
type="danger"
@click="deletedg($event, scope.$index, scope.row)"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
label="企业名称"
prop="companyName"
/>
<el-table-column
label="企业负责人"
prop="companyChargePer"
/>
<el-table-column
label="操作"
>
<el-table-column label="企业名称" prop="companyName" />
<el-table-column label="企业负责人" prop="companyChargePer" />
<el-table-column label="操作">
<template slot-scope="scope1">
<div class="operations-add-import-wrapper">
<el-button
size="mini"
type="primary"
@click="addDanger($event, scope1.$index, scope1.row)"
>新增</el-button>
>新增</el-button
>
<!-- <el-input v-model="importFile" type="file">选择文件</el-input> -->
<div class="import-file-dg-wrapper" @click="importDanger">
<label class="import-file-dg">
导入
<input :ref="`file${scope1.$index}`" multiple class="helloworld" type="file" hidden @change="realImportDanger(scope1.$index, scope1.row)">
<input
:ref="`file${scope1.$index}`"
multiple
class="helloworld"
type="file"
hidden
@change="realImportDanger(scope1.$index, scope1.row)"
/>
</label>
</div>
</div>
......@@ -220,7 +209,7 @@
:visible.sync="adddialogform"
:close-on-click-modal="false"
>
<el-form :model="formInfo">
<el-form :model="formInfo" v-if="adddialogform">
<el-form-item label="序号">
<el-input v-model="formInfo.hdOrder" :disabled="true" />
</el-form-item>
......@@ -250,16 +239,28 @@
<el-input v-model="formInfo.hdRectificationSug" type="textarea" />
</el-form-item>
<el-form-item label="">
<img :src="uploadHdUrl" alt="暂未选择图片" style="width: 60%;">
<img :src="uploadHdUrl" alt="暂未选择图片" style="width: 60%;" />
</el-form-item>
<el-form-item label="">
<label class="import-file-dg" style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;">
<label
class="import-file-dg"
style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;"
>
导入隐患图片
<input :ref="`addhdpic`" class="helloworld" type="file" hidden accept="image/jpeg" @change="addhdPicChange">
<input
:ref="`addhdpic`"
class="helloworld"
type="file"
hidden
accept="image/jpeg"
@change="addhdPicChange"
/>
</label>
</el-form-item>
<el-form-item label="">
<div v-for="(item, index) in addEnterhdPics" :key="item.name + index">{{ item.name }}</div>
<div v-for="(item, index) in addEnterhdPics" :key="item.name + index">
{{ item.name }}
</div>
</el-form-item>
<el-form-item label="整改日期">
<el-date-picker
......@@ -278,16 +279,31 @@
</el-select>
</el-form-item>
<el-form-item label="">
<img :src="uploadRectUrl" alt="暂未选择图片" style="width: 60%">
<img :src="uploadRectUrl" alt="暂未选择图片" style="width: 60%" />
</el-form-item>
<el-form-item label="">
<label class="import-file-dg" style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;">
<label
class="import-file-dg"
style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;"
>
导入整改图片
<input :ref="`addrectpic`" class="helloworld" type="file" hidden accept="image/jpeg" @change="addrectpicChange">
<input
:ref="`addrectpic`"
class="helloworld"
type="file"
hidden
accept="image/jpeg"
@change="addrectpicChange"
/>
</label>
</el-form-item>
<el-form-item label="">
<div v-for="(item, index) in adEnterrectPics" :key="item.name + index">{{ item.name }}</div>
<div
v-for="(item, index) in adEnterrectPics"
:key="item.name + index"
>
{{ item.name }}
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -303,7 +319,7 @@
:visible.sync="editdialogform"
:close-on-click-modal="false"
>
<el-form :model="formInfo">
<el-form :model="formInfo" v-if="editdialogform">
<el-form-item label="序号">
<el-input v-model="formInfo.hdOrder" :disabled="true" />
</el-form-item>
......@@ -333,19 +349,49 @@
<el-input v-model="formInfo.hdRectificationSug" type="textarea" />
</el-form-item>
<el-form-item label="隐患图片">
<img v-for="(item, index) in editEnterhdPics" v-show="typeof item === 'string'" :key="index" style="width: 60%;" :src="'data:image/jpg;base64,' + item" alt="alt">
<img
v-for="(item, index) in editEnterhdPics"
v-show="typeof item === 'string'"
:key="index"
style="width: 60%;"
:src="'data:image/jpg;base64,' + item"
alt="alt"
/>
</el-form-item>
<el-form-item label="">
<label class="import-file-dg" style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;">
<label
class="import-file-dg"
style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;"
>
导入隐患图片
<input :ref="`edithdpic`" class="helloworld" type="file" hidden accept="image/jpeg" @change="edithdPicChange">
<input
:ref="`edithdpic`"
class="helloworld"
type="file"
hidden
accept="image/jpeg"
@change="edithdPicChange"
/>
</label>
</el-form-item>
<el-form-item label="">
<img v-show="editEnterhdPics.length > 0 && typeof editEnterhdPics[0] !== 'string'" :src="uploadEditHdUrl" alt="整改图片" style="width: 60%">
<img
v-show="
editEnterhdPics.length > 0 &&
typeof editEnterhdPics[0] !== 'string'
"
:src="uploadEditHdUrl"
alt="整改图片"
style="width: 60%"
/>
</el-form-item>
<el-form-item label="">
<div v-for="(item, index) in editEnterhdPics" :key="item.name + index">{{ item.name }}</div>
<div
v-for="(item, index) in editEnterhdPics"
:key="item.name + index"
>
{{ item.name }}
</div>
</el-form-item>
<el-form-item label="整改日期">
<el-date-picker
......@@ -364,19 +410,49 @@
</el-select>
</el-form-item>
<el-form-item label="整改图片">
<img v-for="(item, index) in editEnterrectPics" v-show="typeof item === 'string'" :key="index" style="width: 60%;" :src="'data:image/jpg;base64,' + item" alt="alt">
<img
v-for="(item, index) in editEnterrectPics"
v-show="typeof item === 'string'"
:key="index"
style="width: 60%;"
:src="'data:image/jpg;base64,' + item"
alt="alt"
/>
</el-form-item>
<el-form-item label="">
<label class="import-file-dg" style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;">
<label
class="import-file-dg"
style="color: #1890ff;display:inline-block;border: 1px solid #1890ff;"
>
导入整改图片
<input :ref="`editrectpic`" class="helloworld" type="file" hidden accept="image/jpeg" @change="editrectpicChange">
<input
:ref="`editrectpic`"
class="helloworld"
type="file"
hidden
accept="image/jpeg"
@change="editrectpicChange"
/>
</label>
</el-form-item>
<el-form-item label="">
<img v-show="editEnterrectPics.length > 0 && typeof editEnterrectPics[0] !== 'string'" :src="uploadEditRectUrl" alt="整改图片" style="width: 60%">
<img
v-show="
editEnterrectPics.length > 0 &&
typeof editEnterrectPics[0] !== 'string'
"
:src="uploadEditRectUrl"
alt="整改图片"
style="width: 60%"
/>
</el-form-item>
<el-form-item label="">
<div v-for="(item, index) in editEnterrectPics" :key="item.name + index">{{ item.name }}</div>
<div
v-for="(item, index) in editEnterrectPics"
:key="item.name + index"
>
{{ item.name }}
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -388,18 +464,25 @@
</template>
<script>
import axiosFile from '@/utils/requestfile.js'
import { getAllCompanyInfo, getHideDangeById, deletedgById, getHideDangerBychIds, getAllCompanyInfoByhdName, getHdByName } from '../../api/industry.js'
import axios from 'axios'
import { parseTime } from '@/utils/index.js'
import axiosFile from "@/utils/requestfile.js";
import {
getAllCompanyInfo,
getHideDangeById,
deletedgById,
getHideDangerBychIds,
getAllCompanyInfoByhdName,
getHdByName
} from "../../api/industry.js";
import axios from "axios";
import { parseTime } from "@/utils/index.js";
// import { Form } from 'element-ui'
export default {
data() {
return {
// 企业模糊搜索信息
enterSearchInfo: '',
enterSearchInfo: "",
// 搜索隐患信息
hdSearchInfo: '',
hdSearchInfo: "",
// 总的个数
totalElement: 0,
// 当前页的条数
......@@ -407,42 +490,41 @@ export default {
// 当前页码
currentPage: 1,
// 企业信息
enterinfo: '',
enterinfo: "",
formInfo: {
// 企业id
companyId: 12,
// 验收人
hdAcceptancePerson: '',
hdAcceptancePerson: "",
// 隐患描述
hdDesc: '',
hdDesc: "",
// 序号
hdOrder: 1,
// 隐患id
hdId: 1,
// 检查日期
hdInspectDate: '',
hdInspectDate: "",
// 检查专家
hdInspectExpert: '',
hdInspectExpert: "",
// 隐患等级
hdLevel: '1',
hdLevel: "1",
// 检查名称
hdName: '',
hdName: "",
// 整改日期
hdRectificationDate: '',
hdRectificationDate: "",
// 整改建议
hdRectificationSug: '',
hdRectificationSug: "",
// 隐患状态
hdStatus: '0'
hdStatus: "0"
},
// 企业隐患总和
enterdanger: [
],
enterdanger: [],
// 新增隐患清单
adddialogform: false,
// 编辑隐患清单
editdialogform: false,
// 导入的文件
importFile: '',
importFile: "",
// 实现模态对话框的开关
dialogonoff: false,
// 新增企业信息隐患照片的名称数组
......@@ -458,364 +540,435 @@ export default {
// 开关
onoff: false,
// 生成上传隐患图片的url
uploadHdUrl: '',
uploadHdUrl: "",
// 生成上传整改图片的url
uploadRectUrl: '',
uploadRectUrl: "",
// 生成编辑隐患图片的url
uploadEditHdUrl: '',
uploadEditHdUrl: "",
// 生成编辑整改图片的url
uploadEditRectUrl: '',
uploadEditRectUrl: "",
// 导出选择的隐患分析日期区间
hdAnalyzeChosenDateRange: '',
hdAnalyzeChosenDateRange: "",
// 正在加载 loading
loadingHDAnalyzeExcel: false
}
};
},
mounted() {
this.initDangerInfo()
this.initDangerInfo();
},
methods: {
// 初始化所有隐患信息
async initDangerInfo(toPagination) {
let replaceArray = []
let replaceArray = [];
await getAllCompanyInfo({
page: toPagination === undefined ? (Number(this.currentPage) - 1) : 0,
page: toPagination === undefined ? Number(this.currentPage) - 1 : 0,
size: this.currenetPageDegree,
companyName: this.enterSearchInfo
}).then(res => {
this.totalElement = res.totalElements
this.totalElement = res.totalElements;
// this.enterdanger = [...res.content]
replaceArray = [...res.content]
replaceArray = replaceArray.sort((a, b) => a.companyId - b.companyId)
replaceArray = [...res.content];
replaceArray = replaceArray.sort((a, b) => a.companyId - b.companyId);
for (let i = 0; i < replaceArray.length; i++) {
replaceArray[i].hdlist = []
replaceArray[i].hdlist = [];
}
this.enterdanger = [...replaceArray]
})
this.isloading = false
this.enterdanger = [...replaceArray];
});
this.isloading = false;
},
async initDangerInfo2(toPagination) {
let replaceArray = []
await getAllCompanyInfoByhdName(this.enterSearchInfo, this.hdSearchInfo, toPagination === undefined ? (Number(this.currentPage) - 1) : 0, this.currenetPageDegree).then(res => {
let replaceArray = [];
await getAllCompanyInfoByhdName(
this.enterSearchInfo,
this.hdSearchInfo,
toPagination === undefined ? Number(this.currentPage) - 1 : 0,
this.currenetPageDegree
).then(res => {
// console.log(res, 'woqunimalegebi')
console.log(res, '什么鬼啊')
this.totalElement = res.totalElements
replaceArray = [...res.content]
replaceArray = replaceArray.sort((a, b) => a.companyId - b.companyId)
console.log(res, "什么鬼啊");
this.totalElement = res.totalElements;
replaceArray = [...res.content];
replaceArray = replaceArray.sort((a, b) => a.companyId - b.companyId);
for (let i = 0; i < replaceArray.length; i++) {
replaceArray[i].hdlist = []
replaceArray[i].hdlist = [];
}
this.enterdanger = [...replaceArray]
})
this.isloading = false
this.enterdanger = [...replaceArray];
});
this.isloading = false;
},
// 新增隐患清单
addDanger($event, index, scope1) {
// 唤起dialog
console.log($event, index, scope1)
console.log($event, index, scope1);
// 设置this.form中的companyId
this.formInfo.companyId = scope1.companyId
this.formInfo.hdOrder = scope1.hdlist.length + 1
this.adddialogform = true
this.formInfo.companyId = scope1.companyId;
this.formInfo.hdOrder = scope1.hdlist.length + 1;
this.adddialogform = true;
},
// 导入隐患清单
importDanger($event, index, row) {
console.log($event, index, row, 'fsdfdsfsfdsfsdfdsfdsfds')
console.log($event, index, row, "fsdfdsfsfdsfsdfdsfdsfds");
// this.$message.error('helloworld')
// 模态对话框
if (this.dialogonoff === false) {
$event.stopPropagation()
$event.preventDefault()
this.$alert('请先将文件另存为97-2003(xls)格式', '请注意', {
confirmButtonText: '确定',
$event.stopPropagation();
$event.preventDefault();
this.$alert("请先将文件另存为97-2003(xls)格式", "请注意", {
confirmButtonText: "确定",
callback: action => {
console.log(action, 'helloworld')
console.log(action, "helloworld");
// this.onoff = true
this.dialogonoff = true
$event.target.click()
this.dialogonoff = true;
$event.target.click();
setTimeout(() => {
this.dialogonoff = false
}, 0)
this.dialogonoff = false;
}, 0);
}
})
});
}
},
// 格式化时间
toolformatTime(date1) {
let year = 0
let month = 0
let day = 0
let hour = 0
let minute = 0
let second = 0
year = date1.getFullYear()
month = (date1.getMonth() + 1) < 10 ? '0' + (date1.getMonth() + 1) : (date1.getMonth() + 1)
day = date1.getDate() < 10 ? '0' + date1.getDate() : date1.getDate()
hour = date1.getHours() < 10 ? ('0' + date1.getHours()) : date1.getHours()
minute = date1.getMinutes() < 10 ? ('0' + date1.getMinutes()) : date1.getMinutes()
second = date1.getSeconds() < 10 ? ('0' + date1.getSeconds()) : date1.getSeconds()
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
let year = 0;
let month = 0;
let day = 0;
let hour = 0;
let minute = 0;
let second = 0;
year = date1.getFullYear();
month =
date1.getMonth() + 1 < 10
? "0" + (date1.getMonth() + 1)
: date1.getMonth() + 1;
day = date1.getDate() < 10 ? "0" + date1.getDate() : date1.getDate();
hour = date1.getHours() < 10 ? "0" + date1.getHours() : date1.getHours();
minute =
date1.getMinutes() < 10 ? "0" + date1.getMinutes() : date1.getMinutes();
second =
date1.getSeconds() < 10 ? "0" + date1.getSeconds() : date1.getSeconds();
return (
year +
"-" +
month +
"-" +
day +
" " +
hour +
":" +
minute +
":" +
second
);
},
// 新增隐患清单确定提交
confirmadddg($event) {
console.log($event, '新增隐患清单确认提交')
console.log(this.formInfo.hdInspectDate, '检查日期')
console.log(this.formInfo.hdRectificationDate, '整改日期')
console.log($event, "新增隐患清单确认提交");
console.log(this.formInfo.hdInspectDate, "检查日期");
console.log(this.formInfo.hdRectificationDate, "整改日期");
let isToDeleteFormDate = false
let isToDeleteFormDate = false;
if (!this.formInfo.hdInspectDate) {
isToDeleteFormDate = true
this.$confirm('没有添加检查日期', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
isToDeleteFormDate = true;
this.$confirm("没有添加检查日期", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
});
}
if (this.formInfo.hdInspectDate) {
this.formInfo.hdInspectDate = this.toolformatTime(new Date(this.formInfo.hdInspectDate))
this.formInfo.hdInspectDate = this.toolformatTime(
new Date(this.formInfo.hdInspectDate)
);
}
let isToDeleteDate = false
let isToDeleteDate = false;
if (!this.formInfo.hdRectificationDate) {
isToDeleteDate = true
isToDeleteDate = true;
}
if (this.formInfo.hdRectificationDate) {
this.formInfo.hdRectificationDate = this.toolformatTime(new Date(this.formInfo.hdRectificationDate))
this.formInfo.hdRectificationDate = this.toolformatTime(
new Date(this.formInfo.hdRectificationDate)
);
}
const formData = new FormData()
const formData = new FormData();
for (const key of Object.keys(this.formInfo)) {
formData.append(key, this.formInfo[key])
formData.append(key, this.formInfo[key]);
}
if (isToDeleteDate) {
formData.delete('hdRectificationDate')
formData.delete("hdRectificationDate");
}
if (isToDeleteFormDate) {
formData.delete('hdInspectDate')
formData.delete("hdInspectDate");
}
for (let i = 0; i < this.addEnterhdPics.length; i++) {
formData.append('hdPic', this.addEnterhdPics[i])
formData.append("hdPic", this.addEnterhdPics[i]);
}
for (let i = 0; i < this.adEnterrectPics.length; i++) {
formData.append('hdRectificationPic', this.adEnterrectPics[i])
formData.append("hdRectificationPic", this.adEnterrectPics[i]);
}
if (this.addEnterhdPics.length === 0) {
formData.delete('hdPic')
formData.delete("hdPic");
}
if (this.adEnterrectPics.length === 0) {
formData.delete('hdRectificationPic')
formData.delete("hdRectificationPic");
}
formData.delete('hdId')
formData.delete("hdId");
axiosFile({
url: '/api/thHiddenDanger',
method: 'POST',
url: "/api/thHiddenDanger",
method: "POST",
data: formData
}).then(res => {
console.log(res)
this.$message({
message: '添加成功',
type: 'success'
})
this.adddialogform = false
this.isloading = true
this.initDangerInfo()
this.clearPics()
}, () => {
this.$message.error('添加失败')
})
}).then(
res => {
console.log(res);
this.$message({
message: "添加成功",
type: "success"
});
this.adddialogform = false;
this.isloading = true;
this.initDangerInfo();
this.clearPics();
},
() => {
this.$message.error("添加失败");
}
);
},
// 编辑隐患清单
editdg($event, index, row) {
// 编辑隐患清单
console.log($event, '编辑隐患清单', index, row)
this.formInfo = { ...row }
this.formInfo.hdLevel = this.formInfo.hdLevel + ''
this.formInfo.hdStatus = this.formInfo.hdStatus + ''
if (this.formInfo.hdDesc === 'null') {
this.formInfo.hdDesc = ''
console.log($event, "编辑隐患清单", index, row);
this.formInfo = { ...row };
this.formInfo.hdLevel = this.formInfo.hdLevel + "";
this.formInfo.hdStatus = this.formInfo.hdStatus + "";
if (this.formInfo.hdDesc === "null") {
this.formInfo.hdDesc = "";
}
if (this.formInfo.hdAcceptancePerson === 'null') {
this.formInfo.hdAcceptancePerson = ''
if (this.formInfo.hdAcceptancePerson === "null") {
this.formInfo.hdAcceptancePerson = "";
}
getHideDangerBychIds(row.companyId, row.hdId).then(res => {
if (res && res.content && res.content.length > 0) {
this.formInfo = { ... res.content[0] }
if (this.formInfo.hdDesc === 'null') {
this.formInfo.hdDesc = ''
this.formInfo = { ...res.content[0] };
if (this.formInfo.hdDesc === "null") {
this.formInfo.hdDesc = "";
}
if (this.formInfo.hdAcceptancePerson === 'null') {
this.formInfo.hdAcceptancePerson = ''
if (this.formInfo.hdAcceptancePerson === "null") {
this.formInfo.hdAcceptancePerson = "";
}
this.formInfo.hdLevel = this.formInfo.hdLevel + ''
this.formInfo.hdStatus = this.formInfo.hdStatus + ''
if (res.content[0].hdPic && res.content[0].hdPic.length && res.content[0].hdPic.length > 0) {
this.editEnterhdPics = [...res.content[0].hdPic]
this.formInfo.hdLevel = this.formInfo.hdLevel + "";
this.formInfo.hdStatus = this.formInfo.hdStatus + "";
if (
res.content[0].hdPic &&
res.content[0].hdPic.length &&
res.content[0].hdPic.length > 0
) {
this.editEnterhdPics = [...res.content[0].hdPic];
} else {
this.editEnterhdPics = []
this.editEnterhdPics = [];
}
if (res.content[0].hdRectificationPic && res.content[0].hdRectificationPic.length && res.content[0].hdRectificationPic.length > 0) {
this.editEnterrectPics = [...res.content[0].hdRectificationPic]
if (
res.content[0].hdRectificationPic &&
res.content[0].hdRectificationPic.length &&
res.content[0].hdRectificationPic.length > 0
) {
this.editEnterrectPics = [...res.content[0].hdRectificationPic];
} else {
this.editEnterrectPics = []
this.editEnterrectPics = [];
}
}
})
this.editdialogform = true
});
this.editdialogform = true;
},
// 编辑隐患清单确认提交
confirmeditdg($event) {
console.log($event, '编辑隐患清单确认提交')
this.formInfo.hdInspectDate = this.toolformatTime(new Date(this.formInfo.hdInspectDate))
let isToDeleteDate = false
console.log($event, "编辑隐患清单确认提交");
this.formInfo.hdInspectDate = this.toolformatTime(
new Date(this.formInfo.hdInspectDate)
);
let isToDeleteDate = false;
if (!this.formInfo.hdRectificationDate) {
isToDeleteDate = true
isToDeleteDate = true;
}
if (this.formInfo.hdRectificationDate) {
this.formInfo.hdRectificationDate = this.toolformatTime(new Date(this.formInfo.hdRectificationDate))
this.formInfo.hdRectificationDate = this.toolformatTime(
new Date(this.formInfo.hdRectificationDate)
);
}
const formData = new FormData()
console.log(this.formInfo.hdStatus, '12332323323232113221321312321321')
const formData = new FormData();
console.log(this.formInfo.hdStatus, "12332323323232113221321312321321");
for (const key of Object.keys(this.formInfo)) {
formData.append(key, this.formInfo[key])
formData.append(key, this.formInfo[key]);
}
for (let i = 0; i < this.editEnterhdPics.length; i++) {
console.log(typeof this.editEnterhdPics[i], 'helloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld')
console.log(
typeof this.editEnterhdPics[i],
"helloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld"
);
if (typeof this.editEnterhdPics[i] === 'string') {
const bstr = atob(this.editEnterhdPics[i])
let l = bstr.length
const u8Arr = new Uint8Array(l)
if (typeof this.editEnterhdPics[i] === "string") {
const bstr = atob(this.editEnterhdPics[i]);
let l = bstr.length;
const u8Arr = new Uint8Array(l);
while (l--) {
u8Arr[l] = bstr.charCodeAt(l)
u8Arr[l] = bstr.charCodeAt(l);
}
// const curBlob = new Blob([u8Arr], {
// type: 'image/jpg;'
// })
const name1 = '' + (Math.random() * 10) + (Math.random() * 10) + (Math.random() * 10) + (Math.random() * 10) + '.jpg'
const curFile = new File([u8Arr], name1, { type: 'image/jpg' })
formData.append('hdPic', curFile)
const name1 =
"" +
Math.random() * 10 +
Math.random() * 10 +
Math.random() * 10 +
Math.random() * 10 +
".jpg";
const curFile = new File([u8Arr], name1, { type: "image/jpg" });
formData.append("hdPic", curFile);
} else {
formData.append('hdPic', this.editEnterhdPics[i])
formData.append("hdPic", this.editEnterhdPics[i]);
}
}
for (let i = 0; i < this.editEnterrectPics.length; i++) {
if (typeof this.editEnterrectPics[i] === 'string') {
const bstr = atob(this.editEnterrectPics[i])
let l = bstr.length
const u8Arr = new Uint8Array(l)
if (typeof this.editEnterrectPics[i] === "string") {
const bstr = atob(this.editEnterrectPics[i]);
let l = bstr.length;
const u8Arr = new Uint8Array(l);
while (l--) {
u8Arr[l] = bstr.charCodeAt(l)
u8Arr[l] = bstr.charCodeAt(l);
}
// const curBlob = new Blob([u8Arr], {
// type: 'image/jpg;'
// })
const name1 = '' + (Math.random() * 10) + (Math.random() * 10) + (Math.random() * 10) + (Math.random() * 10) + '.jpg'
const curFile = new File([u8Arr], name1, { type: 'image/jpg' })
formData.append('hdRectificationPic', curFile)
const name1 =
"" +
Math.random() * 10 +
Math.random() * 10 +
Math.random() * 10 +
Math.random() * 10 +
".jpg";
const curFile = new File([u8Arr], name1, { type: "image/jpg" });
formData.append("hdRectificationPic", curFile);
} else {
formData.append('hdRectificationPic', this.editEnterrectPics[i])
formData.append("hdRectificationPic", this.editEnterrectPics[i]);
}
}
// if (this.formInfo.hdPic && this.formInfo.hdPic.length && this.formInfo.hdPic.length > 0) {
// if (this.edit)
// }
if (isToDeleteDate) {
formData.delete('hdRectificationDate')
formData.delete("hdRectificationDate");
}
if (this.editEnterhdPics.length === 0) {
formData.delete('hdPic')
formData.delete("hdPic");
}
if (this.editEnterrectPics.length === 0) {
formData.delete('hdRectificationPic')
formData.delete("hdRectificationPic");
}
axiosFile({
url: '/api/thHiddenDanger/update',
method: 'POST',
url: "/api/thHiddenDanger/update",
method: "POST",
data: formData
}).then(res => {
console.log(res)
this.$message({
message: '编辑成功',
type: 'success'
})
this.isloading = true
this.initDangerInfo()
this.editdialogform = false
}, () => {
this.$message.error('编辑失败')
})
}).then(
res => {
console.log(res);
this.$message({
message: "编辑成功",
type: "success"
});
this.isloading = true;
this.initDangerInfo();
this.editdialogform = false;
},
() => {
this.$message.error("编辑失败");
}
);
},
// 删除隐患清单
deletedg($event, index, row) {
this.$confirm('此操作不可逆, 确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(
() => {
deletedgById(row.hdId).then(res => {
this.$confirm("此操作不可逆, 确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
deletedgById(row.hdId).then(
res => {
this.$message({
message: '删除成功',
type: 'success'
})
this.isloading = true
this.initDangerInfo()
}, () => {
this.$message.error('删除失败')
})
}
)
message: "删除成功",
type: "success"
});
this.isloading = true;
this.initDangerInfo();
},
() => {
this.$message.error("删除失败");
}
);
});
},
// 导入文件
realImportDanger(index, row) {
// this.dialogonoff = false
console.log(index, row, 'fuck the world')
console.log(index, row, "fuck the world");
// 调用提交按钮
const formdata = new FormData()
formdata.append('companyId', row.companyId)
for (let i = 0; i < this.$refs['file' + index].files.length; i++) {
formdata.append('files', this.$refs['file' + index].files[i])
const formdata = new FormData();
formdata.append("companyId", row.companyId);
for (let i = 0; i < this.$refs["file" + index].files.length; i++) {
formdata.append("files", this.$refs["file" + index].files[i]);
}
if (this.$refs['file' + index].files.length === 0) {
return
if (this.$refs["file" + index].files.length === 0) {
return;
}
axiosFile({
url: '/api/thHiddenDanger/importExcel',
method: 'POST',
url: "/api/thHiddenDanger/importExcel",
method: "POST",
data: formdata
}).then(res => {
this.$message({
message: '上传成功',
type: 'success'
})
}, () => {
this.$message.error('上传失败')
})
}).then(
res => {
this.$message({
message: "上传成功",
type: "success"
});
},
() => {
this.$message.error("上传失败");
}
);
},
// 当前页的条数变化
handleSizeChange(val) {
this.currenetPageDegree = val
this.initDangerInfo2()
this.currenetPageDegree = val;
this.initDangerInfo2();
},
// 当前第几页
handleCurrentChange(val) {
this.currentPage = val
this.initDangerInfo2()
this.currentPage = val;
this.initDangerInfo2();
},
// 模糊搜索
searchLikeEnterInfo() {
this.initDangerInfo2('a')
this.initDangerInfo2("a");
},
// 新增隐患照片事件
addhdPicChange() {
this.addEnterhdPics = this.$refs['addhdpic'].files
if (this.addEnterhdPics && this.addEnterhdPics.length && this.addEnterhdPics.length > 0) {
this.uploadHdUrl = URL.createObjectURL(this.addEnterhdPics[0])
this.addEnterhdPics = this.$refs["addhdpic"].files;
if (
this.addEnterhdPics &&
this.addEnterhdPics.length &&
this.addEnterhdPics.length > 0
) {
this.uploadHdUrl = URL.createObjectURL(this.addEnterhdPics[0]);
}
},
// 新增导入照片事件
addrectpicChange() {
this.adEnterrectPics = this.$refs['addrectpic'].files
if (this.adEnterrectPics && this.adEnterrectPics.length && this.adEnterrectPics.length > 0) {
this.uploadRectUrl = URL.createObjectURL(this.adEnterrectPics[0])
this.adEnterrectPics = this.$refs["addrectpic"].files;
if (
this.adEnterrectPics &&
this.adEnterrectPics.length &&
this.adEnterrectPics.length > 0
) {
this.uploadRectUrl = URL.createObjectURL(this.adEnterrectPics[0]);
}
},
// 生成URL
......@@ -824,81 +977,89 @@ export default {
// for (let i = 0; i < item.length; i++) {
// myarrayBuffer[i] = item[i]
// }
return URL.createObjectURL(new Blob([item], { type: 'image/jpeg' }))
return URL.createObjectURL(new Blob([item], { type: "image/jpeg" }));
},
// 编辑隐患照片事件
edithdPicChange() {
this.editEnterhdPics = this.$refs['edithdpic'].files
this.editEnterhdPics = this.$refs["edithdpic"].files;
// console.log(this.editEnterhdPics, 'helloworldhelloworldhelloworldhelloworldhelloworld')
// if (this.editEnterhdPics && this.editEnterhdPics.length && this.editEnterhdPics.length > 0) {
// console.log('进来了吗, 1111111')
// // uploadHdUrl 被设置
// this.uploadHdUrl = URL.createObjectURL(this.editEnterhdPics[0])
// }
if (this.editEnterhdPics && this.editEnterhdPics.length && this.editEnterhdPics.length > 0) {
this.uploadEditHdUrl = URL.createObjectURL(this.editEnterhdPics[0])
console.log('这边进来了吗,' + this.uploadEditHdUrl)
if (
this.editEnterhdPics &&
this.editEnterhdPics.length &&
this.editEnterhdPics.length > 0
) {
this.uploadEditHdUrl = URL.createObjectURL(this.editEnterhdPics[0]);
console.log("这边进来了吗," + this.uploadEditHdUrl);
}
},
// 编辑整改照片事件
editrectpicChange() {
this.editEnterrectPics = this.$refs['editrectpic'].files
this.editEnterrectPics = this.$refs["editrectpic"].files;
// console.log(this.editEnterrectPics, '')
// if (this.editEnterrectPics && this.editEnterrectPics.length && this.editEnterrectPics.length > 0) {
// console.log('进来了吗, 222222222')
// // upload\
// this.uploadRectUrl = URL.createObjectURL(this.editEnterrectPics[0])
// }
if (this.editEnterrectPics && this.editEnterrectPics.length && this.editEnterrectPics.length > 0) {
this.uploadEditRectUrl = URL.createObjectURL(this.editEnterrectPics[0])
if (
this.editEnterrectPics &&
this.editEnterrectPics.length &&
this.editEnterrectPics.length > 0
) {
this.uploadEditRectUrl = URL.createObjectURL(this.editEnterrectPics[0]);
}
},
// 清空全部
clearAllFormInfo() {
// 除了companyId 剩下的都置零
this.formInfo.hdAcceptancePerson = ''
this.formInfo.hdAcceptancePerson = "";
// 隐患描述
this.formInfo.hdDesc = ''
this.formInfo.hdDesc = "";
// 序号
this.formInfo.hdOrder = this.formInfo.hdOrder++
this.formInfo.hdOrder = this.formInfo.hdOrder++;
// 隐患id
this.formInfo.hdId = this.formInfo.hdId
this.formInfo.hdId = this.formInfo.hdId;
// 检查日期
this.formInfo.hdInspectDate = ''
this.formInfo.hdInspectDate = "";
// 检查专家
this.formInfo.hdInspectExpert = ''
this.formInfo.hdInspectExpert = "";
// 隐患等级
this.formInfo.hdLevel = '1'
this.formInfo.hdLevel = "1";
// 检查名称
this.formInfo.hdName = ''
this.formInfo.hdName = "";
// 整改日期
this.formInfo.hdRectificationDate = ''
this.formInfo.hdRectificationDate = "";
// 整改建议
this.formInfo.hdRectificationSug = ''
this.formInfo.hdRectificationSug = "";
// 隐患状态
this.formInfo.hdStatus = '0'
this.formInfo.hdStatus = "0";
},
// 清空图片
clearPics() {
this.addEnterhdPics = []
this.adEnterrectPics = []
this.uploadHdUrl = ''
this.uploadRectUrl = ''
this.addEnterhdPics = [];
this.adEnterrectPics = [];
this.uploadHdUrl = "";
this.uploadRectUrl = "";
},
// 展开事件
expandHdInfo(row, expanded) {
console.log(row, expanded, '展开事件被触发')
let isNotFount = false
console.log(row, expanded, "展开事件被触发");
let isNotFount = false;
if (expanded && expanded.length && expanded.length > 0) {
expanded.forEach(item => {
if (Number(item.companyId) === Number(row.companyId)) {
isNotFount = true
isNotFount = true;
}
})
});
}
// 如果是展开事件并且hdlist不存在
if (isNotFount === true && row.hdlist.length === 0) {
this.isloading = true
this.isloading = true;
// getHideDangeById(Number(row.companyId)).then(resdg => {
// row.hdlist = [...resdg.content]
// row.hdlist = row.hdlist.sort((a, b) => a.hdId - b.hdId)
......@@ -917,23 +1078,41 @@ export default {
// }, () => {
// this.isloading = false
// })
getHdByName(Number(row.companyId), undefined, this.hdSearchInfo, 0, 9999, 'hdId,desc').then(res => {
row.hdlist = [...res.content]
row.hdlist = row.hdlist.sort((a, b) => a.hdId - b.hdId)
for (let j = 0; j < row.hdlist.length; j++) {
row.hdlist[j].hdOrder = j + 1
row.hdlist[j].companyId = Number(row.companyId)
getHdByName(row.companyId, row.hdlist[j].hdId, this.hdSearchInfo, 0, 9999, 'hdId,desc').then(res1 => {
if (res1 && res1.content && res1.content.length > 0) {
row.hdlist[j].hdPic = res1.content[0].hdPic
row.hdlist[j].hdRectificationPic = res1.content[0].hdRectificationPic
}
})
getHdByName(
Number(row.companyId),
undefined,
this.hdSearchInfo,
0,
9999,
"hdId,desc"
).then(
res => {
row.hdlist = [...res.content];
row.hdlist = row.hdlist.sort((a, b) => a.hdId - b.hdId);
for (let j = 0; j < row.hdlist.length; j++) {
row.hdlist[j].hdOrder = j + 1;
row.hdlist[j].companyId = Number(row.companyId);
getHdByName(
row.companyId,
row.hdlist[j].hdId,
this.hdSearchInfo,
0,
9999,
"hdId,desc"
).then(res1 => {
if (res1 && res1.content && res1.content.length > 0) {
row.hdlist[j].hdPic = res1.content[0].hdPic;
row.hdlist[j].hdRectificationPic =
res1.content[0].hdRectificationPic;
}
});
}
this.isloading = false;
},
() => {
this.isloading = false;
}
this.isloading = false
}, () => {
this.isloading = false
})
);
}
// if (expanded) {}
// if (row.hdlist.length > 0) {
......@@ -955,142 +1134,155 @@ export default {
},
exportStatus() {
axios({
url: process.env.VUE_APP_BASE_API + '/api/thHiddenDanger/export',
method: 'get',
responseType: 'blob',
url: process.env.VUE_APP_BASE_API + "/api/thHiddenDanger/export",
method: "get",
responseType: "blob",
params: {
hdStatus: 1
}
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'export.xls')
document.body.appendChild(link)
link.click()
link.remove()
window.URL.revokeObjectURL(link.href)
})
}).then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "export.xls");
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(link.href);
});
},
exportNoStatus() {
axios({
url: process.env.VUE_APP_BASE_API + '/api/thHiddenDanger/export',
method: 'get',
responseType: 'blob',
url: process.env.VUE_APP_BASE_API + "/api/thHiddenDanger/export",
method: "get",
responseType: "blob",
params: {
hdStatus: 0
}
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'export.xls')
document.body.appendChild(link)
link.click()
link.remove()
window.URL.revokeObjectURL(link.href)
})
}).then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "export.xls");
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(link.href);
});
},
exportOvertime() {
axios({
url: process.env.VUE_APP_BASE_API + '/api/thHiddenDanger/export',
method: 'get',
responseType: 'blob',
url: process.env.VUE_APP_BASE_API + "/api/thHiddenDanger/export",
method: "get",
responseType: "blob",
params: {
hdStatus: 2
}
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'export.xls')
document.body.appendChild(link)
link.click()
link.remove()
window.URL.revokeObjectURL(link.href)
})
}).then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "export.xls");
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(link.href);
});
},
exportHDAnalyze() {
if (this.hdAnalyzeChosenDateRange instanceof Array) {
this.loadingHDAnalyzeExcel = true
this.loadingHDAnalyzeExcel = true;
axios({
url: process.env.VUE_APP_BASE_API + '/api/thHiddenDanger/exportExcel',
method: 'get',
responseType: 'blob',
onDownloadProgress: (ProgressEvent) => {
console.log(ProgressEvent, 'exportHDAnalyze exportHDAnalyze exportHDAnalyze')
this.loadingHDAnalyzeExcel = true
url: process.env.VUE_APP_BASE_API + "/api/thHiddenDanger/exportExcel",
method: "get",
responseType: "blob",
onDownloadProgress: ProgressEvent => {
console.log(
ProgressEvent,
"exportHDAnalyze exportHDAnalyze exportHDAnalyze"
);
this.loadingHDAnalyzeExcel = true;
if (this.timerLoadingHDAnalyzeExcel) {
clearTimeout(this.timerLoadingHDAnalyzeExcel)
clearTimeout(this.timerLoadingHDAnalyzeExcel);
} else {
this.timerLoadingHDAnalyzeExcel = setTimeout(() => {
this.loadingHDAnalyzeExcel = false
}, 500)
this.loadingHDAnalyzeExcel = false;
}, 500);
}
},
params: {
startTime: parseTime(new Date(this.hdAnalyzeChosenDateRange[0]), '{y}-{m}-{d}'),
endTime: parseTime(new Date(this.hdAnalyzeChosenDateRange[1]), '{y}-{m}-{d}')
startTime: parseTime(
new Date(this.hdAnalyzeChosenDateRange[0]),
"{y}-{m}-{d}"
),
endTime: parseTime(
new Date(this.hdAnalyzeChosenDateRange[1]),
"{y}-{m}-{d}"
)
}
}).then(res => {
console.dir(res, 'console')
console.log(res, 'this.hdAnalyzeChosenDateRange this.hdAnalyzeChosenDateRange')
const url = window.URL.createObjectURL(new Blob([res.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', decodeURI(res.headers['content-disposition'].split("''")[1]))
document.body.appendChild(link)
link.click()
link.remove()
window.URL.revokeObjectURL(link.href)
})
console.dir(res, "console");
console.log(
res,
"this.hdAnalyzeChosenDateRange this.hdAnalyzeChosenDateRange"
);
const url = window.URL.createObjectURL(new Blob([res.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute(
"download",
decodeURI(res.headers["content-disposition"].split("''")[1])
);
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(link.href);
});
} else {
this.$message.error('请选择日期')
this.$message.error("请选择日期");
}
}
}
}
};
</script>
<style lang="scss">
.hidedanger-wrapper {
padding: 20px;
}
/* input[type="file"] {
.hidedanger-wrapper {
padding: 20px;
}
/* input[type="file"] {
color: lightblue;
} */
/* input {
/* input {
color: lightblue !important;
font-size: 16px;
} */
/* label {
/* label {
margin: 0 10px;
} */
.operations-add-import-wrapper {
display: flex;
align-items: center;
.import-file-dg-wrapper {
display: inline-block;
margin: 0 20px;
.import-file-dg {
color: white;
border-radius: 3px;
background-color: #1890ff;
/* display: inline-block; */
text-align: center;
width: 56px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
&:hover {
/* color: #46a6ff; */
/* border-color: #badeff; */
background-color: #46a6ff;
}
.operations-add-import-wrapper {
display: flex;
align-items: center;
.import-file-dg-wrapper {
display: inline-block;
margin: 0 20px;
.import-file-dg {
color: white;
border-radius: 3px;
background-color: #1890ff;
/* display: inline-block; */
text-align: center;
width: 56px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
&:hover {
/* color: #46a6ff; */
/* border-color: #badeff; */
background-color: #46a6ff;
}
}
}
}
</style>
......@@ -3677,13 +3677,13 @@ export default {
console.log(result, 'result reuslt _____________')
for (let i = 0; i < result.length;i++) {
if (result[i].dualSystemNum > 0) {
this.dualSystemEnters.push(result[i])
this.dualSystemEnters.push({...result[i]})
}
if (result[i].emergencyPlanNum > 0) {
this.emergencyPlanEnters.push(result[i])
this.emergencyPlanEnters.push({...result[i]})
}
if (result[i].standardizationNum > 0) {
this.standardization.push(result[i])
this.standardization.push({...result[i]})
}
}
let proArr2 = []
......@@ -3694,6 +3694,7 @@ export default {
size: 999,
page: 0
}).then(res => {
console.log(res, '双体系证书 双体系证书 双体系证书')
this.dualSystemEnters[i].certifies = [...res.content.map(item => {
const index1 = item.filePath.indexOf('\\')
const index2 = item.filePath.indexOf('\\', index1 + 1)
......@@ -3711,6 +3712,7 @@ export default {
size: 999,
page: 0
}).then(res => {
console.log(res, '应急预案 应急预案 应急预案')
this.emergencyPlanEnters[i].certifies = [...res.content.map(item => {
const index1 = item.filePath.indexOf('\\')
const index2 = item.filePath.indexOf('\\', index1 + 1)
......@@ -3721,14 +3723,15 @@ export default {
})
proArr2.push(p1)
}
for (let i = 0; i < this.standardizationNum.length; i++) {
for (let i = 0; i < this.standardization.length; i++) {
const p1 = enterHwapproval({
companyId: this.standardizationNum[i].companyId,
companyId: this.standardization[i].companyId,
category: '标准化',
size: 999,
page: 0
}).then(res => {
this.standardizationNum[i].certifies = [...res.content.map(item => {
console.log(res, '标准化 标准化 标准化')
this.standardization[i].certifies = [...res.content.map(item => {
const index1 = item.filePath.indexOf('\\')
const index2 = item.filePath.indexOf('\\', index1 + 1)
const index3 = item.filePath.indexOf('\\', index2 + 1)
......@@ -12018,146 +12021,6 @@ export default {
if (this.isCurCertifyIndex === 3) {
this.certifies = item.certifies
}
// 判断当前的企业
// if (this.isCurCertifyIndex === 1) {
// if (item.companyName === "威海大庆特种材料制品有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify1/威海大庆特种材料制作有限公司-双体系.pdf",
// },
// ];
// }
// if (item.companyName === "威海大宇电子有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify1/威海大宇电子有限公司-双体系.jpg",
// },
// ];
// }
// if (item.companyName === "威海海马地毯集团有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify1/威海海马地毯集团有限公司-双体系1.pdf",
// },
// {
// filePath:
// "https://8.143.198.78/certify1/威海海马地毯集团有限公司-双体系2.pdf",
// },
// ];
// }
// if (item.companyName === "威海市金宇彩印有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify1/威海市金宇彩印有限公司-双体系1.jpg",
// },
// {
// filePath:
// "https://8.143.198.78/certify1/威海市金宇彩印有限公司-双体系2.jpg",
// },
// ];
// }
// }
// if (this.isCurCertifyIndex === 2) {
// if (item.companyName === "威海大庆特种材料制品有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify3/威海大庆特种材料制品有限公司-应急预案.pdf",
// },
// ];
// }
// if (item.companyName === "威海大宇电子有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify3/威海大宇电子有限公司-应急预案.jpg",
// },
// ];
// }
// if (item.companyName === "威海海马地毯集团有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify3/威海海马地毯集团有限公司-应急预案.pdf",
// },
// ];
// }
// if (item.companyName === "威海锦佳印刷有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify3/威海锦佳印刷有限公司-应急预案.jpg",
// },
// ];
// }
// if (item.companyName === "威海众恒医疗设备有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify3/威海众恒医疗设备有限公司-应急预案.jpg",
// },
// ];
// }
// }
// if (this.isCurCertifyIndex === 3) {
// if (item.companyName === "威海大庆特种材料制品有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海大庆特种材料制品有限公司-标准化.pdf",
// },
// ];
// }
// if (item.companyName === "威海大宇电子有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海大宇电子有限公司-标准化.jpg",
// },
// ];
// }
// if (item.companyName === "威海海马地毯集团有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海海马地毯集团有限公司-标准化.pdf",
// },
// ];
// }
// if (item.companyName === "威海锦佳印刷有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海锦佳印刷有限公司-标准化.jpg",
// },
// ];
// }
// if (item.companyName === "威海市金宇彩印有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海市金宇彩印有限公司-标准化.jpg",
// },
// ];
// }
// if (item.companyName === "威海众恒医疗设备有限公司") {
// this.certifies = [
// {
// filePath:
// "https://8.143.198.78/certify2/威海众恒医疗设备有限公司-标准化1.jpg",
// },
// {
// filePath:
// "https://8.143.198.78/certify2/威海众恒医疗设备有限公司-标准化2.jpg",
// },
// ];
// }
// }
return;
}
const AMap = window.AMap || {};
......
<template>
<div class="hwapproval-wrapper">
<div class="hwapproval-tools-wrapper">
<el-select
<!-- <el-select
v-model="searchEnter"
multiple
filterable
......@@ -17,8 +17,9 @@
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button type="success" @click="">查找</el-button>
</el-select> -->
<el-input v-model="searchEnter" placeholder="请输入企业名称" style="width: 80%;"></el-input>
<el-button type="success" @click="clickToSearchEnter">查找</el-button>
</div>
<div class="hwapproval-table-wrapper">
<el-table :data="approvalList" border>
......@@ -87,13 +88,13 @@
placeholder="选择日期时间"
/>
</el-form-item>
<el-form-item prop="uploadTime" label="上传时间">
<!-- <el-form-item prop="uploadTime" label="上传时间">
<el-date-picker
v-model="addFormInfo.uploadTime"
type="datetime"
placeholder="选择日期时间"
/>
</el-form-item>
</el-form-item> -->
<el-form-item prop="file" label="文件">
<div>
<label
......@@ -115,7 +116,8 @@
<script>
import pdf from "vue-pdf";
import { dangerJobReportEnterprise } from "@/api/dangerjob.js";
import { dangerJobReportEnterprise, postDangerJobReport } from "@/api/dangerjob.js";
import { parseTime } from '../../utils';
export default {
components: {
pdf,
......@@ -173,13 +175,13 @@ export default {
trigger: "change",
},
],
uploadTime: [
{
required: true,
message: "请选择上传时间",
trigger: "change",
},
],
// uploadTime: [
// {
// required: true,
// message: "请选择上传时间",
// trigger: "change",
// },
// ],
file: [
{
required: true,
......@@ -220,8 +222,9 @@ export default {
chooseFile() {
this.addFormInfo.file = null;
this.uploadFilePath = "";
console.log(this.$refs.chosenfile.files, 'this.$refs.chosenfile.files this.$refs.chosenfile.files this.$refs.chosenfile.files')
if (this.$refs.chosenfile.files.length) {
const filePath = this.$refs.chooseFile.files[0].name;
const filePath = this.$refs.chosenfile.files[0].name;
if (
!(
filePath.endsWith(".pdf") ||
......@@ -234,7 +237,7 @@ export default {
return;
}
this.uploadFilePath = filePath;
this.addFormInfo.file = this.$refs.chooseFile.files[0];
this.addFormInfo.file = this.$refs.chosenfile.files[0];
}
},
cancelHWapproval() {
......@@ -243,6 +246,21 @@ export default {
submitHWapproval() {
this.$refs.addform.validate((valid) => {
if (valid) {
const formData = new FormData();
formData.append('companyId', this.addFormInfo.companyId);
formData.append('name', this.addFormInfo.name);
formData.append('file', this.addFormInfo.file);
formData.append('time', parseTime(this.workTime, '{y}-{m}-{d} {h}:{i}:{s}'))
postDangerJobReport(formData).then(res => {
console.log(res, 'postDanegrJobReport postDangerJobReport')
this.$message({
type: 'success',
message: '上传成功'
})
this.addDialogShow = false
}).catch(() => {
this.$message.error('上传失败')
})
}
});
},
......@@ -258,6 +276,21 @@ export default {
},
viewApproval(prow, childrow) {},
downloadApproval(prow, childrow) {},
clickToSearchEnter() {
dangerJobReportEnterprise({
enterpriseName: this.searchEnter
}).then(res => {
this.approvalList = [
...res.content.map((item) => {
return {
companyName: item.enterpriseName,
companyId: item.enterpriseId,
};
}),
];
})
},
},
};
</script>
......
......@@ -5,15 +5,6 @@
<h2>{{ companyName }}</h2>
<el-divider></el-divider>
</div>
<!-- <div class="hwapprovals-find-item">
<div class="hwapprovals-title">企业名称:</div>
<div>
<el-input
v-model="hwapprovalsName"
placeholder="请输入企业名称"
></el-input>
</div>
</div> -->
<div class="hwapprovals-find-item">
<div class="hwapprovals-title">危险作业名称:</div>
<div>
......@@ -84,6 +75,35 @@
</el-table>
</div>
</div>
<div
v-if="certifyShow && getFileType"
class="certify-item"
@click.stop=""
@mousewheel.stop.prevent=""
>
<div class="certify-inner-wrapper">
<div class="certify-innerw-wrapper" @mousewheel.stop="">
<pdf
v-for="i in pdfNumPage"
:key="i"
:page="i"
:src="loadingTask"
></pdf>
</div>
<div class="close-certify" @click="certifyShow = false"></div>
</div>
</div>
<div
v-if="certifyShow && !getFileType"
class="certify-item"
@click.stop=""
@mousewheel.stop.prevent=""
>
<div class="certify-inner-wrapper">
<img :src="curCertifyFilePath" class="certify-img" />
<div class="close-certify" @click="certifyShow = false"></div>
</div>
</div>
</div>
</template>
......@@ -97,6 +117,7 @@ export default {
},
data() {
return {
certifyShow: false,
hwapprovalsName: "", //企业名称
dangerName: "", //危险作业名称
uploadDate: "", //上传日期
......@@ -186,12 +207,14 @@ export default {
});
},
viewHwapproval(row) {
// this.certifyShow = true;
this.certifyShow = true;
this.curHwapprovalFilePath = row.filePath;
const index1 = this.curHwapprovalFilePath.indexOf("\\");
const index2 = this.curHwapprovalFilePath.indexOf("\\", index1 + 1);
const index3 = this.curHwapprovalFilePath.indexOf("\\", index2 + 1);
this.curHwapprovalFilePath = this.curHwapprovalFilePath.substring(index3);
this.curCertifyFilePath = this.curHwapprovalFilePath
if (this.curHwapprovalFilePath.endsWith(".pdf")) {
// if (this.curHwapprovalFilePath.endsWith(".pdf")) {
this.loadingTask = pdf.createLoadingTask(this.curHwapprovalFilePath);
......@@ -218,6 +241,14 @@ export default {
window.URL.revokeObjectURL(link.href);
},
},
computed: {
getFileType() {
if (this.curCertifyFilePath.endsWith(".pdf")) {
return true;
}
return false;
},
},
mounted() {
// console.log(this.$route.params.name);
this.companyId = this.$route.params.name.split("&")[0];
......@@ -336,4 +367,49 @@ export default {
background: #eee;
}
}
.certify-item {
display: block;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 9999;
background: #808080;
.certify-inner-wrapper {
position: absolute;
width: 960px;
height: 620px;
left: 50%;
top: 50%;
padding: 20px;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
background: #eee;
.certify-innerw-wrapper {
width: 100%;
height: 100%;
overflow-y: scroll;
&::-webkit-scrollbar {
display: none;
}
}
.certify-img {
height: 100%;
}
.close-certify {
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 30px;
background-image: url("../../assets/home/certifyclose.png");
background-size: 100% 100%;
background-position: center;
cursor: pointer;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="train-image-wrapper">
<div class="train-image-tools-wrapper">
<el-input v-model="searchEntryName" style="width: 80%;" placeholder="请输入企业名称"></el-input>
<el-button type="primary" style="margin-left: 20px;" @click="searchEntry">查找</el-button>
</div>
<div class="train-image-list-wrapper">
<el-table
:data="enterList"
border
v-loading="isLoadingData"
>
<el-table-column
prop="name"
label="企业名称"
width="480"
></el-table-column>
<el-table-column
label="操作"
>
<template slot-scope="scope">
<el-button type="text" @click="enterDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="curPageSize"
layout="total, prev, pager, next, jumper"
:total="totalSize"
></el-pagination>
</div>
</div>
</template>
<script>
import { searchEnterprise } from '@/api/trainimage.js'
export default {
data() {
return {
searchEntryName: '',
enterList: [
{
name: '威海晶合数字矿山有限公司',
id: -1
},
{
name: '威海港盛船务有限公司',
id: -1
},
{
name: '山东港口威海港有限公司',
id: -1
},
{
name: '山东威海港国际客运有限公司',
id: -1
},
{
name: '威海兴茂置业有限公司'
}
],
currentPage: 1,
curPageSize: 10,
totalSize: 100,
isLoadingData: false
}
},
mounted() {
this.initData()
},
methods: {
initData() {
this.isLoadingData = true
const params = {
page: this.currentPage - 1,
size: this.curPageSize
}
if (this.searchEntryName) {
params.name = this.searchEntryName
}
searchEnterprise(params).then(res => {
this.enterList = [...res.content]
this.totalSize = res.totalElements
this.isLoadingData = false
}).catch(() => {
this.isLoadingData = false
})
},
enterDetail(row) {
console.log(row, 'enterDetail enterDetail enterDetail')
this.$router.push('/train/trainimage/trainimg/' + row.id)
},
handleSizeChange(val) {
this.curPageSize = val
this.initData()
},
handleCurrentChange(val) {
this.currentPage = val
this.initData()
},
searchEntry() {
this.initData()
}
}
}
</script>
<style lang="scss" scoped>
.train-image-wrapper {
width: 80%;
margin: 30px auto;
padding: 30px;
border-radius: 30px;
box-shadow: 0 0 9px 1px #eee;
.train-image-tools-wrapper {
width: 80%;
margin: 30px auto;
padding: 20px;
border-radius: 20px;
box-shadow: 0 0 9px 1px #eee;
display: flex;
flex-direction: row;
justify-content: flex-start;
}
.train-image-list-wrapper {
width: 80%;
margin: 30px auto;
padding: 20px;
border-radius: 20px;
box-shadow: 0 0 9px 1px #eee;
display: flex;
flex-direction: column;
align-items: center;
}
}
</style>
<template>
<div class="trainimg-statistics-wrapper">
<div class="trainimg-statistics-tools-wrapper">
<div class="trainimg-statistics-tool">
<div class="trainimg-statistics-tool-title">行业-主管部门</div>
<div class="trainimg-statistics-tool-content">
<el-select
v-model="indus_manager"
placeholder="请选择行业-主管部门"
>
<el-option
v-for="item in industries"
:key="item.name"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</div>
</div>
<div class="trainimg-statistics-tool">
<div class="trainimg-statistics-tool-title">日期</div>
<div class="trainimg-statistics-tool-content">
<el-date-picker
v-model="trainDateTime"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
</div>
<div class="trainimg-statistics-tool">
<div class="trainimg-statistics-tool-title">是否参加培训</div>
<div class="trainimg-statistics-tool-content">
<el-radio v-model="train" :label="true">参加培训</el-radio>
<el-radio v-model="train" :label="false">未参加培训</el-radio>
</div>
</div>
<div style="display: flex;flex-direction: row;justify-content: flex-end;padding: 10px;margin: 20px auto; width: 80%;">
<el-button type="primary" @click="findTrainImgStatistics">查找</el-button>
</div>
</div>
<div class="trainimg-statistics-table-wrapper">
<el-table
:data="tableData"
border
v-loading="isLoadingData"
>
<el-table-column
prop="enterpriseName"
label="企业名称"
></el-table-column>
<el-table-column
prop="peopleNum"
label="参与人数"
></el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="curPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalElements">
</el-pagination>
</div>
<div class="trainimg-statistics-census-wrapper">
<div class="trainimg-statistics-census-item">参与培训企业总数量: <span class="fontColorStatistics">{{trainEnterpriseNum}}</span></div>
<div class="trainimg-statistics-census-item">总参与人次:<span class="fontColorStatistics">{{peopleNum}}</span></div>
<div class="trainimg-statistics-census-item">未参与培训的企业数量: <span class="fontColorStatistics">{{notTrainEnterpriseNum}}</span></div>
</div>
</div>
</template>
<script>
import { trainImageAnalyze1, trainImageAnalyze2, getThIndustryChargeDept, getAllIndustry } from '@/api/trainimage.js'
import { parseTime } from '@/utils/index.js'
export default {
data() {
return {
indus_manager: '',
trainDateTime: '',
startTime: '',
endTime: '',
industry: '',
manager: '',
train: false,
industries: [],
tableData: [],
currentPage: 1,
curPageSize: 10,
totalElements: 0,
// 未参与培训企业数量
notTrainEnterpriseNum: 0,
// 总参与人次
peopleNum: 0,
// 参与培训企业总数
trainEnterpriseNum: 0,
// 是否正在加载表格数据
isLoadingData: false
}
},
mounted() {
let params = {
page: 0,
size: 999
}
getAllIndustry(params).then(res => {
console.log(res, 'getAllIndustry getAllIndustry')
this.industries = [...res.content.map(item => {
return {
name: item.industryName + '-' + item.thIndustryChargeDept.icdName
}
})]
})
trainImageAnalyze2().then(res => {
this.notTrainEnterpriseNum = res.notTrainEnterpriseNum
this.peopleNum = res.peopleNum? res.peopleNum : 0
this.trainEnterpriseNum = res.trainEnterpriseNum
})
// console.log(this.$refs.statistics, 'this.$refs.statistics')
},
methods: {
handleSizeChange(val) {
this.curPageSize = val
},
handleCurrentChange(val) {
this.currentPage = val
},
findTrainImgStatistics() {
if (!(this.startTime || this.endTime)) {
this.$message.error('请选择日期范围')
return
}
if (!(this.industry || this.manager)) {
this.$message.error('请选择行业-主管部门')
return
}
let params = {
department: this.manager,
endtime: this.endTime,
industry: this.industry,
page: this.currentPage,
size: this.curPageSize,
startTime: this.startTime,
train: this.train
}
this.isLoadingData = true
trainImageAnalyze1(params).then(res => {
console.log(res ,'trainImageAnalyze1 trainImageAnalyze1')
this.totalElements = res.totalElements
this.tableData = [...res.content]
this.isLoadingData = false
}).catch(() => {
this.isLoadingData = false
})
}
},
watch: {
indus_manager(newVal, oldVal) {
/**
* industry: '',
manager: '',
*/
this.industry = newVal.split('-')[0]
this.manager = newVal.split('-')[1]
},
trainDateTime(newVal, oldVal) {
if (newVal instanceof Array) {
/**
* startTime: '',
* endTime: '',
*/
this.startTime = parseTime(newVal[0])
this.endTime = parseTime(newVal[1])
}
}
}
}
</script>
<style lang="scss" scoped>
.trainimg-statistics-wrapper {
width: 80%;
margin: 30px auto;
padding: 30px;
border-radius: 30px;
box-shadow: 0 0 9px 1px #eee;
}
.trainimg-statistics-tools-wrapper {
width: 80%;
margin: 30px auto;
padding: 20px;
border-radius: 20px;
box-shadow: 0 0 9px 1px #eee;
.trainimg-statistics-tool {
width: 80%;
margin: 20px auto;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 15px;
.trainimg-statistics-tool-title {
flex-basis: 30%;
flex-grow: 0;
flex-shrink: 0;
text-align: right;
margin-right: 13px;
}
.trainimg-statistics-tool-content {
flex-basis: 70%;
flex-grow: 0;
flex-shrink: 0;
}
}
}
.trainimg-statistics-table-wrapper {
width: 80%;
padding: 20px;
border-radius: 20px;
box-shadow: 0 0 9px 1px #eee;
margin: 30px auto;
}
.trainimg-statistics-census-wrapper {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
width: 80%;
margin: 30px auto;
padding: 20px;
border-radius: 20px;
box-shadow: 0 0 9px 1px #eee;
.trainimg-statistics-census-item {
flex-basis: 33%;
.fontColorStatistics {
color: #090d9c;
}
}
}
</style>
<template>
<div class="trainimg-total-wrapper">
<el-table
:data="trainimgData"
border
v-loading="isLoadingData"
>
<el-table-column
prop="briefIntroduction"
label="培训简介"
></el-table-column>
<el-table-column
prop="location"
label="培训位置"
></el-table-column>
<el-table-column
prop="peopleNum"
label="培训人数"
></el-table-column>
<el-table-column
prop="time"
label="培训时间"
></el-table-column>
<el-table-column
prop="beforeImgPath"
label="培训前照片"
>
<template slot-scope="scope">
<el-image
style="width: 70px; height: 70px"
:src="scope.row.beforeImgPath"
:preview-src-list="[scope.row.beforeImgPath]">
</el-image>
</template>
</el-table-column>
<el-table-column
prop="trainingImgPath"
label="培训中照片"
>
<template slot-scope="scope">
<el-image
style="width: 70px; height: 70px"
:src="scope.row.trainingImgPath"
:preview-src-list="[scope.row.trainingImgPath]">
</el-image>
</template>
</el-table-column>
<el-table-column
prop="afterImgPath"
label="培训后照片"
>
<template slot-scope="scope">
<el-image
style="width: 70px; height: 70px"
:src="scope.row.afterImgPath"
:preview-src-list="[scope.row.afterImgPath]">
</el-image>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="curPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalSize">
</el-pagination>
</div>
</template>
<script>
import { searchTrainImage } from '@/api/trainimage.js'
export default {
data() {
return {
companyId: '',
trainimgData: [
{
briefIntroduction: '',
location: '',
peopleNum: '',
time: '',
beforeImgPath: '',
trainingImgPath: '',
afterImgPath: ''
}
],
currentPage: 1,
curPageSize: 10,
totalSize: 100,
isLoadingData: false,
}
},
mounted() {
console.log(this.$route.params.name, 'this.$route.params.name this.$route.params.name')
this.companyId = this.$route.params.name
this.initData()
},
methods: {
handleSizeChange(val) {
this.curPageSize = val
this.initData()
},
handleCurrentChange(val) {
this.currentPage = val
this.initData()
},
initData() {
this.isLoadingData = true
let params = {
enterpriseId: this.companyId,
page: this.currentPage,
size: this.curPageSize,
sort: 'time,desc'
}
searchTrainImage(params).then(res => {
this.trainimgData = [...res.content.map(item => {
return {
briefIntroduction: item.briefIntroduction,
location: item.location,
peopleNum: item.peopleNum,
time: item.time,
beforeImgPath: item.beforeImgPath,
trainingImgPath: item.trainingImgPath,
afterImgPath: item.afterImgPath
}
})]
this.totalSize = res.totalElements
this.isLoadingData = false
}).catch(() => {
this.isLoadingData = false
})
}
}
}
</script>
<style lang="scss" scoped>
.trainimg-total-wrapper {
width: 80%;
padding: 30px;
border-radius: 30px;
margin: 30px auto;
box-shadow: 0 0 9px 1px #eee;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment