| | |
| | | <el-tabs v-model="activeTab" @tab-click="handleTabChange"> |
| | | <el-tab-pane v-for="tab in tabsList" :key="tab.name" :label="`${tab.label} (${tab.count})`" :name="tab.name"> |
| | | <SearchBox @search="searchClick"></SearchBox> |
| | | <el-button v-if="hasAddBtnPermission() && activeTab != 'WAIT_AUDIT'" type="primary" icon="el-icon-plus" @click="handleAddOrder">新建工单 |
| | | <el-button v-if="permission?.order_log_add && activeTab != 'WAIT_AUDIT'" type="primary" icon="el-icon-plus" @click="handleAddOrder">新建工单 |
| | | </el-button> |
| | | <el-button type="success" plain icon="el-icon-download" @click="exportData">导出 |
| | | </el-button> |
| | |
| | | <el-table-column prop="cycle_time_value" label="工单周期频次" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="操作" width="200" align="center"> |
| | | <template #default="scope"> |
| | | <template v-if="scope.row.status == 1"> |
| | | <el-button v-if="hasPaddingBtnPermission()" type="text" icon="el-icon-view" @click="handleCheckDetail(row)">审核</el-button> |
| | | <template v-if="scope.row.status === 1"> |
| | | <el-button type="text" icon="el-icon-view" v-if="permission.order_log_review" @click="handleCheckDetail(scope.row, '工单审核')">审核</el-button> |
| | | <!--待审核状态--> |
| | | <el-button type="text" icon="el-icon-warning" v-if="hasRecallPaddingBtnPermission()" @click="orderLogRecall(scope.row.id)">撤回 |
| | | <el-button type="text" icon="el-icon-warning" v-if="permission.order_log_recall" @click="revokeOrder(scope.row.id)">撤回 |
| | | </el-button> |
| | | </template> |
| | | <!--已驳回--> |
| | | <template v-if="scope.row.status == 2"> |
| | | <el-button type="text" icon="el-icon-warning" @click="rejectDetail(scope.row.id)">驳回原因</el-button> |
| | | <el-button v-if="userInfo.user_id == row.create_user" type="text" icon="el-icon-view" @click="handleViewDetail(scope.row)">编辑</el-button> |
| | | <el-button v-else type="text" icon="el-icon-view" @click="handleViewDetail(scope.row)">详情</el-button> |
| | | <template v-if="scope.row.status === 2"> |
| | | <el-button type="text" icon="el-icon-warning" @click="rejectReason(scope.row.id)">驳回原因</el-button> |
| | | <el-button type="text" icon="el-icon-view" v-if="userInfo.user_id === scope.row.create_user" @click="handleViewDetail(scope.row, '工单编辑')">编辑</el-button> |
| | | <el-button type="text" icon="el-icon-view" v-else @click="handleViewDetail(scope.row, '工单详情')">详情</el-button> |
| | | </template> |
| | | <!-- 已通过 --> |
| | | <template v-if="scope.row.status == 3"> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(scope.row)">详情</el-button> |
| | | <template v-if="scope.row.status === 3"> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(scope.row, '工单详情')">详情</el-button> |
| | | </template> |
| | | <!--草稿--> |
| | | <template v-if="scope.row.status == 0"> |
| | | <el-button type="text" icon="el-icon-edit" @click="handleViewDetail(scope.row)">编辑</el-button> |
| | | <template v-if="scope.row.status === 0"> |
| | | <el-button type="text" icon="el-icon-edit" @click="handleViewDetail(scope.row, '工单编辑')">编辑</el-button> |
| | | <el-button type="text" icon="el-icon-position" @click="userPublishPush(scope.row.id)">发布</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteOrderLog(scope.row.id)">删除</el-button> |
| | | <el-button type="text" icon="el-icon-delete" @click="deleteOrder(scope.row.id)">删除</el-button> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | <AddEditDetails v-model:show="isShowAddEditDetails" @refresh="refreshGetOrderList" /> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import SearchBox from './SearchBox.vue' |
| | | import SearchBox from './component/SearchBox.vue' |
| | | import AddEditDetails from './component/AddEditDetails.vue' |
| | | import NProgress from 'nprogress' |
| | | import { useStore } from 'vuex' |
| | | import { downloadXls } from '@/utils/util' |
| | | import { |
| | | getList, |
| | | saveUpdateOrderLog, |
| | |
| | | } from '@/api/tickets/orderLog' |
| | | import { cloneDeep } from 'lodash'; |
| | | import { computed, onMounted } from 'vue'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | |
| | | const store = useStore() |
| | | |
| | | const userInfo = computed(() => store.state.user.userInfo) |
| | | const permission = computed(() => store.state.user.permission); |
| | | |
| | | console.log(permission, '8888') |
| | | console.log(userInfo,permission, '8888') |
| | | |
| | | const isShowAddEditDetails = ref(false) |
| | | |
| | | const activeTab = ref('all') |
| | | // tab切换 |
| | |
| | | }, |
| | | } |
| | | getList(apiParams).then(res => { |
| | | console.log(res.data.data.records,'99999999') |
| | | orderListTable.value = res.data.data.records |
| | | total.value = res.data.data.total |
| | | }) |
| | |
| | | getTableList() |
| | | } |
| | | |
| | | const refreshGetJobList = () => { |
| | | const refreshGetOrderList = () => { |
| | | orderListParams.current = 1 |
| | | orderListParams.size = 10 |
| | | getTableList() |
| | | } |
| | | |
| | | // 新增按钮 和 导出按钮 |
| | | function hasAddBtnPermission () { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | console.log(permission?.value.order_log_add, '66666') |
| | | return permission && permission?.value.order_log_add |
| | | // function hasAddBtnPermission () { |
| | | // return permission && permission?.value.order_log_add |
| | | // } |
| | | // 新建工单、编辑、详情 |
| | | const txtTitle = ref('新建工单') |
| | | const rowObj = ref({}) |
| | | provide('txtTitle', txtTitle) |
| | | provide('rowObj', rowObj) |
| | | function handleAddOrder() { |
| | | isShowAddEditDetails.value = true |
| | | } |
| | | // 新建工单 |
| | | function handleAddOrder() {} |
| | | // 详情、编辑 |
| | | function handleViewDetail(row, txt) { |
| | | txtTitle.value = txt |
| | | isShowAddEditDetails.value = true |
| | | } |
| | | |
| | | // 审核 |
| | | function handleCheckDetail(row, txt) { |
| | | rowObj.value = row |
| | | txtTitle.value = txt |
| | | isShowAddEditDetails.value = true |
| | | } |
| | | |
| | | // 导出 |
| | | async function exportData() { |
| | | try { |
| | | await ElMessageBox.confirm('是否导出智飞工单数据?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | |
| | | NProgress.start() |
| | | |
| | | const apiParams = { |
| | | ...cloneDeep(orderListParams), |
| | | searchParams: { |
| | | ...cloneDeep(orderListParams.searchParams) |
| | | }, |
| | | } |
| | | const res = await orderLogExport(apiParams) |
| | | |
| | | downloadXls(res.data, `智飞工单${dayjs().format('YYYY-MM-DD')}.xlsx`) |
| | | ElMessage.success('导出成功') |
| | | |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | ElMessage.error('导出失败') |
| | | console.error('导出错误:', error) |
| | | } |
| | | } finally { |
| | | NProgress.done() |
| | | } |
| | | } |
| | | |
| | | // 撤回工单 |
| | | async function revokeOrder(id) { |
| | | try { |
| | | await ElMessageBox.confirm('确定撤回到草稿箱?', '是否撤回', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | // 用户点击确定,执行撤回操作 |
| | | await orderLogRecall(id) |
| | | // 显示成功消息 |
| | | ElMessage.success('撤回成功') |
| | | // 触发搜索刷新 |
| | | refreshGetOrderList() |
| | | } catch (error) { |
| | | // 用户点击取消,不执行任何操作 |
| | | if (error !== 'cancel') { |
| | | ElMessage.error('撤回失败') |
| | | console.error('撤回错误:', error) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 驳回原因 |
| | | async function rejectReason(id) { |
| | | try { |
| | | const res = await orderLogDetails(id) |
| | | const data = res.data.data |
| | | |
| | | await ElMessageBox.confirm(data.remark, '驳回原因', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | |
| | | // 用户点击确定后的逻辑 TODO |
| | | // form.value = { ...res.data.data } |
| | | // handleViewDetail(data) |
| | | |
| | | } catch (error) { |
| | | // 用户点击取消,不执行任何操作 |
| | | if (error !== 'cancel') { |
| | | ElMessage.error('操作失败') |
| | | console.error('错误:', error) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 删除 |
| | | async function deleteOrder(id) { |
| | | try { |
| | | await ElMessageBox.confirm('确定删除吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | deleteOrderLog(id) |
| | | ElMessage.success('删除成功') |
| | | // 触发搜索刷新 |
| | | refreshGetOrderList() |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | ElMessage.error('删除失败') |
| | | console.error('删除错误:', error) |
| | | } |
| | | } |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTableList() |