<!-- 业务结算列表 --> <script lang="ts" setup name="Vocational"> import type { Ref } from 'vue' import { ElLoading, ElMessage } from 'element-plus' import type { DateModelType } from 'element-plus' import type { IListQuery } from './businessSettlement-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 { IlistQuery, IlistType, 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 listQuery: Ref<IListQuery> = ref({ interchangeCode: '', // 交接单编号 customerNo: '', // 委托方代码 customerName: '', // 委托方名称 reciever: '', // 接收人 deliverer: '', // 送样人 startTime: '', // 交接开始时间 endTime: '', // 交接结束时间 offset: 1, limit: 20, }) const total = ref(0) const loadingTable = ref(false) const timeRange = ref<[DateModelType, DateModelType]>(['', '']) const menu = ref<IMenu[]>([]) // 审批状态按钮组合 const active = ref('') const statusList = [ { name: '是', value: 1, }, { name: '否', value: 0, }, ] // 表头 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' }, { text: '部门', value: 'deliverer', align: 'center' }, { 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' }, { text: '审批状态', value: 'deliverTime', align: 'center', width: '180px' }, ]) const list = ref([]) // 搜索 const searchList = () => { } // 清除条件 const clearList = () => { } // 新建 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('businessSettlementActive', val) clearList() } onMounted(async () => { await getDict() if (window.sessionStorage.getItem('businessSettlementActive') !== 'undefined' && window.sessionStorage.getItem('businessSettlementActive') !== '' && window.sessionStorage.getItem('businessSettlementActive') !== null) { active.value = window.sessionStorage.getItem('businessSettlementActive')! } 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.interchangeCode" placeholder="合同编号" class="short-input" clearable /> </search-item> <search-item> <el-input v-model.trim="listQuery.customerNo" placeholder="合同名称" class="short-input" clearable /> </search-item> <search-item> <el-input v-model.trim="listQuery.customerName" placeholder="合同类型" class="short-input" clearable /> </search-item> <search-item> <el-input v-model.trim="listQuery.reciever" placeholder="甲方单位" class="short-input" clearable /> </search-item> <search-item> <search-item> <el-date-picker v-model="timeRange" type="datetimerange" range-separator="到" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" start-placeholder="签订开始时间" end-placeholder="签订结束时间" /> </search-item> </search-item> <search-item> <el-select v-model="listQuery.reciever" placeholder="合同完成状态" class="short-input" clearable> <el-option v-for="item in statusList" :key="item.value" :label="item.name" :value="item.value" /> </el-select> </search-item> </search-area> <table-container> <template #btns-right> <icon-button v-if="proxy.hasPerm('/schedule/receiptList/add')" icon="icon-add" title="新建" type="primary" @click="add" /> <icon-button v-if="proxy.hasPerm('/schedule/receiptList/export')" icon="icon-export" title="导出" type="primary" @click="exportAll" /> <icon-button v-if="proxy.hasPerm('/schedule/receiptList/print')" 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>