Browse Source

检测项模块

master
songguoqiang 1 year ago
parent
commit
6b808db0a8
  1. 1
      src/api/spc/detectionTemplate/index.ts
  2. 67
      src/api/spc/detectionTemplate/indexdetails.ts
  3. 328
      src/components/Detail/src/TemplateDetails.vue
  4. 2
      src/utils/dict.ts
  5. 22
      src/views/spc/detectiontemplate/detectionTemplate.data.ts
  6. 69
      src/views/spc/detectiontemplate/index.vue
  7. 210
      src/views/spc/detectiontemplate/templateItemDetails.data.ts

1
src/api/spc/detectionTemplate/index.ts

@ -13,6 +13,7 @@ export interface DetectionTemplateVO {
concurrencyStamp: string
siteId: string
itemType: string
lineNumber: string
}
// 查询检测记录信息列表

67
src/api/spc/detectionTemplate/indexdetails.ts

@ -0,0 +1,67 @@
import request from '@/config/axios'
export interface TemplateItemDetailsVO {
templateId: number
orderNo: number
methods: string
contents: string
levels: string
upLimit: number
available: string
downLimit: number
type: string
image1: string
image2: string
image3: string
remark: string
deletionTime: Date
deleterId: string
extraProperties: string
concurrencyStamp: string
siteId: string
}
// 查询检测记录明细列表
export const getTemplateItemDetailsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/spc/template-item-details/senior', data })
} else {
return await request.get({ url: `/spc/template-item-details/page`, params })
}
}
// 查询检测记录明细详情
export const getTemplateItemDetails = async (id: number) => {
return await request.get({ url: `/spc/template-item-details/get?id=` + id })
}
// 新增检测记录明细
export const createTemplateItemDetails = async (data: TemplateItemDetailsVO) => {
return await request.post({ url: `/spc/template-item-details/create`, data })
}
// 修改检测记录明细
export const updateTemplateItemDetails = async (data: TemplateItemDetailsVO) => {
return await request.put({ url: `/spc/template-item-details/update`, data })
}
// 删除检测记录明细
export const deleteTemplateItemDetails = async (id: number) => {
return await request.delete({ url: `/spc/template-item-details/delete?id=` + id })
}
// 导出检测记录明细 Excel
export const exportTemplateItemDetails = async (params) => {
return await request.download({ url: `/spc/template-item-details/export-excel`, params })
}
// 下载导入模板
export const importTemplate = () => {
return request.download({ url: '/spc/template-item-details/get-import-template' })
}
export const selectDetectionItems = async (itemCode: String , detectionType: String) => {
return await request.get({ url: `/spc/template-item-details/selectDetectionItems?itemCode=` + itemCode + `&detectionType=` + detectionType })
}

328
src/components/Detail/src/TemplateDetails.vue

@ -0,0 +1,328 @@
<template>
<div>
<el-drawer v-model="isShowDrawer" title="模版检测项" direction="rtl" size="80%" v-loading="detailLoading">
<!-- <template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template> -->
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="TemplateItemDetails.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="TemplateItemDetails.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>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="TemplateItemDetailsRules"
:formAllSchemas="TemplateItemDetails.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="TemplateItemDetailsApi.updateTemplateItemDetails"
:apiCreate="TemplateItemDetailsApi.createTemplateItemDetails"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'TemplateDetailsDetail' })
import download from '@/utils/download'
import { TemplateItemDetails,TemplateItemDetailsRules } from '@/views/spc/detectiontemplate/templateItemDetails.data'
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
const isShowDrawer = ref(false)
const templateId = 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
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemasRules: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: false,
default: null
},
// API
apiUpdate: {
type: Function,
required: false,
default: null
},
// API
apiPage: {
type: Function,
required: false,
default: null
},
// API
apiDelete: {
type: Function,
required: false,
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
templateId.value = row.id;
let param = {
templateId:templateId.value
}
setSearchParams(param);
}
}
defineExpose({ openDetail }) // open
const formsSuccess = async (formType,data) => {
data.templateId = templateId.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 TemplateItemDetailsApi.createTemplateItemDetails(data)
message.success(t('common.createSuccess'))
} else {
await TemplateItemDetailsApi.updateTemplateItemDetails(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(TemplateItemDetails.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: TemplateItemDetailsApi.getTemplateItemDetailsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:templateItemDetails:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:templateItemDetails: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(null), //
defaultButtons.mainListDeleteBtn(null), //
]
// -
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 handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await TemplateItemDetailsApi.deleteTemplateItemDetails(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 TemplateItemDetailsApi.exportTemplateItemDetails(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>

2
src/utils/dict.ts

@ -193,6 +193,8 @@ export enum DICT_TYPE {
ITEM_CATEGORY = 'Item_category', // 物品种类
ITEM_COLOR = 'item_color', // 物品颜色
ITEMBASIC_TYPE= 'itembasic_type', // 物料检测类型
ITEMBASIC_RANK= 'template_detec_rank',//检测项级别
DETECT_TYPE='detect_type',//检测项类型
ITEM_CONFIGURATION = 'item_configuration', // 物品配置
EQ_LEVEL = 'eq_level', // 质量等级
CURRENCY = 'currency', // 货币

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

@ -2,11 +2,12 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/spc/itembasic/index'
import {Itembasic} from '@/views/spc/itembasic/itembasic.data'
import { checkboxProps } from 'element-plus'
// 表单校验
export const DetectionTemplateRules = reactive({
itemCode: [required]
})
// export const DetectionTemplateRules = reactive({
// itemCode: [required]
// })
export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
{
@ -36,7 +37,7 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: true,
isSearch: false,
isTable:true,
form: {
// labelMessage: '信息提示说明!!!',
@ -63,6 +64,19 @@ export const DetectionTemplate = useCrudSchemas(reactive<CrudSchema[]>([
field: 'name',
sort: 'custom',
},
{
label: '色差行数',
field: 'lineNumber',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component: 'InputNumber',
componentProps: {
min: 1,
}
}
},
{
label: '备注',
field: 'remark',

69
src/views/spc/detectiontemplate/index.vue

@ -4,7 +4,7 @@
<Search :schema="DetectionTemplate.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<!-- 列表头部 allschemas管理列表标题-->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
@ -28,7 +28,7 @@
v-model:sort="tableObject.sort"
>
<template #itemCode="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<el-button type="primary" link @click="openDetail(row, '模版项管理', row.code)">
<span>{{ row.itemCode }}</span>
</el-button>
</template>
@ -51,21 +51,30 @@
:isBusiness="false"
/>
<!-- 详情 -->
<template-details
ref="detailRef"
:isBasic="false"
:allSchemas="DetectionTemplate.allSchemas"
:detailAllSchemas="TemplateItemDetails.allSchemas"
:detailAllSchemasRules="TemplateItemDetailsRules"
:apiCreate="TemplateItemDetailsApi.createTemplateItemDetails"
:apiUpdate="TemplateItemDetailsApi.updateTemplateItemDetails"
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage"
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="DetectionTemplate.allSchemas" /> -->
<!-- 导入 -->
<!-- <ImportForm ref="importFormRef" url="/spc/detection-template/import" :importTemplateData="importTemplateData" @success="importSuccess" /> -->
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DetectionTemplate,DetectionTemplateRules,rules } from './detectionTemplate.data'
import { DetectionTemplate,rules } from './detectionTemplate.data'
import { TemplateItemDetails,TemplateItemDetailsRules} from './templateItemDetails.data'
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails'
import * as DetectionTemplateApi from '@/api/spc/detectionTemplate'
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'
const router = useRouter() //
defineOptions({ name: 'DetectionTemplate' })
@ -187,6 +196,38 @@ const searchTableSuccess = (formField, searchField, val, formRef,type,row) => {
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef,type,row) => {
// nextTick(() => {
// const setV = {}
// setV[formField] = val[0][searchField]
// formRef.setValues(setV)
// })
nextTick(() => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['poLine'] = val[0]['poLine']
row['batch'] = val[0]['toBatch']
row['altBatch'] = val[0]['altBatch']
row['itemCode'] = val[0]['itemCode']
row['itemName'] = val[0]['itemName']
row['itemDesc1'] = val[0]['itemDesc1']
row['itemDesc2'] = val[0]['itemDesc2']
row['projectCode'] = val[0]['projectCode']
row['qty'] = val[0]['qty']
row['uom'] = val[0]['uom']
} else {
//
const setV = {}
setV[formField] = val[0][searchField]
setV['itemName'] = val[0]['name']
setV['projectName'] = val[0]['projectName']
formRef.setValues(setV)
}
})
}
const formsSuccess = async (formType,data) => {
var isHave =DetectionTemplate.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
@ -211,8 +252,12 @@ const formsSuccess = async (formType,data) => {
}
/** 详情操作 */
const openDetail = () => {
router.push({ path: '/spc/templateitemdetails' })
// const openDetail = () => {
// //router.push({ path: '/spc/templateitemdetails' })
// }
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue)
}
/** 删除按钮操作 */

210
src/views/spc/detectiontemplate/templateItemDetails.data.ts

@ -0,0 +1,210 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
export const TemplateItemDetails = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '模版id',
field: 'templateId',
sort: 'custom',
isSearch: false,
isForm:false,
isTable:false,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '序号',
field: 'orderNo',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value:0
}
},
{
label: '检测工具/方法',
field: 'methods',
sort: 'custom',
isSearch: false
},
{
label: '检测内容',
field: 'contents',
sort: 'custom',
isSearch: true
},
{
label: '数据类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.DETECT_TYPE,
isSearch: false,
form: {
component: 'Select',
componentProps: {
// inactiveValue: 'DISABLE',
// activeValue: 'ENABLE',
}
},
},
{
label: '级别',
field: 'ranks',
sort: 'custom',
dictType: DICT_TYPE.ITEMBASIC_RANK,
isSearch: false,
form: {
component: 'Select',
componentProps: {
// inactiveValue: 'DISABLE',
// activeValue: 'ENABLE',
}
},
},
{
label: '上限',
field: 'upLimit',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
componentProps: {
min: 0.00,
precision: 2
}
}
},
{
label: '下限',
field: 'downLimit',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
componentProps: {
min: 0.00,
precision: 2
}
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable:false
},
{
label: '工程图',
field: 'image1',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component:'UploadImg',
}
},
{
label: '工具图',
field: 'image2',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component:'UploadImg',
componentProps:{
upData:{
tabelId:1,tableName:"detection"
}
}
}
},
{
label: '操作指导书',
field: 'image3',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component:'UploadImg',
}
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
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: 'deletionTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable:false,
isForm:false,
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '删除者ID',
field: 'deleterId',
sort: 'custom',
isSearch: false,
isTable:false,
isForm:false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
// 表单校验
export const TemplateItemDetailsRules = reactive({
orderNo: [
{ required: true, message: '请输入序号', trigger: 'blur' }
],
contents: [
{ required: true, message: '请输入检测内容', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择物料类型', trigger: 'change' }
],
})
Loading…
Cancel
Save