Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
yufei0306 7 months ago
parent
commit
ba9699e96f
  1. 8
      src/api/qms/aql/index.ts
  2. 8
      src/config/axios/index.ts
  3. 23
      src/utils/disposition/defaultButtons.ts
  4. 78
      src/views/qms/aql/aql.data.ts
  5. 43
      src/views/qms/aql/index.vue

8
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 })
}

8
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 <T = any>(option: any) => {
const res = await request({ method: 'POST', ...option })
return res.data as unknown as T
},
disable: async <T = any>(option: any) => {
const res = await request({ method: 'POST', ...option })
return res.data as unknown as T
},
put: async <T = any>(option: any) => {
const res = await request({ method: 'PUT', ...option })
return res.data as unknown as T

23
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,{

78
src/views/qms/aql/aql.data.ts

@ -116,7 +116,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_010',
label: 'A0.01',
field: 'a0separator010',
sort: 'custom',
table: {
@ -124,7 +124,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_010',
label: 'R0.01',
field: 'r0separator010',
sort: 'custom',
table: {
@ -132,7 +132,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_015',
label: 'A0.015',
field: 'a0separator015',
sort: 'custom',
table: {
@ -140,7 +140,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_015',
label: 'R0.015',
field: 'r0separator015',
sort: 'custom',
table: {
@ -148,7 +148,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_025',
label: 'A0.025',
field: 'a0separator025',
sort: 'custom',
table: {
@ -156,7 +156,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_025',
label: 'R0.025',
field: 'r0separator025',
sort: 'custom',
table: {
@ -164,7 +164,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_040',
label: 'A0.04',
field: 'a0separator040',
sort: 'custom',
table: {
@ -172,7 +172,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_040',
label: 'R0.04',
field: 'r0separator040',
sort: 'custom',
table: {
@ -180,7 +180,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_065',
label: 'A0.065',
field: 'a0separator065',
sort: 'custom',
table: {
@ -188,7 +188,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_065',
label: 'R0.065',
field: 'r0separator065',
sort: 'custom',
table: {
@ -196,7 +196,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_10',
label: 'A0.1',
field: 'a0separator10',
sort: 'custom',
table: {
@ -204,7 +204,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_10',
label: 'R0.1',
field: 'r0separator10',
sort: 'custom',
table: {
@ -212,7 +212,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_15',
label: 'A0.15',
field: 'a0separator15',
sort: 'custom',
table: {
@ -220,7 +220,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_15',
label: 'R0.15',
field: 'r0separator15',
sort: 'custom',
table: {
@ -228,7 +228,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_25',
label: 'A0.25',
field: 'a0separator25',
sort: 'custom',
table: {
@ -236,7 +236,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_25',
label: 'R0.25',
field: 'r0separator25',
sort: 'custom',
table: {
@ -244,7 +244,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_40',
label: 'A0.4',
field: 'a0separator40',
sort: 'custom',
table: {
@ -252,7 +252,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_40',
label: 'R0.4',
field: 'r0separator40',
sort: 'custom',
table: {
@ -260,7 +260,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A0_65',
label: 'A0.65',
field: 'a0separator65',
sort: 'custom',
table: {
@ -268,7 +268,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R0_65',
label: 'R0.65',
field: 'r0separator65',
sort: 'custom',
table: {
@ -276,7 +276,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A1_0',
label: 'A1.0',
field: 'a1separator0',
sort: 'custom',
table: {
@ -284,7 +284,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R1_0',
label: 'R1.0',
field: 'r1separator0',
sort: 'custom',
table: {
@ -292,7 +292,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A1_5',
label: 'A1.5',
field: 'a1separator5',
sort: 'custom',
table: {
@ -300,7 +300,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R1_5',
label: 'R1.5',
field: 'r1separator5',
sort: 'custom',
table: {
@ -308,7 +308,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A2_5',
label: 'A2.5',
field: 'a2separator5',
sort: 'custom',
table: {
@ -316,7 +316,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R2_5',
label: 'R2.5',
field: 'r2separator5',
sort: 'custom',
table: {
@ -324,7 +324,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A4_0',
label: 'A4.0',
field: 'a4separator0',
sort: 'custom',
table: {
@ -332,7 +332,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R4_0',
label: 'R4.0',
field: 'r4separator0',
sort: 'custom',
table: {
@ -340,7 +340,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'A6_5',
label: 'A6.5',
field: 'a6separator5',
sort: 'custom',
table: {
@ -348,7 +348,7 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: 'R6_5',
label: 'R6.5',
field: 'r6separator5',
sort: 'custom',
table: {
@ -550,6 +550,24 @@ export const Aql = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
{
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',

43
src/views/qms/aql/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>
@ -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) //

Loading…
Cancel
Save