| | |
| | | <template> |
| | | <basic-container> |
| | | <el-tabs class="gd-tabs" v-model="activeName" @tab-click="tabsClick"> |
| | | <el-tab-pane :label="`全部(${allTotal})`" name="all"></el-tab-pane> |
| | | <el-tab-pane :label="`我的任务工单(${myTotal})`" name="my"></el-tab-pane> |
| | | </el-tabs> |
| | | <el-form ref="queryParamsRef" :model="searchParams" class="gd-search-form"> |
| | | <el-form-item label="工单名称" prop="workOrderName"> |
| | | <el-input |
| | | class="gd-input" |
| | | class="gd-input gray" |
| | | v-model="searchParams.workOrderName" |
| | | placeholder="请输入" |
| | | clearable |
| | |
| | | |
| | | <el-form-item label="工单类型" prop="workOrderType"> |
| | | <el-select |
| | | class="gd-select" |
| | | class="gd-select gray" |
| | | popper-class="gd-select-popper" |
| | | v-model="searchParams.workOrderType" |
| | | placeholder="请选择" |
| | |
| | | |
| | | <el-form-item label="工单状态" prop="workOrderStatus"> |
| | | <el-select |
| | | class="gd-select" |
| | | class="gd-select gray" |
| | | popper-class="gd-select-popper" |
| | | v-model="searchParams.workOrderStatus" |
| | | placeholder="请选择" |
| | |
| | | <el-option |
| | | v-for="item in dictObj.workOrderStatus" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :label="item.dictValue.split('_')[1]" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | |
| | | |
| | | <el-form-item label="执行时间" prop="executeTime"> |
| | | <el-date-picker |
| | | class="gd-date-picker" |
| | | class="gd-date-picker gray" |
| | | popper-class="gd-date-picker-popper" |
| | | v-model="executeTime" |
| | | v-model="dateRange" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="开始日期" |
| | |
| | | </el-form> |
| | | |
| | | <div class="gd-table-toolbar"> |
| | | <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button> |
| | | <el-button :icon="Delete" color="#4C34FF" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button> |
| | | <el-button v-if="permission.order_release" :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')"> |
| | | 新增工单 |
| | | </el-button> |
| | | </div> |
| | | |
| | | <div class="gd-table-container" v-loading="loading"> |
| | | <div class="gd-table-content gd-table-content-bg"> |
| | | <el-table class="gd-table" :data="list" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="46" /> |
| | | <el-table-column type="index" width="64" label="序号" /> |
| | | <el-table-column prop="workOrderName" show-overflow-tooltip label="工单名称" /> |
| | | <el-table-column prop="workOrderCode" show-overflow-tooltip label="工单编号" /> |
| | | <el-table-column prop="workOrderType" show-overflow-tooltip label="工单类型"> |
| | |
| | | {{ getDictLabel(row.workOrderType, dictObj.workOrderType) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="status" show-overflow-tooltip label="阶段状态" /> |
| | | <el-table-column prop="status" show-overflow-tooltip label="阶段状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus).split('_')[0] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="workOrderStatus" show-overflow-tooltip label="工单状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus) }} |
| | | {{ getDictLabel(row.workOrderStatus, dictObj.workOrderStatus).split('_')[1] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="executeTime" show-overflow-tooltip label="执行时间范围"> |
| | | <template v-slot="{ row }">{{ row.executeStartTime }} ~ {{ row.executeEndTime }}</template> |
| | | <template v-slot="{ row }"> |
| | | {{ dayjs(row.executeStartTime).format('YYYY-MM-DD') }} ~ |
| | | {{ dayjs(row.executeEndTime).format('YYYY-MM-DD') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUserName" show-overflow-tooltip label="需求方名称" /> |
| | | <el-table-column prop="serviceParty" show-overflow-tooltip label="服务方名称" /> |
| | | <el-table-column prop="createDeptName" show-overflow-tooltip label="需求方名称" /> |
| | | <el-table-column prop="createTime" show-overflow-tooltip label="工单创建时间" /> |
| | | <el-table-column label="操作" class-name="operation-btns"> |
| | | <template v-slot="{ row }"> |
| | | <el-link @click="openForm('view', row)">查看</el-link> |
| | | <el-link @click="openForm('edit', row)">编辑</el-link> |
| | | <el-link @click="handleDelete(row)">删除</el-link> |
| | | <el-link type="primary" @click="openFormChange(row)">查看</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <PreviewFiles v-model="previewVisible" :src="testDock" type="docx" /> |
| | | <FormDiaLog ref="dialogRef" @success="getList" v-if="dialogVisible" v-model="dialogVisible" /> |
| | | </basic-container> |
| | | </template> |
| | |
| | | import { onMounted, ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDeptTree } from '@/api/system/dept' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { dateRangeFormat, getDictLabel } from '@ztzf/utils' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { gdWorkOrderPageApi, gdWorkOrderRemoveApi } from './orderManageApi' |
| | | import dayjs from 'dayjs' |
| | | import PreviewFiles from '@/components/PreviewFiles/PreviewFiles.vue' |
| | | import testDock from '@/assets/docx/testDocx.docx' |
| | | import testPdf from '@/assets/pdf/testPdf.pdf' |
| | | import { useStore } from 'vuex' |
| | | |
| | | const store = useStore() |
| | | const activeName = ref('all') |
| | | |
| | | const permission = computed(() => store.state.user.permission) |
| | | |
| | | // 初始化查询参数 |
| | | const initSearchParams = () => ({ |
| | |
| | | size: 10, // 每页大小 |
| | | }) |
| | | const searchParams = ref(initSearchParams()) // 查询参数 |
| | | const executeTime = ref([]) // 执行时间范围 |
| | | const dateRange = ref([]) // 执行时间范围 |
| | | const total = ref(0) // 总条数 |
| | | const allTotal = ref(0) // 全部tab总条数 |
| | | const myTotal = ref(0) // 我的任务工单tab总条数 |
| | | const loading = ref(true) // 列表加载中 |
| | | const list = ref([]) // 列表数据 |
| | | const selectedIds = ref([]) // 勾选的ID列表 |
| | | const queryParamsRef = ref(null) // 查询表单实例 |
| | | const dialogRef = ref(null) // 弹框实例 |
| | | const dialogVisible = ref(false) |
| | | const previewVisible = ref(false) |
| | | const dictObj = ref({ |
| | | deviceLoadDemand: [], // 设备负载需求 |
| | | workOrderType: [], // 工单类型 |
| | | workOrderStatus: [], // 工单状态 |
| | | }) |
| | | provide('dictObj', dictObj) |
| | | const deptTree = ref([]) // 部门树 |
| | | const treeProps = { |
| | | label: 'name', |
| | | children: 'children', |
| | | } |
| | | provide('deptTree', deptTree) |
| | | provide('treeProps', treeProps) |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | | const range = dateRangeFormat(dateRange.value) |
| | | loading.value = true |
| | | try { |
| | | const res = await gdWorkOrderPageApi(searchParams.value) |
| | | const res = await gdWorkOrderPageApi({ |
| | | ...searchParams.value, |
| | | startTime: range[0], |
| | | endTime: range[1], |
| | | createUser: activeName.value === 'my' ? store.state.user.userInfo.user_id : '', |
| | | }) |
| | | list.value = res?.data?.data?.records ?? [] |
| | | total.value = res?.data?.data?.total ?? 0 |
| | | } finally { |
| | |
| | | |
| | | // 查询 |
| | | function handleSearch() { |
| | | // 处理执行时间范围 |
| | | if (executeTime.value && executeTime.value.length === 2) { |
| | | searchParams.value.executeStartTime = executeTime.value[0] |
| | | searchParams.value.executeEndTime = executeTime.value[1] |
| | | } else { |
| | | searchParams.value.executeStartTime = '' |
| | | searchParams.value.executeEndTime = '' |
| | | } |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | |
| | | // 重置查询 |
| | | function resetForm() { |
| | | queryParamsRef.value?.resetFields() |
| | | executeTime.value = [] |
| | | dateRange.value = [] |
| | | searchParams.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | function tabsClick(tab, event) { |
| | | activeName.value = tab.props.name |
| | | resetForm() |
| | | handleSearch() |
| | | } |
| | | |
| | | // 新增/编辑/查看 弹框 |
| | | function openForm(mode, row) { |
| | | dialogVisible.value = true |
| | | nextTick(() => { |
| | | dialogRef.value?.open({ mode, row }) |
| | | }) |
| | | } |
| | | // 工单状态:0草稿、10发布中_接单中、11发布中_拒绝接单、20响应中_待拆分、 |
| | | // 21响应中_申请取消、22响应中_申请修改、23响应中_已取消、 |
| | | // 30执行中_待全部完成、31执行中_协商修改、40完成待验_待全部验收、 |
| | | // 50验收通过_待结算、60结算完成_已结算 |
| | | function openFormChange(row) { |
| | | dialogVisible.value = true |
| | | nextTick(() => { |
| | | const mode = ['11'].includes(row.workOrderStatus) && permission.value.order_release ? 'edit' : 'view' |
| | | dialogRef.value?.open({ mode, row }) |
| | | }) |
| | | } |
| | |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('deviceLoadDemand,workOrderType,workOrderStatus').then(res => { |
| | | getDictionaryByCode('deviceLoadDemand,workOrderType,workOrderStatus,taskStatus').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | } |
| | | |
| | | // 获取部门树 |
| | | function getDeptTreeFun() { |
| | | getDeptTree().then(res => { |
| | | deptTree.value = res.data.data |
| | | // 获取两个tab的总条数 |
| | | async function getTabTotals() { |
| | | // 获取全部tab的总数 |
| | | const allRes = await gdWorkOrderPageApi({ |
| | | current: 1, |
| | | size: 1, |
| | | createUser: '', |
| | | }) |
| | | allTotal.value = allRes?.data?.data?.total ?? 0 |
| | | |
| | | // 获取我的任务工单tab的总数 |
| | | const myRes = await gdWorkOrderPageApi({ |
| | | current: 1, |
| | | size: 1, |
| | | createUser: store.state.user.userInfo.user_id, |
| | | }) |
| | | myTotal.value = myRes?.data?.data?.total ?? 0 |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTabTotals() |
| | | getList() |
| | | getDictList() |
| | | getDeptTreeFun() |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"></style> |