diff --git a/src/api/qms/counter/index.ts b/src/api/qms/counter/index.ts index 9190e34f5..cd6d8e2a9 100644 --- a/src/api/qms/counter/index.ts +++ b/src/api/qms/counter/index.ts @@ -59,4 +59,4 @@ export const exportCounter = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/qms/counter/get-import-template' }) -} \ No newline at end of file +} diff --git a/src/api/qms/dynamicRule/index.ts b/src/api/qms/dynamicRule/index.ts index d08387fee..3e457babf 100644 --- a/src/api/qms/dynamicRule/index.ts +++ b/src/api/qms/dynamicRule/index.ts @@ -50,4 +50,13 @@ export const exportDynamicRule = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/qms/dynamic-rule/get-import-template' }) -} \ No newline at end of file +} + +// 启用 +export const enableDynamicRule = async (id: number) => { + return await request.enable({ url: `/qms/dynamic-rule/enable?id=` + id }) +} +// 禁用 +export const disableDynamicRule = async (id: number) => { + return await request.disable({ url: `/qms/dynamic-rule/disable?id=` + id }) +} diff --git a/src/api/qms/inspectionMethod/index.ts b/src/api/qms/inspectionMethod/index.ts index 5721037b9..d11347e87 100644 --- a/src/api/qms/inspectionMethod/index.ts +++ b/src/api/qms/inspectionMethod/index.ts @@ -51,3 +51,11 @@ export const exportInspectionMethod = async (params) => { export const importTemplate = () => { return request.download({ url: '/qms/inspection-method/get-import-template' }) } +// 启用 +export const enableInspectionMethod = async (id: number) => { + return await request.enable({ url: `/qms/inspection-method/enable?id=` + id }) +} +// 禁用 +export const disableInspectionMethod = async (id: number) => { + return await request.disable({ url: `/qms/inspection-method/disable?id=` + id }) +} diff --git a/src/api/qms/inspectionScheme/index.ts b/src/api/qms/inspectionScheme/index.ts index c54e11372..358acd359 100644 --- a/src/api/qms/inspectionScheme/index.ts +++ b/src/api/qms/inspectionScheme/index.ts @@ -21,3 +21,12 @@ export const InspectionSchemePage = async (params) => { return await request.get({ url: `/qms/inspection-scheme/page`, params }) } } + +// 启用 +export const enableInspectionScheme = async (id: number) => { + return await request.enable({ url: `/qms/inspection-scheme/enable?id=` + id }) +} +// 禁用 +export const disableInspectionScheme = async (id: number) => { + return await request.disable({ url: `/qms/inspection-scheme/disable?id=` + id }) +} diff --git a/src/api/qms/inspectionTemplate/index.ts b/src/api/qms/inspectionTemplate/index.ts index 8443de973..9fe18afcd 100644 --- a/src/api/qms/inspectionTemplate/index.ts +++ b/src/api/qms/inspectionTemplate/index.ts @@ -27,4 +27,13 @@ export const inspectionTemplatePage = async (params) => { } else { return await request.get({ url: `/qms/programme-template/page`, params }) } -} \ No newline at end of file +} + +// 启用 +export const enableInspectionTemplate = async (id: number) => { + return await request.enable({ url: `/qms/programme-template/enable?id=` + id }) +} +// 禁用 +export const disableInspectionTemplate = async (id: number) => { + return await request.disable({ url: `/qms/programme-template/disable?id=` + id }) +} diff --git a/src/api/qms/sampleCode/index.ts b/src/api/qms/sampleCode/index.ts index 374a97e8a..9f7f9f13e 100644 --- a/src/api/qms/sampleCode/index.ts +++ b/src/api/qms/sampleCode/index.ts @@ -59,3 +59,12 @@ export const importTemplate = () => { export const getSamplingScheme = async () => { return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) } + +// 启用 +export const enableSampleCode = async (id: number) => { + return await request.enable({ url: `/qms/sample-code/enable?id=` + id }) +} +// 禁用 +export const disableSampleCode = async (id: number) => { + return await request.disable({ url: `/qms/sample-code/disable?id=` + id }) +} diff --git a/src/api/qms/samplingProcess/index.ts b/src/api/qms/samplingProcess/index.ts index 9fcdcd20f..398238653 100644 --- a/src/api/qms/samplingProcess/index.ts +++ b/src/api/qms/samplingProcess/index.ts @@ -61,3 +61,11 @@ export const importTemplate = () => { export const getSamplingScheme = async () => { return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) } +// 启用 +export const enableSamplingProcess = async (id: number) => { + return await request.enable({ url: `/qms/sampling-process/enable?id=` + id }) +} +// 禁用 +export const disableSamplingProcess = async (id: number) => { + return await request.disable({ url: `/qms/sampling-process/disable?id=` + id }) +} diff --git a/src/api/qms/samplingScheme/index.ts b/src/api/qms/samplingScheme/index.ts index f60047e97..c65058f2e 100644 --- a/src/api/qms/samplingScheme/index.ts +++ b/src/api/qms/samplingScheme/index.ts @@ -47,3 +47,12 @@ export const exportSamplingScheme = async (params) => { export const importTemplate = () => { return request.download({ url: '/qms/sampling-scheme/get-import-template' }) } + +// 启用 +export const enableSamplingScheme = async (id: number) => { + return await request.enable({ url: `/qms/sampling-scheme/enable?id=` + id }) +} +// 禁用 +export const disableSamplingScheme = async (id: number) => { + return await request.disable({ url: `/qms/sampling-scheme/disable?id=` + id }) +} diff --git a/src/api/qms/selectedSet/index.ts b/src/api/qms/selectedSet/index.ts index 69add3718..5e4348d17 100644 --- a/src/api/qms/selectedSet/index.ts +++ b/src/api/qms/selectedSet/index.ts @@ -52,4 +52,13 @@ export const exportSelectedSet = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/qms/selected-set/get-import-template' }) -} \ No newline at end of file +} + +// 启用 +export const enableSelectedSet = async (id: number) => { + return await request.enable({ url: `/qms/selected-set/enable?id=` + id }) +} +// 禁用 +export const disableSelectedSet = async (id: number) => { + return await request.disable({ url: `/qms/selected-set/disable?id=` + id }) +} diff --git a/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts b/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts index 2ce60aa0e..55c0c56fa 100644 --- a/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts +++ b/src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts @@ -33,6 +33,24 @@ export const DynamicRule = useCrudSchemas(reactive([ sort: 'custom', isSearch: true }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/basicDataManage/dynamicRule/index.vue b/src/views/qms/basicDataManage/dynamicRule/index.vue index b8363ba05..15f2bc404 100644 --- a/src/views/qms/basicDataManage/dynamicRule/index.vue +++ b/src/views/qms/basicDataManage/dynamicRule/index.vue @@ -33,7 +33,7 @@ @@ -163,11 +163,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:dynamic-rule:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:dynamic-rule:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:dynamic-rule:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:dynamic-rule:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:dynamic-rule:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -175,6 +185,10 @@ const buttonTableClick = async (val, row) => { editForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -235,6 +249,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } +const handleEnable = async (id: number) => { + try { + await DynamicRuleApi.enableDynamicRule(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await DynamicRuleApi.disableDynamicRule(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 diff --git a/src/views/qms/basicDataManage/inspectionScheme/index.vue b/src/views/qms/basicDataManage/inspectionScheme/index.vue index 13e7a84a7..5509a3fa6 100644 --- a/src/views/qms/basicDataManage/inspectionScheme/index.vue +++ b/src/views/qms/basicDataManage/inspectionScheme/index.vue @@ -33,7 +33,7 @@ @@ -117,11 +117,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:type-template:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:type-template:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:type-template:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:type-template:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:type-template:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -129,6 +139,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -198,7 +212,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } - +const handleEnable = async (id: number) => { + try { + await InspectionSchemeApi.enableInspectionScheme(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await InspectionSchemeApi.disableInspectionScheme(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} // 筛选提交 const searchFormClick = (searchData) => { diff --git a/src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts b/src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts index deb0650c2..c282caae8 100644 --- a/src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts +++ b/src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts @@ -196,25 +196,24 @@ export const InspectionSchemeMain = useCrudSchemas(reactive([ } }, }, - // { - // 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: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/basicDataManage/inspectionTemplate/index.vue b/src/views/qms/basicDataManage/inspectionTemplate/index.vue index f23a456ee..a3369a861 100644 --- a/src/views/qms/basicDataManage/inspectionTemplate/index.vue +++ b/src/views/qms/basicDataManage/inspectionTemplate/index.vue @@ -33,7 +33,7 @@ @@ -125,11 +125,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:programme-template:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:programme-template:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:programme-template:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:programme-template:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:programme-template:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -137,6 +147,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -177,7 +191,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } - +const handleEnable = async (id: number) => { + try { + await InspectionProcessPageApi.enableInspectionTemplate(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await InspectionProcessPageApi.disableInspectionTemplate(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} // 筛选提交 const searchFormClick = (searchData) => { diff --git a/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts b/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts index 425576ac8..e98a400e5 100644 --- a/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts +++ b/src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts @@ -95,6 +95,24 @@ export const InspectionTemplateMain = useCrudSchemas(reactive([ field: 'version', sort: 'custom', }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', @@ -291,4 +309,4 @@ export const InspectionTemplateFeatures= useCrudSchemas(reactive([ component:'Select' } } -])) \ No newline at end of file +])) diff --git a/src/views/qms/basicDataManage/selectedSet/index.vue b/src/views/qms/basicDataManage/selectedSet/index.vue index 42fde7870..8a20c8ea2 100644 --- a/src/views/qms/basicDataManage/selectedSet/index.vue +++ b/src/views/qms/basicDataManage/selectedSet/index.vue @@ -33,7 +33,7 @@ @@ -166,11 +166,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:selected-set:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:selected-set:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:selected-set:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:selected-set:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:selected-set:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -178,6 +188,10 @@ const buttonTableClick = async (val, row) => { editForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -238,7 +252,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } - +const handleEnable = async (id: number) => { + try { + await SelectedSetApi.enableSelectedSet(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await SelectedSetApi.disableSelectedSet(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => { diff --git a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts index 6371cdb26..9bd2e1a8c 100644 --- a/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts +++ b/src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts @@ -26,6 +26,24 @@ export const SelectedSet = useCrudSchemas(reactive([ sort: 'custom', isSearch: true }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/inspectionMethod/index.vue b/src/views/qms/inspectionMethod/index.vue index 01bf866cd..dcc3441a1 100644 --- a/src/views/qms/inspectionMethod/index.vue +++ b/src/views/qms/inspectionMethod/index.vue @@ -33,7 +33,7 @@ @@ -137,11 +137,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:inspectionMethod:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:inspectionMethod:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:inspectionMethod:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:inspectionMethod:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:inspectionMethod:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -149,6 +159,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -220,6 +234,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } +const handleEnable = async (id: number) => { + try { + await InspectionMethodApi.enableInspectionMethod(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await InspectionMethodApi.disableInspectionMethod(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 diff --git a/src/views/qms/inspectionMethod/inspectionMethod.data.ts b/src/views/qms/inspectionMethod/inspectionMethod.data.ts index ed6fb2d94..3079f5f52 100644 --- a/src/views/qms/inspectionMethod/inspectionMethod.data.ts +++ b/src/views/qms/inspectionMethod/inspectionMethod.data.ts @@ -71,6 +71,24 @@ export const InspectionMethod = useCrudSchemas(reactive([ } }, }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/sampleCode/index.vue b/src/views/qms/sampleCode/index.vue index c1f3f6d11..d4417960b 100644 --- a/src/views/qms/sampleCode/index.vue +++ b/src/views/qms/sampleCode/index.vue @@ -33,7 +33,7 @@ @@ -66,7 +66,6 @@ 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 {connection} from "@antv/x6/es/registry/attr/connection"; defineOptions({ name: 'SampleCode' }) @@ -139,11 +138,22 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:sampleCode:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:sampleCode:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:sampleCode:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:sampleCode:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:sampleCode:disable'}), + ] +} + // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -151,6 +161,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -207,6 +221,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } +const handleEnable = async (id: number) => { + try { + await SampleCodeApi.enableSampleCode(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await SampleCodeApi.disableSampleCode(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 diff --git a/src/views/qms/sampleCode/sampleCode.data.ts b/src/views/qms/sampleCode/sampleCode.data.ts index ef2cf0dcf..2c8bb6541 100644 --- a/src/views/qms/sampleCode/sampleCode.data.ts +++ b/src/views/qms/sampleCode/sampleCode.data.ts @@ -107,6 +107,24 @@ export const SampleCode = useCrudSchemas(reactive([ } }, }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/samplingProcess/index.vue b/src/views/qms/samplingProcess/index.vue index b8918ceb8..85fb11271 100644 --- a/src/views/qms/samplingProcess/index.vue +++ b/src/views/qms/samplingProcess/index.vue @@ -33,7 +33,7 @@ @@ -133,11 +133,21 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:samplingProcess:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingProcess:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:samplingProcess:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:samplingProcess:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:samplingProcess:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { @@ -145,6 +155,10 @@ const buttonTableClick = async (val, row) => { openForm('update', row) } else if (val == 'delete') { // 删除 handleDelete(row.id) + }else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -193,6 +207,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } +const handleEnable = async (id: number) => { + try { + await SamplingProcessApi.enableSamplingProcess(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await SamplingProcessApi.disableSamplingProcess(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 diff --git a/src/views/qms/samplingProcess/samplingProcess.data.ts b/src/views/qms/samplingProcess/samplingProcess.data.ts index 3832d94b3..8c21e4cea 100644 --- a/src/views/qms/samplingProcess/samplingProcess.data.ts +++ b/src/views/qms/samplingProcess/samplingProcess.data.ts @@ -95,6 +95,24 @@ export const SamplingProcess = useCrudSchemas(reactive([ } }, }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action', diff --git a/src/views/qms/samplingScheme/index.vue b/src/views/qms/samplingScheme/index.vue index 9c2a9b8bc..880616d63 100644 --- a/src/views/qms/samplingScheme/index.vue +++ b/src/views/qms/samplingScheme/index.vue @@ -33,7 +33,7 @@ @@ -131,18 +131,30 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:samplingScheme:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingScheme:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} + +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:samplingScheme:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:samplingScheme:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:samplingScheme:disable'}), + ] +} // 列表-操作按钮事件 const buttonTableClick = async (val, row) => { if (val == 'edit') { // 编辑 openForm('update', row) - } else if (val == 'delete') { // 删除 - handleDelete(row.id) + } else if (val == 'enable') { + handleEnable(row.id) + }else if (val == 'disable') { + handleDisable(row.id) } } @@ -195,6 +207,23 @@ const handleDelete = async (id: number) => { } catch {} } +const handleEnable = async (id: number) => { + try { + await SamplingSchemeApi.enableSamplingScheme(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await SamplingSchemeApi.disableSamplingScheme(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 const handleExport = async () => { diff --git a/src/views/qms/samplingScheme/samplingScheme.data.ts b/src/views/qms/samplingScheme/samplingScheme.data.ts index 61c81bba4..4085ec49d 100644 --- a/src/views/qms/samplingScheme/samplingScheme.data.ts +++ b/src/views/qms/samplingScheme/samplingScheme.data.ts @@ -42,6 +42,24 @@ export const SamplingScheme = useCrudSchemas(reactive([ } }, }, + { + label: '是否可用', + field: 'available', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', // 默认都是字符串类型其他暂不考虑 + form: { + component: 'Switch', + value: 'TRUE', + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE' + } + }, + table: { + width: 110 + } + }, { label: '操作', field: 'action',