|
|
|
|
@ -44,6 +44,27 @@
|
|
|
|
|
<el-option v-for="opt in jobResultOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.WorkOrderManagement.operatorName')" prop="operator" v-show="showAllFilters">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.operator"
|
|
|
|
|
filterable
|
|
|
|
|
:placeholder="t('EquipmentManagement.WorkOrderManagement.placeholderOperatorName')"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in users" :key="String(item.id)" :label="item.nickname" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('EquipmentManagement.WorkOrderManagement.taskTimeRange')" prop="taskTimeRange" v-show="showAllFilters">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.taskTimeRange"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
:start-placeholder="t('EquipmentManagement.WorkOrderManagement.placeholderTaskTime')"
|
|
|
|
|
:end-placeholder="t('EquipmentManagement.WorkOrderManagement.placeholderTaskEndTime')"
|
|
|
|
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
class="!w-240px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="filterCount > 3">
|
|
|
|
|
<el-button type="text" class="text-primary" @click="toggleFilters">
|
|
|
|
|
<Icon :icon="showAllFilters ? 'ep:arrow-up' : 'ep:arrow-down'" class="mr-5px" />
|
|
|
|
|
@ -73,7 +94,7 @@
|
|
|
|
|
type="warning"
|
|
|
|
|
plain
|
|
|
|
|
@click="handleBatchCancel"
|
|
|
|
|
:disabled="!selectedIds.length"
|
|
|
|
|
:disabled="isCancelDisabled"
|
|
|
|
|
:loading="cancelLoading"
|
|
|
|
|
>
|
|
|
|
|
{{ t('EquipmentManagement.WorkOrderManagement.cancelTask') }}
|
|
|
|
|
@ -213,6 +234,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import { getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
|
|
|
|
import { TicketManagementApi, TicketManagementVO } from '@/api/mes/ticketManagement'
|
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
|
import TicketResultDialog from './components/TicketResultDialog.vue'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'WorkOrderManagement' })
|
|
|
|
|
@ -246,8 +268,10 @@ const updatePlanTableMaxHeight = async () => {
|
|
|
|
|
planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight)))
|
|
|
|
|
}
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
const selectedRows = ref<TicketManagementVO[]>([])
|
|
|
|
|
const cancelLoading = ref(false)
|
|
|
|
|
const exportLoading = ref(false)
|
|
|
|
|
const users = ref<UserVO[]>([])
|
|
|
|
|
const resultVisible = ref(false)
|
|
|
|
|
const selectedResultRow = ref<TicketManagementVO>()
|
|
|
|
|
const resultTitle = computed(() => {
|
|
|
|
|
@ -264,22 +288,40 @@ const queryParams = reactive({
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
planNo: undefined as string | undefined,
|
|
|
|
|
planType: undefined as string | undefined,
|
|
|
|
|
jobStatus: undefined as string | undefined,
|
|
|
|
|
jobResult: undefined as string | undefined
|
|
|
|
|
jobStatus: '0' as string | undefined,
|
|
|
|
|
jobResult: undefined as string | undefined,
|
|
|
|
|
operator: undefined as string | undefined,
|
|
|
|
|
taskTimeRange: [] as string[]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
const showAllFilters = ref(false)
|
|
|
|
|
const filterCount = 4
|
|
|
|
|
const filterCount = 6
|
|
|
|
|
const UNWORKED_JOB_STATUS = '0'
|
|
|
|
|
const CANCELED_JOB_STATUS = '4'
|
|
|
|
|
|
|
|
|
|
const toggleFilters = () => {
|
|
|
|
|
showAllFilters.value = !showAllFilters.value
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isUnworkedTicket = (row?: TicketManagementVO) => String(row?.jobStatus ?? '') === UNWORKED_JOB_STATUS
|
|
|
|
|
const hasUncancelableSelection = computed(() => selectedRows.value.some((row) => !isUnworkedTicket(row)))
|
|
|
|
|
const isCancelDisabled = computed(() => !selectedIds.value.length || hasUncancelableSelection.value)
|
|
|
|
|
|
|
|
|
|
const buildQueryParams = () => {
|
|
|
|
|
const { taskTimeRange, ...params } = queryParams
|
|
|
|
|
return {
|
|
|
|
|
...params,
|
|
|
|
|
taskTime: taskTimeRange?.[0],
|
|
|
|
|
taskEndTime: taskTimeRange?.[1]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await TicketManagementApi.getTicketManagementPage(queryParams)
|
|
|
|
|
const data = await TicketManagementApi.getTicketManagementPage(buildQueryParams())
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
@ -299,6 +341,7 @@ const resetQuery = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSelectionChange = (rows: TicketManagementVO[]) => {
|
|
|
|
|
selectedRows.value = rows
|
|
|
|
|
selectedIds.value = rows
|
|
|
|
|
.map((r) => r.id)
|
|
|
|
|
.filter((id): id is number => typeof id === 'number')
|
|
|
|
|
@ -306,6 +349,10 @@ const handleSelectionChange = (rows: TicketManagementVO[]) => {
|
|
|
|
|
|
|
|
|
|
const handleBatchCancel = async () => {
|
|
|
|
|
if (!selectedIds.value.length) return
|
|
|
|
|
if (hasUncancelableSelection.value) {
|
|
|
|
|
message.warning(t('EquipmentManagement.WorkOrderManagement.cancelOnlyUnworkedTip'))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const { value } = await ElMessageBox.prompt('请输入取消原因', t('EquipmentManagement.WorkOrderManagement.cancelTask'), {
|
|
|
|
|
confirmButtonText: t('common.ok'),
|
|
|
|
|
@ -316,11 +363,12 @@ const handleBatchCancel = async () => {
|
|
|
|
|
cancelLoading.value = true
|
|
|
|
|
await TicketManagementApi.batchUpdateTicketStatus({
|
|
|
|
|
ids: selectedIds.value.join(','),
|
|
|
|
|
jobStatus: '4',
|
|
|
|
|
jobStatus: CANCELED_JOB_STATUS,
|
|
|
|
|
cancelReason: value
|
|
|
|
|
})
|
|
|
|
|
message.success(t('EquipmentManagement.WorkOrderManagement.cancelSuccess'))
|
|
|
|
|
selectedIds.value = []
|
|
|
|
|
selectedRows.value = []
|
|
|
|
|
await getList()
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
@ -333,7 +381,7 @@ const handleExport = async () => {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const params: any = {
|
|
|
|
|
...queryParams,
|
|
|
|
|
...buildQueryParams(),
|
|
|
|
|
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
const data = await TicketManagementApi.exportTicketManagement(params)
|
|
|
|
|
@ -367,6 +415,7 @@ const handleResultSuccess = async () => {
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await dictStore.setDictMap()
|
|
|
|
|
users.value = await getSimpleUserList()
|
|
|
|
|
await getList()
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
window.addEventListener("resize", updatePlanTableMaxHeight)
|
|
|
|
|
|