Browse Source

基础数据启用禁用

master_hella_20240701
zhaoyiran 7 months ago
parent
commit
09359a9538
  1. 2
      src/api/qms/counter/index.ts
  2. 11
      src/api/qms/dynamicRule/index.ts
  3. 8
      src/api/qms/inspectionMethod/index.ts
  4. 9
      src/api/qms/inspectionScheme/index.ts
  5. 11
      src/api/qms/inspectionTemplate/index.ts
  6. 9
      src/api/qms/sampleCode/index.ts
  7. 8
      src/api/qms/samplingProcess/index.ts
  8. 9
      src/api/qms/samplingScheme/index.ts
  9. 11
      src/api/qms/selectedSet/index.ts
  10. 18
      src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts
  11. 42
      src/views/qms/basicDataManage/dynamicRule/index.vue
  12. 43
      src/views/qms/basicDataManage/inspectionScheme/index.vue
  13. 37
      src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts
  14. 43
      src/views/qms/basicDataManage/inspectionTemplate/index.vue
  15. 20
      src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts
  16. 43
      src/views/qms/basicDataManage/selectedSet/index.vue
  17. 18
      src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts
  18. 42
      src/views/qms/inspectionMethod/index.vue
  19. 18
      src/views/qms/inspectionMethod/inspectionMethod.data.ts
  20. 44
      src/views/qms/sampleCode/index.vue
  21. 18
      src/views/qms/sampleCode/sampleCode.data.ts
  22. 42
      src/views/qms/samplingProcess/index.vue
  23. 18
      src/views/qms/samplingProcess/samplingProcess.data.ts
  24. 45
      src/views/qms/samplingScheme/index.vue
  25. 18
      src/views/qms/samplingScheme/samplingScheme.data.ts

2
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' })
}
}

11
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' })
}
}
// 启用
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 })
}

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

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

11
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 })
}
}
}
// 启用
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 })
}

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

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

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

11
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' })
}
}
// 启用
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 })
}

18
src/views/qms/basicDataManage/dynamicRule/dynamicRule.data.ts

@ -33,6 +33,24 @@ export const DynamicRule = useCrudSchemas(reactive<CrudSchema[]>([
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',

42
src/views/qms/basicDataManage/dynamicRule/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>
@ -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) //

43
src/views/qms/basicDataManage/inspectionScheme/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>
@ -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) => {

37
src/views/qms/basicDataManage/inspectionScheme/inspectionScheme.data.ts

@ -196,25 +196,24 @@ export const InspectionSchemeMain = useCrudSchemas(reactive<CrudSchema[]>([
}
},
},
// {
// 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',

43
src/views/qms/basicDataManage/inspectionTemplate/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>
@ -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) => {

20
src/views/qms/basicDataManage/inspectionTemplate/inspectionTemplate.data.ts

@ -95,6 +95,24 @@ export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
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<CrudSchema[]>([
component:'Select'
}
}
]))
]))

43
src/views/qms/basicDataManage/selectedSet/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>
@ -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 () => {

18
src/views/qms/basicDataManage/selectedSet/selectedSet.data.ts

@ -26,6 +26,24 @@ export const SelectedSet = useCrudSchemas(reactive<CrudSchema[]>([
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',

42
src/views/qms/inspectionMethod/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>
@ -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) //

18
src/views/qms/inspectionMethod/inspectionMethod.data.ts

@ -71,6 +71,24 @@ export const InspectionMethod = 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',

44
src/views/qms/sampleCode/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>
@ -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) //

18
src/views/qms/sampleCode/sampleCode.data.ts

@ -107,6 +107,24 @@ export const SampleCode = 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',

42
src/views/qms/samplingProcess/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>
@ -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) //

18
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -95,6 +95,24 @@ export const SamplingProcess = 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',

45
src/views/qms/samplingScheme/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>
@ -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 () => {

18
src/views/qms/samplingScheme/samplingScheme.data.ts

@ -42,6 +42,24 @@ export const SamplingScheme = 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',

Loading…
Cancel
Save