Browse Source

制造商供应商添加禁用启用按钮

master_hella_20240701
ljlong_2630 6 months ago
parent
commit
844d62a6a4
  1. 12
      src/views/eam/equipmentManufacturer/equipmentManufacturer.data.ts
  2. 33
      src/views/eam/equipmentManufacturer/index.vue
  3. 12
      src/views/eam/equipmentSupplier/equipmentSupplier.data.ts
  4. 32
      src/views/eam/equipmentSupplier/index.vue
  5. 15
      src/views/eam/inspectionItem/index.vue
  6. 12
      src/views/eam/spotCheckItem/index.vue

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

@ -96,6 +96,18 @@ export const EquipmentManufacturer = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '是否启用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '备注',
field: 'remark',

33
src/views/eam/equipmentManufacturer/index.vue

@ -33,7 +33,7 @@
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
@ -90,6 +90,15 @@ const updataTableColumns = (val) => {
tableColumns.value = val
}
const judgeStatus = (row) =>{
if(row.available === 'TRUE'){
return true
}else{
return false
}
}
const { tableObject, tableMethods } = useTable({
getListApi: EquipmentManufacturerApi.getEquipmentManufacturerPage //
})
@ -132,10 +141,13 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-manufacturer:update'}), //
defaultButtons.mainListEnableBtn({hasPermi:'eam:inspection-item:enable',hide: judgeStatus(row)}), //
defaultButtons.mainListDisableBtn({hasPermi:'eam:inspection-item:disable',hide: !judgeStatus(row)}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-manufacturer:delete'}), //
]
]}
// -
const buttonTableClick = async (val, row) => {
@ -143,6 +155,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'enable') { //
handleEnable(row,'TRUE')
}else if (val == 'disable') {//
handleEnable(row,'FALSE')
}
}
@ -235,6 +251,17 @@ const searchFormClick = (searchData) => {
getList() //
}
const handleEnable = (row,enable) =>{
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => {
row.available = enable
EquipmentManufacturerApi.updateEquipmentManufacturer(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
})
}
/** 初始化 **/
onMounted(async () => {
getList()

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

@ -102,6 +102,18 @@ export const EquipmentSupplier = useCrudSchemas(reactive<CrudSchema[]>([
}
}
},
{
label: '是否启用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: true,
isDetail: false,
isSearch: false,
isTableForm: false,
isForm: false,
},
{
label: '备注',
field: 'remark',

32
src/views/eam/equipmentSupplier/index.vue

@ -33,7 +33,7 @@
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
@ -90,6 +90,15 @@ const updataTableColumns = (val) => {
tableColumns.value = val
}
const judgeStatus = (row) =>{
if(row.available === 'TRUE'){
return true
}else{
return false
}
}
const { tableObject, tableMethods } = useTable({
getListApi: EquipmentSupplierApi.getEquipmentSupplierPage //
})
@ -132,10 +141,13 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
const butttondata = (row) => {
return [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-supplier:update'}), //
defaultButtons.mainListEnableBtn({hasPermi:'eam:inspection-item:enable',hide: judgeStatus(row)}), //
defaultButtons.mainListDisableBtn({hasPermi:'eam:inspection-item:disable',hide: !judgeStatus(row)}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-supplier:delete'}), //
]
]}
// -
const buttonTableClick = async (val, row) => {
@ -143,6 +155,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'enable') { //
handleEnable(row,'TRUE')
}else if (val == 'disable') {//
handleEnable(row,'FALSE')
}
}
@ -235,6 +251,16 @@ const searchFormClick = (searchData) => {
getList() //
}
const handleEnable = (row,enable) =>{
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => {
row.available = enable
EquipmentSupplierApi.updateEquipmentSupplier(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
})
}
/** 初始化 **/
onMounted(async () => {
getList()

15
src/views/eam/inspectionItem/index.vue

@ -253,16 +253,15 @@ const searchFormClick = (searchData) => {
}
const handleEnable = (row,enable) =>{
row.available = enable
InspectionItemApi.updateInspectionItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => {
row.available = enable
InspectionItemApi.updateInspectionItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
})
}
/** 初始化 **/
onMounted(async () => {
getList()

12
src/views/eam/spotCheckItem/index.vue

@ -252,11 +252,13 @@ const searchFormClick = (searchData) => {
const handleEnable = (row,enable) =>{
row.available = enable
SpotCheckItemApi.updateSpotCheckItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
message.confirm(t('您确定'+(enable=='TRUE'?'启用':'禁用')+'该项吗, 是否继续?')).then(() => {
row.available = enable
SpotCheckItemApi.updateSpotCheckItem(row).then(res => {
message.success(t('common.updateSuccess'))
getList()
})
})
}
/** 初始化 **/

Loading…
Cancel
Save