From f3ba9aa2a8837b5ec81576cb97019ef28e768421 Mon Sep 17 00:00:00 2001 From: zhaoyiran Date: Fri, 19 Apr 2024 10:32:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?aql=E5=90=AF=E7=94=A8=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/qms/aql/index.ts | 8 +++++ src/config/axios/index.ts | 8 +++++ src/utils/disposition/defaultButtons.ts | 23 ++++++++++++- src/views/qms/aql/aql.data.ts | 18 +++++++++++ src/views/qms/aql/index.vue | 43 ++++++++++++++++++++----- 5 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/api/qms/aql/index.ts b/src/api/qms/aql/index.ts index dda72b699..2a3317051 100644 --- a/src/api/qms/aql/index.ts +++ b/src/api/qms/aql/index.ts @@ -105,3 +105,11 @@ export const importTemplate = () => { export const getSamplingScheme = async () => { return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) } +// 启用 +export const enableAql = async (id: number) => { + return await request.enable({ url: `/qms/aql/enable?id=` + id }) +} +// 禁用 +export const disableAql = async (id: number) => { + return await request.disable({ url: `/qms/aql/disable?id=` + id }) +} diff --git a/src/config/axios/index.ts b/src/config/axios/index.ts index 69c5e72ac..ad0fd2f8c 100644 --- a/src/config/axios/index.ts +++ b/src/config/axios/index.ts @@ -39,6 +39,14 @@ export default { const res = await request({ method: 'DELETE', ...option }) return res.data as unknown as T }, + enable: async (option: any) => { + const res = await request({ method: 'POST', ...option }) + return res.data as unknown as T + }, + disable: async (option: any) => { + const res = await request({ method: 'POST', ...option }) + return res.data as unknown as T + }, put: async (option: any) => { const res = await request({ method: 'PUT', ...option }) return res.data as unknown as T diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index e8d89e7d8..0893325bb 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -250,7 +250,28 @@ export function mainListDeleteBtn(option:any) { hasPermi: '' }) } - +export function mainListEnableBtn(option:any) { + return __defaultBtnOption(option,{ + label: '启用', + name: 'enable', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} +export function mainListDisableBtn(option:any) { + return __defaultBtnOption(option,{ + label: '禁用', + name: 'disable', + hide: false, + type: 'danger', + color: '', + link: true, // 文本展现按钮 + hasPermi: '' + }) +} // 主列表-中止按钮1 export function mainListSuspend1Btn(option:any) { return __defaultBtnOption(option,{ diff --git a/src/views/qms/aql/aql.data.ts b/src/views/qms/aql/aql.data.ts index d16783a9f..1351f93d1 100644 --- a/src/views/qms/aql/aql.data.ts +++ b/src/views/qms/aql/aql.data.ts @@ -550,6 +550,24 @@ export const Aql = 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/aql/index.vue b/src/views/qms/aql/index.vue index 378d5b12c..3ac3045a6 100644 --- a/src/views/qms/aql/index.vue +++ b/src/views/qms/aql/index.vue @@ -33,7 +33,7 @@ @@ -132,18 +132,29 @@ const buttonBaseClick = (val, item) => { } } -// 列表-操作按钮 -const butttondata = [ - defaultButtons.mainListEditBtn({hasPermi:'qms:aql:update'}), // 编辑 - defaultButtons.mainListDeleteBtn({hasPermi:'qms:aql:delete'}), // 删除 -] +const isShowMainButton = (row,val) => { + if (val.indexOf(row.available) > -1) { + return false + } else { + return true + } +} +const butttondata = (row) => { + return [ + defaultButtons.mainListEditBtn({hasPermi: 'qms:aql:update'}), + defaultButtons.mainListEnableBtn({hide:isShowMainButton(row,['FALSE']),hasPermi:'qms:aql:enable'}), + defaultButtons.mainListDisableBtn({hide:isShowMainButton(row,['TRUE']),hasPermi:'qms:aql: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 +206,22 @@ const handleDelete = async (id: number) => { await getList() } catch {} } +const handleEnable = async (id: number) => { + try { + await AqlApi.enableAql(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} +const handleDisable = async (id: number) => { + try { + await AqlApi.disableAql(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} /** 导出按钮操作 */ const exportLoading = ref(false) // 导出的加载中 From f5d3a2ba80afeb27886ad82e029ad54c99574e3c Mon Sep 17 00:00:00 2001 From: zhaoyiran Date: Fri, 19 Apr 2024 11:00:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/qms/aql/aql.data.ts | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/views/qms/aql/aql.data.ts b/src/views/qms/aql/aql.data.ts index 1351f93d1..b9b11ae3e 100644 --- a/src/views/qms/aql/aql.data.ts +++ b/src/views/qms/aql/aql.data.ts @@ -116,7 +116,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_010', + label: 'A0.01', field: 'a0separator010', sort: 'custom', table: { @@ -124,7 +124,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_010', + label: 'R0.01', field: 'r0separator010', sort: 'custom', table: { @@ -132,7 +132,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_015', + label: 'A0.015', field: 'a0separator015', sort: 'custom', table: { @@ -140,7 +140,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_015', + label: 'R0.015', field: 'r0separator015', sort: 'custom', table: { @@ -148,7 +148,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_025', + label: 'A0.025', field: 'a0separator025', sort: 'custom', table: { @@ -156,7 +156,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_025', + label: 'R0.025', field: 'r0separator025', sort: 'custom', table: { @@ -164,7 +164,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_040', + label: 'A0.04', field: 'a0separator040', sort: 'custom', table: { @@ -172,7 +172,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_040', + label: 'R0.04', field: 'r0separator040', sort: 'custom', table: { @@ -180,7 +180,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_065', + label: 'A0.065', field: 'a0separator065', sort: 'custom', table: { @@ -188,7 +188,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_065', + label: 'R0.065', field: 'r0separator065', sort: 'custom', table: { @@ -196,7 +196,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_10', + label: 'A0.1', field: 'a0separator10', sort: 'custom', table: { @@ -204,7 +204,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_10', + label: 'R0.1', field: 'r0separator10', sort: 'custom', table: { @@ -212,7 +212,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_15', + label: 'A0.15', field: 'a0separator15', sort: 'custom', table: { @@ -220,7 +220,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_15', + label: 'R0.15', field: 'r0separator15', sort: 'custom', table: { @@ -228,7 +228,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_25', + label: 'A0.25', field: 'a0separator25', sort: 'custom', table: { @@ -236,7 +236,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_25', + label: 'R0.25', field: 'r0separator25', sort: 'custom', table: { @@ -244,7 +244,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_40', + label: 'A0.4', field: 'a0separator40', sort: 'custom', table: { @@ -252,7 +252,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_40', + label: 'R0.4', field: 'r0separator40', sort: 'custom', table: { @@ -260,7 +260,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A0_65', + label: 'A0.65', field: 'a0separator65', sort: 'custom', table: { @@ -268,7 +268,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R0_65', + label: 'R0.65', field: 'r0separator65', sort: 'custom', table: { @@ -276,7 +276,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A1_0', + label: 'A1.0', field: 'a1separator0', sort: 'custom', table: { @@ -284,7 +284,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R1_0', + label: 'R1.0', field: 'r1separator0', sort: 'custom', table: { @@ -292,7 +292,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A1_5', + label: 'A1.5', field: 'a1separator5', sort: 'custom', table: { @@ -300,7 +300,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R1_5', + label: 'R1.5', field: 'r1separator5', sort: 'custom', table: { @@ -308,7 +308,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A2_5', + label: 'A2.5', field: 'a2separator5', sort: 'custom', table: { @@ -316,7 +316,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R2_5', + label: 'R2.5', field: 'r2separator5', sort: 'custom', table: { @@ -324,7 +324,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A4_0', + label: 'A4.0', field: 'a4separator0', sort: 'custom', table: { @@ -332,7 +332,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R4_0', + label: 'R4.0', field: 'r4separator0', sort: 'custom', table: { @@ -340,7 +340,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'A6_5', + label: 'A6.5', field: 'a6separator5', sort: 'custom', table: { @@ -348,7 +348,7 @@ export const Aql = useCrudSchemas(reactive([ } }, { - label: 'R6_5', + label: 'R6.5', field: 'r6separator5', sort: 'custom', table: {