12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { ref } from 'vue'
- import { ElMessage } from 'element-plus'
- import { GeneralDataReception, Query } from '@/api/webApi'
- import { IdType } from '../type'
- const tableHeader = ref<any>([])
- const tableData = ref<any>([])
- const msgId = ref<any>('')
- const getTable = async (id: IdType, dataContent) => {
- try {
- const { code, returnData, message } = await Query({
- id: id,
- needPage: 1,
- dataContent: [...dataContent],
- })
- if (code == 0 && returnData) {
- const { columnSet, listValues, submitID } = returnData
- console.log(submitID)
- tableHeader.value = columnSet
- tableData.value = listValues
- msgId.value = submitID
- return {
- tableHeader,
- tableData,
- msgId,
- }
- } else {
- ElMessage.error(message)
- return {
- tableHeader,
- tableData,
- msgId,
- }
- }
- } catch (err: any) {
- return {
- tableHeader,
- tableData,
- msgId,
- }
- }
- }
- const dataChange = async (id: IdType, event: IdType, data) => {
- const obj = Object.assign(data, { event })
- const { code, message } = await GeneralDataReception({
- serviceId: id,
- dataContent: JSON.stringify(obj),
- })
- return {
- code,
- message,
- }
- }
- export default { getTable, dataChange }
|