| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item v-if="data.isAdmin"> |
| | | <el-button type="primary" style="margin-left: 30px" @click="searchClick">查询</el-button> |
| | | <el-button plain @click="reset">重置</el-button> |
| | | </el-form-item> |
| | |
| | | </el-form> |
| | | </div> |
| | | <!-- 表格数据 --> |
| | | <el-table v-loading="loading" :data="dataList" :border="true" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column type="index" label="序号" width="80" align="center"></el-table-column> |
| | | <el-table-column label="名称" align="center"> |
| | | <template #default="scope"> |
| | | <span>{{scope.row.deptName}}登记</span> |
| | | </template> |
| | | <el-table v-loading="loading" :data="dataList" :border="true" @selection-change="handleSelectionChange" :span-method="mergeCells"> |
| | | <el-table-column type="selection" prop="selection" width="55" /> |
| | | <!-- <el-table-column type="index" prop="sequenceNumber" label="序号" width="80" align="center"></el-table-column>--> |
| | | <!-- <el-table-column label="企业名称" prop="companyName" align="center" v-if="data.isAdmin" />--> |
| | | <el-table-column label="名称" prop="recordName" align="center"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160"> |
| | | <el-table-column label="时间" prop="monthlyTime" align="center" /> |
| | | <el-table-column label="检查人" prop="checkUser" align="center" /> |
| | | <el-table-column label="防护" prop="entrench" align="center" /> |
| | | <el-table-column label="标识" prop="identification" align="center" /> |
| | | <el-table-column label="摆放" prop="place" align="center" /> |
| | | <el-table-column label="清洁" prop="clean" align="center" /> |
| | | <el-table-column label="安全" prop="safety" align="center" /> |
| | | <el-table-column label="环境" prop="environment" align="center" /> |
| | | <el-table-column label="帐务卡一致性" prop="consistency" align="center" /> |
| | | <el-table-column label="操作" align="center" prop="operate" class-name="small-padding fixed-width" width="160"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openDialog('review',scope.row)" >查看</el-button> |
| | | <el-button link type="primary" @click="openDialog('edit',scope.row)" >编辑</el-button> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div class="pag-container"> |
| | | <el-pagination |
| | | v-model:current-page="data.queryParams.pageNum" |
| | | v-model:page-size="data.queryParams.pageSize" |
| | | :page-sizes="[10,15,20,25]" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | <!-- <div class="pag-container">--> |
| | | <!-- <el-pagination--> |
| | | <!-- v-model:current-page="data.queryParams.pageNum"--> |
| | | <!-- v-model:page-size="data.queryParams.pageSize"--> |
| | | <!-- :page-sizes="[10,15,20,25]"--> |
| | | <!-- layout="total, sizes, prev, pager, next, jumper"--> |
| | | <!-- :total="total"--> |
| | | <!-- @size-change="handleSizeChange"--> |
| | | <!-- @current-change="handleCurrentChange"--> |
| | | <!-- />--> |
| | | <!-- </div>--> |
| | | <editDialog ref="noticeRef" @getList = "getList"></editDialog> |
| | | </div> |
| | | </template> |
| | |
| | | import {generateWordDocument} from "@/utils/exportWord"; |
| | | import {delTable, getTable} from "@/api/qualityObjectives/table"; |
| | | import {delNeedDiscren, getNeedDiscren} from "@/api/need/need"; |
| | | import {delMonthlyRecord, getMonthlyRecord, getMonthlyRecordById} from "@/api/monthlyInspectionRecord"; |
| | | import {getQualityTemplateById} from "@/api/standardSys/standardSys"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const loading = ref(false); |
| | | const noticeRef = ref(); |
| | |
| | | getCompanyList() |
| | | } |
| | | }); |
| | | |
| | | const resData = ref([]) |
| | | const getList = async () => { |
| | | // loading.value = true; |
| | | // const res = await getNeedDiscren(data.queryParams); |
| | | // if(res.code === 200){ |
| | | // dataList.value = res.data.list |
| | | // total.value = res.data.total |
| | | // }else{ |
| | | // ElMessage.warning(res.message) |
| | | // } |
| | | // loading.value = false; |
| | | dataList.value = [{}] |
| | | loading.value = true; |
| | | const res = await getMonthlyRecord(data.queryParams); |
| | | if(res.code === 200){ |
| | | const resultArray = []; |
| | | for (const obj of res.data.list) { |
| | | const listItemArray = obj.inspectionMesses; |
| | | for (const listItem of listItemArray) { |
| | | resultArray.push({ |
| | | id:obj.id, |
| | | companyName: obj.companyName, |
| | | recordName: obj.recordName, |
| | | monthlyTime: listItem.monthlyTime, |
| | | checkUser: listItem.checkUser, |
| | | entrench: listItem.entrench, |
| | | identification: listItem.identification, |
| | | place: listItem.place, |
| | | clean: listItem.clean, |
| | | safety: listItem.safety, |
| | | environment: listItem.environment, |
| | | consistency: listItem.consistency, |
| | | }); |
| | | } |
| | | } |
| | | dataList.value = resultArray.map((item,index) => { |
| | | return { |
| | | ...item, |
| | | sequenceNumber: index + 1 |
| | | } |
| | | }) |
| | | calculateSpan() |
| | | // dataList.value = res.data.list |
| | | // total.value = res.data.total |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | loading.value = false; |
| | | } |
| | | |
| | | const searchClick = () => { |
| | |
| | | const startGeneration = async () => { |
| | | const data = JSON.parse(JSON.stringify(choosedData.value)) |
| | | data.forEach(item => { |
| | | item.expectContents = [ |
| | | { |
| | | name: '张三', |
| | | expectContentMesses: [ |
| | | { |
| | | need: 'xxx', |
| | | personName: 'x', |
| | | visit:true, |
| | | network: true, |
| | | other: false |
| | | |
| | | }, |
| | | { |
| | | need: '22', |
| | | personName: '2', |
| | | visit:false, |
| | | network: false, |
| | | other: true |
| | | |
| | | }, |
| | | ] |
| | | } |
| | | ] |
| | | item.tableData = item.expectContents.map((i,index) => { |
| | | return{ |
| | | ...i, |
| | | expectContentMesses: i.expectContentMesses.map((q,qindex) => { |
| | | return{ |
| | | ...q, |
| | | first: qindex == 0, |
| | | num: index+1, |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | item.tableData = item.inspectionMesses |
| | | console.log('xxx',item.tableData) |
| | | try { |
| | | generateWordDocument(templatePath.value, item, item.companyName + `_月度检查记录表.docx`); |
| | | generateWordDocument(templatePath.value, item, item.recordName + `_月度检查记录表.docx`); |
| | | } catch (error){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | } |
| | | }) |
| | | } |
| | | const handleSelectionChange = (val) => { |
| | | choosedData.value = val |
| | | const handleSelectionChange = async (val) => { |
| | | let arr = [] |
| | | for (const item of val) { |
| | | const res = await getMonthlyRecordById({monthlyId: item.id}) |
| | | if(res.code == 200){ |
| | | arr.push(res.data) |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | choosedData.value = arr |
| | | } |
| | | const handleDelete = (val) => { |
| | | ElMessageBox.confirm( |
| | |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | const res = await delNeedDiscren(val.id); |
| | | const res = await delMonthlyRecord(val.id); |
| | | if(res.code === 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | |
| | | }) |
| | | } |
| | | |
| | | const mergeCells = ({ row, column, rowIndex, columnIndex }) => { |
| | | if ( column.property == 'operate' || column.property == 'recordName' || column.property == 'selection') { |
| | | const _row = spanArr.value[rowIndex]; |
| | | const _col = _row > 0 ? 1 : 0; |
| | | return [_row, _col]; |
| | | } |
| | | }; |
| | | |
| | | const spanArr = ref([]); // 存储每一行的合并信息 |
| | | const position = ref(0); // 记录当前位置 |
| | | // 计算合并的行数 |
| | | const calculateSpan = () => { |
| | | spanArr.value = []; |
| | | position.value = 0; |
| | | |
| | | dataList.value.forEach((item, index) => { |
| | | if (index === 0) { |
| | | spanArr.value.push(1); |
| | | position.value = 0; |
| | | } else { |
| | | // 判断当前行的id与上一行是否相同 |
| | | if (dataList.value[index].id === dataList.value[index - 1].id) { |
| | | spanArr.value[position.value] += 1; |
| | | spanArr.value.push(0); |
| | | } else { |
| | | spanArr.value.push(1); |
| | | position.value = index; |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | </script> |
| | | <style lang="scss"> |