Browse Source

添加不合格品信息管理模块

master
songguoqiang 11 months ago
parent
commit
28703d5e9e
  1. 4
      src/api/detection/records/index.ts
  2. 35
      src/api/detection/unqualified/index.ts
  3. 3
      src/components/ImportForm/src/DetecImportForm.vue
  4. 4
      src/views/board/Index.vue
  5. 4
      src/views/board/Index1.vue
  6. 1
      src/views/detection/records/records.data.ts
  7. 203
      src/views/detection/unqualified/index.vue
  8. 148
      src/views/detection/unqualified/unqualified.data.ts
  9. 25
      src/views/spc/itembasic/itembasic.data.ts

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

@ -61,8 +61,8 @@ export const importTemplate = (itemType:string) => {
}
// 提交导入记录
export const saveRecords = async (id: number) => {
return await request.get({ url: `/detection/records/saveRecords?id=` + id })
export const saveRecords = async (id: number,itemType:string) => {
return await request.get({ url: `/detection/records/saveRecords?id=` + id +'&itemType='+itemType})
}
//每次导入前会传模版id后端会根据模版id和用户id把草稿状态的数据逻辑删除

35
src/api/detection/unqualified/index.ts

@ -0,0 +1,35 @@
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
itemCode?:string
ProjectCode?:string
itemType?:string
}
// 查询不合格品检测记录列表
export const getRecordsDetailsPage = async (params) => {
return await request.get({ url: `/detection/recordsdetails/selectUnqualifiedPage`, params })
}
// 删除检测记录详细
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})
}

3
src/components/ImportForm/src/DetecImportForm.vue

@ -411,6 +411,7 @@ const submitFormSuccess = (response: any) => {
decRecId:decRecId,
saveStatus:1,
result:"NG",
itemType:queryParams.detectionType
});
uploadOpen.value = false;
}
@ -422,7 +423,7 @@ const submitFormError = (): void => {
//
const saveSubmit = async () => {
await RecordsApi.saveRecords(decRecId.value);
await RecordsApi.saveRecords(decRecId.value,queryParams.detectionType);
dialogVisible.value =false
emits('success')

4
src/views/board/Index.vue

@ -8,7 +8,7 @@
<div class="time">{{date}}</div>
<div class="pl-2vw pr-2vw">
<el-row :gutter="14" justify="space-between">
<el-col :xl="10" :lg="10" :md="10" :sm="10" :xs="10">
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="12">
<div class="left">
<div class="table">
<ul class="table-header">
@ -81,7 +81,7 @@
</div>
</div>
</el-col>
<el-col :xl="14" :lg="14" :md="14" :sm="14" :xs="14">
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="12">
<div class="right">
<div class="samll-title">合格数据</div>
<div class="mt-10px qualified-list" style="height:calc(50% - 44px);">

4
src/views/board/Index1.vue

@ -8,7 +8,7 @@
<div class="time">{{date}}</div>
<div class="pl-2vw pr-2vw">
<el-row :gutter="14" justify="space-between">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="12">
<div class="left">
<div class="table">
<ul class="table-header">
@ -81,7 +81,7 @@
</div>
</div>
</el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="12">
<div class="right">
<div class="samll-title">合格数据</div>
<div class="mt-10px qualified-list" style="height:calc(50% - 44px);">

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

@ -112,7 +112,6 @@ export const Records = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {

203
src/views/detection/unqualified/index.vue

@ -0,0 +1,203 @@
<template>
<!-- 搜索工作栏 -->
<ContentWrap>
<Search :schema="Unqualified.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Unqualified.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
ref="tableid"
:columns="tableColumns"
:data="tableObject.tableList"
:selection="true"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<!-- <template #templateId="{row}">
<el-button type="primary" link @click="openDetail(row, '检测记录明细', row.code)">
<span>{{ row.templateId }}</span>
</el-button>
</template> -->
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
</template>
<script setup lang="ts">
import {Unqualified } from './unqualified.data'
import * as UnqualifiedApi from '@/api/detection/unqualified'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { any } from 'vue-types'
import dayjs from 'dayjs'
defineOptions({ name: 'DetectionRecords' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Unqualified.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: UnqualifiedApi.getRecordsDetailsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
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) => {
console.log("row",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 handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await UnqualifiedApi.deleteRecordsDetails(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/*批量删除操作*/
const handleBatchDelete = async (ids:any) => {
try {
//
await message.delConfirm()
//
await UnqualifiedApi.batchDeleteRecordDetails(ids)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList();
//importTemplateData.templateUrl = await RecordsApi.importTemplate()
})
</script>

148
src/views/detection/unqualified/unqualified.data.ts

@ -0,0 +1,148 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
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 Unqualified = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '模版id',
field: 'templateId',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '项目编码',
field: 'projectCode',
isSearch: true,
search: {
show: true,
component: 'Select',
api: () => projectList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'code',
valueField: 'code'
}
}
},
},
{
label: '物料编号',
field: 'itemCode',
isSearch: true,
search: {
show: true,
component: 'Select',
api: () => itembasicList,
componentProps: {
filterable:true,
optionsAlias: {
labelField: 'code',
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: '检测内容',
field: 'contents',
isSearch: true,
isTable:true,
},
{
label: '检测值',
field: 'detectValue',
isSearch: false,
isTable:true,
},
{
label: '检测结果',
field: 'result',
isSearch: false,
isTable:true,
},
{
label: '上限',
field: 'upLimit',
isSearch: false,
isTable:false,
},
{
label: '下限',
field: 'downLimit',
isSearch: false,
isTable:false,
},
{
label: '行号',
field: 'recodeLines',
isSearch: false,
isTable:true,
},
{
label: '列号',
field: 'recodeColumns',
isSearch: false,
isTable:true,
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
isSearch: 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'
}
}
]))

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

@ -74,25 +74,12 @@ export const Itembasic = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
isTable:true,
},
// {
// label: '颜色',
// field: 'color',
// sort: 'custom',
// dictType: DICT_TYPE.ITEM_COLOR,
// dictClass: 'string',
// isTable: true,
// table: {
// width: 100
// } ,
// // form: {
// // component: 'Select',
// // componentProps: {
// // // inactiveValue: 'DISABLE',
// // // activeValue: 'ENABLE',
// // }
// // },
// },
{
label: '色差模版代码',
field: 'detectionField',
isTable: true,
isSearch: false,
},
{
label: '创建时间',

Loading…
Cancel
Save