import { get, put, putJ, postJ, deleteApi } from "@/utils/request"; import Vue from "vue"; // 随手拍分页列表 export async function getList(params) { const res = await get(Vue.prototype.apiUrl + '/ehs/safetyquickshot/page', params); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 随手拍详情 export async function getById(id) { const res = await get(Vue.prototype.apiUrl + `/ehs/safetyquickshot/getById/${id}`); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 保存随手拍 export async function save(data) { const res = await postJ(Vue.prototype.apiUrl + '/ehs/safetyquickshot/save', data); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 更新随手拍 export async function update(data) { const url = Vue.prototype.apiUrl + '/ehs/safetyquickshot/' + (data.id ? 'update' : 'save'); const fn = data.id ? putJ : postJ; const res = await fn(url, data); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 删除随手拍 export async function remove(data) { const res = await deleteApi(Vue.prototype.apiUrl + '/ehs/safetyquickshot/delete', data); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 处理/下发整改 export async function handle(data) { const res = await postJ(Vue.prototype.apiUrl + '/ehs/safetyquickshot/handle', data); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); } // 废弃 export async function discard(data) { const res = await postJ(Vue.prototype.apiUrl + '/ehs/safetyquickshot/discard', data); if (res.code == 0) { return res.data; } return Promise.reject(new Error(res.message)); }