| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 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 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 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));
- }
|