Browse Source

生成代码

master_hella_20240701
zhaoyiran 8 months ago
parent
commit
57213081e0
  1. 103
      src/api/qms/aql/index.ts
  2. 53
      src/api/qms/inspectionMethod/index.ts
  3. 57
      src/api/qms/sampleCode/index.ts
  4. 50
      src/api/qms/samplingScheme/index.ts
  5. 332
      src/views/qms/aql/aql.data.ts
  6. 244
      src/views/qms/aql/index.vue
  7. 244
      src/views/qms/inspectionMethod/index.vue
  8. 75
      src/views/qms/inspectionMethod/inspectionMethod.data.ts
  9. 244
      src/views/qms/sampleCode/index.vue
  10. 101
      src/views/qms/sampleCode/sampleCode.data.ts
  11. 3
      src/views/qms/samplingProcess/index.vue
  12. 244
      src/views/qms/samplingScheme/index.vue
  13. 61
      src/views/qms/samplingScheme/samplingScheme.data.ts

103
src/api/qms/aql/index.ts

@ -0,0 +1,103 @@
import request from '@/config/axios'
export interface AqlVO {
id: number
sampleProgCode: string
inspectionQualification: string
sampleCharacterCode: string
sampleSize: number
a0010: number
r0010: number
a0015: number
r0015: number
a0025: number
r0025: number
a0040: number
r0040: number
a0065: number
r0065: number
a010: number
r010: number
a015: number
r015: number
a025: number
r025: number
a040: number
r040: number
a065: number
r065: number
a10: number
r10: number
a15: number
r15: number
a25: number
r25: number
a40: number
r40: number
a65: number
r65: number
a10: number
r10: number
a15: number
r15: number
a25: number
r25: number
a40: number
r40: number
a65: number
r65: number
a100: number
r100: number
a150: number
r150: number
a250: number
r250: number
a400: number
r400: number
a650: number
r650: number
a1000: number
r1000: number
available: string
}
// 查询aql列表
export const getAqlPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/aql/senior', data })
} else {
return await request.get({ url: `/qms/aql/page`, params })
}
}
// 查询aql详情
export const getAql = async (id: number) => {
return await request.get({ url: `/qms/aql/get?id=` + id })
}
// 新增aql
export const createAql = async (data: AqlVO) => {
return await request.post({ url: `/qms/aql/create`, data })
}
// 修改aql
export const updateAql = async (data: AqlVO) => {
return await request.put({ url: `/qms/aql/update`, data })
}
// 删除aql
export const deleteAql = async (id: number) => {
return await request.delete({ url: `/qms/aql/delete?id=` + id })
}
// 导出aql Excel
export const exportAql = async (params) => {
return await request.download({ url: `/qms/aql/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/aql/get-import-template' })
}

53
src/api/qms/inspectionMethod/index.ts

@ -0,0 +1,53 @@
import request from '@/config/axios'
export interface InspectionMethodVO {
id: number
code: string
describe: string
version: string
status: string
operationGuidance: string
videoAddress: string
available: string
}
// 查询检验方法列表
export const getInspectionMethodPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/inspection-method/senior', data })
} else {
return await request.get({ url: `/qms/inspection-method/page`, params })
}
}
// 查询检验方法详情
export const getInspectionMethod = async (id: number) => {
return await request.get({ url: `/qms/inspection-method/get?id=` + id })
}
// 新增检验方法
export const createInspectionMethod = async (data: InspectionMethodVO) => {
return await request.post({ url: `/qms/inspection-method/create`, data })
}
// 修改检验方法
export const updateInspectionMethod = async (data: InspectionMethodVO) => {
return await request.put({ url: `/qms/inspection-method/update`, data })
}
// 删除检验方法
export const deleteInspectionMethod = async (id: number) => {
return await request.delete({ url: `/qms/inspection-method/delete?id=` + id })
}
// 导出检验方法 Excel
export const exportInspectionMethod = async (params) => {
return await request.download({ url: `/qms/inspection-method/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/inspection-method/get-import-template' })
}

57
src/api/qms/sampleCode/index.ts

@ -0,0 +1,57 @@
import request from '@/config/axios'
export interface SampleCodeVO {
id: number
code: string
batchLow limiting: number
batchUpperLimiting: number
s1: number
s2: number
s3: number
s4: number
g1: number
g2: number
g3: number
available: string
}
// 查询样本字码列表
export const getSampleCodePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/sample-code/senior', data })
} else {
return await request.get({ url: `/qms/sample-code/page`, params })
}
}
// 查询样本字码详情
export const getSampleCode = async (id: number) => {
return await request.get({ url: `/qms/sample-code/get?id=` + id })
}
// 新增样本字码
export const createSampleCode = async (data: SampleCodeVO) => {
return await request.post({ url: `/qms/sample-code/create`, data })
}
// 修改样本字码
export const updateSampleCode = async (data: SampleCodeVO) => {
return await request.put({ url: `/qms/sample-code/update`, data })
}
// 删除样本字码
export const deleteSampleCode = async (id: number) => {
return await request.delete({ url: `/qms/sample-code/delete?id=` + id })
}
// 导出样本字码 Excel
export const exportSampleCode = async (params) => {
return await request.download({ url: `/qms/sample-code/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/sample-code/get-import-template' })
}

50
src/api/qms/samplingScheme/index.ts

@ -0,0 +1,50 @@
import request from '@/config/axios'
export interface SamplingSchemeVO {
id: number
code: string
describe: string
status: string
available: string
}
// 查询采样方案列表
export const getSamplingSchemePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/sampling-scheme/senior', data })
} else {
return await request.get({ url: `/qms/sampling-scheme/page`, params })
}
}
// 查询采样方案详情
export const getSamplingScheme = async (id: number) => {
return await request.get({ url: `/qms/sampling-scheme/get?id=` + id })
}
// 新增采样方案
export const createSamplingScheme = async (data: SamplingSchemeVO) => {
return await request.post({ url: `/basic/sampling-scheme/create`, data })
}
// 修改采样方案
export const updateSamplingScheme = async (data: SamplingSchemeVO) => {
return await request.put({ url: `/basic/sampling-scheme/update`, data })
}
// 删除采样方案
export const deleteSamplingScheme = async (id: number) => {
return await request.delete({ url: `/basic/sampling-scheme/delete?id=` + id })
}
// 导出采样方案 Excel
export const exportSamplingScheme = async (params) => {
return await request.download({ url: `/basic/sampling-scheme/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/basic/sampling-scheme/get-import-template' })
}

332
src/views/qms/aql/aql.data.ts

@ -0,0 +1,332 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const AqlRules = reactive({
sampleProgCode: [required],
inspectionQualification: [required],
sampleCharacterCode: [required],
sampleSize: [required],
available: [required],
})
export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isForm: false,
},
{
label: '编码',
field: 'sampleProgCode',
sort: 'custom',
isSearch: true,
},
{
label: '检验严格性',
field: 'inspectionQualification',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_SEVERITY,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '样本字码',
field: 'sampleCharacterCode',
sort: 'custom',
isSearch: true,
},
{
label: '样本量',
field: 'sampleSize',
sort: 'custom',
},
{
label: 'A0_010',
field: 'a0010',
sort: 'custom',
},
{
label: 'R0_010',
field: 'r0010',
sort: 'custom',
},
{
label: 'A0_015',
field: 'a0015',
sort: 'custom',
},
{
label: 'R0_015',
field: 'r0015',
sort: 'custom',
},
{
label: 'A0_025',
field: 'a0025',
sort: 'custom',
isSearch: true,
},
{
label: 'R0_025',
field: 'r0025',
sort: 'custom',
},
{
label: 'A0_040',
field: 'a0040',
sort: 'custom',
},
{
label: 'R0_040',
field: 'r0040',
sort: 'custom',
},
{
label: 'A0_065',
field: 'a0065',
sort: 'custom',
isSearch: true,
},
{
label: 'R0_065',
field: 'r0065',
sort: 'custom',
},
{
label: 'A0_10',
field: 'a010',
sort: 'custom',
},
{
label: 'R0_10',
field: 'r010',
sort: 'custom',
},
{
label: 'A0_15',
field: 'a015',
sort: 'custom',
},
{
label: 'R0_15',
field: 'r015',
sort: 'custom',
},
{
label: 'A0_25',
field: 'a025',
sort: 'custom',
},
{
label: 'R0_25',
field: 'r025',
sort: 'custom',
},
{
label: 'A0_40',
field: 'a040',
sort: 'custom',
},
{
label: 'R0_40',
field: 'r040',
sort: 'custom',
},
{
label: 'A0_65',
field: 'a065',
sort: 'custom',
},
{
label: 'R0_65',
field: 'r065',
sort: 'custom',
},
{
label: 'A1_0',
field: 'a10',
sort: 'custom',
},
{
label: 'R1_0',
field: 'r10',
sort: 'custom',
},
{
label: 'A1_5',
field: 'a15',
sort: 'custom',
},
{
label: 'R1_5',
field: 'r15',
sort: 'custom',
},
{
label: 'A2_5',
field: 'a25',
sort: 'custom',
},
{
label: 'R2_5',
field: 'r25',
sort: 'custom',
},
{
label: 'A4_0',
field: 'a40',
sort: 'custom',
},
{
label: 'R4_0',
field: 'r40',
sort: 'custom',
},
{
label: 'A6_5',
field: 'a65',
sort: 'custom',
},
{
label: 'R6_5',
field: 'r65',
sort: 'custom',
},
{
label: 'A10',
field: 'a10',
sort: 'custom',
},
{
label: 'R10',
field: 'r10',
sort: 'custom',
},
{
label: 'A15',
field: 'a15',
sort: 'custom',
},
{
label: 'R15',
field: 'r15',
sort: 'custom',
},
{
label: 'A25',
field: 'a25',
sort: 'custom',
},
{
label: 'R25',
field: 'r25',
sort: 'custom',
},
{
label: 'A40',
field: 'a40',
sort: 'custom',
},
{
label: 'R40',
field: 'r40',
sort: 'custom',
},
{
label: 'A65',
field: 'a65',
sort: 'custom',
},
{
label: 'R65',
field: 'r65',
sort: 'custom',
},
{
label: 'A100',
field: 'a100',
sort: 'custom',
},
{
label: 'R100',
field: 'r100',
sort: 'custom',
},
{
label: 'A150',
field: 'a150',
sort: 'custom',
},
{
label: 'R150',
field: 'r150',
sort: 'custom',
},
{
label: 'A250',
field: 'a250',
sort: 'custom',
},
{
label: 'R250',
field: 'r250',
sort: 'custom',
},
{
label: 'A400',
field: 'a400',
sort: 'custom',
},
{
label: 'R400',
field: 'r400',
sort: 'custom',
},
{
label: 'A650',
field: 'a650',
sort: 'custom',
},
{
label: 'R650',
field: 'r650',
sort: 'custom',
},
{
label: 'A1000',
field: 'a1000',
sort: 'custom',
},
{
label: 'R1000',
field: 'r1000',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/qms/aql/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Aql.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Aql.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="formsSuccess"
:rules="AqlRules"
:formAllSchemas="Aql.allSchemas"
:apiUpdate="AqlApi.updateAql"
:apiCreate="AqlApi.createAql"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Aql.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/aql/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { Aql,AqlRules } from './aql.data'
import * as AqlApi from '@/api/qms/aql'
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: 'Aql' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Aql.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: AqlApi.getAqlPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:aql:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:aql:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:aql: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:aql:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:aql: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)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Aql.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await AqlApi.createAql(data)
message.success(t('common.createSuccess'))
} else {
await AqlApi.updateAql(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicAql')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await AqlApi.deleteAql(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 AqlApi.exportAql(tableObject.params)
download.excel(data, 'aql.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: 'aql导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await AqlApi.importTemplate()
})
</script>

244
src/views/qms/inspectionMethod/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="InspectionMethod.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InspectionMethod.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="formsSuccess"
:rules="InspectionMethodRules"
:formAllSchemas="InspectionMethod.allSchemas"
:apiUpdate="InspectionMethodApi.updateInspectionMethod"
:apiCreate="InspectionMethodApi.createInspectionMethod"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMethod.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/inspection-method/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { InspectionMethod,InspectionMethodRules } from './inspectionMethod.data'
import * as InspectionMethodApi from '@/api/qms/inspectionMethod'
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: 'InspectionMethod' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(InspectionMethod.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: InspectionMethodApi.getInspectionMethodPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:inspectionMethod:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:inspectionMethod:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:inspectionMethod: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:inspectionMethod:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:inspectionMethod: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)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =InspectionMethod.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await InspectionMethodApi.createInspectionMethod(data)
message.success(t('common.createSuccess'))
} else {
await InspectionMethodApi.updateInspectionMethod(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicInspectionMethod')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await InspectionMethodApi.deleteInspectionMethod(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 InspectionMethodApi.exportInspectionMethod(tableObject.params)
download.excel(data, '检验方法.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '检验方法导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await InspectionMethodApi.importTemplate()
})
</script>

75
src/views/qms/inspectionMethod/inspectionMethod.data.ts

@ -0,0 +1,75 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const InspectionMethodRules = reactive({
code: [required],
status: [required],
available: [required],
})
export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isForm: false,
},
{
label: '编码',
field: 'code',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom',
},
{
label: '版本',
field: 'version',
sort: 'custom',
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '操作指导',
field: 'operationGuidance',
sort: 'custom',
},
{
label: '视频地址',
field: 'videoAddress',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/qms/sampleCode/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SampleCode.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SampleCode.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="formsSuccess"
:rules="SampleCodeRules"
:formAllSchemas="SampleCode.allSchemas"
:apiUpdate="SampleCodeApi.updateSampleCode"
:apiCreate="SampleCodeApi.createSampleCode"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SampleCode.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/sample-code/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SampleCode,SampleCodeRules } from './sampleCode.data'
import * as SampleCodeApi from '@/api/qms/sampleCode'
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: 'SampleCode' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SampleCode.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SampleCodeApi.getSampleCodePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:sampleCode:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:sampleCode:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:sampleCode: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:sampleCode:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:sampleCode: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)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =SampleCode.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SampleCodeApi.createSampleCode(data)
message.success(t('common.createSuccess'))
} else {
await SampleCodeApi.updateSampleCode(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicSampleCode')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SampleCodeApi.deleteSampleCode(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 SampleCodeApi.exportSampleCode(tableObject.params)
download.excel(data, '样本字码.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '样本字码导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await SampleCodeApi.importTemplate()
})
</script>

101
src/views/qms/sampleCode/sampleCode.data.ts

@ -0,0 +1,101 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SampleCodeRules = reactive({
code: [required],
batchUpperLimiting: [required],
available: [required],
})
export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isForm: false,
},
{
label: '采样方案编码',
field: 'code',
sort: 'custom',
isSearch: true,
},
{
label: '批量下限',
field: 'batchLow limiting',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '批量上限',
field: 'batchUpperLimiting',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: 's1',
field: 's1',
sort: 'custom',
},
{
label: 's2',
field: 's2',
sort: 'custom',
},
{
label: 's3',
field: 's3',
sort: 'custom',
},
{
label: 's4',
field: 's4',
sort: 'custom',
},
{
label: 'g1',
field: 'g1',
sort: 'custom',
},
{
label: 'g2',
field: 'g2',
sort: 'custom',
},
{
label: 'g3',
field: 'g3',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

3
src/views/qms/samplingProcess/index.vue

@ -99,7 +99,8 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:samplingProcess:create'}), //
// defaultButtons.defaultAddBtn({hasPermi:'wms:samplingProcess:create'}), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingProcess:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingProcess:export'}), //
defaultButtons.defaultFreshBtn(null), //

244
src/views/qms/samplingScheme/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SamplingScheme.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SamplingScheme.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="formsSuccess"
:rules="SamplingSchemeRules"
:formAllSchemas="SamplingScheme.allSchemas"
:apiUpdate="SamplingSchemeApi.updateSamplingScheme"
:apiCreate="SamplingSchemeApi.createSamplingScheme"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SamplingScheme.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/basic/sampling-scheme/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SamplingScheme,SamplingSchemeRules } from './samplingScheme.data'
import * as SamplingSchemeApi from '@/api/basic/samplingScheme'
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: 'SamplingScheme' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SamplingScheme.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SamplingSchemeApi.getSamplingSchemePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:samplingScheme:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingScheme:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingScheme: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:samplingScheme:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:samplingScheme: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)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =SamplingScheme.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SamplingSchemeApi.createSamplingScheme(data)
message.success(t('common.createSuccess'))
} else {
await SamplingSchemeApi.updateSamplingScheme(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicSamplingScheme')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SamplingSchemeApi.deleteSamplingScheme(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 SamplingSchemeApi.exportSamplingScheme(tableObject.params)
download.excel(data, '采样方案.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采样方案导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await SamplingSchemeApi.importTemplate()
})
</script>

61
src/views/qms/samplingScheme/samplingScheme.data.ts

@ -0,0 +1,61 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SamplingSchemeRules = reactive({
code: [required],
status: [required],
available: [required],
})
export const SamplingScheme = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isForm: false,
},
{
label: '编码',
field: 'code',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: true,
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save