| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { get, postJ, putJ, deleteApi } from "@/utils/request";
- import Vue from "vue";
- // 保存或更新
- export async function save(data) {
- const url = Vue.prototype.apiUrl + '/ehs/accidentIncidents/' + (data.id ? 'update' : 'save');
- const res = await postJ(url, data);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
- // 局部修改(处理)
- export async function updatePartial(data) {
- const res = await postJ(Vue.prototype.apiUrl + '/ehs/accidentIncidents/updatePartial', data);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
- // 列表
- export async function getList(params) {
- const res = await postJ(Vue.prototype.apiUrl + '/ehs/accidentIncidents/page', params);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
- // 审批通过分页(处理列表)
- export async function pageApproved(params) {
- const res = await postJ(Vue.prototype.apiUrl + '/ehs/accidentIncidents/pageApproved', 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/accidentIncidents/getById/${id}`);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
- // 删除
- export async function remove(data) {
- const res = await postJ(Vue.prototype.apiUrl + '/ehs/accidentIncidents/delete', data);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
- // 处理(废弃,使用updatePartial)
- export async function process(data) {
- const res = await putJ(Vue.prototype.apiUrl + '/ehs/accidentIncidents/process', data);
- if (res.code == 0) return res.data;
- return Promise.reject(new Error(res.message));
- }
|