Newer
Older
vue3-front / src / views / business / subpackage / approve / list.vue
<!-- 分包方资格审批列表 -->
<script lang="ts" setup name="approve">
import type { Ref } from 'vue'
import { ElLoading, ElMessage } from 'element-plus'
import type { DateModelType } from 'element-plus'
import type { IListQueryApprove } from '../subpackage-interface'
import { printJSON } from '@/utils/printUtils'
import { exportFile } from '@/utils/exportUtils'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import { getDictByCode } from '@/api/system/dict'
import type { dictType } from '@/views/device/receive/receive'
import type { IMenu } from '@/components/buttonBox/buttonBox'
import ButtonBox from '@/components/buttonBox/buttonBox.vue'
const $router = useRouter()
const { proxy } = getCurrentInstance() as any
const TabActiveButton = 'SubpackageApproveActive'
// 查询条件
const listQuery: Ref<IListQueryApprove> = ref({
  applicantEndTime: '', // 开始时间
  applicantName: '', // 申请人名称
  applicantStartTime: '', // 结束时间
  approvalStatus: '', // 申请状态
  formId: '', // 表单id
  outsourcerName: '', // 	分包方名称
  projectName: '', // 分包项目名称
  projectNo: '', // 分包项目编号
  businessSize: '', //	业务规模-字典code
  evaluation: '', // 	整体评价-字典code
  grade: '', // 	履约评级-字典code
  outsourcerNo: '', // 	分包方编号
  offset: 1,
  limit: 20,
})
const total = ref(0)
const loadingTable = ref(false)
const menu = ref<IMenu[]>([]) // 审批状态按钮组合
const active = ref('')
// 表头
const columns = ref<TableColumn[]>([
  { text: '分包项目编号', value: 'interchangeCode', align: 'center', width: '160px' },
  { text: '公司名称', value: 'customerNo', align: 'center', width: '160px' },
  { text: '公司规模', value: 'customerName', align: 'center', width: '160px' },
  { text: '业务规模', value: 'reciever', align: 'center', width: '180px' },
  { text: '履约评级', value: 'deliverer', align: 'center', width: '180px' },
  { text: '整体评价', value: 'deliverTime', align: 'center', width: '180px' },
  { text: '业务内容', value: 'deliverTime', align: 'center', width: '180px' },
  { text: '公司地址', value: 'deliverTime', align: 'center', width: '180px' },
  { text: '创建时间', value: 'deliverTime', align: 'center', width: '180px' },
  { text: '审批状态', value: 'deliverTime', align: 'center', width: '180px' },
])
const list = ref([])

// 搜索
const searchList = () => {

}

// 清除条件
const clearList = () => {
  listQuery.value = {
    applicantEndTime: '', // 开始时间
    applicantName: '', // 申请人名称
    applicantStartTime: '', // 结束时间
    approvalStatus: '', // 申请状态
    formId: '', // 表单id
    outsourcerName: '', // 	分包方名称
    projectName: '', // 分包项目名称
    projectNo: '', // 分包项目编号
    businessSize: '', //	业务规模-字典code
    evaluation: '', // 	整体评价-字典code
    grade: '', // 	履约评级-字典code
    outsourcerNo: '', // 	分包方编号
    offset: 1,
    limit: 20,
  }
}
// 新建
const add = () => {

}
// 导出
const exportAll = () => {

}
// 打印
const printList = () => {

}
// 分页
const changePage = () => {

}
// 选中
const handleSelectionChange = () => {

}
// 详情或者编辑
const handleEdit = (row, status) => {

}
// 取消
const handleCancle = (row) => {

}
// 获取字典值
const getDict = async () => {
  // 审批状态
  const res = await getDictByCode('approvalStatus')
  // 制作右上角的菜单
  res.data.forEach((item: dictType) => {
    if (item.name === '全部' || item.name === '草稿箱'
      || item.name === '待审批' || item.name === '审批中'
      || item.name === '已通过' || item.name === '未通过'
      || item.name === '已取消') {
      menu.value.push({
        name: item.name,
        id: `${item.value}`,
      })
    }
  })
}
// 切换tab状态
const changeCurrentButton = (val: string) => {
  active.value = val
  window.sessionStorage.setItem(TabActiveButton, val)
  clearList()
}

onMounted(async () => {
  await getDict()
  if (window.sessionStorage.getItem(TabActiveButton) !== 'undefined' && window.sessionStorage.getItem(TabActiveButton) !== '' && window.sessionStorage.getItem(TabActiveButton) !== null) {
    active.value = window.sessionStorage.getItem(TabActiveButton)!
  }
  else {
    active.value = menu.value.find(item => item.name === '全部')!.id as string // 全部
  }
})
</script>

<template>
  <div>
    <!-- 布局 -->
    <app-container>
      <search-area :need-clear="true" @search="searchList" @clear="clearList">
        <search-item>
          <el-input v-model.trim="listQuery.outsourcerNo" placeholder="分包项目编号" class="short-input" clearable />
        </search-item>
        <search-item>
          <el-input v-model.trim="listQuery.outsourcerName" placeholder="公司名称" class="short-input" clearable />
        </search-item>
        <search-item>
          <el-input v-model.trim="listQuery.businessSize" placeholder="业务规模" class="short-input" clearable />
        </search-item>
        <search-item>
          <el-input v-model.trim="listQuery.grade" placeholder="履约评级" class="short-input" clearable />
        </search-item>
        <search-item>
          <el-input v-model.trim="listQuery.evaluation" placeholder="整体评价" class="short-input" clearable />
        </search-item>
      </search-area>
      <table-container>
        <template #btns-right>
          <icon-button
            icon="icon-add" title="新建" type="primary"
            @click="add"
          />
          <icon-button
            icon="icon-export" title="导出" type="primary"
            @click="exportAll"
          />
          <icon-button
            icon="icon-print" title="打印" type="primary"
            @click="printList"
          />
        </template>
        <normal-table
          :data="list" :total="total" :columns="columns" :query="listQuery" :list-loading="loadingTable"
          is-showmulti-select @change="changePage" @multi-select="handleSelectionChange"
        >
          <template #preColumns>
            <el-table-column label="序号" width="55" align="center">
              <template #default="scope">
                {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }}
              </template>
            </el-table-column>
          </template>
          <template #columns>
            <el-table-column label="操作" align="center" fixed="right" width="120">
              <template #default="{ row }">
                <el-button size="small" type="primary" link @click="handleEdit(row, 'edit')">
                  编辑
                </el-button>
                <el-button size="small" link type="primary" @click="handleEdit(row, 'detail')">
                  详情
                </el-button>
                <el-button size="small" link type="danger" @click="handleCancle(row.id)">
                  取消
                </el-button>
              </template>
            </el-table-column>
          </template>
        </normal-table>
      </table-container>
      <button-box :active="active" :menu="menu" @changeCurrentButton="changeCurrentButton" />
    </app-container>
  </div>
</template>