Browse Source

检测记录

master
songguoqiang 1 year ago
parent
commit
accd3d026a
  1. 1
      package.json
  2. 10
      src/api/detection/records/index.ts
  3. 63
      src/api/detection/recordsDetails/index.ts
  4. 5
      src/api/spc/itembasic/index.ts
  5. 5
      src/api/spc/project/index.ts
  6. 16
      src/api/spc/templateItemDetails/index.ts
  7. 305
      src/components/Detail/src/RecordDetails.vue
  8. 12
      src/utils/disposition/defaultButtons.ts
  9. 58
      src/views/detection/records/index.vue
  10. 74
      src/views/detection/records/records.data.ts
  11. 231
      src/views/detection/recordsDetails/index.vue
  12. 130
      src/views/detection/recordsDetails/recordsDetails.data.ts
  13. 34
      src/views/spc/detectiontemplate/detectionTemplate.data.ts
  14. 15
      src/views/spc/itembasic/itembasic.data.ts
  15. 16
      src/views/spc/project/project.data.ts

1
package.json

@ -53,6 +53,7 @@
"vue-i18n": "^9.4.1", "vue-i18n": "^9.4.1",
"vue-router": "^4.2.5", "vue-router": "^4.2.5",
"vue-types": "^5.1.1", "vue-types": "^5.1.1",
"vue-video-player": "^5.0.1",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"web-storage-cache": "^1.1.1", "web-storage-cache": "^1.1.1",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"

10
src/api/detection/records/index.ts

@ -7,6 +7,11 @@ export interface RecordsVO {
remark: string remark: string
version: string version: string
saveStatus: string saveStatus: string
projectName?:string
itemName?:string
itemType?:string
itemCode?:string
projectCode?:string
} }
// 查询检测记录数据主列表 // 查询检测记录数据主列表
@ -40,6 +45,11 @@ export const deleteRecords = async (id: number) => {
return await request.delete({ url: `/detection/records/delete?id=` + id }) return await request.delete({ url: `/detection/records/delete?id=` + id })
} }
// 批量删除检测记录数据主
export const batchDeleteRecords = async (ids: Array<number>) => {
return await request.delete({ url: `/detection/records/batchDelete?ids=` + ids })
}
// 导出检测记录数据主 Excel // 导出检测记录数据主 Excel
export const exportRecords = async (params) => { export const exportRecords = async (params) => {
return await request.download({ url: `/detection/records/export-excel`, params }) return await request.download({ url: `/detection/records/export-excel`, params })

63
src/api/detection/recordsDetails/index.ts

@ -0,0 +1,63 @@
import request from '@/config/axios'
export interface RecordsDetailsVO {
id: number
templateItemId: number
templateId: number
detectValue: number
result: string
saveStatus: string
remark: string
version: string
contents?:string
methods?:string
upLimit?:string
downLimit?:string
}
// 查询检测记录详细列表
export const getRecordsDetailsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/detection/recordsdetails/senior', data })
} else {
return await request.get({ url: `/detection/recordsdetails/page`, params })
}
}
// 查询检测记录详细详情
export const getRecordsDetails = async (id: number) => {
return await request.get({ url: `/detection/recordsdetails/get?id=` + id })
}
// 新增检测记录详细
export const createRecordsDetails = async (data: RecordsDetailsVO) => {
return await request.post({ url: `/detection/recordsdetails/create`, data })
}
// 修改检测记录详细
export const updateRecordsDetails = async (data: RecordsDetailsVO) => {
return await request.put({ url: `/detection/recordsdetails/update`, data })
}
// 删除检测记录详细
export const deleteRecordsDetails = async (id: number) => {
return await request.delete({ url: `/detection/recordsdetails/delete?id=` + id })
}
// 删除检测记录详细
export const batchDeleteRecordDetails = async (ids: Array<number>) => {
return await request.delete({ url: `/detection/recordsdetails/batchDelete?ids=` + ids})
}
// 导出检测记录详细 Excel
export const exportRecordsDetails = async (params) => {
return await request.download({ url: `/detection/recordsdetails/export-excel`, params })
}
// 下载导入模板
export const importTemplate = () => {
return request.download({ url: '/detection/recordsdetails/get-import-template' })
}

5
src/api/spc/itembasic/index.ts

@ -89,3 +89,8 @@ export const selectItems = async () => {
export const selectItemsByProjectCode = async (code:String) => { export const selectItemsByProjectCode = async (code:String) => {
return await request.get({ url: `/spc/itembasic/selectItemsByProjectCode?code=` + code}) return await request.get({ url: `/spc/itembasic/selectItemsByProjectCode?code=` + code})
} }
// 查询物品基本信息列表不分页用于下拉数据
export const getList = async (params) => {
return await request.get({ url: `/spc/itembasic/getList`, params })
}

5
src/api/spc/project/index.ts

@ -57,4 +57,9 @@ export const importTemplate = () => {
export const selectAllPros = async () => {//查询所有的项目 export const selectAllPros = async () => {//查询所有的项目
return await request.get({ url: `/spc/project/selectAllPros`}) return await request.get({ url: `/spc/project/selectAllPros`})
}
// 查询项目基本信息列表不分页用于下拉数据
export const getList = async (params) => {
return await request.get({ url: `/spc/project/getList`, params })
} }

16
src/api/spc/templateItemDetails/index.ts

@ -1,4 +1,5 @@
import request from '@/config/axios' import request from '@/config/axios'
import { pa } from 'element-plus/es/locale'
export interface TemplateItemDetailsVO { export interface TemplateItemDetailsVO {
templateId: number templateId: number
@ -20,7 +21,6 @@ export interface TemplateItemDetailsVO {
concurrencyStamp: string concurrencyStamp: string
siteId: string siteId: string
} }
// 查询检测记录明细列表 // 查询检测记录明细列表
export const getTemplateItemDetailsPage = async (params) => { export const getTemplateItemDetailsPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
@ -64,4 +64,18 @@ export const importTemplate = () => {
export const selectDetectionItems = async (itemCode: String , detectionType: String) => { export const selectDetectionItems = async (itemCode: String , detectionType: String) => {
return await request.get({ url: `/spc/template-item-details/selectDetectionItems?itemCode=` + itemCode + `&detectionType=` + detectionType }) return await request.get({ url: `/spc/template-item-details/selectDetectionItems?itemCode=` + itemCode + `&detectionType=` + detectionType })
}
let templateId=0
// 查询检测项列表用于下拉选择
export const getTemplateItemDetailsList = async (params) => {
params = {templateId:templateId};
return await request.get({ url: `/spc/template-item-details/getList`,params})
}
export const acceptParam = async (params) => {
templateId =params.templateId
console.info("templateId",templateId)
return
//return await request.get({ url: `/spc/template-item-details/getList`,params})
} }

305
src/components/Detail/src/RecordDetails.vue

@ -0,0 +1,305 @@
<template>
<div>
<el-drawer v-model="isShowDrawer" title="检测记录明细" direction="rtl" size="80%" v-loading="detailLoading">
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="RecordsDetails.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="RecordsDetails.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
ref="tableid"
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:selection="true"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
</el-drawer>
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'RecordDetails' })
import download from '@/utils/download'
import { RecordsDetails,RecordsDetailsRules } from '@/views/detection/recordsDetails/recordsDetails.data'
import * as RecordDetailsApi from '@/api/detection/recordsDetails/index'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ContentAPI from '@/api/spc/templateItemDetails'
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const isShowDrawer = ref(false)
const decRecId = ref("")
// routeName.value = route.name
// routeName.value = routeName.value.substring(0,routeName.value.length - 4) + 'Detail'
const props = defineProps({
//
tabs: {
type: Object,
required: true,
default: null
},
//
isBasic: {
type: Boolean,
required: false,
default: false
},
//
allSchemas: {
type: Object,
required: true,
default: null
},
//
Echo: {
type: Array,
required: false,
default: null
},
})
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
if(row){
isShowDrawer.value = true
decRecId.value = row.id;
ContentAPI.acceptParam({templateId:row.id});
let param = {
decRecId:decRecId.value
}
setSearchParams(param);
}
}
defineExpose({ openDetail }) // open
const formsSuccess = async (formType,data) => {
data.templateId = decRecId.value;
if(data.type=='NUMBER'&& data.upLimit<data.downLimit){
message.error('数值型上限值要大于下限')
return;
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await RecordDetailsApi.createRecordsDetails(data)
message.success(t('common.createSuccess'))
} else {
await RecordDetailsApi.updateRecordsDetails(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const masterParmas=ref({
masterId:'',//id
number: '',//
status: '',//
})
routeName.value = route.name
const tableColumns = ref(RecordsDetails.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
const { tableObject, tableMethods } = useTable({
getListApi: RecordDetailsApi.getRecordsDetailsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
//defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:templateItemDetails:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:templateItemDetails:export'}), //
defaultButtons.defaultBatchDeletionBtn(null), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
const tableid=ref();
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else if(val == 'batch'){//
let params = [];
let ids = tableid.value.selections;
if(ids.length > 0){
for(let i = 0; i < ids.length; i++){
params[i] = ids[i].id;
}
console.info(params);
handleBatchDelete(params);
}
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
//defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/*批量删除操作*/
const handleBatchDelete = async (ids:any) => {
try {
//
await message.delConfirm()
//
await RecordDetailsApi.batchDeleteRecordDetails(ids)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RecordDetailsApi.deleteRecordsDetails(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await RecordDetailsApi.exportRecordsDetails(setSearchParams)
download.excel(data, '检测记录明细.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '检测记录明细导入模版.xls'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
// importTemplateData.templateUrl = await TemplateItemDetailsApi.importTemplate()
})
</script>

12
src/utils/disposition/defaultButtons.ts

@ -4,6 +4,18 @@
* @param {*} option * @param {*} option
* @returns * @returns
*/ */
//批量删除
export function defaultBatchDeletionBtn(option:any) {
return __defaultBtnOption(option,{
label: '批量删除',
name: 'batch',
hide: false,
type: 'warning',
icon: 'ep:upload',
color: '',
hasPermi: ''
})
}
// 新增按钮 // 新增按钮
export function defaultAddBtn(option:any) { export function defaultAddBtn(option:any) {

58
src/views/detection/records/index.vue

@ -1,8 +1,8 @@
<template> <template>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<!-- <ContentWrap> <ContentWrap>
<Search :schema="Records.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="Records.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> --> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
@ -17,8 +17,10 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table
ref="tableid"
:columns="tableColumns" :columns="tableColumns"
:data="tableObject.tableList" :data="tableObject.tableList"
:selection="true"
:loading="tableObject.loading" :loading="tableObject.loading"
:pagination="{ :pagination="{
total: tableObject.total total: tableObject.total
@ -27,9 +29,9 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #code="{row}"> <template #templateId="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '检测记录明细', row.code)">
<span>{{ row.code }}</span> <span>{{ row.templateId }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
@ -51,6 +53,15 @@
:isBusiness="false" :isBusiness="false"
/> />
<!-- 详情 -->
<record-details
ref="detailRef"
:isBasic="false"
:allSchemas="Records.allSchemas"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 --> <!-- 导入 -->
<DetecImportForm ref="importFormRef" url="/detection/records/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <DetecImportForm ref="importFormRef" url="/detection/records/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -61,6 +72,7 @@ import download from '@/utils/download'
import { Records,RecordsRules } from './records.data' import { Records,RecordsRules } from './records.data'
import * as RecordsApi from '@/api/detection/records' import * as RecordsApi from '@/api/detection/records'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { any } from 'vue-types'
defineOptions({ name: 'DetectionRecords' }) defineOptions({ name: 'DetectionRecords' })
@ -98,7 +110,8 @@ const { getList, setSearchParams } = tableMethods
const HeadButttondata = [ const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), // // defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), // defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:records:export'}), // defaultButtons.defaultBatchDeletionBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), // // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -111,7 +124,7 @@ const HeadButttondata = [
// color: '' // color: ''
// }, // },
] ]
const tableid=ref();
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') { //
@ -123,19 +136,32 @@ const buttonBaseClick = (val, item) => {
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') { //
} else { // } else if(val == 'batch'){//
let params = [];
let ids = tableid.value.selections;
if(ids.length > 0){
for(let i = 0; i < ids.length; i++){
params[i] = ids[i].id;
}
console.info(params);
handleBatchDelete(params);
}
}else { //
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn(null), // //defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), // defaultButtons.mainListDeleteBtn(null), //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
console.log("row",row)
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
@ -161,7 +187,7 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicRecords') detailRef.value.openDetail(row, titleName, titleValue)
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -176,6 +202,18 @@ const handleDelete = async (id: number) => {
await getList() await getList()
} catch {} } catch {}
} }
/*批量删除操作*/
const handleBatchDelete = async (ids:any) => {
try {
//
await message.delConfirm()
//
await RecordsApi.batchDeleteRecords(ids)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //

74
src/views/detection/records/records.data.ts

@ -1,29 +1,87 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { stubFalse } from 'lodash-es' import { stubFalse } from 'lodash-es'
import * as itembasicApi from '@/api/spc/itembasic/index'
import * as ProjectApi from '@/api/spc/project/index'
const itembasicList = await itembasicApi.getList({});
const projectList = await ProjectApi.getList({});
// 表单校验 // 表单校验
export const RecordsRules = reactive({ export const RecordsRules = reactive({
result: [required], result: [required],
}) })
export const Records = useCrudSchemas(reactive<CrudSchema[]>([ export const Records = useCrudSchemas(reactive<CrudSchema[]>([
// {
// label: 'id',
// field: 'id',
// sort: 'custom',
// isForm: false,
// },
{ {
label: '模版id', label: '模版id',
field: 'templateId', field: 'templateId',
sort: 'custom',
isSearch: false, isSearch: false,
form: { form: {
component: 'InputNumber', component: 'InputNumber',
value: 0 value: 0
}, },
}, },
{
label: '项目编码',
field: 'projectCode',
isSearch: true,
search: {
show: true,
component: 'Select',
api: () => projectList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'name',
valueField: 'code'
}
}
},
},
{
label: '物料编码',
field: 'itemCode',
isSearch: true,
search: {
show: true,
component: 'Select',
api: () => itembasicList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'name',
valueField: 'code'
}
}
},
},
{
label: '物料类型',
field: 'itemType',
dictType: DICT_TYPE.ITEMBASIC_TYPE,
dictClass: 'string',
isTable: true,
isSearch:true,
search:{
componentProps: {
filterable:true
// inactiveValue: 'DISABLE',
// activeValue: 'ENABLE',
}
},
// table: {
// width: 100
// } ,
form: {
component: 'Select',
componentProps: {
filterable:true
// inactiveValue: 'DISABLE',
// activeValue: 'ENABLE',
}
},
},
{ {
label: '检测结果', label: '检测结果',
field: 'result', field: 'result',

231
src/views/detection/recordsDetails/index.vue

@ -0,0 +1,231 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="RecordsDetails.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="RecordsDetails.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
:rules="RecordsDetailsRules"
:formAllSchemas="RecordsDetails.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="RecordsDetailsApi.updateRecordsDetails"
:apiCreate="RecordsDetailsApi.createRecordsDetails"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="RecordsDetails.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/detection/records-details/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { RecordsDetails,RecordsDetailsRules } from './recordsDetails.data'
import * as RecordsDetailsApi from '@/api/detection/recordsDetails'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'RecordsDetails' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(RecordsDetails.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
const { tableObject, tableMethods } = useTable({
getListApi: RecordsDetailsApi.getRecordsDetailsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:recordsDetails:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:recordsDetails:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:recordsDetails:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:recordsDetails:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:recordsDetails:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicRecordsDetails')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await RecordsDetailsApi.deleteRecordsDetails(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await RecordsDetailsApi.exportRecordsDetails(setSearchParams)
download.excel(data, '检测记录详细.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '检测记录详细导入模版.xls'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await RecordsDetailsApi.importTemplate()
})
</script>

130
src/views/detection/recordsDetails/recordsDetails.data.ts

@ -0,0 +1,130 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ContentAPI from '@/api/spc/templateItemDetails'
// 表单校验
export const RecordsDetailsRules = reactive({
result: [required]
})
// 表单校验
const getlsit = await ContentAPI.getTemplateItemDetailsList({
});
export const RecordsDetails = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isSearch: false,
isTable:false,
},
{
label: '检测项主键',
field: 'templateItemId',
sort: 'custom',
isSearch: false,
isTable:false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '模版id',
field: 'templateId',
sort: 'custom',
isSearch: false,
isTable:false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '检测内容',
field: 'contents',
isSearch: true,
isTable:true,
search: {
show: true,
component: 'Select',
api: () => getlsit(),
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'contents',
valueField: 'contents'
}
}
},
},
{
label: '检测方法',
field: 'methods',
isSearch: false,
isTable:true,
},
{
label: '检测值',
field: 'detectValue',
isSearch: false,
isTable:true,
},
{
label: '检测结果',
field: 'result',
isSearch: false,
isTable:true,
},
{
label: '保存状态0保存1草稿',
field: 'saveStatus',
sort: 'custom',
isSearch: false,
isTable:false,
form: {
component: 'Radio'
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable:false,
},
{
label: '版本号',
field: 'version',
sort: 'custom',
isSearch: false,
isTable:false,
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
isTable:true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

34
src/views/spc/detectiontemplate/detectionTemplate.data.ts

@ -3,6 +3,10 @@ import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/spc/itembasic/index' import * as ItembasicApi from '@/api/spc/itembasic/index'
import {Itembasic} from '@/views/spc/itembasic/itembasic.data' import {Itembasic} from '@/views/spc/itembasic/itembasic.data'
import { checkboxProps } from 'element-plus' import { checkboxProps } from 'element-plus'
import * as itembasicApi from '@/api/spc/itembasic/index'
import * as ProjectApi from '@/api/spc/project/index'
const itembasicList = await itembasicApi.getList({});
const projectList = await ProjectApi.getList({});
// 表单校验 // 表单校验
// export const DetectionTemplateRules = reactive({ // export const DetectionTemplateRules = reactive({
@ -13,7 +17,6 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '物料编码', label: '物料编码',
field: 'itemCode',//传第给后端字段名称 field: 'itemCode',//传第给后端字段名称
sort: 'custom',
table: { table: {
width: 150, width: 150,
fixed: 'left' fixed: 'left'
@ -30,13 +33,24 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法 searchPage: ItembasicApi.getItembasicPage // 查询弹窗所需分页方法
} }
} },
search: {
show: true,
component: 'Select',
api: () => itembasicList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'code',
valueField: 'code'
}
}
},
}, },
{ {
label: '物料名称', label: '物料名称',
field: 'itemName', field: 'itemName',
sort: 'custom',
isSearch: false, isSearch: false,
isTable:true, isTable:true,
form: { form: {
@ -50,7 +64,6 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '项目名称', label: '项目名称',
field: 'projectName', field: 'projectName',
sort: 'custom',
form: { form: {
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
@ -62,7 +75,6 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '模版名称', label: '模版名称',
field: 'name', field: 'name',
sort: 'custom',
}, },
{ {
label: '色差行数', label: '色差行数',
@ -80,14 +92,12 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',
sort: 'custom',
isSearch: false, isSearch: false,
isTable:false, isTable:false,
}, },
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',
sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
isSearch: false, isSearch: false,
search: { search: {
@ -135,13 +145,21 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '物料类型', label: '物料类型',
field: 'itemType', field: 'itemType',
sort: 'custom',
dictType: DICT_TYPE.ITEMBASIC_TYPE, dictType: DICT_TYPE.ITEMBASIC_TYPE,
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: true,
isSearch:true,
// table: { // table: {
// width: 100 // width: 100
// } , // } ,
search:{
componentProps: {
// inactiveValue: 'DISABLE',
// activeValue: 'ENABLE',
filterable:true
}
},
form: { form: {
component: 'Select', component: 'Select',
componentProps: { componentProps: {

15
src/views/spc/itembasic/itembasic.data.ts

@ -2,6 +2,9 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import {Project } from '@/views/spc/project/project.data' import {Project } from '@/views/spc/project/project.data'
import * as ProjectApi from '@/api/spc/project/index' import * as ProjectApi from '@/api/spc/project/index'
import * as itembasicApi from '@/api/spc/itembasic/index'
const itembasicList = await itembasicApi.getList({});
const projectList = await ProjectApi.getList({});
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
/** /**
@ -52,6 +55,18 @@ export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
width: 'auto', width: 'auto',
}, },
search: {
show: true,
component: 'Select',
api: () => itembasicList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'code',
valueField: 'code'
}
}
},
}, },
{ {
label: '物料名称', label: '物料名称',

16
src/views/spc/project/project.data.ts

@ -1,5 +1,7 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as ProjectApi from '@/api/spc/project/index'
const projectList = await ProjectApi.getList({});
// 表单校验 // 表单校验
export const ProjectRules = reactive({ export const ProjectRules = reactive({
@ -11,7 +13,19 @@ export const Project = useCrudSchemas(reactive<CrudSchema[]>([
label: '项目编号', label: '项目编号',
field: 'code', field: 'code',
sort: 'custom', sort: 'custom',
isSearch: true isSearch: true,
search: {
show: true,
component: 'Select',
api: () => projectList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'code',
valueField: 'code'
}
}
}
}, },
{ {
label: '项目名称', label: '项目名称',

Loading…
Cancel
Save