@@ -38,15 +49,15 @@ const searchDialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+// 列表头部按钮
+const HeadButttondata = [
+ defaultButtons.defaultFilterBtn(null), // 筛选
+]
/** 打开弹窗 */
const getListRef = ref()
const setSearchParamsRef = ref()
-const tableObjectRef = ref({
- tableList:'',
- loading:false,
- params:{}
-})
+const tableObjectRef = ref()
const getPage:any = ref()
const searchSchema = ref()
const tableColumns = ref()
@@ -61,7 +72,6 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
searchDialogVisible.value = true
formFieldRef.value = formField
searchFieldRef.value = searchField
-
allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns.filter(item => (item.field !== 'action'))
@@ -69,20 +79,53 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
typeRef.value = type
rowRef.value = row
multipleBol.value = multiple
+ // dialogTitle.value = t('action.' + type)
dialogTitle.value = titleName
- const getList = async () => {
- await getPage.value().then((res)=>{
- tableObjectRef.value.tableList = res
+ const {tableObject, tableMethods } = useTable({
+ getListApi: getPage.value // 分页接口
})
+ tableObjectRef.value = tableObject
searchConditionRef.value = searchCondition
if (searchCondition) tableObjectRef.value.params = searchCondition;
- }
- console.log(tableObjectRef.value)
+ // 获得表格的各种操作
+ const { getList } = tableMethods
+ // setSearchParamsRef.value = setSearchParams
+ setSearchParamsRef.value = tableObject.params
+ getListRef.value = getList
getList()
}
-
+// 筛选提交
+const searchFormClick = (searchData) => {
+ // console.log(99, rowRef.value)
+ // console.log(100, searchData)
+ // console.log(101, searchConditionRef.value)
+ // 20240104 修改 判断 当前弹窗 是否有条件 如果有条件 需拼接到 筛选中 searchData.filters
+ if (searchConditionRef.value) {
+ Object.keys(searchConditionRef.value).forEach(key => {
+ if (searchData.filters) {
+ searchData.filters.push({
+ action: "==",
+ column: key,
+ value: searchConditionRef.value[key]
+ })
+ // }
+ } else {
+ searchData.filters = [{
+ action: "==",
+ column: key,
+ value: searchConditionRef.value[key]
+ }]
+ }
+ });
+ }
+ tableObjectRef.value.params = {
+ isSearch: true,
+ filters: searchData.filters
+ }
+ getListRef.value() // 刷新当前列表
+}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -110,15 +153,9 @@ const submitForm = async () => {
return
}
}
- let isQtyNone = selections.filter(item=>!item.qty)
- if(isQtyNone&&isQtyNone.length>0){
- message.warning('请填写数量')
- formLoading.value = false
- return
- }
+
try {
searchDialogVisible.value = false
- console.log(selections)
// 发送操作成功的事件
emit('searchTableSuccess', formFieldRef.value, searchFieldRef.value, selections, typeRef.value, rowRef.value)
} finally {
diff --git a/src/components/SearchTableItem/index.ts b/src/components/SearchTableItem/index.ts
new file mode 100644
index 0000000..c1bfdc4
--- /dev/null
+++ b/src/components/SearchTableItem/index.ts
@@ -0,0 +1,3 @@
+import SearchTableItem from './src/SearchTableItem.vue'
+
+export { SearchTableItem }
diff --git a/src/components/SearchTableItem/src/SearchTableItem.vue b/src/components/SearchTableItem/src/SearchTableItem.vue
new file mode 100644
index 0000000..b4321f3
--- /dev/null
+++ b/src/components/SearchTableItem/src/SearchTableItem.vue
@@ -0,0 +1,144 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/utils/disposition/tabsList.ts b/src/utils/disposition/tabsList.ts
index a7f0bf1..e88f418 100644
--- a/src/utils/disposition/tabsList.ts
+++ b/src/utils/disposition/tabsList.ts
@@ -1,5 +1,5 @@
-// 页面tabs标签
-export const ItemBasicTabsList = [{
+// 设备台账tabs标签
+export const DeviceLedgerTabsList = [{
label: "设备信息",
prop: 'info',
},
diff --git a/src/views/eam/device/deviceAccounts/index.vue b/src/views/eam/device/deviceAccounts/index.vue
index dc1958e..c2e4176 100644
--- a/src/views/eam/device/deviceAccounts/index.vue
+++ b/src/views/eam/device/deviceAccounts/index.vue
@@ -49,6 +49,7 @@
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
+
-
-
{
nextTick(() => {
diff --git a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
index a49f750..39eda72 100644
--- a/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
+++ b/src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts
@@ -40,10 +40,13 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive([
table: {
width: '150',
},
+ isForm: false,
+ isSearch: true,
+ isTable: true,
},
{
- label: '设备',
+ label: '设备模具编号',
field: 'deviceNumber',
sort: 'custom',
table: {
@@ -202,55 +205,32 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([
field: 'describes',
sort: 'custom',
table: {
- width: '150',
},
- isForm: false,
isSearch: false,
- isTable: false,
},
{
label: '故障真因',
field: 'describes1',
sort: 'custom',
table: {
- width: '150',
},
- isForm: false,
isSearch: false,
- isTable: false,
},
{
label: '解决措施',
field: 'workOut',
sort: 'custom',
table: {
- width: '150',
},
- isForm: false,
isSearch: false,
- isTable: false,
},
{
label: '维修人',
field: 'maintenances',
sort: 'custom',
- table: {
- width: '150',
- },
api: () => userList,
- formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
- return userList.find((account) => account.id == cellValue)?.name
- },
- search: {
- show: true,
- component: 'Select',
- api: () => userList,
- componentProps: {
- optionsAlias: {
- labelField: 'name',
- valueField: 'id'
- }
- }
+ formatter: (_: Recordable, __: TableColumn, cellValue) => {
+ return userList.filter(item=>cellValue.includes(item.id)).map(cur=>cur.name).join(',')
},
tableForm: {
type: 'Select',
@@ -262,19 +242,31 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([
labelField: 'name',
valueField: 'id'
}
+ },
+ form:{
+ component: 'Select',
+ api: () => userList,
+ componentProps: {
+ multiple:true,
+ collapseTags:true,
+ collapseTagsTooltip:true,
+ optionsAlias: {
+ labelField: 'name',
+ valueField: 'id'
+ }
+ }
}
},
{
label: '备件',
- field: 'itemNUmbers',
+ field: 'itemNumbers1',
sort: 'custom',
table: {
- width: '150',
},
tableForm:{
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择备件',
- searchField: 'itemNUmbers',
+ searchField: 'itemNumbers1',
searchTitle: '备件',
multiple:true,
searchAllSchemas: ItemSearchTable.allSchemas,
@@ -286,10 +278,48 @@ export const DeviceMaintenanceDetail = useCrudSchemas(reactive([
isMainValue: true
}]
},
- isForm: false,
+ form: {
+ // labelMessage: '信息提示说明!!!',
+ componentProps: {
+ isSearchList: true, // 开启查询弹窗
+ searchListPlaceholder: '请选择备件', // 输入框占位文本
+ searchField: 'itemNumbers1', // 查询弹窗赋值字段
+ searchTitle: '备件', // 查询弹窗标题
+ multiple:true,
+ searchAllSchemas: ItemSearchTable.allSchemas, // 查询弹窗所需类
+ searchPage: ItemApi.getItemList, // 查询弹窗所需分页方法
+ searchCondition: [{
+ key: 'deviceNumber',
+ value: 'deviceNumber',
+ message: '请选择设备模具编号!',
+ isMainValue: true
+ }]
+ }
+ },
isSearch: false,
- isTable: false,
},
+ {
+ label: '备件1',
+ field: 'itemNumbers',
+ sort: 'custom',
+ table: {
+ },
+ isForm:false,
+ isDetail:false,
+ isTable:false,
+ isSearch: false,
+ isTableForm: false,
+ },
+ {
+ label: '操作',
+ field: 'action',
+ isForm: false,
+ table: {
+ width: 300,
+ fixed: 'right'
+ },
+ isDetail:false
+ }
]))
// 表单校验
export const DeviceMaintenanceDetailRules = reactive({
@@ -297,5 +327,5 @@ export const DeviceMaintenanceDetailRules = reactive({
describes1: [required],
workOut: [required],
maintenance: [required],
- itemNUmbers: [required],
+ itemNumbers: [required],
})
\ No newline at end of file
diff --git a/src/views/eam/device/deviceMaintenanceMain/index.vue b/src/views/eam/device/deviceMaintenanceMain/index.vue
index 6ed691b..5905a94 100644
--- a/src/views/eam/device/deviceMaintenanceMain/index.vue
+++ b/src/views/eam/device/deviceMaintenanceMain/index.vue
@@ -61,24 +61,27 @@
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
+ :isSearchTableItem="true"
/>
@@ -120,20 +123,19 @@ const tableData = ref([])
const updataTableColumns = (val) => {
tableColumns.value = val
}
-const itemNUmbers = ref()
// 查询页面返回
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
// 明细查询页赋值
- if (formField == 'itemNUmbers') {
+ if (formField == 'itemNumbers') {
let str = ''
val.forEach((element) => {
str += element.name + ':' + element.qty + ','
})
str = str.substring(0, str.length - 1)
- row['itemNUmbers'] = str
- row['itemNUmbers1'] = val
+ row['itemNumbers1'] = str
+ row['itemNumbers'] = val
}
} else {
// const setV = {}
@@ -149,12 +151,15 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
- if (formField == 'itemCode') {
- setV['itemCode'] = val[0]['code']
- } else {
- setV['poNumber'] = val[0]['number']
- setV['poLine'] = val[0]['lineNumber']
- }
+ if (formField == 'itemNumbers1') {
+ let str = ''
+ val.forEach((element) => {
+ str += element.name + ':' + element.qty + ','
+ })
+ str = str.substring(0, str.length - 1)
+ setV['itemNumbers'] = val
+ setV['itemNumbers1'] = str
+ }
formRef.setValues(setV)
})
}
@@ -186,6 +191,7 @@ const buttonBaseClick = (val, item) => {
if (val == 'add') {
// 新增
DeviceMaintenanceMain.allSchemas.formSchema[3].value = 'DEVICE'
+ DeviceMaintenanceMain.allSchemas.formSchema[0].componentProps.disabled = false
openForm('create')
} else if (val == 'import') {
// 导入
@@ -242,10 +248,11 @@ const onChange = (field, cur, item) => {
if (field == 'deviceNumber') {
// DeviceMaintenanceMain.allSchemas.formSchema[1].componentProps.disabled = true
// DeviceMaintenanceMain.allSchemas.formSchema[2].componentProps.disabled = true
- formRef.value.formRef.formModel.factoryAreaNumber = Number(
- item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber
- )
- formRef.value.formRef.formModel.maintenance = String(userStore?.getUser?.id)
+ formRef.value.formRef.formModel.factoryAreaNumber =String(item.componentProps.options.find((item) => item.number == cur).factoryAreaNumber)
+ console.log(typeof formRef.value.formRef.formModel.factoryAreaNumber)
+ // console.log(item)
+ // console.log(item.componentProps.options)
+ formRef.value.formRef.formModel.maintenance = Number(userStore?.getUser?.id)
}
}
// 列表-操作按钮事件
@@ -369,7 +376,7 @@ const submitForm = async (formType, data) => {
return {
describes: item.describes,
describes1: item.describes1,
- itemNUmbers: item.itemNUmbers1,
+ itemNumbers: item.itemNumbers1,
maintenances: item.maintenances.join(','),
workOut: item.workOut,
}
@@ -417,6 +424,7 @@ const detailOpenForm = (type, row) =>{
}
// 子表新增/编辑校验
const detailValidate = (data) => {
+ return true;
let tag = false;
if(data.qty <= 0){
message.warning('数量必须大于0')
@@ -427,6 +435,43 @@ const detailValidate = (data) => {
return tag;
}
}
+// 子表提交
+const detailSubmitForm= async (formType,data,getList,formRef,tableList) => {
+ try {
+ let data1 = {
+ id:data.id,
+ maintenanceNumber:data.maintenanceNumber,
+ describes:data.describes,
+ describes1:data.describes1,
+ itemNumbers:data.itemNumbers,
+ maintenances:data.maintenances.join(','),
+ workOut:data.workOut,
+ }
+ console.log(data1)
+ if (formType === 'create') {
+ await DeviceMaintenanceDetailApi.createDeviceMaintenanceDetail(data1)
+ message.success(t('common.createSuccess'))
+ } else {
+ await DeviceMaintenanceDetailApi.updateDeviceMaintenanceDetail(data1)
+ message.success(t('common.updateSuccess'))
+ }
+ formRef.dialogVisible = false
+ // 刷新当前列表
+ await getList()
+ detailRef.value.tableObject.tableList.forEach(item=>{
+ if (item.itemNumbers?.length>0) {
+ let str = ''
+ item.itemNumbers.forEach(element => {
+ str += element.name + ':' + element.qty + ','
+ })
+ item.itemNumbers1 = str.substring(0, str.length - 1)
+ }
+
+ })
+ } finally {
+ formRef.formLoading = false
+ }
+}
/** 初始化 **/
onMounted(async () => {