保修前端代码
This commit is contained in:
parent
7bdda83d45
commit
fa3a7599d0
@ -1,82 +0,0 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
// 让步接收申请表 类型定义
|
||||
export interface ConcessionApply {
|
||||
id?: number
|
||||
|
||||
qcId?: number
|
||||
|
||||
concessionQty?: number
|
||||
|
||||
applyRemark?: string
|
||||
|
||||
applyContent?: string
|
||||
|
||||
applyFile?: string
|
||||
|
||||
applyUserId?: number
|
||||
|
||||
deptId?: number
|
||||
|
||||
instanceId?: string
|
||||
|
||||
approveStatus?: number
|
||||
|
||||
createTime?: string
|
||||
|
||||
updateTime?: string
|
||||
|
||||
}
|
||||
|
||||
// 让步接收申请表 API
|
||||
export const concessionApplyApi = {
|
||||
// 分页查询
|
||||
page(params: { page: number; pageSize: number; id?: number }) {
|
||||
return request({ url: '/biz/concessionApply/page', method: 'get', params })
|
||||
},
|
||||
|
||||
// 获取详情
|
||||
detail(id: string) {
|
||||
return request({ url: `/biz/concessionApply/${id}`, method: 'get' })
|
||||
},
|
||||
|
||||
// 新增
|
||||
create(data: ConcessionApply) {
|
||||
return request({ url: '/biz/concessionApply', method: 'post', data })
|
||||
},
|
||||
|
||||
// 修改
|
||||
update(data: ConcessionApply) {
|
||||
return request({ url: '/biz/concessionApply', method: 'put', data })
|
||||
},
|
||||
|
||||
// 删除
|
||||
delete(ids: string[]) {
|
||||
return request({ url: `/biz/concessionApply/${ids.join(',')}`, method: 'delete' })
|
||||
},
|
||||
|
||||
// 导出
|
||||
export(params?: { ids?: string[]; id?: number }) {
|
||||
const p: Record<string, any> = {}
|
||||
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if (params?.id !== undefined && params?.id !== null) p.id = params.id
|
||||
return request({ url: `/biz/concessionApply/export`, method: 'get', params: p, responseType: 'blob' })
|
||||
},
|
||||
|
||||
// 导入
|
||||
importData(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request<{ success: number; fail: number; errors: string[] }>({
|
||||
url: `/biz/concessionApply/import`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/concessionApply/template`, method: 'get', responseType: 'blob' })
|
||||
}
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
// MES设备维修保养记录表 类型定义
|
||||
export interface MaintenanceRecord {
|
||||
recordId?: string
|
||||
|
||||
equipmentId?: string
|
||||
|
||||
recordType?: string
|
||||
|
||||
itemContent?: string
|
||||
|
||||
handleContent?: string
|
||||
|
||||
executorId?: number
|
||||
|
||||
startTime?: string
|
||||
|
||||
endTime?: string
|
||||
|
||||
recordStatus?: string
|
||||
|
||||
createTime?: string
|
||||
|
||||
updateTime?: string
|
||||
|
||||
}
|
||||
|
||||
// MES设备维修保养记录表 API
|
||||
export const maintenanceRecordApi = {
|
||||
// 分页查询
|
||||
page(params: { page: number; pageSize: number; recordId?: string }) {
|
||||
return request({ url: '/biz/maintenanceRecord/page', method: 'get', params })
|
||||
},
|
||||
|
||||
// 获取详情
|
||||
detail(recordId: string) {
|
||||
return request({ url: `/biz/maintenanceRecord/${recordId}`, method: 'get' })
|
||||
},
|
||||
|
||||
// 新增
|
||||
create(data: MaintenanceRecord) {
|
||||
return request({ url: '/biz/maintenanceRecord', method: 'post', data })
|
||||
},
|
||||
|
||||
// 修改
|
||||
update(data: MaintenanceRecord) {
|
||||
return request({ url: '/biz/maintenanceRecord', method: 'put', data })
|
||||
},
|
||||
|
||||
// 删除
|
||||
delete(recordIds: string[]) {
|
||||
return request({ url: `/biz/maintenanceRecord/${recordIds.join(',')}`, method: 'delete' })
|
||||
},
|
||||
|
||||
// 导出
|
||||
export(params?: { ids?: string[]; recordId?: string }) {
|
||||
const p: Record<string, any> = {}
|
||||
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if (params?.recordId !== undefined && params?.recordId !== null) p.recordId = params.recordId
|
||||
return request({ url: `/biz/maintenanceRecord/export`, method: 'get', params: p, responseType: 'blob' })
|
||||
},
|
||||
|
||||
// 导入
|
||||
importData(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request<{ success: number; fail: number; errors: string[] }>({
|
||||
url: `/biz/maintenanceRecord/import`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/maintenanceRecord/template`, method: 'get', responseType: 'blob' })
|
||||
}
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
// 委外记录表 类型定义
|
||||
export interface Outsourcing {
|
||||
id?: number
|
||||
|
||||
name?: string
|
||||
|
||||
code?: string
|
||||
|
||||
businessType?: number
|
||||
|
||||
businessId?: number
|
||||
|
||||
businessCode?: string
|
||||
|
||||
orderItemId?: number
|
||||
|
||||
quantity?: number
|
||||
|
||||
supplierId?: number
|
||||
|
||||
supplierName?: string
|
||||
|
||||
unitPrice?: string
|
||||
|
||||
totalAmount?: string
|
||||
|
||||
beginPreparationTime?: string
|
||||
|
||||
endPreparationTime?: string
|
||||
|
||||
beginTime?: string
|
||||
|
||||
endTime?: string
|
||||
|
||||
remark?: string
|
||||
|
||||
createTime?: string
|
||||
|
||||
createBy?: string
|
||||
|
||||
overdue?: number
|
||||
|
||||
}
|
||||
|
||||
// 委外记录表 API
|
||||
export const outsourcingApi = {
|
||||
// 分页查询
|
||||
page(params: { page: number; pageSize: number; id?: number; name?: string; businessType?: number }) {
|
||||
return request({ url: '/biz/outsourcing/page', method: 'get', params })
|
||||
},
|
||||
|
||||
// 获取详情
|
||||
detail(id: string) {
|
||||
return request({ url: `/biz/outsourcing/${id}`, method: 'get' })
|
||||
},
|
||||
|
||||
// 新增
|
||||
create(data: Outsourcing) {
|
||||
return request({ url: '/biz/outsourcing', method: 'post', data })
|
||||
},
|
||||
|
||||
// 修改
|
||||
update(data: Outsourcing) {
|
||||
return request({ url: '/biz/outsourcing', method: 'put', data })
|
||||
},
|
||||
|
||||
// 删除
|
||||
delete(ids: string[]) {
|
||||
return request({ url: `/biz/outsourcing/${ids.join(',')}`, method: 'delete' })
|
||||
},
|
||||
|
||||
// 导出
|
||||
export(params?: { ids?: string[]; id?: number; name?: string; businessType?: number }) {
|
||||
const p: Record<string, any> = {}
|
||||
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if (params?.id !== undefined && params?.id !== null) p.id = params.id
|
||||
if (params?.name !== undefined && params?.name !== null) p.name = params.name
|
||||
if (params?.businessType !== undefined && params?.businessType !== null) p.businessType = params.businessType
|
||||
return request({ url: `/biz/outsourcing/export`, method: 'get', params: p, responseType: 'blob' })
|
||||
},
|
||||
|
||||
// 导入
|
||||
importData(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request<{ success: number; fail: number; errors: string[] }>({
|
||||
url: `/biz/outsourcing/import`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/outsourcing/template`, method: 'get', responseType: 'blob' })
|
||||
}
|
||||
}
|
||||
71
src/api/exceptionFilter.ts
Normal file
71
src/api/exceptionFilter.ts
Normal file
@ -0,0 +1,71 @@
|
||||
import { request } from '@/utils/request'
|
||||
|
||||
// 异常过滤表 类型定义
|
||||
export interface ExceptionFilter {
|
||||
id?: number
|
||||
|
||||
title?: string
|
||||
|
||||
filterCondition?: string
|
||||
|
||||
description?: string
|
||||
|
||||
status?: 0
|
||||
|
||||
deleted?: number
|
||||
|
||||
}
|
||||
|
||||
// 异常过滤表 API
|
||||
export const exceptionFilterApi = {
|
||||
// 分页查询
|
||||
page(params: { page: number; pageSize: number; id?: number; status?: number }) {
|
||||
return request({ url: '/biz/exceptionFilter/page', method: 'get', params })
|
||||
},
|
||||
|
||||
// 获取详情
|
||||
detail(id: string) {
|
||||
return request({ url: `/biz/exceptionFilter/${id}`, method: 'get' })
|
||||
},
|
||||
|
||||
// 新增
|
||||
create(data: ExceptionFilter) {
|
||||
return request({ url: '/biz/exceptionFilter', method: 'post', data })
|
||||
},
|
||||
|
||||
// 修改
|
||||
update(data: ExceptionFilter) {
|
||||
return request({ url: '/biz/exceptionFilter', method: 'put', data })
|
||||
},
|
||||
|
||||
// 删除
|
||||
delete(ids: string[]) {
|
||||
return request({ url: `/biz/exceptionFilter/${ids.join(',')}`, method: 'delete' })
|
||||
},
|
||||
|
||||
// 导出
|
||||
export(params?: { ids?: string[]; id?: number; status?: number }) {
|
||||
const p: Record<string, any> = {}
|
||||
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if (params?.id !== undefined && params?.id !== null) p.id = params.id
|
||||
if (params?.status !== undefined && params?.status !== null) p.status = params.status
|
||||
return request({ url: `/biz/exceptionFilter/export`, method: 'get', params: p, responseType: 'blob' })
|
||||
},
|
||||
|
||||
// 导入
|
||||
importData(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request<{ success: number; fail: number; errors: string[] }>({
|
||||
url: `/biz/exceptionFilter/import`,
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
|
||||
// 下载导入模板
|
||||
downloadTemplate() {
|
||||
return request({ url: `/biz/exceptionFilter/template`, method: 'get', responseType: 'blob' })
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ export interface SysNotice {
|
||||
errorNotificationId?:number,
|
||||
filler?:number,
|
||||
filingStatus?:number,
|
||||
deviceName?:string
|
||||
}
|
||||
|
||||
export interface NoticeChannelOption {
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
import {onMounted, ref, watch} from "vue";
|
||||
import { Notifications } from '@vicons/ionicons5'
|
||||
import { ErrorNotification } from '@/api/errorNotification.ts'
|
||||
import {} from '@/api/system.ts'
|
||||
import {noticeApi, SysNotice} from '@/api/message'
|
||||
import type {FormInst} from "naive-ui";
|
||||
@ -12,7 +11,7 @@ const emit = defineEmits<{
|
||||
|
||||
const props = defineProps<{
|
||||
show: boolean
|
||||
errorNotifiaction:ErrorNotification,
|
||||
|
||||
notice:SysNotice,
|
||||
}>()
|
||||
|
||||
@ -72,7 +71,7 @@ watch(showModal, (val) => {
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await formRef.value?.validate()
|
||||
formData.value.id = props.errorNotifiaction.noticeId
|
||||
formData.value.id = props.notice.id
|
||||
formData.value.filingStatus = 1
|
||||
//修改通知表
|
||||
noticeApi.update({
|
||||
@ -114,7 +113,7 @@ async function handleSubmit() {
|
||||
<template #1>
|
||||
<n-grid x-gap="12" :cols="1">
|
||||
<n-gi>
|
||||
<h2>异常内容</h2>
|
||||
<h2>通知内容</h2>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
<n-form
|
||||
@ -122,21 +121,21 @@ async function handleSubmit() {
|
||||
label-width="100"
|
||||
style="margin: 10px"
|
||||
>
|
||||
<n-form-item label="异常名称" path="title">
|
||||
<n-form-item label="通知标题" path="title">
|
||||
<n-input
|
||||
v-model:value="props.errorNotifiaction.title"
|
||||
v-model:value="props.notice.title"
|
||||
disabled
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="异常设备" path="devices">
|
||||
<n-form-item label="异常设备" path="title">
|
||||
<n-input
|
||||
v-model:value="props.errorNotifiaction.devices"
|
||||
v-model:value="props.notice.deviceName"
|
||||
disabled
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="通知内容" path="notifierContent">
|
||||
<n-input
|
||||
v-model:value="errorNotifiaction.notifierContent"
|
||||
v-model:value="props.notice.content"
|
||||
type="textarea"
|
||||
disabled
|
||||
/>
|
||||
@ -172,7 +171,7 @@ async function handleSubmit() {
|
||||
<div v-if="!isFili">
|
||||
<n-grid x-gap="12" :cols="1">
|
||||
<n-gi>
|
||||
<h2>异常内容</h2>
|
||||
<h2>通知内容</h2>
|
||||
</n-gi>
|
||||
</n-grid>
|
||||
<n-form
|
||||
@ -180,21 +179,21 @@ async function handleSubmit() {
|
||||
label-width="100"
|
||||
style="margin: 10px"
|
||||
>
|
||||
<n-form-item label="异常名称" path="title">
|
||||
<n-form-item label="通知标题" path="title">
|
||||
<n-input
|
||||
v-model:value="props.errorNotifiaction.title"
|
||||
v-model:value="props.notice.title"
|
||||
disabled
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="异常设备" path="devices">
|
||||
<n-form-item label="异常设备" path="title">
|
||||
<n-input
|
||||
v-model:value="props.errorNotifiaction.devices"
|
||||
v-model:value="props.notice.deviceName"
|
||||
disabled
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="通知内容" path="notifierContent">
|
||||
<n-input
|
||||
v-model:value="errorNotifiaction.notifierContent"
|
||||
v-model:value="props.notice.content"
|
||||
type="textarea"
|
||||
disabled
|
||||
/>
|
||||
|
||||
@ -609,22 +609,9 @@ function stripHtml(html: string | undefined): string {
|
||||
}
|
||||
|
||||
// 点击通知
|
||||
//异常订阅内容
|
||||
const errorNotifiaction = ref({
|
||||
title: '',
|
||||
devices: '',
|
||||
sendingMethodName: '',
|
||||
notifierName: '',
|
||||
notifierContent: ''
|
||||
})
|
||||
//是否需要填报
|
||||
const notice = ref<SysNotice>( {})
|
||||
async function handleNoticeClick(item: SysNotice) {
|
||||
|
||||
|
||||
const res = await errorNotificationApi.detail(item.errorNotificationId);
|
||||
errorNotifiaction.value = {...res}
|
||||
errorNotifiaction.value.noticeId = item.id
|
||||
notice.value = item
|
||||
//异常填报直接弹窗
|
||||
showErrorReportModal.value = true
|
||||
|
||||
@ -4,8 +4,11 @@
|
||||
<!-- 搜索表单 -->
|
||||
<div class="search-form">
|
||||
<n-form inline :model="searchForm" label-placement="left">
|
||||
<n-form-item label="主键id">
|
||||
<n-input v-model:value="searchForm.id" placeholder="请输入主键id" clearable />
|
||||
<n-form-item label="主键ID">
|
||||
<n-input v-model:value="searchForm.id" placeholder="请输入主键ID" clearable />
|
||||
</n-form-item>
|
||||
<n-form-item label="状态">
|
||||
<n-select v-model:value="searchForm.status" placeholder="请选择状态" clearable style="width: 150px" :options="statusOptions" />
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-space>
|
||||
@ -61,29 +64,26 @@
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
|
||||
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
|
||||
<n-form-item label="质检编号" path="qcId">
|
||||
<n-input v-model:value="formData.qcId" placeholder="请输入质检编号" />
|
||||
<n-form-item label="异常过滤标题" path="title">
|
||||
<n-input v-model:value="formData.title" placeholder="请输入异常过滤标题" />
|
||||
</n-form-item>
|
||||
<n-form-item label="让步接收数量" path="concessionQty">
|
||||
<n-input v-model:value="formData.concessionQty" placeholder="请输入让步接收数量" />
|
||||
<n-form-item label="过滤条件" path="filterCondition">
|
||||
<n-input v-model:value="formData.filterCondition" type="textarea" placeholder="请输入过滤条件" />
|
||||
</n-form-item>
|
||||
<n-form-item label="申请原因" path="applyRemark">
|
||||
<n-input v-model:value="formData.applyRemark" type="textarea" placeholder="请输入申请原因" />
|
||||
<n-form-item label="描述" path="description">
|
||||
<n-input v-model:value="formData.description" type="textarea" placeholder="请输入描述" />
|
||||
</n-form-item>
|
||||
<n-form-item label="申请内容" path="applyContent">
|
||||
<n-input v-model:value="formData.applyContent" type="textarea" placeholder="请输入申请内容" />
|
||||
</n-form-item>
|
||||
<n-form-item label="申请人id(发去人id)" path="applyUserId">
|
||||
<n-input v-model:value="formData.applyUserId" placeholder="请输入申请人id(发去人id)" />
|
||||
</n-form-item>
|
||||
<n-form-item label="部门id" path="deptId">
|
||||
<n-input v-model:value="formData.deptId" placeholder="请输入部门id" />
|
||||
</n-form-item>
|
||||
<n-form-item label="钉钉单据id" path="instanceId">
|
||||
<n-input v-model:value="formData.instanceId" placeholder="请输入钉钉单据id" />
|
||||
</n-form-item>
|
||||
<n-form-item label="审批状态 1待审批 2审批通过 3 审批驳回" path="approveStatus">
|
||||
<n-select v-model:value="formData.approveStatus" placeholder="请选择审批状态 1待审批 2审批通过 3 审批驳回" :options="approveStatusOptions" />
|
||||
<n-form-item label="状态">
|
||||
<n-radio-group v-model:value="formData.status" :default-value="0" >
|
||||
<n-space>
|
||||
<n-radio :value="1">
|
||||
启用
|
||||
</n-radio>
|
||||
<n-radio :value="0">
|
||||
禁用
|
||||
</n-radio>
|
||||
</n-space>
|
||||
</n-radio-group>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
@ -95,7 +95,7 @@
|
||||
</n-modal>
|
||||
|
||||
<!-- 导入弹窗 -->
|
||||
<n-modal v-model:show="importModalVisible" preset="card" title="导入让步接收申请表" style="width: 500px">
|
||||
<n-modal v-model:show="importModalVisible" preset="card" title="导入异常过滤表" style="width: 500px">
|
||||
<n-space vertical>
|
||||
<n-alert type="info">
|
||||
<template #header>导入说明</template>
|
||||
@ -131,7 +131,7 @@
|
||||
import { ref, reactive, h, onMounted } from 'vue'
|
||||
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
|
||||
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
|
||||
import { concessionApplyApi, type ConcessionApply } from '@/api/concessionApply'
|
||||
import { exceptionFilterApi, type ExceptionFilter } from '@/api/exceptionFilter'
|
||||
import { dictDataApi } from '@/api/org'
|
||||
|
||||
const message = useMessage()
|
||||
@ -140,10 +140,11 @@ const dialog = useDialog()
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
id: null as number | null,
|
||||
status: null as number | null,
|
||||
})
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref<ConcessionApply[]>([])
|
||||
const tableData = ref<ExceptionFilter[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedIds = ref<number[]>([])
|
||||
const pagination = reactive({
|
||||
@ -159,47 +160,35 @@ const modalVisible = ref(false)
|
||||
const modalTitle = ref('')
|
||||
const importModalVisible = ref(false)
|
||||
const formRef = ref()
|
||||
const defaultFormData: ConcessionApply = {
|
||||
qcId: undefined,
|
||||
concessionQty: undefined,
|
||||
applyRemark: '',
|
||||
applyContent: '',
|
||||
applyFile: '',
|
||||
applyUserId: undefined,
|
||||
deptId: undefined,
|
||||
instanceId: '',
|
||||
approveStatus: undefined,
|
||||
const defaultFormData: ExceptionFilter = {
|
||||
title: '',
|
||||
filterCondition: '',
|
||||
description: '',
|
||||
status: undefined,
|
||||
}
|
||||
const formData = reactive<ConcessionApply>({ ...defaultFormData })
|
||||
const formData = reactive<ExceptionFilter>({ ...defaultFormData })
|
||||
|
||||
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||
const approveStatusOptions = ref<{ label: string; value: any }[]>([])
|
||||
const statusOptions = ref<{ label: string; value: any }[]>([])
|
||||
|
||||
// 表单校验规则
|
||||
const formRules = {
|
||||
}
|
||||
|
||||
// 表格列
|
||||
const columns: DataTableColumns<ConcessionApply> = [
|
||||
const columns: DataTableColumns<ExceptionFilter> = [
|
||||
{ type: 'selection' },
|
||||
{ title: '主键id', key: 'id' },
|
||||
{ title: '质检编号', key: 'qcId' },
|
||||
{ title: '让步接收数量', key: 'concessionQty' },
|
||||
{ title: '申请原因', key: 'applyRemark' },
|
||||
{ title: '申请内容', key: 'applyContent' },
|
||||
{ title: '申请附件', key: 'applyFile' },
|
||||
{ title: '申请人id(发去人id)', key: 'applyUserId' },
|
||||
{ title: '部门id', key: 'deptId' },
|
||||
{ title: '钉钉单据id', key: 'instanceId' },
|
||||
{ title: '审批状态 1待审批 2审批通过 3 审批驳回', key: 'approveStatus',
|
||||
{ title: '主键ID', key: 'id' },
|
||||
{ title: '异常过滤标题', key: 'title' },
|
||||
{ title: '过滤条件', key: 'filterCondition' },
|
||||
{ title: '描述', key: 'description' },
|
||||
{ title: '状态', key: 'status',
|
||||
render(row) {
|
||||
const val = row.approveStatus
|
||||
const opt = approveStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
||||
const val = row.status
|
||||
const opt = statusOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
||||
return opt ? opt.label : (val ?? '-')
|
||||
}
|
||||
},
|
||||
{ title: '创建时间', key: 'createTime', width: 180 },
|
||||
{ title: '更新时间', key: 'updateTime', width: 180 },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
@ -222,10 +211,11 @@ const columns: DataTableColumns<ConcessionApply> = [
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await concessionApplyApi.page({
|
||||
const res = await exceptionFilterApi.page({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
id: searchForm.id || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
})
|
||||
tableData.value = res.list
|
||||
pagination.itemCount = res.total
|
||||
@ -244,6 +234,8 @@ function handleSearch() {
|
||||
function handleReset() {
|
||||
searchForm.id = null
|
||||
|
||||
searchForm.status = null
|
||||
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
@ -266,21 +258,15 @@ function handleCheck(keys: Array<string | number>) {
|
||||
|
||||
// 新增
|
||||
function handleAdd() {
|
||||
modalTitle.value = '新增让步接收申请表'
|
||||
modalTitle.value = '新增异常过滤表'
|
||||
Object.assign(formData, defaultFormData)
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
// 编辑
|
||||
function handleEdit(row: ConcessionApply) {
|
||||
modalTitle.value = '编辑让步接收申请表'
|
||||
function handleEdit(row: ExceptionFilter) {
|
||||
modalTitle.value = '编辑异常过滤表'
|
||||
Object.assign(formData, row)
|
||||
if (formData.createTime && typeof formData.createTime === 'string') {
|
||||
formData.createTime = new Date(formData.createTime.replace(' ', 'T')).getTime()
|
||||
}
|
||||
if (formData.updateTime && typeof formData.updateTime === 'string') {
|
||||
formData.updateTime = new Date(formData.updateTime.replace(' ', 'T')).getTime()
|
||||
}
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
@ -288,18 +274,12 @@ function handleEdit(row: ConcessionApply) {
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
try {
|
||||
const submitData = { ...formData } as ConcessionApply
|
||||
if (typeof submitData.createTime === 'number') {
|
||||
submitData.createTime = new Date(submitData.createTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||
}
|
||||
if (typeof submitData.updateTime === 'number') {
|
||||
submitData.updateTime = new Date(submitData.updateTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||
}
|
||||
const submitData = { ...formData } as ExceptionFilter
|
||||
if (submitData.id) {
|
||||
await concessionApplyApi.update(submitData)
|
||||
await exceptionFilterApi.update(submitData)
|
||||
message.success('修改成功')
|
||||
} else {
|
||||
await concessionApplyApi.create(submitData)
|
||||
await exceptionFilterApi.create(submitData)
|
||||
message.success('新增成功')
|
||||
}
|
||||
modalVisible.value = false
|
||||
@ -310,7 +290,7 @@ async function handleSubmit() {
|
||||
}
|
||||
|
||||
// 删除
|
||||
function handleDelete(row: ConcessionApply) {
|
||||
function handleDelete(row: ExceptionFilter) {
|
||||
dialog.warning({
|
||||
title: '提示',
|
||||
content: '确定要删除该记录吗?',
|
||||
@ -318,7 +298,7 @@ function handleDelete(row: ConcessionApply) {
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try {
|
||||
await concessionApplyApi.delete([row.id!])
|
||||
await exceptionFilterApi.delete([row.id!])
|
||||
message.success('删除成功')
|
||||
loadData()
|
||||
} catch (error) {
|
||||
@ -337,7 +317,7 @@ function handleBatchDelete() {
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try {
|
||||
await concessionApplyApi.delete(selectedIds.value)
|
||||
await exceptionFilterApi.delete(selectedIds.value)
|
||||
message.success('删除成功')
|
||||
selectedIds.value = []
|
||||
loadData()
|
||||
@ -354,11 +334,12 @@ async function handleExport() {
|
||||
const params: Record<string, any> = {}
|
||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||
if (searchForm.id != null) params.id = searchForm.id
|
||||
const blob = await concessionApplyApi.export(params)
|
||||
if (searchForm.status != null) params.status = searchForm.status
|
||||
const blob = await exceptionFilterApi.export(params)
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '让步接收申请表数据.xlsx'
|
||||
link.download = '异常过滤表数据.xlsx'
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (error) {
|
||||
@ -369,11 +350,11 @@ async function handleExport() {
|
||||
// 下载导入模板
|
||||
async function handleDownloadTemplate() {
|
||||
try {
|
||||
const blob = await concessionApplyApi.downloadTemplate()
|
||||
const blob = await exceptionFilterApi.downloadTemplate()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = '让步接收申请表导入模板.xlsx'
|
||||
link.download = '异常过滤表导入模板.xlsx'
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (error) {
|
||||
@ -385,7 +366,7 @@ async function handleDownloadTemplate() {
|
||||
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
||||
if (!file.file) return
|
||||
try {
|
||||
const result = await concessionApplyApi.importData(file.file)
|
||||
const result = await exceptionFilterApi.importData(file.file)
|
||||
if (result.fail > 0) {
|
||||
dialog.warning({
|
||||
title: '导入结果',
|
||||
@ -406,7 +387,7 @@ async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
||||
async function loadDictOptions() {
|
||||
try {
|
||||
const data = await dictDataApi.listByType('sys_status')
|
||||
approveStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue) }))
|
||||
statusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue) }))
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ const defaultFormData: QcItem = {
|
||||
plans: '',
|
||||
description: '',
|
||||
createby: undefined,
|
||||
status:undefined
|
||||
status:0
|
||||
}
|
||||
const formData = reactive<QcItem>({ ...defaultFormData })
|
||||
|
||||
@ -319,6 +319,8 @@ const formData = reactive<QcItem>({ ...defaultFormData })
|
||||
|
||||
// 表单校验规则
|
||||
const formRules = {
|
||||
name: [{ required: true, message: '请输入质检项名称', trigger: 'blur' }],
|
||||
spec: [{ required: true, message: '请输入质检项规格', trigger: 'blur' }],
|
||||
}
|
||||
|
||||
// 表格列
|
||||
@ -497,15 +499,16 @@ async function handleSubmit() {
|
||||
if (typeof submitData.updateTime === 'number') {
|
||||
submitData.updateTime = new Date(submitData.updateTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||
}
|
||||
if (submitData.id) {
|
||||
await qcItemApi.update(submitData)
|
||||
message.success('修改成功')
|
||||
} else {
|
||||
await qcItemApi.create(submitData)
|
||||
message.success('新增成功')
|
||||
}
|
||||
modalVisible.value = false
|
||||
loadData()
|
||||
console.log(submitData)
|
||||
// if (submitData.id) {
|
||||
// await qcItemApi.update(submitData)
|
||||
// message.success('修改成功')
|
||||
// } else {
|
||||
// await qcItemApi.create(submitData)
|
||||
// message.success('新增成功')
|
||||
// }
|
||||
// modalVisible.value = false
|
||||
// loadData()
|
||||
} catch (error) {
|
||||
// 错误已在拦截器处理
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user