|
|
|
|
@ -41,6 +41,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('MoldManagement.MoldWorkOrderInquiry.operatorName')" prop="operator" v-show="showAllFilters">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.operator"
|
|
|
|
|
filterable
|
|
|
|
|
:placeholder="t('MoldManagement.MoldWorkOrderInquiry.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('MoldManagement.MoldWorkOrderInquiry.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('MoldManagement.MoldWorkOrderInquiry.placeholderTaskTime')"
|
|
|
|
|
:end-placeholder="t('MoldManagement.MoldWorkOrderInquiry.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" />
|
|
|
|
|
@ -54,13 +75,16 @@
|
|
|
|
|
<el-button type="primary" @click="handleQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> {{ t('MoldManagement.MoldWorkOrderInquiry.query') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> {{ t('MoldManagement.MoldWorkOrderInquiry.export') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<div class="mb-10px">
|
|
|
|
|
<el-button type="warning" plain @click="handleBatchCancel" :disabled="!selectedIds.length" :loading="cancelLoading">
|
|
|
|
|
<el-button type="warning" plain @click="handleBatchCancel" :disabled="isCancelDisabled" :loading="cancelLoading">
|
|
|
|
|
{{ t('MoldManagement.MoldWorkOrderInquiry.cancelTask') }}
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
@ -125,6 +149,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import { getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
|
|
|
|
import { TicketManagementApi, TicketManagementVO } from '@/api/mold/ticketManagement'
|
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
|
import TicketResultDialog from '@/views/mold/workOrderInquiry/components/TicketResultDialog.vue'
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
@ -139,8 +164,8 @@ const planTypeOptions = [
|
|
|
|
|
{ label: t('MoldManagement.MoldWorkOrderInquiry.planTypeMaintain'), value: '2' }
|
|
|
|
|
]
|
|
|
|
|
const jobResultOptions = [
|
|
|
|
|
{ label: t('MoldManagement.MoldWorkOrderInquiry.jobResultOk'), value: 'OK' },
|
|
|
|
|
{ label: t('MoldManagement.MoldWorkOrderInquiry.jobResultNg'), value: 'NG' }
|
|
|
|
|
{ label: t('MoldManagement.MoldWorkOrderInquiry.jobResultOk'), value: '1' },
|
|
|
|
|
{ label: t('MoldManagement.MoldWorkOrderInquiry.jobResultNg'), value: '2' }
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const loading = ref(true)
|
|
|
|
|
@ -159,7 +184,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(() => {
|
|
|
|
|
@ -175,22 +203,36 @@ 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 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 {
|
|
|
|
|
@ -210,13 +252,22 @@ const resetQuery = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSelectionChange = (rows: TicketManagementVO[]) => {
|
|
|
|
|
selectedRows.value = rows
|
|
|
|
|
selectedIds.value = rows
|
|
|
|
|
.map((r) => r.id)
|
|
|
|
|
.filter((id): id is number => typeof id === 'number')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 handleBatchCancel = async () => {
|
|
|
|
|
if (!selectedIds.value.length) return
|
|
|
|
|
if (hasUncancelableSelection.value) {
|
|
|
|
|
message.warning(t('MoldManagement.MoldWorkOrderInquiry.cancelOnlyUnworkedTip'))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const { value } = await ElMessageBox.prompt('请输入取消原因', t('MoldManagement.MoldWorkOrderInquiry.cancelTask'), {
|
|
|
|
|
confirmButtonText: t('common.ok'),
|
|
|
|
|
@ -227,11 +278,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('MoldManagement.MoldWorkOrderInquiry.cancelSuccess'))
|
|
|
|
|
selectedIds.value = []
|
|
|
|
|
selectedRows.value = []
|
|
|
|
|
await getList()
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
@ -239,6 +291,23 @@ const handleBatchCancel = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const params: any = {
|
|
|
|
|
...buildQueryParams(),
|
|
|
|
|
ids: selectedIds.value.length ? selectedIds.value.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
const data = await TicketManagementApi.exportTicketManagement(params)
|
|
|
|
|
const download = (await import('@/utils/download')).default
|
|
|
|
|
download.excel(data, t('MoldManagement.MoldWorkOrderInquiry.exportFilename'))
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleRowClick = (row: TicketManagementVO, column: any) => {
|
|
|
|
|
if (column?.type === 'selection') return
|
|
|
|
|
if (!row?.id) return
|
|
|
|
|
@ -259,6 +328,7 @@ const handleResultSuccess = async () => {
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await dictStore.setDictMap()
|
|
|
|
|
users.value = await getSimpleUserList()
|
|
|
|
|
await getList()
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
window.addEventListener("resize", updatePlanTableMaxHeight)
|
|
|
|
|
@ -268,3 +338,4 @@ onBeforeUnmount(() => {
|
|
|
|
|
window.removeEventListener("resize", updatePlanTableMaxHeight)
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|