From c819024e241b9f7c54cc3786373ad0d2998f2190 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 05 五月 2023 08:55:46 +0800 Subject: [PATCH] 修改 --- src/views/hiddenDangerManagement/fillInspector.vue | 319 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 317 insertions(+), 2 deletions(-) diff --git a/src/views/hiddenDangerManagement/fillInspector.vue b/src/views/hiddenDangerManagement/fillInspector.vue index a0c414b..33df0e6 100644 --- a/src/views/hiddenDangerManagement/fillInspector.vue +++ b/src/views/hiddenDangerManagement/fillInspector.vue @@ -1,13 +1,328 @@ <template> + <div class="app-container"> + <div> + <Titlename title="填写督查"></Titlename> + <div class="whole-form"> + <el-form ref="configTableForm"> + <el-table + :data="tableData" + border + style="width: 1600px" + @cell-mouse-enter="handleCellEnter" + @cell-mouse-leave="handleCellLeave" + > + <el-table-column + prop="serial" + label="序号" + align="center" + width="50"> + </el-table-column> + <el-table-column + prop="number" + label="编号" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="ht_branch" + label="隐患单位" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="check_man" + label="检查人" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="check_class" + label="检查班次" + align="center" + width="80"> + </el-table-column> + <el-table-column + prop="check_date" + label="检查时间" + align="center" + :formatter="formatDate" + width="100"> + </el-table-column> + <el-table-column + prop="address" + label="地点" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="ht_content" + label="内容" + align="center" + width="180"> + </el-table-column> + <el-table-column + prop="ht_typesub" + label="类别" + align="center" + width="80"> + </el-table-column> + <el-table-column + prop="ht_level" + label="级别" + align="center" + width="120"> + </el-table-column> + <el-table-column + prop="measure" + label="整改措施" + align="center" + width="120"> + </el-table-column> + <el-table-column + prop="duty_officer" + label="责任人" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="alter_time" + label="限改时间" + align="center" + :formatter="formatDate" + width="120"> + </el-table-column> + <el-table-column + prop="ACCOMPLISHTIME" + align="center" + label="完成时间" + :formatter="formatDate" + width="100"> + </el-table-column> + <el-table-column + prop="CALLBACKPERSON" + label="复查人" + align="center" + width="100"> + </el-table-column> + <el-table-column + prop="CALLBACKTIME" + align="center" + width="100" + :formatter="formatDate" + label="复查时间"> + </el-table-column> + <el-table-column + prop="inspectionClass" + label="督察单位" + disabled="" + align="center" + width="160"> + <div class="item" slot-scope="scope"> + <el-input class="item__input" v-model="scope.row.inspectionClass" disabled placeholder="请输入内容" clearable></el-input> + <div class="item__txt">{{scope.row.inspectionClass}}</div> + </div> + </el-table-column> + <el-table-column + prop="inspectionTime" + align="center" + label="督察时间" + width="160"> + <div class="item" slot-scope="scope"> + <el-date-picker + v-model="scope.row.inspectionTime" + type="date" + placeholder="选择日期" clearable> + </el-date-picker> + <div class="item__txt">{{scope.row.inspectionTime}}</div> + </div> + </el-table-column> + <el-table-column + prop="inspectionResult" + label="督察结果" + align="center" + width="160"> + <div class="item" slot-scope="scope"> + <el-input class="item__input" v-model="scope.row.inspectionResult" placeholder="请输入内容" clearable></el-input> + <div class="item__txt">{{scope.row.inspectionResult}}</div> + </div> + </el-table-column> + <el-table-column + prop="inspectionMan" + label="督察人" + align="center" + width="160"> + <div class="item" slot-scope="scope"> + <el-input class="item__input" v-model="scope.row.inspectionMan" placeholder="请输入内容" clearable></el-input> + <div class="item__txt">{{scope.row.inspectionMan}}</div> + </div> + </el-table-column> + </el-table> + </el-form> + <div class="btn"> + <el-button + class="btns" + size="small" + type="primary" + @click="submitConfig()">保存</el-button> + <el-button size="small" + @click="close()">关闭</el-button> + </div> + </div> + </div> + </div> </template> <script> + + import Titlename from "../../components/Titlename/index.vue"; + import {getUserInfo,self_edit_do} from "@/api/sgyhpczl/hiddenDangerManagement"; + export default { - name: "fillInspector" + components: {Titlename}, + name: "fillInspector", + data() { + return { + department:"", + // 表格数据 + tableData: [], + // 需要编辑的属性 + editProp: ['inspectorTime', 'results', 'inspector'] + }; + }, + mounted(){ + this.tableData = this.$route.query.checkData; + getUserInfo().then(res=>{ + if(res.data.code == 200){ + this.tableData.forEach(n=>{ + n.inspectionClass = res.data.result.department; + n.inspectionTime = new Date().toLocaleDateString().replaceAll("/","-") + }) + }else{ + this.$message({type:'error', message:"用户信息获取失败!请重试", duration:3000}) + } + }) + }, + computed: { + foodLabel () { + return (val) => { + return this.options.find(o => o.value === val).label + } + } + }, + methods: { + /** 鼠标移入cell */ + handleCellEnter (row, column, cell, event) { + const property = column.property + if (this.editProp.includes(property)) { + // cell.querySelector('.item__input').style.display = 'block' + // cell.querySelector('.item__txt').style.display = 'none' + } + }, + /** 鼠标移出cell */ + handleCellLeave (row, column, cell, event) { + const property = column.property + if (this.editProp.includes(property)) { + // cell.querySelector('.item__input').style.display = 'none' + // cell.querySelector('.item__txt').style.display = 'block' + } + }, + submitConfig(){ + console.log(this.tableData) + var requestData = []; + this.tableData.forEach(n=>{ + if(n.inspectionResult == null ||n.inspectionResult == "" + ||n.inspectionMan == null ||n.inspectionMan == "" ){ + this.$message({type: 'Warn', message: "请填写完整信息", duration: 3000}) + return; + } + var data= { + "type": 2, + "id": n.id, + "inspectionResult": n.inspectionResult, + "inspectionMan": n.inspectionMan, + "inspectionTime": n.inspectionTime, + "inspectionClass": n.inspectionClass + } + requestData.push(data); + }) + + var successFlag = 0; + for (let i = 0; i < requestData.length; i++) { + self_edit_do(requestData[i]).then(res=>{ + if(res.data.ok){ + successFlag ++; + if(successFlag== requestData.length){ + this.$message({type: 'success', message: "操作成功!", duration: 3000}) + this.$router.push({ + path:"/hiddenDangerManagement" + }) + } + } + }) + } + }, + formatDate(row, column) { + // 获取单元格数据 + let data = row[column.property] + if(data == null) { + return null + } + let dt = new Date(data) + return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate() + }, + close(){ + this.$router.push({ + path:"/hiddenDangerManagement" + }) + } + } } </script> <style scoped> - + .app-container { + padding: 20px; + height: 850px; + overflow-y: auto; + } + .whole-form{ + margin-top: 20px; + } + .item .item__input { + /*display: none;*/ + font-size: 14px; + } + /deep/ .item .item__input .el-input__inner{ + font-size: 14px; + } + .item .item__txt{ + display: none; + /*box-sizing: border-box;*/ + /*padding: 0 15px;*/ + /*height: 36px;*/ + /*line-height: 36px;*/ + /*font-size: 14px;*/ + /* border: 1px solid transparent;*/ + } + /deep/ .item .el-input--medium .el-input__inner{ + /*display: none;*/ + width: 140px; + } + /deep/ .is-center{ + font-size: 14px; + } + .btn{ + text-align: center; + margin-top: 50px; + } + .btns{ + background-color: #034ea2; + border: 1px solid #034ea2; + } + /*.el-button:hover {*/ + /* background: #66b1ff;*/ + /* border-color: #66b1ff;*/ + /* color: #FFF;*/ + /*}*/ </style> -- Gitblit v1.9.2