123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <!-- -->
- <template>
- <div class="hc-page-box">
- <HcNewCard>
- <HcTable is-new :column="tableColumn" :datas="tableData">
- <template #inspectName="{ row }">
- <span class="text-link" @click="tableRowEdit(row)">{{ row?.inspectName }}</span>
- </template>
- <template #isRectify="{ row }">
- <span v-if="row.isRectify == 1">需要</span>
- <span v-else>不需要</span>
- </template>
- <template #action="{ row }">
- <el-link v-if="row.submitRectify == 2 && row.isRectify == 1" type="primary" @click="reviewRow(row)">复核</el-link>
- <el-link type="primary" @click="updateRow(row)">修改</el-link>
- <el-link type="primary" @click="delRow(row)">删除</el-link>
- </template>
- </HcTable>
- <template #action>
- <HcPages :pages="searchForm" @change="pageChange" />
- </template>
- </HcNewCard>
- </div>
- </template>
- <script setup>
- import { onActivated, onMounted, ref } from 'vue'
- import { useRouter } from 'vue-router'
- import patrolApi from '~api/patrol/patrol'
- import { useAppStore } from '~src/store'
- import { getArrValue } from 'js-fast-way'
- import { delMessageV2 } from '~com/message/index.js'
- const useAppState = useAppStore()
- const projectId = ref(useAppState.getProjectId)
- //初始变量
- const router = useRouter()
- const tableColumn = [
- { key: 'projectName', name: '项目' },
- { key: 'inspectTypeName', name: '检查类别' },
- { key: 'inspectName', name: '检查名称' },
- { key: 'reviewInspectStatusName', name: '复核检查状态' },
- { key: 'isRectify', name: '是否需要整改' },
- { key: 'rectifyDate', name: '需求整改完成日期' },
- { key: 'actualRectifyDate', name: '实际整改完成日期' },
- { key: 'action', name: '操作' },
- ]
- const tableData = ref([])
- //搜索表单
- const searchForm = ref({
- current: 1, size: 20, total: 0,
- })
- //分页被点击
- const pageChange = ({ current, size }) => {
- searchForm.value.current = current
- searchForm.value.size = size
- getTableData()
- }
- const tableLoading = ref(false)
- const getTableData = async () => {
- tableLoading.value = true
- const { error, code, data } = await patrolApi.queryPage({
- ...searchForm.value,
- projectId: projectId.value,
- })
- //判断状态
- tableLoading.value = false
- if (!error && code === 200) {
- tableData.value = getArrValue(data['records'])
- searchForm.value.total = data['total'] || 0
- } else {
- tableData.value = []
- searchForm.value.total = 0
- }
- }
- onActivated(()=>{
- getTableData()
- })
- const tableRowEdit = (row)=>{
- router.push({
- path: '/patrol/add',
- query: {
- type: 'view',
- id:row.id,
- },
- })
- }
- const updateRow = (row)=>{
- router.push({
- path: '/patrol/add',
- query: {
- type: 'confirmChange',
- id:row.id,
- },
- })
- }
- const reviewRow = (row)=>{
- router.push({
- path: '/patrol/add',
- query: {
- type: 'review',
- id:row.id,
- },
- })
- }
- //删除
- const delRow = (row)=>{
- delMessageV2(async (action, instance, done) => {
- if (action === 'confirm') {
- instance.confirmButtonLoading = true
- delInfo(row)
- instance.confirmButtonLoading = false
- done()
- } else {
- done()
- }
- })
- }
- const delInfo = async (row)=>{
- const { error, code, msg } = await patrolApi.delete({
- id:row.id,
- })
- //判断状态
- if (!error && code === 200) {
- window.$message.success(msg)
- getTableData()
- }
- }
- </script>
- <style lang='scss' scoped>
- </style>
|