operatorController.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { addOperatorVersion, delOperatorById, delOperatorVersion, getOperatorById, getOperatorPage, getOperatorType, updateOperatorName } from '@/api/cvs/operator'
  2. import { message } from 'ant-design-vue'
  3. export class OperatorController {
  4. static async page (params: COMMON.API.QueryParams) {
  5. return await getOperatorPage(params)
  6. }
  7. static async type () {
  8. const { data } = await getOperatorType()
  9. return data
  10. }
  11. static async byId (aiId: string) {
  12. const { data } = await getOperatorById(aiId)
  13. return data
  14. }
  15. static async del (aiId: string) {
  16. const { msg, code } = await delOperatorById(aiId)
  17. code === 200 ? message.success('删除成功') : message.error(msg)
  18. }
  19. static async upadteName (aiId: string, aiName: string) {
  20. const { code, msg } = await updateOperatorName(aiId, aiName)
  21. code === 200 ? message.success('修改成功') : message.error(msg)
  22. }
  23. static async addVersion (data: CVS.OperatorVersion) {
  24. const { code, msg } = await addOperatorVersion(data)
  25. code === 200 ? message.success('新增成功') : message.error(msg)
  26. }
  27. static async delVersion (id: string) {
  28. const { code, msg } = await delOperatorVersion(id)
  29. code === 200 ? message.success('删除成功') : message.error(msg)
  30. }
  31. }