Browse Source

基础数据启用禁用

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

9
src/api/qms/dynamicRule/index.ts

@ -51,3 +51,12 @@ export const exportDynamicRule = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/qms/dynamic-rule/get-import-template' }) 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 = () => { export const importTemplate = () => {
return request.download({ url: '/qms/inspection-method/get-import-template' }) 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 }) 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 })
}

9
src/api/qms/inspectionTemplate/index.ts

@ -28,3 +28,12 @@ export const inspectionTemplatePage = async (params) => {
return await request.get({ url: `/qms/programme-template/page`, params }) 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 () => { export const getSamplingScheme = async () => {
return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) 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 () => { export const getSamplingScheme = async () => {
return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) 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 = () => { export const importTemplate = () => {
return request.download({ url: '/qms/sampling-scheme/get-import-template' }) 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 })
}

9
src/api/qms/selectedSet/index.ts

@ -53,3 +53,12 @@ export const exportSelectedSet = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/qms/selected-set/get-import-template' }) 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', sort: 'custom',
isSearch: true 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: '操作', label: '操作',
field: 'action', field: 'action',

40
src/views/qms/basicDataManage/dynamicRule/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -163,11 +163,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:dynamic-rule:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:dynamic-rule:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -175,6 +185,10 @@ const buttonTableClick = async (val, row) => {
editForm('update', row) editForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) // const exportLoading = ref(false) //

41
src/views/qms/basicDataManage/inspectionScheme/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -117,11 +117,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:type-template:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:type-template:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -129,6 +139,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) => { const searchFormClick = (searchData) => {

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

@ -196,25 +196,24 @@ export const InspectionSchemeMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
}, },
// { {
// label: '是否可用', label: '是否可用',
// field: 'available', field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE, sort: 'custom',
// dictClass: 'string', dictType: DICT_TYPE.TRUE_FALSE,
// isTable: true, dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// sort: 'custom', form: {
// table: { component: 'Switch',
// width: 150 value: 'TRUE',
// }, componentProps: {
// form: { inactiveValue: 'FALSE',
// component: 'Switch', activeValue: 'TRUE'
// value: 'TRUE', }
// componentProps: { },
// inactiveValue: 'FALSE', table: {
// activeValue: 'TRUE' width: 110
// } }
// }, },
// },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

41
src/views/qms/basicDataManage/inspectionTemplate/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -125,11 +125,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:programme-template:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:programme-template:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -137,6 +147,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) => { const searchFormClick = (searchData) => {

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

@ -95,6 +95,24 @@ export const InspectionTemplateMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'version', field: 'version',
sort: 'custom', 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: '操作', label: '操作',
field: 'action', field: 'action',

41
src/views/qms/basicDataManage/selectedSet/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -166,11 +166,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:selected-set:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:selected-set:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -178,6 +188,10 @@ const buttonTableClick = async (val, row) => {
editForm('update', row) editForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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 exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {

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

@ -26,6 +26,24 @@ export const SelectedSet = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true 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: '操作', label: '操作',
field: 'action', field: 'action',

40
src/views/qms/inspectionMethod/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -137,11 +137,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:inspectionMethod:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:inspectionMethod:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -149,6 +159,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) // 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: '操作', label: '操作',
field: 'action', field: 'action',

42
src/views/qms/sampleCode/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -66,7 +66,6 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import {connection} from "@antv/x6/es/registry/attr/connection";
defineOptions({ name: 'SampleCode' }) defineOptions({ name: 'SampleCode' })
@ -139,11 +138,22 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:sampleCode:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:sampleCode:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -151,6 +161,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) // 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: '操作', label: '操作',
field: 'action', field: 'action',

40
src/views/qms/samplingProcess/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -133,11 +133,21 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:samplingProcess:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingProcess:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
@ -145,6 +155,10 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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() await getList()
} catch {} } 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) // const exportLoading = ref(false) //

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

@ -94,6 +94,24 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x', valueFormat: 'x',
} }
}, },
},
{
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: '操作', label: '操作',

43
src/views/qms/samplingScheme/index.vue

@ -33,7 +33,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -131,18 +131,30 @@ const buttonBaseClick = (val, item) => {
} }
} }
// - const isShowMainButton = (row,val) => {
const butttondata = [ if (val.indexOf(row.available) > -1) {
defaultButtons.mainListEditBtn({hasPermi:'qms:samplingScheme:update'}), // return false
defaultButtons.mainListDeleteBtn({hasPermi:'qms:samplingScheme:delete'}), // } 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) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'enable') {
handleDelete(row.id) handleEnable(row.id)
}else if (val == 'disable') {
handleDisable(row.id)
} }
} }
@ -195,6 +207,23 @@ const handleDelete = async (id: number) => {
} catch {} } 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 exportLoading = ref(false) //
const handleExport = async () => { 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: '操作', label: '操作',
field: 'action', field: 'action',

Loading…
Cancel
Save