Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
ljlong_2630 7 months ago
parent
commit
a0ec74c60c
  1. 59
      src/api/mes/holidayCalendar/index.ts
  2. 61
      src/api/mes/holidaySetting/index.ts
  3. 60
      src/api/mes/ordermonthplan/index.ts
  4. 76
      src/api/mes/reworkBatch/index.ts
  5. 16
      src/api/mes/reworkSingle/index.ts
  6. 30
      src/api/qms/inspectionPlan/index.ts
  7. 26
      src/api/qms/inspectionTemplate/index.ts
  8. 14
      src/api/qms/sampleCode/index.ts
  9. 2
      src/api/qms/samplingProcess/index.ts
  10. 1
      src/api/qms/samplingScheme/index.ts
  11. 8
      src/components/BasicForm/src/BasicForm.vue
  12. 109
      src/layout/components/CategoryHeader.vue
  13. 22
      src/layout/components/Menu/src/Menu.vue
  14. 7
      src/layout/components/useRenderLayout.tsx
  15. 17
      src/store/modules/app.ts
  16. 53
      src/utils/disposition/defaultButtons.ts
  17. 95
      src/views/mes/holidayCalendar/holidayCalendar.data.ts
  18. 43
      src/views/mes/holidayCalendar/index.vue
  19. 55
      src/views/mes/ordermonthplan/index.vue
  20. 86
      src/views/mes/ordermonthplan/mesOrderMonthMain.data.ts
  21. 318
      src/views/mes/reworkBatch/index.vue
  22. 229
      src/views/mes/reworkBatch/reworkBatch.data.ts
  23. 72
      src/views/mes/reworkSingle/index.vue
  24. 105
      src/views/mes/workstation/components/Detail.vue
  25. 20
      src/views/mes/workstation/index.vue
  26. 83
      src/views/mes/workstation/mesOrderMonthMain.data.ts
  27. 159
      src/views/mes/workstation/workstation.data.ts
  28. 864
      src/views/qms/basicDataManage/inspectionPlan/addForm.vue
  29. 197
      src/views/qms/basicDataManage/inspectionPlan/index.vue
  30. 208
      src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts
  31. 652
      src/views/qms/basicDataManage/inspectionTemplate/addForm.vue
  32. 95
      src/views/qms/basicDataManage/inspectionTemplate/index.vue
  33. 287
      src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts
  34. 10
      src/views/qms/sampleCode/index.vue
  35. 7
      src/views/qms/sampleCode/sampleCode.data.ts
  36. 11
      src/views/qms/samplingProcess/index.vue
  37. 5
      src/views/qms/samplingProcess/samplingProcess.data.ts
  38. 10
      src/views/qms/samplingScheme/index.vue
  39. 15
      src/views/qms/samplingScheme/samplingScheme.data.ts
  40. 38
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue
  41. 8
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/purchaseMain.data.ts

59
src/api/mes/holidayCalendar/index.ts

@ -0,0 +1,59 @@
import request from '@/config/axios'
export interface HolidayCalendarVO {
id: number
holidayDate: Date
endTime: Date
textOne: string
textTwo: string
textThree: string
textFour: string
textFive: string
deleteTime: Date
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
}
// 查询节假日设置日历列表
export const getHolidayCalendarPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/holidayCalendar/senior', data })
} else {
return await request.get({ url: `/mes/holidayCalendar/page`, params })
}
}
// 查询节假日设置日历详情
export const getHolidayCalendar = async (id: number) => {
return await request.get({ url: `/mes/holidayCalendar/get?id=` + id })
}
// 新增节假日设置日历
export const createHolidayCalendar = async (data: HolidayCalendarVO) => {
return await request.post({ url: `/mes/holidayCalendar/create`, data })
}
// 修改节假日设置日历
export const updateHolidayCalendar = async (data: HolidayCalendarVO) => {
return await request.put({ url: `/mes/holidayCalendar/update`, data })
}
// 删除节假日设置日历
export const deleteHolidayCalendar = async (id: number) => {
return await request.delete({ url: `/mes/holidayCalendar/delete?id=` + id })
}
// 导出节假日设置日历 Excel
export const exportHolidayCalendar = async (params) => {
return await request.download({ url: `/mes/holidayCalendar/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/holidayCalendar/get-import-template' })
}

61
src/api/mes/holidaySetting/index.ts

@ -1,61 +0,0 @@
import request from '@/config/axios'
export interface HolidaySettingVO {
id: number
textOne: string
textTwo: string
textThree: string
textFour: string
textFive: string
deleteTime: Date
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
changeEmplId: number
holidayDate: Date
holidayFlag: string
holidayName: string
}
// 查询节假日设置列表
export const getHolidaySettingPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/holidaySetting/senior', data })
} else {
return await request.get({ url: `/mes/holidaySetting/page`, params })
}
}
// 查询节假日设置详情
export const getHolidaySetting = async (id: number) => {
return await request.get({ url: `/mes/holidaySetting/get?id=` + id })
}
// 新增节假日设置
export const createHolidaySetting = async (data: HolidaySettingVO) => {
return await request.post({ url: `/mes/holidaySetting/create`, data })
}
// 修改节假日设置
export const updateHolidaySetting = async (data: HolidaySettingVO) => {
return await request.put({ url: `/mes/holidaySetting/update`, data })
}
// 删除节假日设置
export const deleteHolidaySetting = async (id: number) => {
return await request.delete({ url: `/mes/holidaySetting/delete?id=` + id })
}
// 导出节假日设置 Excel
export const exportHolidaySetting = async (params) => {
return await request.download({ url: `/mes/holidaySetting/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/holidaySetting/get-import-template' })
}

60
src/api/mes/ordermonthplan/index.ts

@ -0,0 +1,60 @@
import request from '@/config/axios'
export interface MesOrderMonthMainVO {
deleteTime: Date
id: number
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
sourceType: string
planMasterCode: string
planSubCode: string
planType: string
checker: string
checkDate: string
factoryCode: string
factoryName: string
}
// 查询订单计划月主列表
export const getMesOrderMonthMainPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/plan/mes-order-month-main/senior', data })
} else {
return await request.get({ url: `/plan/mes-order-month-main/page`, params })
}
}
// 查询订单计划月主详情
export const getMesOrderMonthMain = async (id: number) => {
return await request.get({ url: `/plan/mes-order-month-main/get?id=` + id })
}
// 新增订单计划月主
export const createMesOrderMonthMain = async (data: MesOrderMonthMainVO) => {
return await request.post({ url: `/plan/mes-order-month-main/create`, data })
}
// 修改订单计划月主
export const updateMesOrderMonthMain = async (data: MesOrderMonthMainVO) => {
return await request.put({ url: `/plan/mes-order-month-main/update`, data })
}
// 删除订单计划月主
export const deleteMesOrderMonthMain = async (id: number) => {
return await request.delete({ url: `/plan/mes-order-month-main/delete?id=` + id })
}
// 导出订单计划月主 Excel
export const exportMesOrderMonthMain = async (params) => {
return await request.download({ url: `/plan/mes-order-month-main/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/plan/mes-order-month-main/get-import-template' })
}

76
src/api/mes/reworkBatch/index.ts

@ -0,0 +1,76 @@
import request from '@/config/axios'
export interface ReworkBatchVO {
deleteTime: Date
id: number
status: string
concurrencyStamp: number
remark: string
deleter: string
siteId: number
reworkType: string
productionCode: string
productionCount: string
reworkAction: string
replaceFlag: string
reworkPersoncode: string
reworkTime: Date
reworkResult: string
reworkbillNo: string
}
// 查询返工登记批量列表
export const getReworkBatchPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/rework-batch/senior', data })
} else {
return await request.get({ url: `/mes/rework-batch/page`, params })
}
}
// 查询返工登记批量详情
export const getReworkBatch = async (id: number) => {
return await request.get({ url: `/mes/rework-batch/get?id=` + id })
}
// 新增返工登记批量
export const createReworkBatch = async (data: ReworkBatchVO) => {
return await request.post({ url: `/mes/rework-batch/create`, data })
}
// 修改返工登记批量
export const updateReworkBatch = async (data: ReworkBatchVO) => {
return await request.put({ url: `/mes/rework-batch/update`, data })
}
// 删除返工登记批量
export const deleteReworkBatch = async (id: number) => {
return await request.delete({ url: `/mes/rework-batch/delete?id=` + id })
}
// 中止返工登记单件
export const suspendReworkSingle = async (id: number) => {
return await request.delete({ url: `/mes/rework-batch/suspend?id=` + id })
}
// 领取返工登记单件
export const receiveReworkSingle = async (id: number) => {
return await request.put({ url: `/mes/rework-batch/receive?id=` + id })
}
// 完成返工登记单件
export const finishReworkSingle = async (id: number) => {
return await request.put({ url: `/mes/rework-batch/finish?id=` + id })
}
// 导出返工登记批量 Excel
export const exportReworkBatch = async (params) => {
return await request.download({ url: `/mes/rework-batch/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/rework-batch/get-import-template' })
}

16
src/api/mes/reworkSingle/index.ts

@ -49,6 +49,22 @@ export const deleteReworkSingle = async (id: number) => {
return await request.delete({ url: `/mes/rework-single/delete?id=` + id }) return await request.delete({ url: `/mes/rework-single/delete?id=` + id })
} }
// 中止返工登记单件
export const suspendReworkSingle = async (id: number) => {
return await request.delete({ url: `/mes/rework-single/suspend?id=` + id })
}
// 领取返工登记单件
export const receiveReworkSingle = async (id: number) => {
return await request.put({ url: `/mes/rework-single/receive?id=` + id })
}
// 完成返工登记单件
export const finishReworkSingle = async (id: number) => {
return await request.put({ url: `/mes/rework-single/finish?id=` + id })
}
// 导出返工登记单件 Excel // 导出返工登记单件 Excel
export const exportReworkSingle = async (params) => { export const exportReworkSingle = async (params) => {
return await request.download({ url: `/mes/rework-single/export-excel`, params }) return await request.download({ url: `/mes/rework-single/export-excel`, params })

30
src/api/qms/inspectionPlan/index.ts

@ -0,0 +1,30 @@
import request from '@/config/axios'
// 查询采样过程列表
export const getListByTempleteCode = async (code) => {
return await request.get({ url: `/qms/inspection-process/getListByTempleteCode?code=`+code})
}
// 新增
export const inspectionTemplateCreat = async (data) => {
return await request.post({ url: `/qms/programme-template/create`,data})
}
// 编辑
export const inspectionTemplateUpdate = async (data) => {
return await request.put({ url: `/qms/programme-template/update`,data})
}
// 删除
export const inspectionTemplateDelete = async (id) => {
return await request.delete({ url: `/qms/programme-template/delete?id=`+id})
}
// 列表
export const inspectionTemplatePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return request.post({ url: '/wms/accountcalendar/senior', data })
} else {
return await request.get({ url: `/qms/programme-template/page`, params })
}
}

26
src/api/qms/inspectionTemplate/index.ts

@ -3,6 +3,28 @@ import request from '@/config/axios'
// 查询采样过程列表 // 查询采样过程列表
export const getInspectionProcessPage = async (params) => { export const getListByTempleteCode = async (code) => {
return await request.get({ url: `/qms/inspection-process/page`}) return await request.get({ url: `/qms/inspection-process/getListByTempleteCode?code=`+code})
}
// 新增
export const inspectionTemplateCreat = async (data) => {
return await request.post({ url: `/qms/programme-template/create`,data})
}
// 编辑
export const inspectionTemplateUpdate = async (data) => {
return await request.put({ url: `/qms/programme-template/update`,data})
}
// 删除
export const inspectionTemplateDelete = async (id) => {
return await request.delete({ url: `/qms/programme-template/delete?id=`+id})
}
// 列表
export const inspectionTemplatePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return request.post({ url: '/wms/accountcalendar/senior', data })
} else {
return await request.get({ url: `/qms/programme-template/page`, params })
}
} }

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

@ -5,13 +5,13 @@ export interface SampleCodeVO {
code: string code: string
batchLowLimiting: number batchLowLimiting: number
batchUpperLimiting: number batchUpperLimiting: number
s1: number s1: string
s2: number s2: string
s3: number s3: string
s4: number s4: string
g1: number g1: string
g2: number g2: string
g3: number g3: string
available: string available: string
} }

2
src/api/qms/samplingProcess/index.ts

@ -3,7 +3,7 @@ import request from '@/config/axios'
export interface SamplingProcessVO { export interface SamplingProcessVO {
id: number id: number
code: string code: string
describe: string description: string
sampleType: string sampleType: string
evaluationMode: string evaluationMode: string
sampleSize: number sampleSize: number

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

@ -4,7 +4,6 @@ export interface SamplingSchemeVO {
id: number id: number
code: string code: string
describe: string describe: string
status: string
available: string available: string
} }

8
src/components/BasicForm/src/BasicForm.vue

@ -266,6 +266,12 @@ const props = defineProps({
required: false, required: false,
default: false default: false
}, },
// TableForm
indexTableColumn :{
type: Number,
required: false,
default: 0
}
}) })
const { t } = useI18n() // const { t } = useI18n() //
@ -576,7 +582,7 @@ const handleAddTable = () => {
tableAllSchemas.value.tableFormColumns.forEach(item => { tableAllSchemas.value.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : '' tableFormKeys[item.field] = item.default ? item.default : ''
}) })
inpuFocus(tableAllSchemas.value.tableFormColumns[0],tableFormKeys,0) inpuFocus(tableAllSchemas.value.tableFormColumns[props.indexTableColumn],tableFormKeys,0)
}else{ }else{
emit('handleAddTable') emit('handleAddTable')
} }

109
src/layout/components/CategoryHeader.vue

@ -0,0 +1,109 @@
<script lang="tsx">
import { defineComponent, computed } from 'vue'
import { useRouter } from 'vue-router'
import { useAppStore } from '@/store/modules/app'
import { isUrl } from '@/utils/is'
import { pathResolve } from '@/utils/routerHelper'
import type { RouteMeta } from 'vue-router'
import { ElMenu, ElMenuItem } from 'element-plus'
import { usePermissionStore } from '@/store/modules/permission'
import { hasOneShowingChild } from '@/layout/components/Menu/src/helper'
import { useRenderMenuTitle } from '@/layout/components/Menu/src/components/useRenderMenuTitle'
//
import { useDesign } from '@/hooks/web/useDesign'
const { getPrefixCls, variables } = useDesign()
const appStore = useAppStore()
const layout = computed(() => appStore.getLayout)
const prefixCls = getPrefixCls('tool-header')
const permissionStore = usePermissionStore()
const routers = computed(() =>
unref(layout) === 'cutMenu' ? permissionStore.getMenuTabRouters : permissionStore.getRouters
)
const getPath = (route) => {
let routePath = route.path
if(routePath.startsWith('/')){
routePath = route.path
}else{
routePath = '/'+route.path
}
if(route.redirect){
return route.redirect
}else if(route.children){
return routePath+getPath(route.children[0])
}else{
return routePath
}
}
export default defineComponent({
name: 'CategoryHeader',
setup() {
console.log('useRouter()',useRouter())
const { push } = useRouter()
// backgroundColor="var(--left-menu-bg-color)"
// textColor="var(--left-menu-text-color)"
return () => (
<div
id={`${variables.namespace}-tool-header`}
class={[
prefixCls,
'h-[var(--top-tool-height)] relative px-[var(--top-tool-p-x)] flex items-center justify-between',
'dark:bg-[var(--el-bg-color)]'
]}
>
<ElMenu style="width:100%"
mode="horizontal"
backgroundColor="white"
textColor="var(--left-menu-bg-color)"
activeTextColor="var(--left-menu-text-active-color)"
>
{{
default: () => {
const { renderMenuTitle } = useRenderMenuTitle()
const categoryRouters = unref(routers).filter(item=>item.meta.hidden!=true&&item.path!='/')
console.log('categoryRouters==',categoryRouters)
{/* default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta) */}
return categoryRouters.map((v) => {
const meta = (v.meta ?? {}) as RouteMeta
const { onlyOneChild } = hasOneShowingChild(v.children, v)
const fullPath = isUrl(v.path) ? v.path : pathResolve('/', v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
return (
<ElMenuItem index={fullPath} onClick={()=>{
console.log(v)
appStore.setCategoryRoutePath(v.path)
}}>
{{
default: () => renderMenuTitle(meta.title?meta:onlyOneChild?.meta)
}}
</ElMenuItem>
)
})
}
}}
</ElMenu>
</div>
)
}
})
</script>
<style lang="scss" scoped>
$prefix-cls: #{$namespace}-tool-header;
.#{$prefix-cls} {
transition: left var(--transition-time-02);
}
::v-deep(.el-menu--horizontal>.el-menu-item){
border-radius: 5px;
height: 40px;
margin-right: 10px;
background: linear-gradient(to top left,var(--left-menu-bg-color),var(--left-menu-text-color));
}
</style>

22
src/layout/components/Menu/src/Menu.vue

@ -45,6 +45,26 @@ export default defineComponent({
unref(layout) === 'cutMenu' ? permissionStore.getMenuTabRouters : permissionStore.getRouters unref(layout) === 'cutMenu' ? permissionStore.getMenuTabRouters : permissionStore.getRouters
) )
const categoryRoutes = computed(() => {
const allRoutes = unref(layout) === 'cutMenu' ? permissionStore.getMenuTabRouters : permissionStore.getRouters
const categoryPath = appStore.getCategoryRoutePath
let findRoutes = allRoutes.find(item=>!item.meta.hidden&&item.path === categoryPath)
if(findRoutes){
findRoutes = JSON.parse(JSON.stringify(findRoutes))
findRoutes?.children?.forEach(item => {
item.path = findRoutes?.path+'/'+item.path
});
}
let homeRoute = allRoutes.find(item=>!item.meta.hidden&&item.path === '/')
if(categoryPath!=homeRoute?.path&&homeRoute){
homeRoute = JSON.parse(JSON.stringify(homeRoute))
homeRoute?.children?.forEach(item => {
item.path = homeRoute?.path+item.path
});
}
return categoryPath!=homeRoute?.path?[...homeRoute?.children||[],...findRoutes?.children||[]]:[...findRoutes?.children||[]]||homeRoute||[]
})
const collapse = computed(() => appStore.getCollapse) const collapse = computed(() => appStore.getCollapse)
const uniqueOpened = computed(() => appStore.getUniqueOpened) const uniqueOpened = computed(() => appStore.getUniqueOpened)
@ -95,7 +115,7 @@ export default defineComponent({
{{ {{
default: () => { default: () => {
const { renderMenuItem } = useRenderMenuItem(unref(menuMode)) const { renderMenuItem } = useRenderMenuItem(unref(menuMode))
return renderMenuItem(unref(routers)) return appStore.getShowCategoryMenu?renderMenuItem(unref(categoryRoutes)):renderMenuItem(unref(routers))
} }
}} }}
</ElMenu> </ElMenu>

7
src/layout/components/useRenderLayout.tsx

@ -6,6 +6,7 @@ import { TagsView } from '@/layout/components/TagsView'
import { Logo } from '@/layout/components/Logo' import { Logo } from '@/layout/components/Logo'
import AppView from './AppView.vue' import AppView from './AppView.vue'
import ToolHeader from './ToolHeader.vue' import ToolHeader from './ToolHeader.vue'
import CategoryHeader from './CategoryHeader.vue'
import { ElScrollbar } from 'element-plus' import { ElScrollbar } from 'element-plus'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'
import RouterSearch from '@/components/RouterSearch/index.vue' import RouterSearch from '@/components/RouterSearch/index.vue'
@ -111,6 +112,12 @@ export const useRenderLayout = () => {
]} ]}
style="transition: all var(--transition-time-02);" style="transition: all var(--transition-time-02);"
> >
{appStore.getShowCategoryMenu?(<CategoryHeader class={[
'bg-[var(--top-header-bg-color)]',
{
'layout-border__bottom': !tagsView.value
}
]}></CategoryHeader>):undefined}
<ToolHeader <ToolHeader
class={[ class={[
'bg-[var(--top-header-bg-color)]', 'bg-[var(--top-header-bg-color)]',

17
src/store/modules/app.ts

@ -36,6 +36,8 @@ interface AppState {
footer: boolean footer: boolean
theme: ThemeTypes theme: ThemeTypes
fixedMenu: boolean fixedMenu: boolean
categoryRoutePath:string
showCategoryMenu: boolean
} }
export const useAppStore = defineStore('app', { export const useAppStore = defineStore('app', {
@ -97,7 +99,9 @@ export const useAppStore = defineStore('app', {
topHeaderHoverColor: '#f6f6f6', topHeaderHoverColor: '#f6f6f6',
// 头部边框颜色 // 头部边框颜色
topToolBorderColor: '#eee' topToolBorderColor: '#eee'
} },
categoryRoutePath:'',
showCategoryMenu:false // true:顶部展示一级菜单栏 false:只有左侧菜单栏
} }
}, },
getters: { getters: {
@ -175,7 +179,13 @@ export const useAppStore = defineStore('app', {
}, },
getFooter(): boolean { getFooter(): boolean {
return this.footer return this.footer
} },
getCategoryRoutePath():string{
return this.categoryRoutePath
},
getShowCategoryMenu():boolean {
return this.showCategoryMenu
},
}, },
actions: { actions: {
setBreadcrumb(breadcrumb: boolean) { setBreadcrumb(breadcrumb: boolean) {
@ -267,6 +277,9 @@ export const useAppStore = defineStore('app', {
}, },
setFooter(footer: boolean) { setFooter(footer: boolean) {
this.footer = footer this.footer = footer
},
setCategoryRoutePath(path:string){
this.categoryRoutePath = path
} }
} }
}) })

53
src/utils/disposition/defaultButtons.ts

@ -250,6 +250,59 @@ export function mainListDeleteBtn(option:any) {
hasPermi: '' hasPermi: ''
}) })
} }
// 主列表-中止按钮1
export function mainListSuspend1Btn(option:any) {
return __defaultBtnOption(option,{
label: '中止',
name: 'suspend',
hide: false,
type: 'danger',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-中止按钮2
export function mainListSuspend2Btn(option:any) {
return __defaultBtnOption(option,{
label: '中止',
name: 'suspend',
hide: false,
type: 'danger',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-领取按钮
export function mainListReceiveBtn(option:any) {
return __defaultBtnOption(option,{
label: '领取',
name: 'receive',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-完成按钮
export function mainListFinishBtn(option:any) {
return __defaultBtnOption(option,{
label: '完成',
name: 'finish',
hide: false,
type: 'primary',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 主列表-绑定 // 主列表-绑定
export function mainListBindBtn(option:any) { export function mainListBindBtn(option:any) {
return __defaultBtnOption(option,{ return __defaultBtnOption(option,{

95
src/views/mes/holidaySetting/holidaySetting.data.ts → src/views/mes/holidayCalendar/holidayCalendar.data.ts

@ -2,17 +2,62 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
// 表单校验 // 表单校验
export const HolidaySettingRules = reactive({ export const HolidayCalendarRules = reactive({
endTime: [required],
concurrencyStamp: [required], concurrencyStamp: [required],
}) })
export const HolidaySetting = useCrudSchemas(reactive<CrudSchema[]>([ export const HolidayCalendar = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: 'id', label: 'ID',
field: 'id', field: 'id',
sort: 'custom', sort: 'custom',
isForm: false, isForm: false,
}, },
{
label: '日期',
field: 'holidayDate',
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: '结束时间',
field: 'endTime',
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: '备用字段一', label: '备用字段一',
field: 'textOne', field: 'textOne',
@ -122,50 +167,6 @@ export const HolidaySetting = useCrudSchemas(reactive<CrudSchema[]>([
value: 0 value: 0
}, },
}, },
{
label: '更改ID',
field: 'changeEmplId',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '节假日日期',
field: 'holidayDate',
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: '节假日类型',
field: 'holidayFlag',
sort: 'custom',
isSearch: true,
},
{
label: '节假日名称',
field: 'holidayName',
sort: 'custom',
isSearch: true,
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

43
src/views/mes/holidayCalendar/index.vue

@ -0,0 +1,43 @@
<template>
<div>
<el-calendar>
<template #date-cell="{ data }">
<div
style="height: 100"
:class="data.isSelected ? 'is-selected' : ''"
@click="handleClick(data.day)">
<div>{{ data.day.split('-').slice(1).join('-') }}</div>
<div v-if="arr.find((v) => v.date === data.day)">{{ arr.find((v) => v.date === data.day).content }}
</div>
<!-- <div>{{ data.isSelected ? '打羽毛球' : '' }}</div>  -->
</div>
</template>
</el-calendar>
</div>
</template>
<script>
export default {
name: 'Calendar',
data() {
return {
value: new Date(),
arr: [
{ date: '2024-04-01', content: '打球' },
{ date: '2024-04-02', content: '打台球' },
{ date: '2024-04-03', content: '打篮球' },
{ date: '2024-04-04', content: '踢足球' }
]
}
},
methods: {
handleClick(date) {
alert(date)
}
}
}
</script>
<style scoped>
</style>

55
src/views/mes/holidaySetting/index.vue → src/views/mes/ordermonthplan/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="HolidaySetting.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="MesOrderMonthMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -11,7 +11,7 @@
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="HolidaySetting.allSchemas" :allSchemas="MesOrderMonthMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
@ -42,31 +42,31 @@
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="formsSuccess" @success="formsSuccess"
:rules="HolidaySettingRules" :rules="MesOrderMonthMainRules"
:formAllSchemas="HolidaySetting.allSchemas" :formAllSchemas="MesOrderMonthMain.allSchemas"
:apiUpdate="HolidaySettingApi.updateHolidaySetting" :apiUpdate="MesOrderMonthMainApi.updateMesOrderMonthMain"
:apiCreate="HolidaySettingApi.createHolidaySetting" :apiCreate="MesOrderMonthMainApi.createMesOrderMonthMain"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" :isBusiness="false"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="HolidaySetting.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="MesOrderMonthMain.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/holidaySetting/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/plan/mes-order-month-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { HolidaySetting,HolidaySettingRules } from './holidaySetting.data' import { MesOrderMonthMain,MesOrderMonthMainRules } from './mesOrderMonthMain.data'
import * as HolidaySettingApi from '@/api/mes/holidaySetting' import * as MesOrderMonthMainApi from '@/api/mes/ordermonthplan'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'MesHolidaySetting' }) defineOptions({ name: 'MesOrderMonthMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -74,7 +74,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(HolidaySetting.allSchemas.tableColumns) const tableColumns = ref(MesOrderMonthMain.allSchemas.tableColumns)
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -91,7 +91,7 @@ const updataTableColumns = (val) => {
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: HolidaySettingApi.getHolidaySettingPage // getListApi: MesOrderMonthMainApi.getMesOrderMonthMainPage //
}) })
// //
@ -99,9 +99,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'mes:holidaySetting:create'}), // defaultButtons.defaultAddBtn({hasPermi:'wms:mesOrderMonthMain:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'mes:holidaySetting:import'}), // defaultButtons.defaultImportBtn({hasPermi:'wms:mesOrderMonthMain:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'mes:holidaySetting:export'}), // defaultButtons.defaultExportBtn({hasPermi:'wms:mesOrderMonthMain:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -133,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'mes:holidaySetting:update'}), // defaultButtons.mainListEditBtn({hasPermi:'wms:mesOrderMonthMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'mes:holidaySetting:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'wms:mesOrderMonthMain:delete'}), //
] ]
// - // -
@ -154,7 +154,7 @@ const openForm = (type: string, row?: any) => {
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType,data) => {
var isHave =HolidaySetting.allSchemas.formSchema.some(function (item) { var isHave =MesOrderMonthMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime';
}); });
if(isHave){ if(isHave){
@ -166,10 +166,10 @@ const formsSuccess = async (formType,data) => {
if(data.activeTime==0)data.activeTime = null; if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
await HolidaySettingApi.createHolidaySetting(data) await MesOrderMonthMainApi.createMesOrderMonthMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await HolidaySettingApi.updateHolidaySetting(data) await MesOrderMonthMainApi.updateMesOrderMonthMain(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
@ -179,7 +179,7 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */ /** 详情操作 */
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, 'basicHolidaySetting') detailRef.value.openDetail(row, titleName, titleValue, 'basicMesOrderMonthMain')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -188,7 +188,7 @@ const handleDelete = async (id: number) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await HolidaySettingApi.deleteHolidaySetting(id) await MesOrderMonthMainApi.deleteMesOrderMonthMain(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
@ -203,8 +203,8 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await HolidaySettingApi.exportHolidaySetting(tableObject.params) const data = await MesOrderMonthMainApi.exportMesOrderMonthMain(tableObject.params)
download.excel(data, '节假日设置.xlsx') download.excel(data, '订单计划月主.xlsx')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@ -219,7 +219,7 @@ const handleImport = () => {
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '节假日设置导入模版.xlsx' templateTitle: '订单计划月主导入模版.xlsx'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
@ -238,8 +238,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await HolidaySettingApi.importTemplate() importTemplateData.templateUrl = await MesOrderMonthMainApi.importTemplate()
}) })
</script> </script>
./holidaySetting.data

86
src/views/mes/ordermonthplan/mesOrderMonthMain.data.ts

@ -0,0 +1,86 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const MesOrderMonthMainRules = reactive({
})
export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备注',
field: 'remark',
sort: 'custom',
isTable: false
},
{
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: 'creator',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '主计划编码',
field: 'planMasterCode',
sort: 'custom',
isSearch: true
},
{
label: '计划辅助编码',
field: 'planSubCode',
sort: 'custom',
isSearch: true
},
{
label: '计划类型',
field: 'planType',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
},
{
label: '审核人',
field: 'checker',
sort: 'custom',
isSearch: true
},
{
label: '工厂编码',
field: 'factoryCode',
sort: 'custom',
isSearch: true
},
{
label: '工厂名称',
field: 'factoryName',
sort: 'custom',
isSearch: true
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

318
src/views/mes/reworkBatch/index.vue

@ -0,0 +1,318 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ReworkBatch.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ReworkBatch.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 #reworkbillNo="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.reworkbillNo)">
<span>{{ row.reworkbillNo }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ReworkBatchRules"
:formAllSchemas="ReworkBatch.allSchemas"
:apiUpdate="ReworkBatchApi.updateReworkBatch"
:apiCreate="ReworkBatchApi.createReworkBatch"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ReworkBatch.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/rework-batch/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ReworkBatch,ReworkBatchRules } from './reworkBatch.data'
import * as ReworkBatchApi from '@/api/mes/reworkBatch'
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: 'MesReworkBatch' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ReworkBatch.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: ReworkBatchApi.getReworkBatchPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'mes:reworkBatch:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'mes:reworkBatch:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'mes:reworkBatch: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 isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), //
defaultButtons.mainListSuspend1Btn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:delete'}), // 1
defaultButtons.mainListReceiveBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), //
defaultButtons.mainListSuspend2Btn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:delete'}), // 2
defaultButtons.mainListFinishBtn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:update'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'suspend') { // 1
handleSuspend(row.id)
} else if (val == 'receive') { //
handleReceive(row.id)
} else if (val == 'suspend') { // 2
handleSuspend(row.id)
} else if (val == 'finish') { //
handleFinish(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type == "create"){
ReworkBatch.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.value = '1';
item.componentProps.disabled = true
}
})
}else{
ReworkBatch.allSchemas.formSchema.forEach((item) => {
if(item.field == 'status'){
item.componentProps.disabled = false
}
})
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ReworkBatch.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 ReworkBatchApi.createReworkBatch(data)
message.success(t('common.createSuccess'))
} else {
await ReworkBatchApi.updateReworkBatch(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, 'basicReworkBatch')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ReworkBatchApi.deleteReworkBatch(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 中止按钮操作 */
const handleSuspend = async (id: number) => {
try {
//
await message.delConfirm('是否中止所选中任务?');
//
await ReworkBatchApi.suspendReworkSingle(id)
message.success(t('中止成功'))
//
await getList()
} catch {}
}
/** 领取按钮操作 */
const handleReceive = async (id: number) => {
try {
//
await message.delConfirm('是否领取所选中任务?');
//
await ReworkBatchApi.receiveReworkSingle(id)
message.success(t('领取成功'))
//
await getList()
} catch {}
}
/** 完成按钮操作 */
const handleFinish = async (id: number) => {
try {
//
await message.delConfirm('是否完成所选中任务?');
//
await ReworkBatchApi.finishReworkSingle(id)
message.success(t('任务已完成'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ReworkBatchApi.exportReworkBatch(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 ReworkBatchApi.importTemplate()
})
</script>

229
src/views/mes/reworkBatch/reworkBatch.data.ts

@ -0,0 +1,229 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
// 表单校验
export const ReworkBatchRules = reactive({
reworkType: [required],
productionCode:[required],
replaceFlag:[required],
status:[required],
})
export const ReworkBatch = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '删除时间',
field: 'deleteTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm:false,
isDetail: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: '主键',
field: 'id',
sort: 'custom',
isSearch: false,
isTable: false,
isForm:false,
isDetail:false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: false,
isTable: false,
isForm:false,
isDetail:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
isTable: false,
isForm:false,
isDetail: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')]
}
},
},
{
label: '删除用户名',
field: 'deleter',
sort: 'custom',
isSearch: false,
isTable: false,
isForm:false,
isDetail:false,
},
{
label: '位置ID',
field: 'siteId',
sort: 'custom',
isSearch: false,
isTable: false,
isForm:false,
isDetail:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '单据号',
field: 'reworkbillNo',
sort: 'custom',
isSearch: true,
isForm: false,
isDetail: true
},
{
label: '工作类型',
field: 'reworkType',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.REWORK_TYPE,
dictClass: 'string',
},
{
label: '产品编码',
field: 'productionCode',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
isSearchList: true, // 开启查询弹窗
searchTitle: '产品编码', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchField: 'code', // 查询弹窗赋值字段
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'type',
action: 'in', // 查询拼接条件
isSearch: true, // 使用自定义拼接条件
value: 'BCP,CCP',//,SEMI]
isMainValue: false
}]
}
}
},
{
label: '数量',
field: 'productionCount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '返修动作',
field: 'reworkAction',
sort: 'custom',
isSearch: true,
},
{
label: '是否有替换件',
field: 'replaceFlag',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.REWORK_REPLACE_FLAG,
dictClass: 'string',
},
{
label: '返修人员',
field: 'reworkPersoncode',
sort: 'custom',
isSearch: true,
},
{
label: '返修时间',
field: 'reworkTime',
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: '返修结果',
field: 'reworkResult',
sort: 'custom',
isSearch: true,
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.REWORK_STATUS,
dictClass: 'string',
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

72
src/views/mes/reworkSingle/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -131,18 +131,38 @@ const buttonBaseClick = (val, item) => {
} }
} }
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// - // -
const butttondata = [ const butttondata = (row) => {
defaultButtons.mainListEditBtn({hasPermi:'mes:reworkSingle:update'}), // return [
defaultButtons.mainListDeleteBtn({hasPermi:'mes:reworkSingle:delete'}), // defaultButtons.mainListEditBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), //
defaultButtons.mainListSuspend1Btn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:delete'}), // 1
defaultButtons.mainListReceiveBtn({hide: isShowMainButton(row,['1']),hasPermi:'mes:reworkSingle:update'}), //
defaultButtons.mainListSuspend2Btn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:delete'}), // 2
defaultButtons.mainListFinishBtn({hide: isShowMainButton(row,['2']),hasPermi:'mes:reworkSingle:update'}), //
] ]
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'suspend') { // 1
handleDelete(row.id) handleSuspend(row.id)
} else if (val == 'receive') { //
handleReceive(row.id)
} else if (val == 'suspend') { // 2
handleSuspend(row.id)
} else if (val == 'finish') { //
handleFinish(row.id)
} }
} }
@ -209,6 +229,46 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
/** 中止按钮操作 */
const handleSuspend = async (id: number) => {
try {
//
await message.delConfirm('是否中止所选中任务?');
//
await ReworkSingleApi.suspendReworkSingle(id)
message.success(t('中止成功'))
//
await getList()
} catch {}
}
/** 领取按钮操作 */
const handleReceive = async (id: number) => {
try {
//
await message.delConfirm('是否领取所选中任务?');
//
await ReworkSingleApi.receiveReworkSingle(id)
message.success(t('领取成功'))
//
await getList()
} catch {}
}
/** 完成按钮操作 */
const handleFinish = async (id: number) => {
try {
//
await message.delConfirm('是否完成所选中任务?');
//
await ReworkSingleApi.finishReworkSingle(id)
message.success(t('任务已完成'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {

105
src/views/mes/workstation/components/Detail.vue

@ -138,6 +138,8 @@
@onBlur="onBlur" @onBlur="onBlur"
@formFormDateChange="formFormDateChange" @formFormDateChange="formFormDateChange"
/> />
<!-- 表格弹窗 -->
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" />
</div> </div>
</template> </template>
@ -299,7 +301,18 @@ const props = defineProps({
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: true
} },
//
isOpenSearchTable:{
type: Boolean,
required: false,
default: false
},
searchTableSchema: {
type: Array,
required: false,
default: null
},
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
@ -381,6 +394,79 @@ const HeadButttondata = ref()
// - // -
const buttondata = ref() const buttondata = ref()
/** isOpenSearchTable 对应 表格弹窗 */
const initModel = (schema: FormSchema[], formModel: Recordable) => {
const model: Recordable = { ...formModel }
schema.map((v) => {
// hidden
if (v.hidden) {
delete model[v.field]
} else if (v.component && v.component !== 'Divider') {
const hasField = Reflect.has(model, v.field)
//
model[v.field] = hasField ? model[v.field] : v.value !== void 0 ? v.value : ''
}
})
return model
}
const searchTableRef = ref()
const searchTableFormModel = ref<Recordable>({})
if(props.isOpenSearchTable){
searchTableFormModel.value = initModel(props.searchTableSchema.formSchema, unref(searchTableFormModel))
}
const searchTableFormType = ref('') // create - update -
// --> isOpenSearchTable === true
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
for (var i=0; i< searchCondition.length; i++ ) {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = detailData
? detailData.value[searchCondition[i].value]
: ''
}else{
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
console.log(searchCondition)
console.log(_searchCondition)
searchTableRef.value.open(
searchTitle,
searchAllSchemas,
searchPage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
const searchTableSuccess1 = (formField, searchField, val, formRef) => {
console.log('searchTableSuccess1',val)
searchTableFormModel.value[formField] = val.map(item=>item[searchField]).join(',')
console.log('searchTableSuccess1',searchTableFormModel)
submitForm(searchTableFormType.value,searchTableFormModel.value)
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
/** 打开弹窗 */ /** 打开弹窗 */
const formRef = ref() const formRef = ref()
const titleNameRef = ref() const titleNameRef = ref()
@ -512,7 +598,22 @@ const { getList } = tableMethodsRef.value
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { if (val == 'add') {
// //
if(props.isOpenSearchTable){
searchTableFormType.value = 'create'
//
const item = props.searchTableSchema.formSchema[0]
opensearchTable(
item.field, item?.componentProps?.searchField,
item?.componentProps?.searchTitle,
item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchPage,
item?.componentProps?.searchCondition,
item?.componentProps?.multiple,
undefined,undefined
)
}else{
openForm('create') openForm('create')
}
} else if (val == 'import') { } else if (val == 'import') {
// //
handleImport() handleImport()
@ -559,7 +660,7 @@ const submitForm = async (formType, data) => {
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
if (!rs) return if (!rs) return
if (formType === 'create') { if (formType === 'create') {
await props.apiCreate(data) await props.apiCreate(data.list.split(","))
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await props.apiUpdate(data) await props.apiUpdate(data)

20
src/views/mes/workstation/index.vue

@ -53,12 +53,15 @@
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" <Detail ref="detailRef"
:isBasic="false" :isBasic="false"
:isOpenSearchTable="true"
:apiCreate="tabsCreateApi"
:apiDelete="tabsDeleteApi"
:allSchemas="Workstation.allSchemas" :allSchemas="Workstation.allSchemas"
:detailAllSchemas="detailAllSchemas" :detailAllSchemas="detailAllSchemas"
:searchTableSchema="tmpPopList"
:detailAllSchemasRules="WorkstationRules" :detailAllSchemasRules="WorkstationRules"
:apiPage="apiPage" :apiPage="apiPage"
:tabs="TabsList" :tabs="TabsList"
:apiDelete=tabsDeleteApi
@changeTabs="changeTabs" @changeTabs="changeTabs"
:detailButtonIsShowAdd="true" :detailButtonIsShowAdd="true"
:detailButtonIsShowDelete="true" :detailButtonIsShowDelete="true"
@ -67,7 +70,7 @@
/> />
<BasicForm <BasicForm
ref="teamListRef" ref="teamListRef"
:formAllSchemas="popList.allSchemas" :formAllSchemas="tmpPopList"
:isBusiness="false" :isBusiness="false"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -83,7 +86,7 @@ import {
TabsList, TabsList,
Team, Team,
Workstation, Workstation,
WorkstationRules, popList WorkstationRules, teamPopList,equipmentPopList,processPopList,stepPopList
} from './workstation.data' } from './workstation.data'
import * as WorkstationApi from '@/api/mes/workstation' import * as WorkstationApi from '@/api/mes/workstation'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -95,9 +98,9 @@ import {
import Detail from './components/Detail.vue' import Detail from './components/Detail.vue'
defineOptions({ name: 'Workstation' }) defineOptions({ name: 'Workstation' })
let tabsDeleteApi = WorkstationApi.deleteTeamRelation let tabsDeleteApi = WorkstationApi.deleteTeamRelation
let tabsCreateApi = WorkstationApi.createTeamRelation
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const teamRef = ref()
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
@ -270,6 +273,7 @@ const openDetail = (row: any, titleName: any, titleValue: any) => {
const detailAllSchemas = ref(Team.allSchemas) const detailAllSchemas = ref(Team.allSchemas)
const apiPage = ref(WorkstationApi.getTeamPage) const apiPage = ref(WorkstationApi.getTeamPage)
const tableKey = ref("Team"); const tableKey = ref("Team");
let tmpPopList = teamPopList.allSchemas
// tabs // tabs
const changeTabs = (data) =>{ const changeTabs = (data) =>{
tableKey.value = data.prop tableKey.value = data.prop
@ -277,18 +281,26 @@ const changeTabs = (data) =>{
apiPage.value = WorkstationApi.getTeamPage apiPage.value = WorkstationApi.getTeamPage
detailAllSchemas.value = Team.allSchemas detailAllSchemas.value = Team.allSchemas
tabsDeleteApi = WorkstationApi.deleteTeamRelation tabsDeleteApi = WorkstationApi.deleteTeamRelation
tabsCreateApi = WorkstationApi.createTeamRelation
tmpPopList = teamPopList.allSchemas
}else if(data.prop == 'Equipment'){ }else if(data.prop == 'Equipment'){
apiPage.value = WorkstationApi.getEquipmentPage apiPage.value = WorkstationApi.getEquipmentPage
detailAllSchemas.value = Equipment.allSchemas detailAllSchemas.value = Equipment.allSchemas
tabsDeleteApi = WorkstationApi.deleteEquipmentRelation tabsDeleteApi = WorkstationApi.deleteEquipmentRelation
tabsCreateApi = WorkstationApi.createEquipmentRelation
tmpPopList = equipmentPopList.allSchemas
}else if(data.prop == 'Process'){ }else if(data.prop == 'Process'){
apiPage.value = WorkstationApi.getProcessPage apiPage.value = WorkstationApi.getProcessPage
detailAllSchemas.value = Process.allSchemas detailAllSchemas.value = Process.allSchemas
tabsDeleteApi = WorkstationApi.deleteProcessRelation tabsDeleteApi = WorkstationApi.deleteProcessRelation
tabsCreateApi = WorkstationApi.createProcessRelation
tmpPopList = processPopList.allSchemas
}else if(data.prop == 'Opersteps'){ }else if(data.prop == 'Opersteps'){
apiPage.value = WorkstationApi.getOperstepsPage apiPage.value = WorkstationApi.getOperstepsPage
detailAllSchemas.value = Opersteps.allSchemas detailAllSchemas.value = Opersteps.allSchemas
tabsDeleteApi = WorkstationApi.deleteOperstepsRelation tabsDeleteApi = WorkstationApi.deleteOperstepsRelation
tabsCreateApi = WorkstationApi.createOperstepsRelation
tmpPopList = stepPopList.allSchemas
} }
} }
const teamListRef = ref() const teamListRef = ref()

83
src/views/mes/workstation/mesOrderMonthMain.data.ts

@ -0,0 +1,83 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const MesOrderMonthMainRules = reactive({
})
export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备注',
field: 'remark',
sort: 'custom',
isTable: false
},
{
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: 'creator',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '主计划编码',
field: 'planMasterCode',
sort: 'custom',
isTable: false,
isSearch: true
},
{
label: '计划辅助编码',
field: 'planSubCode',
sort: 'custom',
isTable: false,
isSearch: true
},
{
label: '计划类型',
field: 'planType',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
}
},
{
label: '工厂编码',
field: 'factoryCode',
sort: 'custom',
isTable: false
},
{
label: '工厂名称',
field: 'factoryName',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

159
src/views/mes/workstation/workstation.data.ts

@ -1,10 +1,19 @@
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 WorkstationApi from "@/api/mes/workstation"; import * as WorkstationApi from "@/api/mes/workstation";
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data";
import * as WorkshopApi from "@/api/wms/workshop";
import {
Productionline
} from "@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data";
import * as ProductionlineApi from "@/api/wms/productionline";
// 表单校验 // 表单校验
export const WorkstationRules = reactive({ export const WorkstationRules = reactive({
code: [required] code: [required],
name: [required],
workshopCode:[required],
productionLineCode: [required]
}) })
export const TabsList = [{ export const TabsList = [{
label: "班组", label: "班组",
@ -43,14 +52,52 @@ export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([
field: 'workshopCode', field: 'workshopCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}, },
{ {
label: '生产线代码', label: '生产线代码',
field: 'productionLineCode', field: 'productionLineCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}, },
{ {
label: '班组代码', label: '班组代码',
@ -95,6 +142,25 @@ export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
@ -214,21 +280,96 @@ export const Opersteps = useCrudSchemas(reactive<CrudSchema[]>([
isTableForm:true, isTableForm:true,
} }
])) ]))
export const popList = useCrudSchemas(reactive<CrudSchema[]>([ export const teamPopList = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '选择班组',
field: 'list',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择选择班组', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '选择班组', // 查询弹窗标题
searchAllSchemas: Team.allSchemas, // 查询弹窗所需类
searchPage: WorkstationApi.checkTeamPageList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}
]))
export const equipmentPopList = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '选择设备',
field: 'list',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '选择设备', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '选择设备', // 查询弹窗标题
searchAllSchemas: Team.allSchemas, // 查询弹窗所需类
searchPage: WorkstationApi.checkEquipmentPageList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}
]))
export const processPopList = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '选择工序',
field: 'list',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '选择工序', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '选择工序', // 查询弹窗标题
searchAllSchemas: Team.allSchemas, // 查询弹窗所需类
searchPage: WorkstationApi.checkProcessPageList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}
]))
export const stepPopList = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '多选列表', label: '选择操作步骤',
field: 'popCheckList', field: 'list',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
form: { form: {
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
multiple:true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择仓库代码', // 输入框占位文本 searchListPlaceholder: '选择操作步骤', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 searchField: 'code', // 查询弹窗赋值字段
searchTitle: '仓库信息', // 查询弹窗标题 searchTitle: '选择操作步骤', // 查询弹窗标题
searchAllSchemas: Team.allSchemas, // 查询弹窗所需类 searchAllSchemas: Team.allSchemas, // 查询弹窗所需类
searchPage: WorkstationApi.getTeamPage, // 查询弹窗所需分页方法 searchPage: WorkstationApi.checkOperstepsPageList, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key: 'available', key: 'available',
value: 'TRUE', value: 'TRUE',

864
src/views/qms/basicDataManage/inspectionPlan/addForm.vue

@ -0,0 +1,864 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
:vLoading="formLoading"
>
<div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px">
<!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> -->
<el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef">
<el-row>
<el-col :span="12">
<el-form-item label="编码" prop="code">
<el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="data.description" placeholder="请填写描述" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="版本" prop="version">
<el-input v-model="data.version" placeholder="请填写版本" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs
v-model="editableTabsValue"
editable
class="demo-tabs"
@edit="handleTabsEdit"
type="border-card"
tab-position="left"
:stretch="false"
>
<el-tab-pane
v-for="item in data.process"
:key="item.name"
:label="item.description"
:name="item.name"
>
<div class="small-title">检验工序</div>
<!-- <Form
:ref="`formRefProcess`+index"
:schema="formAllSchemasProcess"
:is-col="true"
labelWidth="150px"
:rules="rules"
/> -->
<el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码" prop="code">
<el-input v-model="item.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验方案模板编码">
<el-input
v-model="item.inspectionCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="description">
<el-input v-model="item.description" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验特性编码">
<el-input
v-model="item.inspectionCharCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="small-title">检验特性</div>
<el-form :model="item" label-width="auto" :rules="rules" ref="formFeaturesRef">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="编码">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.code"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="inspectionCharacteristicsBaseVO.description">
<el-input v-model="item.inspectionCharacteristicsBaseVO.description" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="检验方法编码"
prop="inspectionCharacteristicsBaseVO.inspectionMethodCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
disabled
placeholder="请选择检验方法编码"
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethodCode',
null,
'检验方法',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="采样过程编码"
prop="inspectionCharacteristicsBaseVO.dynamicUpdateCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.dynamicUpdateCode"
disabled
placeholder="请选择采样过程编码"
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'采样过程编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="动态修改规则编码"
prop="inspectionCharacteristicsBaseVO.inspectionMethod"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethod"
disabled
placeholder="请选择动态修改规则编码"
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethod',
null,
'动态修改规则编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"
placeholder="请选择是否允许修改特征值"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="结果录入方式"
prop="inspectionCharacteristicsBaseVO.resultEntryMethod"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.resultEntryMethod"
placeholder="请选择结果录入方式"
>
<el-option
v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY
)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="特征类型" prop="inspectionCharacteristicsBaseVO.featureType">
<!-- <el-input v-model="item.featureType" /> -->
<el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型"
@change="changeFeatureType"
>
<el-option
v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE
)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item
label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
placeholder="请选择是否设定上限"
@change="changeIsCapping"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
label="是否设定下限"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
placeholder="请选择是否设定下限"
@change="changeLowlimit"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="下限值"
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsTarget"
label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
placeholder="请选择是否设定目标值"
@change="changeIsTarget"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="小数位"
prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="选择集编码"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
disabled
placeholder="请选择选择集编码"
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'quantifyQuantifyCode',
null,
'选择集编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false">
<div style="padding: 0px 20px">
<el-form ref="nameRef" :model="nameForm">
<el-form-item
:rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"
prop="name"
>
<el-input v-model="nameForm.name" style="width: 240px" placeholder="请输入名称" />
</el-form-item>
</el-form>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick1" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
import { SearchTable } from '@/components/SearchTable'
import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data'
import * as SamplingProcessApi from '@/api/qms/samplingProcess'
const message = useMessage() //
const props = defineProps({
//
basicFormWidth: {
type: String,
default: ''
},
//
formAllSchemasFeatures: {
type: Object,
required: true,
default: null
},
//
formAllSchemasProcess: {
type: Object,
required: true,
default: null
},
//
formAllSchemasMain: {
type: Object,
required: true,
default: null
},
//
footButttondata: {
type: Array,
required: false,
default: null
}
})
const { t } = useI18n() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const dialogWidth = ref()
const formMainRef = ref()
const formFeaturesRef = ref()
const formProcessRef = ref()
const data = ref({
code: '',
description: '',
version: '',
process: []
})
const isYesList = [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
}
]
const dialogVisibleName = ref(false)
const nameForm = ref({
name: ''
})
const nameRef = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }],
version: [{ required: true, message: '请填写版本', trigger: 'blur' }],
inspectionCode: [{ required: true, message: '请选择检验方案模板编码', trigger: 'blur' }],
sequenceCode: [{ required: true, message: '请填写顺序号', trigger: 'blur' }],
inspectionCharCode: [{ required: true, message: '请选择检验特性编码', trigger: 'blur' }],
'inspectionCharacteristicsBaseVO.description': [
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethodCode': [
{ required: true, message: '请选择检验方法编码', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.dynamicUpdateCode': [
{ required: true, message: '请选择采样过程编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethod': [
{ required: true, message: '请选择动态修改规则编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isCanUpdate': [
{ required: true, message: '请选择是否允许修改特征值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isDestructionInspection': [
{ required: true, message: '请选择是否破坏性检验', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.resultEntryMethod': [
{ required: true, message: '请选择结果录入方式', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.featureType': [
{ required: true, message: '请选择特征类型', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsCapping': [
{ required: true, message: '请选择是否设定上限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsLowlimit': [
{ required: true, message: '请选择是否设定下限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsTarget': [
{ required: true, message: '请选择是否设定目标值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyTarget': [
{ required: true, message: '请输入目标值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyCapping': [
{ required: true, message: '请输入上限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [
{ required: true, message: '请输入下限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyUom': [
{ required: true, message: '请选择计量单位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyDecimal': [
{ required: true, message: '请输入小数位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [
{ required: true, message: '请输入选择集编码', trigger: 'blur' }
]
})
/** 打开弹窗 */
let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true
if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
if (row) {
data.value = row
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
})
data.value.process = list
} else {
data.value = {
code: '',
description: '',
version: '',
process: []
}
}
tabIndex = data.value.process.length + 1
}
defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus'
const editableTabsValue = ref('1')
// const editableTabs = ref([])
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') {
nameForm.value.name = ''
dialogVisibleName.value = true
} else if (action === 'remove') {
const tabs = data.value.process
let activeName = editableTabsValue.value
if (activeName === targetName) {
tabs.forEach((tab, index) => {
if (tab.name === targetName) {
const nextTab = tabs[index + 1] || tabs[index - 1]
if (nextTab) {
activeName = nextTab.name
}
}
})
}
editableTabsValue.value = activeName
data.value.process = tabs.filter((tab) => tab.name !== targetName)
}
}
/** 修改名称时间 */
const buttonBaseClick1 = (val) => {
//
if (val == 'save') {
if (!nameRef.value) return
nameRef.value.validate((valid, fields) => {
if (valid) {
const newTabName = `${++tabIndex}`
data.value.process.push({
description: nameForm.value.name,
name: newTabName,
inspectionCode: '',
sequenceCode: '',
inspectionCharCode: '',
inspectionCharacteristicsBaseVO: {
describe: '',
inspectionMethodCode: '',
dynamicUpdateCode: '',
inspectionMethod: '',
isCanUpdate: '',
isDestructionInspection: '',
resultEntryMethod: '',
featureType: '',
quantifyIsCapping: '',
quantifyIsLowlimit: '',
quantifyTarget: '',
quantifyCapping: '',
quantifyLowlimit: '',
quantifyUom: '',
quantifyDecimal: '',
quantifyQuantifyCode: ''
}
})
console.log(data.value.process)
editableTabsValue.value = newTabName
dialogVisibleName.value = false
} else {
console.log('error submit!')
return false
}
})
}
//
else if (val == 'close') {
dialogVisibleName.value = false
}
}
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
//
const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => {
// console.log(TableBaseForm_Ref.value)
let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists)
.then(() => {
return true
})
.catch(() => {
return false
})
}
const submitForm = async () => {
try {
const validateForm1 = await validateForm(formProcessRef.value)
console.log(validateForm1)
await formMainRef.value.validate()
if (!data.value.process || data.value.process.length == 0) {
message.error(`请添加工序`)
return;
}
const bol1 = await validateForm(formProcessRef.value)
const bol2 = await validateForm(formFeaturesRef.value)
if (!bol1 || !bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`)
return;
}
if (formType.value == 'create') {
//
emit('submitForm', formType.value, data)
} else {
//
emit('submitForm', formType.value, data)
}
} catch {
console.log(111)
}
}
/** 弹窗按钮 */
let Butttondata: any = []
if (props.footButttondata) {
Butttondata = props.footButttondata
} else {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
//
const changeFeatureType = (e) => {
console.log(e)
}
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
console.log(988, row)
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i = 0; i < searchCondition.length; i++) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (
_searchCondition[searchCondition[i].key] == '' ||
_searchCondition[searchCondition[i].key] == undefined
) {
isNull = true
}
if (isNull) {
message.warning(
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!'
)
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
console.log(row)
data.value.process.forEach((item) => {
if (item.description == row.description) {
item.inspectionCharacteristicsBaseVO[formField] = val[0].code
}
})
// row.inspectionCharacteristicsBaseVO.inspectionMethodCode = val[0].code
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
//
const changeIsCapping = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
//
const changeLowlimit = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
}
//
const changeIsTarget = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
}
</script>
<style scoped>
.small-title {
font-weight: bold;
padding: 0px 10px 10px;
color: #1a8bfc;
font-size: 16px;
}
</style>
<style>
.el-tabs--left .el-tabs__header.is-left {
min-height: 700px !important;
min-width: 150px !important;
}
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left {
min-width: 120px !important;
}
</style>

197
src/views/qms/basicDataManage/inspectionPlan/index.vue

@ -0,0 +1,197 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="InspectionTemplateMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InspectionTemplateMain.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 #reqCode="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.reqCode)">
<span>{{ row.reqCode }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<AddForm
ref="basicFormRef"
basicFormWidth="80"
:formAllSchemasFeatures="InspectionTemplateFeatures.allSchemas"
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas"
:rules="InspectionTemplateRules"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="true"
:allSchemas="InspectionTemplateMain.allSchemas"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/agv-locationrelation/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './inspectionPlan.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import AddForm from './addForm.vue'
import * as InspectionProcessPageApi from '@/api/qms/inspectionPlan'
defineOptions({ name: 'AgvLocationrelation' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(InspectionTemplateMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: InspectionProcessPageApi.inspectionTemplatePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:agv-locationrelation:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:agv-locationrelation:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:agv-locationrelation: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:'qms:inspectionTemplate:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'qms:inspectionTemplate: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 submitForm = async (formType,data) => {
console.log(data.value)
if (formType === 'create') {
await InspectionProcessPageApi.inspectionTemplateCreat(data.value)
message.success(t('common.createSuccess'))
} else {
await InspectionProcessPageApi.inspectionTemplateUpdate(data.value)
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, 'basicAgvLocationrelation')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await InspectionProcessPageApi.inspectionTemplateDelete(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>
./inspectionPlan.data

208
src/views/qms/basicDataManage/inspectionTemplate/agvLocationrelation.data.ts → src/views/qms/basicDataManage/inspectionPlan/inspectionPlan.data.ts

@ -1,157 +1,8 @@
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 AreaApi from '@/api/wms/areabasic'
import { Area } from '@/views/wms/basicDataManage/factoryModeling/areabasic/areabasic.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
let inspectionProcessPage = await InspectionProcessPageApi.getInspectionProcessPage()
inspectionProcessPage = inspectionProcessPage.list
// 表单校验 // 表单校验
export const AgvLocationrelationRules = reactive({
positionCode: [
{ required: true, message: '请填写AGV点位', trigger: 'change' }
],
positionArea: [
{ required: true, message: '请填写AGV库区', trigger: 'change' }
],
wmsArea: [
{ required: true, message: '请填写WMS库区', trigger: 'change' }
],
wmsPosition: [
{ required: true, message: '请填写WMS库位', trigger: 'change' }
]
})
export const AgvLocationrelation = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'reqCode',
sort: 'custom',
isSearch: true,
isForm: false,
},
{
label: 'AGV点位',
field: 'positionCode',
sort: 'custom',
isSearch: false,
},
{
label: 'AGV库区',
field: 'positionArea',
sort: 'custom',
isSearch: false,
},
{
label: 'WMS库区',
field: 'wmsArea',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库区代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库区信息', // 查询弹窗标题
searchAllSchemas: Area.allSchemas, // 查询弹窗所需类
searchPage: AreaApi.getAreaPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: 'WMS库位',
field: 'wmsPosition',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库位代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'areaCode',
value: "wmsArea",
message: '请选择库区代码!',
isMainValue: true
}]
}
}
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
isSearch: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: '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')]
}
},
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const InspectionTemplateRules = reactive({ export const InspectionTemplateRules = reactive({
description: [ description: [
{ required: true , message: '请填写描述', trigger: 'blur' } { required: true , message: '请填写描述', trigger: 'blur' }
@ -237,6 +88,15 @@ export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '版本', label: '版本',
field: 'version', field: 'version',
sort: 'custom', sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
} }
])) ]))
export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([ export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
@ -260,16 +120,6 @@ export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '检验方案模板编码', label: '检验方案模板编码',
field: 'inspectionCode', field: 'inspectionCode',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{ },{
label: '顺序号', label: '顺序号',
field: 'sequenceCode', field: 'sequenceCode',
@ -277,16 +127,6 @@ export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '检验特性编码', label: '检验特性编码',
field: 'inspectionCharCode', field: 'inspectionCharCode',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
} }
])) ]))
export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([ export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
@ -309,44 +149,14 @@ export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
label: '检验方法编码', label: '检验方法编码',
field: 'inspectionMethodCode', field: 'inspectionMethodCode',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{ },{
label: '采样过程编码', label: '采样过程编码',
field: 'dynamicUpdateCode', field: 'dynamicUpdateCode',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{ },{
label: '动态修改规则编码', label: '动态修改规则编码',
field: 'inspectionMethod', field: 'inspectionMethod',
sort: 'custom', sort: 'custom',
form:{
component:'Select',
api: () => inspectionProcessPage,
componentProps:{
optionsAlias: {
labelField: 'description',
valueField: 'id'
}
}
}
},{ },{
label: '是否允许修改特征值', label: '是否允许修改特征值',
field: 'isCanUpdate', field: 'isCanUpdate',

652
src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

@ -8,20 +8,20 @@
> >
<div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px"> <div style="max-height: 60vh; overflow-y: auto; padding: 0px 20px">
<!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> --> <!-- <Form ref="formRefMain" :schema="formAllSchemasMain" :is-col="true" :rules="rules" /> -->
<el-form :model="data" label-width="auto"> <el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="编码"> <el-form-item label="编码" prop="code">
<el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" /> <el-input v-model="data.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="描述"> <el-form-item label="描述" prop="description">
<el-input v-model="data.description" placeholder="请填写描述" /> <el-input v-model="data.description" placeholder="请填写描述" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="版本"> <el-form-item label="版本" prop="version">
<el-input v-model="data.version" placeholder="请填写版本" /> <el-input v-model="data.version" placeholder="请填写版本" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -50,89 +50,168 @@
labelWidth="150px" labelWidth="150px"
:rules="rules" :rules="rules"
/> --> /> -->
<el-form :model="item" label-width="auto"> <el-form :model="item" label-width="auto" :rules="rules" ref="formProcessRef">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="编码"> <el-form-item label="编码" prop="code">
<el-input v-model="item.code" placeholder="根据系统生成" :disabled="true" /> <el-input v-model="item.code" placeholder="根据系统生成" :disabled="true" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验方案模板编码"> <el-form-item label="检验方案模板编码">
<el-input v-model="item.inspectionCode" placeholder="根据系统生成" :disabled="true"/> <el-input
v-model="item.inspectionCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="描述"> <el-form-item label="描述" prop="description">
<el-input v-model="item.description" /> <el-input v-model="item.description" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="顺序号"> <el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" /> <el-input v-model="item.sequenceCode" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验特性编码"> <el-form-item label="检验特性编码">
<el-input v-model="item.inspectionCharCode" placeholder="根据系统生成" :disabled="true"/> <el-input
v-model="item.inspectionCharCode"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div class="small-title">检验特性</div> <div class="small-title">检验特性</div>
<el-form :model="item" label-width="auto"> <el-form :model="item" label-width="auto" :rules="rules" ref="formFeaturesRef">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="编码"> <el-form-item label="编码">
<el-input v-model="item.inspectionCharacteristicsBaseVO.code" placeholder="根据系统生成" :disabled="true"/> <el-input
v-model="item.inspectionCharacteristicsBaseVO.code"
placeholder="根据系统生成"
:disabled="true"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="描述"> <el-form-item label="描述" prop="inspectionCharacteristicsBaseVO.description">
<el-input v-model="item.inspectionCharacteristicsBaseVO.description" /> <el-input v-model="item.inspectionCharacteristicsBaseVO.description" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验方法编码"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode" placeholder="请选择检验方法编码"> label="检验方法编码"
<el-option prop="inspectionCharacteristicsBaseVO.inspectionMethodCode"
v-for="item in inspectionProcessList" >
:key="item.id" <div style="display: flex; width: 100%">
:label="item.description" <el-input
:value="item.id" v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
disabled
placeholder="请选择检验方法编码"
/> />
</el-select> <el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethodCode',
null,
'检验方法',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="采样过程编码"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionProcessPage" placeholder="请选择采样过程编码"> label="采样过程编码"
<el-option prop="inspectionCharacteristicsBaseVO.dynamicUpdateCode"
v-for="item in inspectionProcessList" >
:key="item.id" <div style="display: flex; width: 100%">
:label="item.description" <el-input
:value="item.id" v-model="item.inspectionCharacteristicsBaseVO.dynamicUpdateCode"
disabled
placeholder="请选择采样过程编码"
/> />
</el-select> <el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'采样过程编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="动态修改规则编码"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.inspectionMethod" placeholder="请选择动态修改规则编码"> label="动态修改规则编码"
<el-option prop="inspectionCharacteristicsBaseVO.inspectionMethod"
v-for="item in inspectionProcessList" >
:key="item.id" <div style="display: flex; width: 100%">
:label="item.description" <el-input
:value="item.id" v-model="item.inspectionCharacteristicsBaseVO.inspectionMethod"
disabled
placeholder="请选择动态修改规则编码"
/> />
</el-select> <el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'inspectionMethod',
null,
'动态修改规则编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否允许修改特征值"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate" placeholder="请选择是否允许修改特征值"> label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"
placeholder="请选择是否允许修改特征值"
>
<el-option <el-option
v-for="item in isYesList" v-for="item in isYesList"
:key="item.value" :key="item.value"
@ -143,10 +222,18 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="结果录入方式"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.resultEntryMethod" placeholder="请选择结果录入方式"> label="结果录入方式"
prop="inspectionCharacteristicsBaseVO.resultEntryMethod"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.resultEntryMethod"
placeholder="请选择结果录入方式"
>
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY)" v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY
)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -155,11 +242,17 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="特征类型"> <el-form-item label="特征类型" prop="inspectionCharacteristicsBaseVO.featureType">
<!-- <el-input v-model="item.featureType" /> --> <!-- <el-input v-model="item.featureType" /> -->
<el-select v-model="item.inspectionCharacteristicsBaseVO.featureType" placeholder="请选择特征类型"> <el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型"
@change="changeFeatureType"
>
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE)" v-for="dict in getStrDictOptions(
DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE
)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -168,9 +261,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item label="是否设定上限"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" placeholder="请选择是否设定上限"> label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
placeholder="请选择是否设定上限"
@change="changeIsCapping"
>
<el-option <el-option
v-for="item in isYesList" v-for="item in isYesList"
:key="item.value" :key="item.value"
@ -181,8 +281,25 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否设定下限"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" placeholder="请选择是否设定下限"> label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
label="是否设定下限"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
placeholder="请选择是否设定下限"
@change="changeLowlimit"
>
<el-option <el-option
v-for="item in isYesList" v-for="item in isYesList"
:key="item.value" :key="item.value"
@ -193,40 +310,94 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="目标值"> <el-form-item
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" /> label="下限值"
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上限值"> <el-form-item
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" /> prop="inspectionCharacteristicsBaseVO.quantifyIsTarget"
label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-select
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
placeholder="请选择是否设定目标值"
@change="changeIsTarget"
>
<el-option
v-for="item in isYesList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="下限值"> <el-form-item
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" /> label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="计量单位"> <el-form-item
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" /> <el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="小数位"> <el-form-item
label="小数位"
prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" /> <el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="选择集编码"> <el-form-item
<el-select v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" placeholder="请选择集编码"> label="选择集编码"
<el-option prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
v-for="item in inspectionProcessList" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"
:key="item.id" >
:label="item.description" <div style="display: flex; width: 100%">
:value="item.id" <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
disabled
placeholder="请选择选择集编码"
/> />
</el-select> <el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'quantifyQuantifyCode',
null,
'选择集编码',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
null,
item
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -240,12 +411,20 @@
</Dialog> </Dialog>
<Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false"> <Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false">
<div style="padding: 0px 20px"> <div style="padding: 0px 20px">
<el-input v-model="name" style="width: 240px" placeholder="请输入名称" /> <el-form ref="nameRef" :model="nameForm">
<el-form-item
:rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"
prop="name"
>
<el-input v-model="nameForm.name" style="width: 240px" placeholder="请输入名称" />
</el-form-item>
</el-form>
</div> </div>
<template #footer> <template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick1" /> <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick1" />
</template> </template>
</Dialog> </Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -253,21 +432,11 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { getCurrentInstance } from 'vue' import { getCurrentInstance } from 'vue'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate' import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
const inspectionProcessList = ref([]) import { SearchTable } from '@/components/SearchTable'
const isYesList = ref([]) import { SamplingProcess } from '@/views/qms/samplingProcess/samplingProcess.data'
onMounted(async()=>{ import * as SamplingProcessApi from '@/api/qms/samplingProcess'
let inspectionProcessPage = await InspectionProcessPageApi.getInspectionProcessPage() const message = useMessage() //
inspectionProcessList.value = inspectionProcessPage.list
console.log(inspectionProcessList)
isYesList.value =[{
value:0,
label:'是'
},{
value:1,
label:'否'
}]
})
const props = defineProps({ const props = defineProps({
// //
basicFormWidth: { basicFormWidth: {
@ -297,40 +466,106 @@ const props = defineProps({
type: Array, type: Array,
required: false, required: false,
default: null default: null
},
// rules
rules: {
type: Object,
required: true,
default: null
} }
}) })
const { t } = useI18n() // const { t } = useI18n() //
const dialogVisible = ref(true) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update -
const dialogWidth = ref() const dialogWidth = ref()
const formMainRef = ref()
const formFeaturesRef = ref()
const formProcessRef = ref()
const data = ref({ const data = ref({
code: '', code: '',
description: '', description: '',
version: '', version: '',
process: [] process: []
}) })
const isYesList = [
{
const dialogVisibleName = ref(false) value: true,
const name = ref('') label: '是'
const onSubmit = () => { },
console.log('submit!') {
value: false,
label: '否'
} }
]
const dialogVisibleName = ref(false)
const nameForm = ref({
name: ''
})
const nameRef = ref()
if (props.basicFormWidth) { if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%' dialogWidth.value = props.basicFormWidth + '%'
} else { } else {
dialogWidth.value = props.isBusiness ? '60%' : '40%' dialogWidth.value = props.isBusiness ? '60%' : '40%'
} }
const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }],
version: [{ required: true, message: '请填写版本', trigger: 'blur' }],
inspectionCode: [{ required: true, message: '请选择检验方案模板编码', trigger: 'blur' }],
sequenceCode: [{ required: true, message: '请填写顺序号', trigger: 'blur' }],
inspectionCharCode: [{ required: true, message: '请选择检验特性编码', trigger: 'blur' }],
'inspectionCharacteristicsBaseVO.description': [
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethodCode': [
{ required: true, message: '请选择检验方法编码', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.dynamicUpdateCode': [
{ required: true, message: '请选择采样过程编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.inspectionMethod': [
{ required: true, message: '请选择动态修改规则编码', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isCanUpdate': [
{ required: true, message: '请选择是否允许修改特征值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.isDestructionInspection': [
{ required: true, message: '请选择是否破坏性检验', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.resultEntryMethod': [
{ required: true, message: '请选择结果录入方式', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.featureType': [
{ required: true, message: '请选择特征类型', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsCapping': [
{ required: true, message: '请选择是否设定上限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsLowlimit': [
{ required: true, message: '请选择是否设定下限', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyIsTarget': [
{ required: true, message: '请选择是否设定目标值', trigger: ['blur', 'change'] }
],
'inspectionCharacteristicsBaseVO.quantifyTarget': [
{ required: true, message: '请输入目标值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyCapping': [
{ required: true, message: '请输入上限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [
{ required: true, message: '请输入下限值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyUom': [
{ required: true, message: '请选择计量单位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyDecimal': [
{ required: true, message: '请输入小数位', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [
{ required: true, message: '请输入选择集编码', trigger: 'blur' }
]
})
/** 打开弹窗 */ /** 打开弹窗 */
let tabIndex = 1
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true dialogVisible.value = true
if (titleName) { if (titleName) {
@ -338,17 +573,53 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
} else { } else {
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
} }
formType.value = type
if (row) {
data.value = row
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
//
if(item.quantifyIsCapping){
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
}else{
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
if(item.quantifyIsLowlimit){
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
}else{
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
if(item.quantifyIsTarget){
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
}else{
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
})
data.value.process = list
} else {
data.value = {
code: '',
description: '',
version: '',
process: []
}
}
tabIndex = data.value.process.length + 1
} }
defineExpose({ open, dialogVisible, formLoading }) // open defineExpose({ open, dialogVisible, formLoading }) // open
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'
let tabIndex = 1
const editableTabsValue = ref('1') const editableTabsValue = ref('1')
// const editableTabs = ref([]) // const editableTabs = ref([])
const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => { const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | 'add') => {
if (action === 'add') { if (action === 'add') {
name.value = '' nameForm.value.name = ''
dialogVisibleName.value = true dialogVisibleName.value = true
} else if (action === 'remove') { } else if (action === 'remove') {
const tabs = data.value.process const tabs = data.value.process
@ -370,11 +641,13 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
/** 修改名称时间 */ /** 修改名称时间 */
const buttonBaseClick1 = (val) => { const buttonBaseClick1 = (val) => {
// //
console.log(val)
if (val == 'save') { if (val == 'save') {
if (!nameRef.value) return
nameRef.value.validate((valid, fields) => {
if (valid) {
const newTabName = `${++tabIndex}` const newTabName = `${++tabIndex}`
data.value.process.push({ data.value.process.push({
description: name.value, description: nameForm.value.name,
name: newTabName, name: newTabName,
inspectionCode: '', inspectionCode: '',
sequenceCode: '', sequenceCode: '',
@ -390,6 +663,7 @@ const buttonBaseClick1 = (val) => {
featureType: '', featureType: '',
quantifyIsCapping: '', quantifyIsCapping: '',
quantifyIsLowlimit: '', quantifyIsLowlimit: '',
quantifyIsTarget: '',
quantifyTarget: '', quantifyTarget: '',
quantifyCapping: '', quantifyCapping: '',
quantifyLowlimit: '', quantifyLowlimit: '',
@ -397,12 +671,16 @@ const buttonBaseClick1 = (val) => {
quantifyDecimal: '', quantifyDecimal: '',
quantifyQuantifyCode: '' quantifyQuantifyCode: ''
} }
}) })
console.log(data.value.process) console.log(data.value.process)
editableTabsValue.value = newTabName editableTabsValue.value = newTabName
dialogVisibleName.value = false dialogVisibleName.value = false
} else {
console.log('error submit!')
return false
}
})
} }
// //
else if (val == 'close') { else if (val == 'close') {
@ -419,15 +697,53 @@ const buttonBaseClick = (val) => {
dialogVisible.value = false dialogVisible.value = false
} }
} }
//
const emit = defineEmits(['submitForm', 'searchTableSuccess'])
const validateForm = (formRef) => {
// console.log(TableBaseForm_Ref.value)
let _lists = formRef?.map((v) => v.validate())
return Promise.all(_lists)
.then(() => {
return true
})
.catch(() => {
return false
})
}
const submitForm = async () => { const submitForm = async () => {
// const data1= unref(formRefMain)?.formModel try {
// const data2= unref(formRefProcess)?.formModel const validateForm1 = await validateForm(formProcessRef.value)
// const data3= unref(formRefFeatures)?.formModel console.log(validateForm1)
// console.log(data1) await formMainRef.value.validate()
// console.log(data2) if (!data.value.process || data.value.process.length == 0) {
console.log(data.list) message.error(`请添加工序`)
return;
}
const bol1 = await validateForm(formProcessRef.value)
const bol2 = await validateForm(formFeaturesRef.value)
if (!bol1 || !bol2) {
message.error(`模板中有检验工序和检验特性未填写完全`)
return;
}
const arr = data.value.process.filter(item=>(!item.inspectionCharacteristicsBaseVO.quantifyIsCapping&&!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit&&!item.inspectionCharacteristicsBaseVO.quantifyIsTarget&&item.inspectionCharacteristicsBaseVO.featureType == 0))
console.log(arr)
if(arr&&arr.length>0){
const str = arr.map(item=>item.description).join(',')
message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`)
return;
}
if (formType.value == 'create') {
//
emit('submitForm', formType.value, data)
} else {
//
emit('submitForm', formType.value, data) emit('submitForm', formType.value, data)
} }
} catch {
console.log(111)
}
}
/** 弹窗按钮 */ /** 弹窗按钮 */
let Butttondata: any = [] let Butttondata: any = []
if (props.footButttondata) { if (props.footButttondata) {
@ -438,6 +754,128 @@ if (props.footButttondata) {
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //
] ]
} }
//
const changeFeatureType = (e) => {
console.log(e)
// if (e) {
// rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true
// } else {
// rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = false
// }
}
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
console.log(988, row)
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i = 0; i < searchCondition.length; i++) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (
_searchCondition[searchCondition[i].key] == '' ||
_searchCondition[searchCondition[i].key] == undefined
) {
isNull = true
}
if (isNull) {
message.warning(
searchCondition[i].message ? searchCondition[i].message : '前置条件未选择!'
)
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition
)
}
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
console.log(row)
data.value.process.forEach((item) => {
if (item.description == row.description) {
item.inspectionCharacteristicsBaseVO[formField] = val[0].code
}
})
// row.inspectionCharacteristicsBaseVO.inspectionMethodCode = val[0].code
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
//
const changeIsCapping = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
//
const changeLowlimit = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
}
//
const changeIsTarget = (e) => {
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
}
</script> </script>
<style scoped> <style scoped>
.small-title { .small-title {

95
src/views/qms/basicDataManage/inspectionTemplate/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="AgvLocationrelation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="InspectionTemplateMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -11,7 +11,7 @@
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="AgvLocationrelation.allSchemas" :allSchemas="InspectionTemplateMain.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
@ -39,16 +39,6 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<!-- <BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="AgvLocationrelationRules"
:formAllSchemas="AgvLocationrelation.allSchemas"
:apiUpdate="AgvLocationrelationApi.updateAgvLocationrelation"
:apiCreate="AgvLocationrelationApi.createAgvLocationrelation"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/> -->
<AddForm <AddForm
ref="basicFormRef" ref="basicFormRef"
basicFormWidth="80" basicFormWidth="80"
@ -56,12 +46,13 @@
:formAllSchemasProcess="InspectionTemplateProcess.allSchemas" :formAllSchemasProcess="InspectionTemplateProcess.allSchemas"
:formAllSchemasMain="InspectionTemplateMain.allSchemas" :formAllSchemasMain="InspectionTemplateMain.allSchemas"
:rules="InspectionTemplateRules" :rules="InspectionTemplateRules"
@submitForm="submitForm"
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail <Detail
ref="detailRef" ref="detailRef"
:isBasic="true" :isBasic="true"
:allSchemas="AgvLocationrelation.allSchemas" :allSchemas="InspectionTemplateMain.allSchemas"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -70,13 +61,13 @@
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { AgvLocationrelation,AgvLocationrelationRules,InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './agvLocationrelation.data' import { InspectionTemplateMain,InspectionTemplateProcess,InspectionTemplateFeatures,InspectionTemplateRules } from './inspectionTemplate.data'
import * as AgvLocationrelationApi from '@/api/wms/agvLocationrelation'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import AddForm from './addForm.vue' import AddForm from './addForm.vue'
import * as InspectionProcessPageApi from '@/api/qms/inspectionTemplate'
defineOptions({ name: 'AgvLocationrelation' }) defineOptions({ name: 'AgvLocationrelation' })
@ -86,16 +77,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(AgvLocationrelation.allSchemas.tableColumns) const tableColumns = ref(InspectionTemplateMain.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
@ -103,7 +85,7 @@ const updataTableColumns = (val) => {
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: AgvLocationrelationApi.getAgvLocationrelationPage // getListApi: InspectionProcessPageApi.inspectionTemplatePage //
}) })
// //
@ -112,8 +94,8 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:agv-locationrelation:create'}), // defaultButtons.defaultAddBtn({hasPermi:'wms:agv-locationrelation:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:agv-locationrelation:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'wms:agv-locationrelation:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:agv-locationrelation:export'}), // // defaultButtons.defaultExportBtn({hasPermi:'wms:agv-locationrelation:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -145,8 +127,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:agv-locationrelation:update'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:inspectionTemplate:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:agv-locationrelation:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'qms:inspectionTemplate:delete'}), //
] ]
// - // -
@ -165,23 +147,13 @@ const openForm = (type: string, row?: any) => {
} }
// form // form
const formsSuccess = async (formType,data) => { const submitForm = async (formType,data) => {
var isHave =AgvLocationrelation.allSchemas.formSchema.some(function (item) { console.log(data.value)
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') { if (formType === 'create') {
await AgvLocationrelationApi.createAgvLocationrelation(data) await InspectionProcessPageApi.inspectionTemplateCreat(data.value)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await AgvLocationrelationApi.updateAgvLocationrelation(data) await InspectionProcessPageApi.inspectionTemplateUpdate(data.value)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
@ -200,43 +172,13 @@ const handleDelete = async (id: number) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await AgvLocationrelationApi.deleteAgvLocationrelation(id) await InspectionProcessPageApi.inspectionTemplateDelete(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch {}
} }
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await AgvLocationrelationApi.exportAgvLocationrelation(tableObject.params)
download.excel(data, 'AGV库位转换.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: 'AGV库位转换导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
@ -250,7 +192,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await AgvLocationrelationApi.importTemplate()
}) })
</script> </script>

287
src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts

@ -0,0 +1,287 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const InspectionTemplateRules = reactive({
description: [
{ required: true , message: '请填写描述', trigger: 'blur' }
],
version: [
{ required: true , message: '请填写版本', trigger: 'blur' }
],
inspectionCode: [
{ required: true, message: '请选择检验方案模板编码', trigger: 'blur' }
],
sequenceCode: [
{ required: true, message: '请填写顺序号', trigger: 'blur' }
],
inspectionCharCode: [
{ required: true, message: '请选择检验特性编码', trigger: 'blur' }
],
describe: [
{ required: true, message: '请填写描述', trigger: 'blur' }
],
inspectionMethodCode: [
{ required: true, message: '请选择检验方法编码', trigger: 'blur' }
],
dynamicUpdateCode: [
{ required: true, message: '请选择采样过程编码', trigger: 'blur' }
],
inspectionMethod: [
{ required: true, message: '请选择动态修改规则编码', trigger: 'blur' }
],
isCanUpdate: [
{ required: true, message: '请选择是否允许修改特征值', trigger: 'blur' }
],
isDestructionInspection: [
{ required: true, message: '请选择是否破坏性检验', trigger: 'blur' }
],
resultEntryMethod: [
{ required: true, message: '请选择结果录入方式', trigger: 'blur' }
],
featureType: [
{ required: true, message: '请选择特征类型', trigger: 'blur' }
],
quantifyIsCapping: [
{ required: true, message: '请选择是否设定上限', trigger: 'blur' }
],
quantifyIsLowlimit: [
{ required: true, message: '请选择是否设定下限', trigger: 'blur' }
],
quantifyTarget: [
{ required: true, message: '请输入目标值', trigger: 'blur' }
],
quantifyCapping: [
{ required: true, message: '请输入上限值', trigger: 'blur' }
],
quantifyLowlimit: [
{ required: true, message: '请输入下限值', trigger: 'blur' }
],
quantifyquantifyUomLowlimit: [
{ required: true, message: '请选择计量单位', trigger: 'blur' }
],
quantifyDecimal: [
{ required: true, message: '请输入小数位', trigger: 'blur' }
],
quantifyQuantifyCode: [
{ required: true, message: '请输入选择集编码', trigger: 'blur' }
],
})
export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
sort: 'custom',
form:{
componentProps:{
disabled:true,
placeholder:'系统自动获取'
}
}
},
{
label: '描述',
field: 'description',
sort: 'custom',
},{
label: '版本',
field: 'version',
sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const InspectionTemplateProcess = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
sort: 'custom',
form:{
componentProps:{
disabled:true,
placeholder:'系统自动获取'
}
}
},
{
label: '描述',
field: 'description',
sort: 'custom',
isForm:false
},{
label: '检验方案模板编码',
field: 'inspectionCode',
sort: 'custom',
},{
label: '顺序号',
field: 'sequenceCode',
},{
label: '检验特性编码',
field: 'inspectionCharCode',
sort: 'custom',
}
]))
export const InspectionTemplateFeatures= useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'code',
sort: 'custom',
form:{
componentProps:{
disabled:true,
placeholder:'系统自动获取'
}
}
},
{
label: '描述',
field: 'describe',
sort: 'custom',
},{
label: '检验方法编码',
field: 'inspectionMethodCode',
sort: 'custom',
},{
label: '采样过程编码',
field: 'dynamicUpdateCode',
sort: 'custom',
},{
label: '动态修改规则编码',
field: 'inspectionMethod',
sort: 'custom',
},{
label: '是否允许修改特征值',
field: 'isCanUpdate',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '是否破坏性检验',
field: 'isDestructionInspection',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '结果录入方式',
field: 'resultEntryMethod',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY,
dictClass: 'string',
table: {
width: 150
},
},{
label: '特征类型',
field: 'featureType',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_CHARACTERISTICS_FEATURE_TYPE,
dictClass: 'string',
table: {
width: 150
},
},{
label: '是否设定上限',
field: 'quantifyIsCapping',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '是否设定下限',
field: 'quantifyIsLowlimit',
sort: 'custom',
form:{
component:'Select',
api: () => [{
value:0,
label:'是'
},{
value:1,
label:'否'
}],
componentProps:{
optionsAlias: {
labelField: 'label',
valueField: 'value'
}
}
}
},{
label: '目标值',
field: 'quantifyTarget',
sort: 'custom',
},{
label: '上限值',
field: 'quantifyCapping',
sort: 'custom',
},{
label: '下限值',
field: 'quantifyLowlimit',
sort: 'custom',
},{
label: '计量单位',
field: 'quantifyUom',
sort: 'custom',
},{
label: '小数位',
field: 'quantifyDecimal',
sort: 'custom',
},{
label: '选择集编码',
field: 'quantifyQuantifyCode',
sort: 'custom',
form:{
component:'Select'
}
}
]))

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

@ -99,9 +99,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:sampleCode:create'}), // defaultButtons.defaultAddBtn({hasPermi:'qms:sampleCode:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:sampleCode:import'}), // defaultButtons.defaultImportBtn({hasPermi:'qms:sampleCode:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:sampleCode:export'}), // defaultButtons.defaultExportBtn({hasPermi:'qms:sampleCode:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -133,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:sampleCode:update'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:sampleCode:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:sampleCode:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'qms:sampleCode:delete'}), //
] ]
// - // -

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

@ -24,7 +24,7 @@ export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
}, },
{ {
label: '批量下限', label: '批量下限',
field: 'batchLow limiting', field: 'batchLowLimiting',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
form: { form: {
@ -81,6 +81,11 @@ export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'SelectV2'
},
}, },
{ {
label: '创建时间', label: '创建时间',

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

@ -99,10 +99,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'wms:samplingProcess:create'}), // defaultButtons.defaultAddBtn({hasPermi:'qms:samplingProcess:create'}), //
defaultButtons.defaultAddBtn(null), // defaultButtons.defaultImportBtn({hasPermi:'qms:samplingProcess:import'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingProcess:import'}), // defaultButtons.defaultExportBtn({hasPermi:'qms:samplingProcess:export'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingProcess:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -134,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:samplingProcess:update'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:samplingProcess:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:samplingProcess:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingProcess:delete'}), //
] ]
// - // -

5
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -64,6 +64,11 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否可用', label: '是否可用',
field: 'available', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'SelectV2'
},
}, },
{ {
label: '创建时间', label: '创建时间',

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

@ -99,9 +99,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:samplingScheme:create'}), // defaultButtons.defaultAddBtn({hasPermi:'qms:samplingScheme:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingScheme:import'}), // defaultButtons.defaultImportBtn({hasPermi:'qms:samplingScheme:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingScheme:export'}), // defaultButtons.defaultExportBtn({hasPermi:'qms:samplingScheme:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -133,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:samplingScheme:update'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:samplingScheme:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:samplingScheme:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingScheme:delete'}), //
] ]
// - // -

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

@ -4,7 +4,7 @@ import { dateFormatter } from '@/utils/formatTime'
// 表单校验 // 表单校验
export const SamplingSchemeRules = reactive({ export const SamplingSchemeRules = reactive({
code: [required], code: [required],
status: [required], // status: [required],
available: [required], available: [required],
}) })
@ -29,19 +29,16 @@ export const SamplingScheme = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
}, },
{ {
label: '状态', label: '是否可用',
field: 'status', field: 'available',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true, isSearch: true,
form: { form: {
component: 'Radio' component: 'SelectV2'
}, },
}, },
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',

38
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue

@ -28,6 +28,8 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef" <BasicForm ref="formRef"
@success="getList" @success="getList"
:isOpenSearchTable="true"
:indexTableColumn="1"
:rules="PurchaseMainRules" :rules="PurchaseMainRules"
:formAllSchemas="PurchaseMain.allSchemas" :formAllSchemas="PurchaseMain.allSchemas"
:tableAllSchemas="PurchaseDetail.allSchemas" :tableAllSchemas="PurchaseDetail.allSchemas"
@ -96,26 +98,40 @@
if (type == 'tableForm') { if (type == 'tableForm') {
// //
if(formField == 'itemCode'){ if(formField == 'itemCode'){
let subList = tableData.value const repeatCode = [] //
let flag = false; if(tableData.value.length > 0){
if(subList.length > 0){ tableData.value.forEach((item) => {
subList.forEach((item) => { const findIndex = val.findIndex(valItem=>valItem['itemCode']==item.itemCode)
if(item.itemCode == val[0]['itemCode']){ if(findIndex > -1){
flag = true; val.splice(findIndex,1)
repeatCode.push(item.itemCode)
} }
}) })
} }
if(flag){ if(repeatCode.length>0){
message.warning("物料代码已经存在"); message.warning(`物料代码${repeatCode.join(',')}已经存在`);
return;
} }
row[formField] = val[0][searchField] if(val.length>0){
val.forEach(item=>{
const newRow = {...row}
newRow[formField] = item[searchField]
let lineNumber = 1
if(tableData.value.length>0){
lineNumber = 1+(tableData.value[tableData.value.length-1]['lineNumber'])
}
newRow['lineNumber'] = lineNumber
newRow['uom'] = item['supplierUom']
tableData.value.push(newRow)
})
const itemCodes = val.map(valItem=>valItem['itemCode'])
await ItembasicApi.getItembasicPage({ await ItembasicApi.getItembasicPage({
code: row['itemCode'] code: itemCodes.join(',')
}).then(res => { }).then(res => {
row['uom'] = res.list[0].uom row['uom'] = res.list[0].uom
}) })
} }
}
} else { } else {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]

8
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/purchaseMain.data.ts

@ -390,6 +390,7 @@ export const PurchaseDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
tableForm:{ tableForm:{
disabled:true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
} }
}, },
@ -400,6 +401,7 @@ export const PurchaseDetail = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
tableForm:{ tableForm:{
multiple:true,//多选
isInpuFocusShow: true, isInpuFocusShow: true,
searchListPlaceholder: '请选择供应商物料', searchListPlaceholder: '请选择供应商物料',
searchField: 'itemCode', searchField: 'itemCode',
@ -848,9 +850,9 @@ export const PurchaseDetailRules = reactive({
orderQty: [ orderQty: [
{ required: true, message: '请输入订单数量', trigger: 'blur' } { required: true, message: '请输入订单数量', trigger: 'blur' }
], ],
uom: [ // uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' } // { required: true, message: '请选择计量单位', trigger: 'change' }
], // ],
available: [ available: [
{ required: true, message: '请选择是否可用', trigger: 'change' } { required: true, message: '请选择是否可用', trigger: 'change' }
], ],

Loading…
Cancel
Save