Browse Source

生成代码提交

master_hella_20240701
ljlong_2630 8 months ago
parent
commit
6251033866
  1. 57
      src/api/qms/selectedProject/index.ts
  2. 55
      src/api/qms/selectedSet/index.ts
  3. 244
      src/views/qms/basicDataManage/selectedProject/index.vue
  4. 131
      src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts
  5. 244
      src/views/qms/basicDataManage/selectedSet/index.vue
  6. 117
      src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts

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

@ -0,0 +1,57 @@
import request from '@/config/axios'
export interface SelectedProjectVO {
id: number
code: string
dictionaryCode: string
dictionaryValue: string
estimateCode: string
defectLevel: string
available: string
deletionTime: Date
deleterId: string
extraProperties: string
concurrencyStamp: number
siteId: string
}
// 查询选定集项目列表
export const getSelectedProjectPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/selected-project/senior', data })
} else {
return await request.get({ url: `/qms/selected-project/page`, params })
}
}
// 查询选定集项目详情
export const getSelectedProject = async (id: number) => {
return await request.get({ url: `/qms/selected-project/get?id=` + id })
}
// 新增选定集项目
export const createSelectedProject = async (data: SelectedProjectVO) => {
return await request.post({ url: `/qms/selected-project/create`, data })
}
// 修改选定集项目
export const updateSelectedProject = async (data: SelectedProjectVO) => {
return await request.put({ url: `/qms/selected-project/update`, data })
}
// 删除选定集项目
export const deleteSelectedProject = async (id: number) => {
return await request.delete({ url: `/qms/selected-project/delete?id=` + id })
}
// 导出选定集项目 Excel
export const exportSelectedProject = async (params) => {
return await request.download({ url: `/qms/selected-project/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/selected-project/get-import-template' })
}

55
src/api/qms/selectedSet/index.ts

@ -0,0 +1,55 @@
import request from '@/config/axios'
export interface SelectedSetVO {
id: number
code: string
describe: string
classification: string
available: string
deletionTime: Date
deleterId: string
extraProperties: string
concurrencyStamp: number
siteId: string
}
// 查询选定集列表
export const getSelectedSetPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/selected-set/senior', data })
} else {
return await request.get({ url: `/qms/selected-set/page`, params })
}
}
// 查询选定集详情
export const getSelectedSet = async (id: number) => {
return await request.get({ url: `/qms/selected-set/get?id=` + id })
}
// 新增选定集
export const createSelectedSet = async (data: SelectedSetVO) => {
return await request.post({ url: `/qms/selected-set/create`, data })
}
// 修改选定集
export const updateSelectedSet = async (data: SelectedSetVO) => {
return await request.put({ url: `/qms/selected-set/update`, data })
}
// 删除选定集
export const deleteSelectedSet = async (id: number) => {
return await request.delete({ url: `/qms/selected-set/delete?id=` + id })
}
// 导出选定集 Excel
export const exportSelectedSet = async (params) => {
return await request.download({ url: `/qms/selected-set/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/selected-set/get-import-template' })
}

244
src/views/qms/basicDataManage/selectedProject/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SelectedProject.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SelectedProject.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="SelectedProjectRules"
:formAllSchemas="SelectedProject.allSchemas"
:apiUpdate="SelectedProjectApi.updateSelectedProject"
:apiCreate="SelectedProjectApi.createSelectedProject"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SelectedProject.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/selected-project/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SelectedProject,SelectedProjectRules } from './selectedProject.data'
import * as SelectedProjectApi from '@/api/qms/selectedProject'
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: 'SelectedProject' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SelectedProject.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: SelectedProjectApi.getSelectedProjectPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:selectedProject:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:selectedProject:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:selectedProject: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:selectedProject:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:selectedProject: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 =SelectedProject.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 SelectedProjectApi.createSelectedProject(data)
message.success(t('common.createSuccess'))
} else {
await SelectedProjectApi.updateSelectedProject(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, 'basicSelectedProject')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SelectedProjectApi.deleteSelectedProject(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 SelectedProjectApi.exportSelectedProject(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 SelectedProjectApi.importTemplate()
})
</script>

131
src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts

@ -0,0 +1,131 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SelectedProjectRules = reactive({
code: [required],
dictionaryCode: [required],
dictionaryValue: [required],
available: [required],
concurrencyStamp: [required]
})
export const SelectedProject = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false
},
{
label: '编码',
field: 'code',
sort: 'custom',
isSearch: true
},
{
label: '字典编码',
field: 'dictionaryCode',
sort: 'custom',
isSearch: true
},
{
label: '字典项值',
field: 'dictionaryValue',
sort: 'custom',
isSearch: true
},
{
label: '评估代码',
field: 'estimateCode',
sort: 'custom',
isSearch: true
},
{
label: '缺陷级别',
field: 'defectLevel',
sort: 'custom',
isSearch: true
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
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: 'deletionTime',
sort: 'custom',
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '删除者ID',
field: 'deleterId',
sort: 'custom',
isSearch: true
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: true
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/qms/basicDataManage/selectedSet/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SelectedSet.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SelectedSet.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="SelectedSetRules"
:formAllSchemas="SelectedSet.allSchemas"
:apiUpdate="SelectedSetApi.updateSelectedSet"
:apiCreate="SelectedSetApi.createSelectedSet"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SelectedSet.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/selected-set/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SelectedSet,SelectedSetRules } from './selectedSet.data'
import * as SelectedSetApi from '@/api/qms/selectedSet'
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: 'SelectedSet' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SelectedSet.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: SelectedSetApi.getSelectedSetPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:selectedSet:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:selectedSet:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:selectedSet: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:selectedSet:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:selectedSet: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 =SelectedSet.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 SelectedSetApi.createSelectedSet(data)
message.success(t('common.createSuccess'))
} else {
await SelectedSetApi.updateSelectedSet(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, 'basicSelectedSet')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SelectedSetApi.deleteSelectedSet(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 SelectedSetApi.exportSelectedSet(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 SelectedSetApi.importTemplate()
})
</script>

117
src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts

@ -0,0 +1,117 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SelectedSetRules = reactive({
code: [required],
available: [required],
concurrencyStamp: [required]
})
export const SelectedSet = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false
},
{
label: '编码',
field: 'code',
sort: 'custom',
isSearch: true
},
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: true
},
{
label: '分类',
field: 'classification',
sort: 'custom',
isSearch: true
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
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: 'deletionTime',
sort: 'custom',
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')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '删除者ID',
field: 'deleterId',
sort: 'custom',
isSearch: true
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isSearch: true
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save