Browse Source

工装入库创建点检单

hella_online_20240829
ljlong_2630 2 months ago
parent
commit
0021388092
  1. 6
      src/api/eam/basicEamWorkshop/index.ts
  2. 59
      src/api/eam/toolChangedRecord/index.ts
  3. 79
      src/api/eam/toolSigning/index.ts
  4. 192
      src/views/eam/equipmentAccounts/equipmentAccounts.data.ts
  5. 27
      src/views/eam/equipmentAccounts/index.vue
  6. 3
      src/views/eam/equipmentMaintenanceRecordMain/equipmentMaintenanceRecordMain.data.ts
  7. 24
      src/views/eam/equipmentManufacturer/equipmentManufacturer.data.ts
  8. 46
      src/views/eam/equipmentSigning/equipmentSigning.data.ts
  9. 19
      src/views/eam/equipmentSigning/index.vue
  10. 23
      src/views/eam/equipmentSupplier/equipmentSupplier.data.ts
  11. 1
      src/views/eam/planSpotCheck/planSpotCheck.data.ts
  12. 28
      src/views/eam/toolAccounts/index.vue
  13. 208
      src/views/eam/toolAccounts/toolAccounts.data.ts
  14. 244
      src/views/eam/toolChangedRecord/index.vue
  15. 110
      src/views/eam/toolChangedRecord/toolChangedRecord.data.ts
  16. 280
      src/views/eam/toolSigning/index.vue
  17. 487
      src/views/eam/toolSigning/toolSigning.data.ts

6
src/api/eam/basicEamWorkshop/index.ts

@ -67,3 +67,9 @@ export const importTemplate = () => {
export const updateEnableCode = async (data: BasicEamWorkshopVO) => {
return await request.post({ url: `/eam/basic-eam-workshop/ables` , data })
}
// 查询EAM车间列表
export const getBasicEamWorkshopNoPage = async (params) => {
return await request.get({ url: `/eam/basic-eam-workshop/noPage`, params })
}

59
src/api/eam/toolChangedRecord/index.ts

@ -0,0 +1,59 @@
import request from '@/config/axios'
export interface ToolChangedRecordVO {
id: number
code: string
name: string
statusBefore: string
statusAfter: string
operator: number
operateTime: Date
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询设备变更记录列表
export const getToolChangedRecordPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/tool-changed-record/senior', data })
} else {
return await request.get({ url: `/eam/tool-changed-record/page`, params })
}
}
// 查询设备变更记录详情
export const getToolChangedRecord = async (id: number) => {
return await request.get({ url: `/eam/tool-changed-record/get?id=` + id })
}
// 新增设备变更记录
export const createToolChangedRecord = async (data: ToolChangedRecordVO) => {
return await request.post({ url: `/eam/tool-changed-record/create`, data })
}
// 修改设备变更记录
export const updateToolChangedRecord = async (data: ToolChangedRecordVO) => {
return await request.put({ url: `/eam/tool-changed-record/update`, data })
}
// 删除设备变更记录
export const deleteToolChangedRecord = async (id: number) => {
return await request.delete({ url: `/eam/tool-changed-record/delete?id=` + id })
}
// 导出设备变更记录 Excel
export const exportToolChangedRecord = async (params) => {
return await request.download({ url: `/eam/tool-changed-record/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/tool-changed-record/get-import-template' })
}

79
src/api/eam/toolSigning/index.ts

@ -0,0 +1,79 @@
import request from '@/config/axios'
export interface ToolSigningVO {
id: number
toolCode: string
operationDate: Date
operationer: string
operationDept: string
telephone: string
supplierCode: string
supplierPeople: string
supplierTelephone: string
status: string
approver: number
approveContent: string
approveTime: Date
autoExamine: string
autoAgree: string
directCreateRecord: string
storageLocation: string
factoryAreaCode: string
workshopCode: string
lineCode: string
processCode: string
workstationCode: string
departmentCode: string
remark: string
siteId: string
available: string
deletionTime: Date
deleterId: byte[]
concurrencyStamp: number
}
// 查询工装到货签收记录列表
export const getToolSigningPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/tool-signing/senior', data })
} else {
return await request.get({ url: `/eam/tool-signing/page`, params })
}
}
// 查询工装到货签收记录详情
export const getToolSigning = async (id: number) => {
return await request.get({ url: `/eam/tool-signing/get?id=` + id })
}
// 新增工装到货签收记录
export const createToolSigning = async (data: ToolSigningVO) => {
return await request.post({ url: `/eam/tool-signing/create`, data })
}
// 新增工装到货签收记录
export const createToolSigningNew = async (data: ToolSigningVO) => {
return await request.post({ url: `/eam/tool-signing/createNew`, data })
}
// 修改工装到货签收记录
export const updateToolSigning = async (data: ToolSigningVO) => {
return await request.put({ url: `/eam/tool-signing/update`, data })
}
// 删除工装到货签收记录
export const deleteToolSigning = async (id: number) => {
return await request.delete({ url: `/eam/tool-signing/delete?id=` + id })
}
// 导出工装到货签收记录 Excel
export const exportToolSigning = async (params) => {
return await request.download({ url: `/eam/tool-signing/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/tool-signing/get-import-template' })
}

192
src/views/eam/equipmentAccounts/equipmentAccounts.data.ts

@ -11,12 +11,18 @@ import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import * as ConfigApi from '@/api/infra/config'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
import * as UserApi from '@/api/system/user'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import * as BasicEamWorkshopApi from '@/api/eam/basicEamWorkshop'
import { BasicEamWorkshop } from '@/views/eam/basicEamWorkshop/basicEamWorkshop.data'
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
export interface User {
id: number,
nickname: string
}
const workshopNoPage = await BasicEamWorkshopApi.getBasicEamWorkshopNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
@ -26,6 +32,13 @@ const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
}
const allDeptList = await DeptApi.getSimpleDeptList();
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(allDeptList)
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 表单校验
export const EquipmentAccountsRules = reactive({
@ -113,13 +126,41 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
label: '使用部门',
field: 'useDept',
sort: 'custom',
isSearch: false
isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
}
}
},
{
label: '负责人',
field: 'principal',
sort: 'custom',
isSearch: false
isSearch: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '负责人联系方式',
@ -233,13 +274,38 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
label: '采购部门',
field: 'purchaseDept',
sort: 'custom',
isSearch: false
isSearch: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
}
}
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
isSearch: false
isSearch: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '出厂日期',
@ -378,8 +444,8 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchAllSchemas: BasicEamWorkshop.allSchemas, // 查询弹窗所需类
searchPage: BasicEamWorkshopApi.getBasicEamWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
@ -388,58 +454,58 @@ export const EquipmentAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '产线编号',
// field: 'lineCode',
// sort: 'custom',
// isSearch: true,
// isDetail: false,
// isForm: false,
// isTable: true,
// isTableForm: false,
// search: {
// component: 'Select',
// componentProps: {
// options: productionlineNoPage,
// optionsAlias: {
// labelField: 'name',
// valueField: 'code'
// },
// filterable: true,
// }
// },
// formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
// return productionlineNoPage.find((item) => item.code == cellValue)?.name
// },
// },
// {
// label: '产线编号',
// field: 'lineName',
// sort: 'custom',
// isSearch: false,
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
// multiple:true,
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '生产线信息', // 查询弹窗标题
// searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
// searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// }
// },
// {
// label: '工序编号',
// field: 'processCode',

27
src/views/eam/equipmentAccounts/index.vue

@ -47,6 +47,7 @@
:apiUpdate="EquipmentAccountsApi.updateEquipmentAccounts"
:apiCreate="EquipmentAccountsApi.createEquipmentAccounts"
@searchTableSuccess="searchTableSuccess"
@onChange="onChange"
:isBusiness="false"
/>
@ -112,6 +113,7 @@ import * as WorkshopApi from '@/api/wms/workshop'
import * as ProductionlineApi from '@/api/wms/productionline'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'EquipmentAccounts' })
@ -130,7 +132,10 @@ const detailAllSchemas = ref()
const apiPage = ref()
const dialogApiPage = ref()
const dialogAllSchemas = ref()
export interface User {
id: number,
nickname: string
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -515,6 +520,26 @@ const submitSparePartRelation = (formField, searchField, val, formRef, rowRef) =
})
}
const onChange = async (field, cur, formRef) => {
if(field == 'purchaseDept'){
const userList = ref<User[]>([])
userList.value = await UserApi.getUserListByDeptIds([cur])
EquipmentAccounts.allSchemas.formSchema.find(item => item.field == 'purchaser').componentProps.options = userList.value
let setV = {}
setV['purchaser'] = ''
formRef.value.setValues(setV)
}
if(field == 'useDept'){
const user01List = ref<User[]>([])
user01List.value = await UserApi.getUserListByDeptIds([cur])
EquipmentAccounts.allSchemas.formSchema.find(item => item.field == 'principal').componentProps.options = user01List.value
let setV = {}
setV['principal'] = ''
formRef.value.setValues(setV)
}
}
/** 初始化 **/
onMounted(async () => {
getList()

3
src/views/eam/equipmentMaintenanceRecordMain/equipmentMaintenanceRecordMain.data.ts

@ -30,7 +30,6 @@ export const EquipmentMaintenanceRecordMain = useCrudSchemas(reactive<CrudSchema
label: '描述',
field: 'describing',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
@ -43,7 +42,6 @@ export const EquipmentMaintenanceRecordMain = useCrudSchemas(reactive<CrudSchema
label: '来源字典',
field: 'sources',
sort: 'custom',
isSearch: true,
isSearch: false,
},
{
@ -56,7 +54,6 @@ export const EquipmentMaintenanceRecordMain = useCrudSchemas(reactive<CrudSchema
label: '故障类型枚举',
field: 'faultType',
sort: 'custom',
isSearch: true,
isSearch: false,
},

24
src/views/eam/equipmentManufacturer/equipmentManufacturer.data.ts

@ -2,10 +2,19 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user'
export interface User {
id: number,
nickname: string
}
const allDeptList = await DeptApi.getSimpleDeptList();
const deptList = ref<Tree[]>([]) // 树形结构
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
deptList.value = handleTreeToComponentOptions(allDeptList)
// 表单校验
export const EquipmentManufacturerRules = reactive({
@ -76,7 +85,18 @@ export const EquipmentManufacturer = useCrudSchemas(reactive<CrudSchema[]>([
label: '联系人',
field: 'contacts',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '部门',

46
src/views/eam/equipmentSigning/equipmentSigning.data.ts

@ -6,21 +6,13 @@ import * as UserApi from '@/api/system/user'
import { EquipmentAccounts,EquipmentAccountsRules } from '../equipmentAccounts/equipmentAccounts.data'
import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProcessApi from '@/api/wms/process'
import { Process } from '@/views/wms/basicDataManage/factoryModeling/process/process.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
import * as BasicEamWorkshopApi from '@/api/eam/basicEamWorkshop'
export interface User {
id: number,
nickname: string
}
const workshopList = await BasicEamWorkshopApi.getBasicEamWorkshopNoPage({})
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const allDeptList = await DeptApi.getSimpleDeptList()
const deptList = ref<Tree[]>([]) // 树形结构
@ -337,7 +329,21 @@ export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isForm: false,
isForm: true,
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return workshopList.find((item) => item.code == cellValue)?.name
},
form: {
component: 'Select',
componentProps: {
options: workshopList,
placeholder: '请选择车间编号',
optionsAlias: {
valueField: 'code',
labelField: 'name'
}
}
}
},
// {
// label: '产线编号',
@ -451,13 +457,13 @@ export const EquipmentSigning = useCrudSchemas(reactive<CrudSchema[]>([
// }
// }
// },
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// }
// }
]))

19
src/views/eam/equipmentSigning/index.vue

@ -90,10 +90,11 @@ const searchTableSuccess = async (formField, searchField, val, formRef) => {
setV[formField] = val[0][searchField]
if(formField == 'equipmentCode'){
setV['supplierCode'] = val[0]['supplierCode']
setV['workshopCode'] = val[0]['workshopCode']
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const entry = equipmentSupplierList.find(item => item.number == val[0]['supplierCode'])
setV['supplierTelephone'] = entry.phone
setV['supplierPeople'] = Number(entry.contacts)
setV['supplierTelephone'] = entry?.phone
setV['supplierPeople'] = Number(entry?.contacts)
}
nextTick(() => {
formRef.setValues(setV)
@ -148,8 +149,8 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
// defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-signing:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-signing:delete'}), //
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-signing:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-signing:delete'}), //
]
// -
@ -264,7 +265,15 @@ const onChange = async (field, cur, formRef) => {
setV['operationer'] = ''
formRef.value.setValues(setV)
}
if(field == 'supplierCode'){
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const entry = equipmentSupplierList.find(item => item.number == cur)
let setV = {}
setV['supplierTelephone'] = entry.phone
setV['supplierPeople'] = Number(entry.contacts)
formRef.value.setValues(setV)
}
}

23
src/views/eam/equipmentSupplier/equipmentSupplier.data.ts

@ -3,10 +3,18 @@ import { dateFormatter } from '@/utils/formatTime'
import { validateHanset,validateNumDot, validateEmail } from '@/utils/validator'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
const deptList = ref<Tree[]>([]) // 树形结构
import * as UserApi from '@/api/system/user'
export interface User {
id: number,
nickname: string
}
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList())
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 表单校验
export const EquipmentSupplierRules = reactive({
@ -82,7 +90,18 @@ export const EquipmentSupplier = useCrudSchemas(reactive<CrudSchema[]>([
label: '联系人',
field: 'contacts',
sort: 'custom',
isSearch: true
isSearch: true,
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '部门',

1
src/views/eam/planSpotCheck/planSpotCheck.data.ts

@ -298,7 +298,6 @@ export const PlanSpotCheck = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '部门id',

28
src/views/eam/toolAccounts/index.vue

@ -52,6 +52,7 @@
:apiCreate="ToolAccountsApi.createToolAccounts"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
@ -149,6 +150,7 @@ import * as WorkshopApi from '@/api/wms/workshop'
import * as ProductionlineApi from '@/api/wms/productionline'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'ToolAccounts' })
@ -172,6 +174,10 @@ const operationRecordList = ref([
{ label: '巡检记录', value: 'inspection' },
{ label: '点检记录', value: 'spot_check' }
])
export interface User {
id: number,
nickname: string
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -521,6 +527,28 @@ const submitSparePartRelation = (formField, searchField, val, formRef, rowRef) =
}
)
}
const onChange = async (field, cur, formRef) => {
if(field == 'purchaseDept'){
const userList = ref<User[]>([])
userList.value = await UserApi.getUserListByDeptIds([cur])
ToolAccounts.allSchemas.formSchema.find(item => item.field == 'purchaser').componentProps.options = userList.value
let setV = {}
setV['purchaser'] = ''
formRef.value.setValues(setV)
}
if(field == 'useDept'){
const user01List = ref<User[]>([])
user01List.value = await UserApi.getUserListByDeptIds([cur])
ToolAccounts.allSchemas.formSchema.find(item => item.field == 'principal').componentProps.options = user01List.value
let setV = {}
setV['principal'] = ''
formRef.value.setValues(setV)
}
}
/** 初始化 **/
onMounted(async () => {
getList()

208
src/views/eam/toolAccounts/toolAccounts.data.ts

@ -9,19 +9,36 @@ import * as EquipmentManufacturerApi from '@/api/eam/equipmentManufacturer'
import { EquipmentManufacturer } from '@/views/eam/equipmentManufacturer/equipmentManufacturer.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as UserApi from '@/api/system/user'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import * as BasicEamWorkshopApi from '@/api/eam/basicEamWorkshop'
import { BasicEamWorkshop } from '@/views/eam/basicEamWorkshop/basicEamWorkshop.data'
export interface User {
id: number,
nickname: string
}
const workshopNoPage = await WorkshopApi.getWorkshopNoPage({})
const workshopNoPage = await BasicEamWorkshopApi.getBasicEamWorkshopNoPage({})
const equipmentManufacturerNoPage = await EquipmentManufacturerApi.getEquipmentManufacturerNoPage({})
const equipmentSupplierNoPage = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const productionlineNoPage = await ProductionlineApi.getProductionlineNoPage({});
const autoCodeSwitch = await ConfigApi.getConfigKey('toolCodeAutoSwitch')
const autoCodeSwitch = await ConfigApi.getConfigKey('deviceCodeAutoSwitch')
// ProductionlineApi.getProductionlinePage
const autoSwitch = ref(false)
if (autoCodeSwitch == 'TRUE') {
autoSwitch.value = true
}
const allDeptList = await DeptApi.getSimpleDeptList();
const deptList = ref<Tree[]>([]) // 树形结构
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(allDeptList)
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 表单校验
export const ToolAccountsRules = reactive({
code: [required],
@ -100,13 +117,41 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
label: '使用部门',
field: 'useDept',
sort: 'custom',
isSearch: false
isTable: false,
isDetail: false,
isSearch: false,
isTableForm: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
}
}
},
{
label: '负责人',
field: 'principal',
sort: 'custom',
isSearch: false
isSearch: false,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '负责人联系方式',
@ -119,6 +164,8 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'status',
sort: 'custom',
isSearch: false,
dictType: DICT_TYPE.DEVICE_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
}
@ -218,13 +265,38 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
label: '采购部门',
field: 'purchaseDept',
sort: 'custom',
isSearch: true
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList,
placeholder: "请选择部门",
filterable: true,
}
}
},
{
label: '采购人',
field: 'purchaser',
sort: 'custom',
isSearch: true
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
filterable: true,
}
}
},
{
label: '出厂日期',
@ -369,8 +441,8 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchAllSchemas: BasicEamWorkshop.allSchemas, // 查询弹窗所需类
searchPage: BasicEamWorkshopApi.getBasicEamWorkshopPage, // 查询弹窗所需分页方法
disable:true,
searchCondition: [{
key: 'available',
@ -380,58 +452,58 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true,
isDetail: false,
isForm: false,
isTable: true,
isTableForm: false,
search: {
component: 'Select',
componentProps: {
options: productionlineNoPage,
optionsAlias: {
labelField: 'name',
valueField: 'code'
},
filterable: true,
}
},
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return productionlineNoPage.find((item) => item.code == cellValue)?.name
},
},
{
label: '产线编号',
field: 'lineName',
sort: 'custom',
isSearch: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
multiple:true,
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '生产线信息', // 查询弹窗标题
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
searchCondition: [{
key:'workshopCode',
value:'workshopCode',
message: '请填写车间代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
// {
// label: '产线编号',
// field: 'lineCode',
// sort: 'custom',
// isSearch: true,
// isDetail: false,
// isForm: false,
// isTable: true,
// isTableForm: false,
// search: {
// component: 'Select',
// componentProps: {
// options: productionlineNoPage,
// optionsAlias: {
// labelField: 'name',
// valueField: 'code'
// },
// filterable: true,
// }
// },
// formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
// return productionlineNoPage.find((item) => item.code == cellValue)?.name
// },
// },
// {
// label: '产线编号',
// field: 'lineName',
// sort: 'custom',
// isSearch: false,
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
// multiple:true,
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '生产线信息', // 查询弹窗标题
// searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
// searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// }
// },
// {
// label: '工序编号',
// field: 'processCode',
@ -494,12 +566,12 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
// }
// },
// },
{
label: '部门',
field: 'departmentCode',
sort: 'custom',
isSearch: false
},
// {
// label: '部门',
// field: 'departmentCode',
// sort: 'custom',
// isSearch: false
// },
{
label: '备注',
field: 'remark',
@ -645,7 +717,7 @@ export const ToolAccounts = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 150,
width: 300,
fixed: 'right'
}
}

244
src/views/eam/toolChangedRecord/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ToolChangedRecord.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ToolChangedRecord.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ToolChangedRecordRules"
:formAllSchemas="ToolChangedRecord.allSchemas"
:apiUpdate="ToolChangedRecordApi.updateToolChangedRecord"
:apiCreate="ToolChangedRecordApi.createToolChangedRecord"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolChangedRecord.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/tool-changed-record/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ToolChangedRecord,ToolChangedRecordRules } from './toolChangedRecord.data'
import * as ToolChangedRecordApi from '@/api/eam/toolChangedRecord'
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: 'ToolChangedRecord' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ToolChangedRecord.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: ToolChangedRecordApi.getToolChangedRecordPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'eam:tool-changed-record:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:tool-changed-record:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'eam:tool-changed-record: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:'eam:tool-changed-record:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-changed-record:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ToolChangedRecord.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 ToolChangedRecordApi.createToolChangedRecord(data)
message.success(t('common.createSuccess'))
} else {
await ToolChangedRecordApi.updateToolChangedRecord(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, 'basicToolChangedRecord')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ToolChangedRecordApi.deleteToolChangedRecord(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ToolChangedRecordApi.exportToolChangedRecord(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 ToolChangedRecordApi.importTemplate()
})
</script>

110
src/views/eam/toolChangedRecord/toolChangedRecord.data.ts

@ -0,0 +1,110 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/system/user'
export interface User {
id: number,
nickname: string
}
// 表单校验
export const ToolChangedRecordRules = reactive({
code: [required],
name: [required],
concurrencyStamp: [required]
})
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
export const ToolChangedRecord = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工装编号',
field: 'code',
sort: 'custom',
isSearch: true,
fixed: 'left'
},
{
label: '工装名称',
field: 'name',
sort: 'custom',
isSearch: true
},
{
label: '变更前状态',
field: 'statusBefore',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEVICE_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select'
}
},
{
label: '变更后状态',
field: 'statusAfter',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEVICE_STATUS,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Select',
}
},
{
label: '操作人',
field: 'operator',
sort: 'custom',
isSearch: true,
search: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
valueField: 'id',
labelField: 'nickname'
},
filterable: true,
clearable: true
}
},
},
{
label: '操作时间',
field: 'operateTime',
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: 'remark',
sort: 'custom',
isSearch: true
},
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// }
// }
]))

280
src/views/eam/toolSigning/index.vue

@ -0,0 +1,280 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ToolSigning.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ToolSigning.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ToolSigningRules"
:formAllSchemas="ToolSigning.allSchemas"
:apiUpdate="ToolSigningApi.updateToolSigning"
:apiCreate="ToolSigningApi.createToolSigningNew"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="ToolSigning.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/tool-signing/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ToolSigning,ToolSigningRules } from './toolSigning.data'
import * as ToolSigningApi from '@/api/eam/toolSigning'
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'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'ToolSigning' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ToolSigning.allSchemas.tableColumns)
//
const searchTableSuccess = async (formField, searchField, val, formRef) => {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'toolName'){
setV['toolCode'] = val[0]['code']
setV['toolName'] = val[0]['name']
setV['supplierCode'] = val[0]['supplierCode']
setV['workshopCode'] = val[0]['workshopCode']
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const entry = equipmentSupplierList.find(item => item.number == val[0]['supplierCode'])
setV['supplierTelephone'] = entry?.phone
setV['supplierPeople'] = Number(entry?.contacts)
}
nextTick(() => {
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: ToolSigningApi.getToolSigningPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:tool-signing:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'eam:tool-signing:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'eam:tool-signing: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:'eam:tool-signing:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:tool-signing:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =ToolSigning.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 ToolSigningApi.createToolSigningNew(data)
message.success(t('common.createSuccess'))
} else {
await ToolSigningApi.updateToolSigning(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, 'basicToolSigning')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ToolSigningApi.deleteToolSigning(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ToolSigningApi.exportToolSigning(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() //
}
const onChange = async (field, cur, formRef) => {
if(field == 'operationDept'){
const userList = await UserApi.getUserListByDeptIds([cur])
ToolSigning.allSchemas.formSchema.find(item => item.field == 'operationer').componentProps.options = userList
let setV = {}
setV['operationer'] = ''
formRef.value.setValues(setV)
}
if(field == 'supplierCode'){
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const entry = equipmentSupplierList.find(item => item.number == cur)
let setV = {}
setV['supplierTelephone'] = entry.phone
setV['supplierPeople'] = Number(entry.contacts)
formRef.value.setValues(setV)
}
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ToolSigningApi.importTemplate()
})
</script>

487
src/views/eam/toolSigning/toolSigning.data.ts

@ -0,0 +1,487 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { handleTreeToComponentOptions } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user'
import { ToolAccounts,ToolAccountsRules } from '../toolAccounts/toolAccounts.data'
import * as ToolAccountsApi from '@/api/eam/toolAccounts'
import * as EquipmentSupplierApi from '@/api/eam/equipmentSupplier'
import * as BasicEamWorkshopApi from '@/api/eam/basicEamWorkshop'
export interface User {
id: number,
nickname: string
}
const toolList = await ToolAccountsApi.getToolAccountsNoPage({})
const workshopList = await BasicEamWorkshopApi.getBasicEamWorkshopNoPage({})
const equipmentSupplierList = await EquipmentSupplierApi.getEquipmentSupplierNoPage({})
const allDeptList = await DeptApi.getSimpleDeptList()
const deptList = ref<Tree[]>([]) // 树形结构
const userList = ref<User[]>([])
userList.value = await UserApi.getSimpleUserList()
// 加载部门树(默认格式)
deptList.value = handleTreeToComponentOptions(allDeptList)
// 表单校验
export const ToolSigningRules = reactive({
toolCode: [required],
operationDate: [required],
operationer: [required],
operationDept: [required],
storageLocation: [required],
concurrencyStamp: [required]
})
export const ToolSigning = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '工装',
field: 'toolCode',
sort: 'custom',
isSearch: true,
isTable: true,
isForm: false,
isDetail: false,
isTableForm: false,
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return toolList.find((item) => item.code == cellValue)?.name
},
},
{
label: '工装',
field: 'toolName',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择设备', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '设备信息', // 查询弹窗标题
searchAllSchemas: ToolAccounts.allSchemas, // 查询弹窗所需类
searchPage: ToolAccountsApi.getToolAccountsPage, // 查询弹窗所需分页方法
searchCondition:
[{
key: 'available',
value: 'TRUE',
isMainValue: false
},{
key: 'status',
value: 'TOACCEPT',
isMainValue: false
}]
}
},
},
{
label: '验收日期',
field: 'operationDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: false,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
}
},
{
label: '验收部门',
field: 'operationDept',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return allDeptList.find((item) => item.id == cellValue)?.name
},
form: {
component: 'TreeSelect',
componentProps: { // 假设deptList是部门数据列表
data: deptList.value,
disabled: false,
placeholder: "请选择部门",
filterable: true,
multiple: false,
}
}
},
{
label: '验收人',
field: 'operationer',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: { // 假设deptList是部门数据列表
options: userList.value,
optionsAlias: {
valueField: 'id',
labelField: 'nickname'
},
disabled: false,
placeholder: "请先选择部门",
filterable: true,
multiple: false,
}
}
},
{
label: '验收人联系方式',
field: 'telephone',
sort: 'custom',
isSearch: false
},
{
label: '供应商编号',
field: 'supplierCode',
sort: 'custom',
isSearch: false,
isForm: true,
isDetail: false,
isTable: false,
isTableForm: false,
form: {
component: 'Select',
componentProps: {
options: equipmentSupplierList,
optionsAlias: {
labelField: 'name',
valueField: 'number'
},
filterable: true,
disabled: true,
}
}
},
// {
// label: '供应商编号',
// field: 'supplierName',
// sort: 'custom',
// isSearch: false,
// isForm: true,
// isDetail: false,
// isTable: false,
// isTableForm: false,
// form: {
// component: 'Input',
// componentProps: {
// disabled: true
// }
// }
// },
{
label: '供应商联系人',
field: 'supplierPeople',
sort: 'custom',
isSearch: true,
formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
return userList.value.find((item) => item.id == cellValue)?.nickname
},
form: {
component: 'Select',
componentProps: {
options: userList.value,
optionsAlias: {
labelField: 'nickname',
valueField: 'id'
},
disabled: true,
}
}
},
{
label: '供应商联系方式',
field: 'supplierTelephone',
sort: 'custom',
isSearch: false,
isForm: true,
form: {
component: 'Input',
componentProps: {
disabled: true
}
}
},
// {
// label: '流程状态',
// field: 'status',
// sort: 'custom',
// isSearch: true,
// dictType: DICT_TYPE.JOB_STATUS,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// form: {
// component: 'Select'
// }
// },
// {
// label: '审核人',
// field: 'approver',
// sort: 'custom',
// isSearch: true,
// form: {
// component: 'InputNumber',
// value: 0
// }
// },
// {
// label: '审核内容',
// field: 'approveContent',
// sort: 'custom',
// isSearch: false,
// form: {
// component: 'Input',
// componentProps: {
// type: 'textarea',
// valueHtml: '',
// height: 200
// }
// }
// },
// {
// label: '审核时间',
// field: 'approveTime',
// sort: 'custom',
// formatter: dateFormatter,
// isSearch: false,
// search: {
// component: 'DatePicker',
// componentProps: {
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// type: 'daterange',
// defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
// }
// },
// form: {
// component: 'DatePicker',
// componentProps: {
// type: 'datetime',
// valueFormat: 'x'
// }
// }
// },
// {
// label: '自动审核',
// field: 'autoExamine',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
// {
// label: '自动通过',
// field: 'autoAgree',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
// {
// label: '直接生成记录',
// field: 'directCreateRecord',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: false,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '存放位置描述',
field: 'storageLocation',
sort: 'custom',
isSearch: false,
isForm: true,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
placeholder: '请输入存放位置描述'
}
}
},
// {
// label: '所属厂区编号',
// field: 'factoryAreaCode',
// sort: 'custom',
// isSearch: false
// },
{
label: '车间编号',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
isForm: true,
formatter: (_: Recordable, __: TableColumn, cellValue: string) => {
return workshopList.find((item) => item.code == cellValue)?.name
},
form: {
component: 'Select',
componentProps: {
options: workshopList,
placeholder: '请选择车间编号',
optionsAlias: {
valueField: 'code',
labelField: 'name'
}
}
}
},
// {
// label: '产线编号',
// field: 'lineCode',
// sort: 'custom',
// isSearch: true,
// form: {
// // labelMessage: '信息提示说明!!!',
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
// multiple:true,
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '生产线信息', // 查询弹窗标题
// searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
// searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// }
// },
// {
// label: '工序编号',
// field: 'processCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true,
// searchListPlaceholder: '请选择工序代码',
// searchField: 'code',
// searchTitle: '工序信息',
// searchAllSchemas: Process.allSchemas,
// searchPage: ProcessApi.getProcessPage,
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key: 'available',
// value: 'TRUE',
// isMainValue: false
// }]
// }
// },
// },
// {
// label: '工位编号',
// field: 'workstationCode',
// sort: 'custom',
// isSearch: true,
// form:{
// componentProps: {
// isSearchList: true, // 开启查询弹窗
// searchListPlaceholder: '请选择工位', // 输入框占位文本
// searchField: 'code', // 查询弹窗赋值字段
// searchTitle: '工位信息', // 查询弹窗标题
// searchAllSchemas: Workstation.allSchemas, // 查询弹窗所需类
// searchPage: WorkStationApi.getWorkstationPage, // 查询弹窗所需分页方法
// searchCondition: [{
// key:'productionLineCode',
// value:'lineCode',
// message: '请填写生产线代码!',
// isMainValue: true
// },{
// key:'workshopCode',
// value:'workshopCode',
// message: '请填写车间代码!',
// isMainValue: true
// },{
// key:'available',
// value:'TRUE',
// isMainValue: false
// }]
// }
// },
// },
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// isSearch: true,
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
// {
// label: '操作',
// field: 'action',
// isForm: false,
// table: {
// width: 150,
// fixed: 'right'
// }
// }
]))
Loading…
Cancel
Save