lyfO_o
2022-05-23 08bf6da5e3164a1b3ee5c79bb5d666e6385b4653
src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
@@ -7,7 +7,7 @@
            </div>
            <div class="basic_search">
                <span>结束时间:</span>
                <el-date-picker v-model="listQuery.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检结束时间"></el-date-picker>
                <el-date-picker v-model="listQuery.endTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="巡检结束时间"></el-date-picker>
            </div>
            <div class="basic_search">
                <span>任务类型:</span>
@@ -22,7 +22,7 @@
            </div>
            <div class="basic_search">
                <span>任务单元状态列表:</span>
                <el-select v-model="listQuery.statusList">
                <el-select v-model="listQuery.statusList" filterable clearable multiple>
                    <el-option
                        v-for="item in statusListList"
                        :key="item.id"
@@ -35,17 +35,6 @@
                <span>巡检任务创建人员:</span>
                <el-select v-model="listQuery.createUid" filterable clearable>
                    <el-option
                        v-for="item in userList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.realname"
                    ></el-option>
                </el-select>
            </div>
            <div class="basic_search">
                <span>异常通知人员:</span>
                <el-select v-model="listQuery.noticeUid" filterable clearable>
                   <el-option
                        v-for="item in userList"
                        :key="item.id"
                        :value="item.id"
@@ -94,15 +83,19 @@
                            <el-table-column label="上报说明" prop="info" align="center">
                            </el-table-column>
                            <el-table-column label="上报照片" prop="img" align="center">
                                <template slot-scope="scope">
                                    <el-button type="text" @click="downloadFile(scope.row)">下载</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column label="状态" prop="status" align="center">
                                <template slot-scope="scope">
                                     {{ scope.row.status | parseStatusList}}
                                     {{ scope.row.status | parseUnitStatus}}
                                </template>
                            </el-table-column>
                            <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                                <template slot-scope="scope">
                                    <el-button type="text" @click="showInspectionRecordDetailForm(scope.row)">详情</el-button>
                                    <el-button type="text" @click="showInspectionRecordDetailForm(scope.row,'上报')" v-show="scope.row.status === 1">上报</el-button>
                                    <el-button type="text" @click="showInspectionRecordDetailForm(scope.row,'查看')">查看</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
@@ -115,8 +108,6 @@
                        {{ scope.row.type | parseType}}
                    </template>
                </el-table-column>
                <el-table-column label="异常通知人" prop="noticeUname" align="center">
                </el-table-column>
                <el-table-column label="巡检人" prop="execUname" align="center">
                </el-table-column>
                <el-table-column label="巡检开始时间" prop="expTime" align="center">
@@ -127,12 +118,13 @@
                </el-table-column>
                <el-table-column label="任务状态" prop="status" align="center">
                     <template slot-scope="scope">
                        {{ scope.row.status | parseStatus}}
                        {{ scope.row.status | parseStatusList}}
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <el-button type="text" @click="showInspectionRecordDetailForm(scope.row,'编辑')">查看</el-button>
                        <el-button type="text" @click="submitInspectionRecordForm(scope.row,'上报')">提交</el-button>
                        <el-button type="text" @click="showInspectionRecordForm(scope.row,'查看')">查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
@@ -151,43 +143,19 @@
            />
            <br>
        </div>
        <el-dialog :title="title" :visible.sync="inspectionRecordVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="600px">
            <el-form ref="inspectionRecordForm"  :model="inspectionRecordForm" label-position="right" label-width="165px">
                <el-form-item label="责任部门" prop="hazardDep">
                    <el-select v-model="inspectionRecordForm.hazardDep" class="analyseUnit_input">
                        <el-option
                            v-for="item in departmentList"
                            :key="item.id"
                            :value="item.department"
                            :label="item.department"
                        ></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="责任人" prop="hazardLiablePerson">
                    <el-input v-model="inspectionRecordForm.hazardLiablePerson" class="analyseUnit_input"></el-input>
                </el-form-item>
                <el-form-item label="安全风险分析对象编码" prop="hazardCode">
                    <el-input v-model="inspectionRecordForm.hazardCode" class="analyseUnit_input"></el-input>
                </el-form-item>
                <el-form-item label="安全风险分析单元名称" prop="riskUnitName">
                    <el-input v-model="inspectionRecordForm.riskUnitName" class="analyseUnit_input"></el-input>
                </el-form-item>
            </el-form>
            <div  align="right">
                <el-button @click="unitFormVisible = false">取消</el-button>
            </div>
        </el-dialog>
        <detail ref="detail"></detail>
        <detail ref="detail" @getList="getInspectionRecordData"></detail>
    </div>
</template>
<script>
    import Cookies from "js-cookie";
    import detail from './components/detail.vue'
    import { mapGetters } from 'vuex'
    import { computePageCount } from '@/utils'
    import { getInspectionRecord } from '@/api/inspectionTask'
    import {getAllDepartment, getDepartmentList} from "../../../../api/departmentManage";
    import {safetyInspectionItemName} from "../../../../api/safetySelfInspection";
    import {submitTask} from "../../../../api/inspectionTask";
    export default {
  components: { detail },
        name: 'index',
@@ -204,6 +172,13 @@
                    return "任务开启"
                }else{
                    return "任务关闭"
                }
            },
            parseUnitStatus(value) {
                if(value === 1){
                    return "待巡检"
                }else if(value === 2) {
                    return "已完成"
                }
            },
            parseStatusList(status) {
@@ -241,16 +216,14 @@
                title:'',
                company:'',
                code:'',
                inspectionRecordVisible:false,
                inspectionRecordForm:{
                },
                listQuery:{
                createUid: null,
                endTime: null,
                execUid: null,
                execUname: null,
                noticeUid: null,
                page: 1,
                pageSize: 10,
                result: null,
@@ -308,8 +281,52 @@
            showInspectionRecordForm(value){
                this.$refs.detail.showInspectionRecordForm(value)
            },
            showInspectionRecordDetailForm(value) {
                this.$refs.detail.showInspectionRecordDetailForm(value)
            showInspectionRecordDetailForm(value,type) {
                this.$refs.detail.showInspectionRecordDetailForm(value,type,this.userList,this.departmentList)
            },
            async submitInspectionRecordForm(value){
                if(value.unitList.find(item => item.status === 1) === undefined){
                    let data = {
                    }
                    let res = await submitTask({
                        execUid:Cookies.get('userId'),
                        info:"",
                        taskId: value.id
                    })
                    if(res.data.code === '200'){
                        this.getInspectionRecordData()
                        this.$message({
                            type:'success',
                            message:'提交成功',
                            duration:2000,
                            title:'成功'
                        })
                    }else{
                        this.$message({
                            type:'warning',
                            message:res.data.message
                        })
                    }
                }else{
                    this.$message({
                        type:'warning',
                        message:'请先上报所有巡检单元'
                    })
                }
            },
            downloadFile(value){
                debugger
                if(value.problem.imageInfoList === null){
                    this.$message({
                        type:'warning',
                        message:'无文件可下载'
                    })
                }else{
                    for(let i in value.problem.imageInfoList){
                        window.open(process.env.IMG_API + value.problem.imageInfoList[i].imgPath, '_blank')
                    }
                }
            },
            refreshHandle(){
                this.getInspectionRecordData()