123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958 |
- import axios from "axios";
- import vuex from "@/store/index.js";
- import errorCode from "@/utils/errorCode";
- import { tansParams, blobValidate } from "@/utils/ruoyi";
- import cache from "@/plugins/cache";
- import { Notification, MessageBox, Message, Loading } from "element-ui";
- import { saveAs } from "file-saver";
- import { getToken } from "@/utils/auth";
- axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
- // 是否显示重新登录
- export let isReloginShow = false;
- // 创建axios实例
- const request = axios.create({
- // axios中请求配置有baseURL选项,表示请求URL公共部分
- baseURL: window.axiosURI,
- //baseURL: "http://192.168.100.252:8080",
- // 超时
- timeout: 100000,
- });
- // request拦截器
- request.interceptors.request.use(
- (config) => {
- //代码防止重复提交会导致浏览器内存溢出,因此没在这添加判断
- config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
- // 是否需要防止数据重复提交
- const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
- // get请求映射params参数
- if (config.method === "get" && config.params) {
- let url = config.url + "?" + tansParams(config.params);
- url = url.slice(0, -1);
- config.params = {};
- config.url = url;
- }
- if (
- !isRepeatSubmit &&
- (config.method === "post" || config.method === "put")
- ) {
- const requestObj = {
- url: config.url,
- data:
- typeof config.data === "object"
- ? JSON.stringify(config.data)
- : config.data,
- time: new Date().getTime(),
- };
- if (requestObj.data.length > 2048) {
- requestObj.data = requestObj.data.substring(0, 2048);
- }
- const sessionObj = cache.session.getJSON("sessionObj");
- if (
- sessionObj === undefined ||
- sessionObj === null ||
- sessionObj === ""
- ) {
- cache.session.setJSON("sessionObj", requestObj);
- } else {
- const s_url = sessionObj.url; // 请求地址
- const s_data = sessionObj.data; // 请求数据
- const s_time = sessionObj.time; // 请求时间
- const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
- if (
- s_data === requestObj.data &&
- requestObj.time - s_time < interval &&
- s_url === requestObj.url
- ) {
- const message = "数据正在处理,请勿重复提交";
- console.warn(`[${s_url}]: ` + message);
- return Promise.reject(new Error(message));
- } else {
- cache.session.setJSON("sessionObj", requestObj);
- }
- }
- }
- return config;
- },
- (error) => {
- console.log(error);
- Promise.reject(error);
- }
- );
- // 响应拦截器
- request.interceptors.response.use(
- (res) => {
- // 未设置状态码则默认成功状态
- const code = res.data.code || 200;
- // 获取错误信息
- const msg = errorCode[code] || res.data.msg || errorCode["default"];
- // 二进制数据则直接返回
- if (
- res.request.responseType === "blob" ||
- res.request.responseType === "arraybuffer"
- ) {
- return res;
- }
- if (code === 401) {
- if (!isReloginShow) {
- isReloginShow = !isReloginShow;
- MessageBox.confirm(
- "登录状态已过期,您可以继续留在该页面,或者重新登录",
- "系统提示",
- {
- confirmButtonText: "重新登录",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(() => {
- isReloginShow = !isReloginShow;
- vuex.dispatch("LogOut").then(() => {
- location.href = "/login";
- });
- })
- .catch(() => {
- isReloginShow = !isReloginShow;
- });
- }
- return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
- } else if (code === 500) {
- Message({
- message: msg,
- type: "error",
- });
- return Promise.reject(new Error(msg));
- } else if (code === 601) {
- Message({
- message: msg,
- type: "warning",
- });
- return Promise.reject("error");
- } else if (code !== 200) {
- Notification.error({
- title: msg,
- });
- return Promise.reject("error");
- } else {
- return res.data;
- }
- },
- (error) => {
- console.log("err" + error);
- let { message } = error;
- if (message == "Network Error") {
- message = "后端接口连接异常";
- } else if (message.includes("timeout")) {
- message = "系统接口请求超时";
- } else if (message.includes("Request failed with status code")) {
- message = "系统接口" + message.substr(message.length - 3) + "异常";
- }
- Message({
- message: message,
- type: "error",
- duration: 5 * 1000,
- });
- return Promise.reject(error);
- }
- );
- /**
- * 基准地价报告
- * @param {*} data
- * @returns
- */
- export async function getJZDJWord(data) {
- let response = await request({
- url: "/model/exportWord/exportWord4",
- method: "post",
- responseType: "blob",
- data: data,
- });
- debugger;
- var fileName = "分析报告";
- debugger;
- const contentDisposition = response.headers["content-disposition"];
- if (contentDisposition) {
- fileName = window.decodeURI(
- response.headers["content-disposition"].split("=")[1],
- "UTF-8"
- );
- }
- const isBlob = blobValidate(response.data);
- debugger;
- if (isBlob) {
- const blob = new Blob([response.data]);
- saveAs(blob, fileName);
- } else {
- const resText = await response.text();
- const rspObj = JSON.parse(resText);
- const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
- Message.error(errMsg);
- }
- return;
- }
- /**
- * 征收补偿报告
- * @param {*} data
- * @returns
- */
- export async function getZDBCWord(data) {
- let response = await request({
- url: "/model/exportWord/exportWord3",
- method: "post",
- responseType: "blob",
- data: data,
- });
- debugger;
- var fileName = data.projectName;
- debugger;
- const contentDisposition = response.headers["content-disposition"];
- if (contentDisposition) {
- fileName = window.decodeURI(
- response.headers["content-disposition"].split("=")[1],
- "UTF-8"
- );
- }
- const isBlob = blobValidate(response.data);
- debugger;
- if (isBlob) {
- const blob = new Blob([response.data]);
- saveAs(blob, fileName);
- } else {
- const resText = await response.text();
- const rspObj = JSON.parse(resText);
- const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
- Message.error(errMsg);
- }
- return;
- }
- /*************************报建项目******************** start */
- // 查询项目信息列表
- export async function listProjectinformation(query) {
- return await request({
- url: "/model/projectinformation/list",
- method: "get",
- params: query,
- });
- }
- // 查询项目信息详细
- export async function getProjectinformation(id) {
- return await request({
- url: "/model/projectinformation/" + id,
- method: "get",
- });
- }
- // 新增项目信息
- export async function addProjectinformation(data) {
- return await request({
- url: "/model/projectinformation",
- method: "post",
- data: data,
- });
- }
- // 修改项目信息
- export async function updateProjectinformation(data) {
- return await request({
- url: "/model/projectinformation",
- method: "put",
- data: data,
- });
- }
- // 删除项目信息
- export async function delProjectinformation(id) {
- return await request({
- url: "/model/projectinformation/" + id,
- method: "delete",
- });
- }
- // 查询报建模型列表
- export async function listConstructionmodel(query) {
- return await request({
- url: "/model/constructionmodel/list",
- method: "get",
- params: query,
- });
- }
- // 查询报建模型详细
- export async function getConstructionmodel(id) {
- return await request({
- url: "/model/constructionmodel/" + id,
- method: "get",
- });
- }
- // 新增报建模型
- export async function addConstructionmodel(data) {
- return await request({
- url: "/model/constructionmodel",
- method: "post",
- data: data,
- });
- }
- // 修改报建模型
- export async function updateConstructionmodel(data) {
- return await request({
- url: "/model/constructionmodel",
- method: "put",
- data: data,
- });
- }
- // 删除报建模型
- export async function delConstructionmodel(id) {
- return await request({
- url: "/model/constructionmodel/" + id,
- method: "delete",
- });
- }
- // 查询项目模型指标人工核算值详细
- export async function getZtProjectModelZb(id) {
- return await request({
- url: "/model/ZtProjectModelZb/" + id,
- method: "get",
- });
- }
- // 新增项目模型指标人工核算值
- export async function addZtProjectModelZb(data) {
- return await request({
- url: "/model/ZtProjectModelZb",
- method: "post",
- data: data,
- });
- }
- // 修改项目模型指标人工核算值
- export async function updateZtProjectModelZb(data) {
- return await request({
- url: "/model/ZtProjectModelZb",
- method: "put",
- data: data,
- });
- }
- /*************************报建项目******************** end */
- /*************************基准地价******************** start */
- // 基准地价分析
- export async function getAnalyseResult(data) {
- return request({
- url: "/model/jzdjanalyse/getAnalyseResult",
- method: "post",
- data: data,
- });
- }
- // 查询基准地价信息列表
- export async function listBenchmarkLandPrices(query) {
- return request({
- url: "/model/BenchmarkLandPrices/list",
- method: "get",
- params: query,
- });
- }
- // 查询基准地价信息详细
- export async function getBenchmarkLandPrices(id) {
- return request({
- url: "/model/BenchmarkLandPrices/" + id,
- method: "get",
- });
- }
- // 新增基准地价信息
- export async function addBenchmarkLandPrices(data) {
- return request({
- url: "/model/BenchmarkLandPrices",
- method: "post",
- data: data,
- });
- }
- // 修改基准地价信息
- export async function updateBenchmarkLandPrices(data) {
- return request({
- url: "/model/BenchmarkLandPrices",
- method: "put",
- data: data,
- });
- }
- // 删除基准地价信息
- export async function delBenchmarkLandPrices(id) {
- return request({
- url: "/model/BenchmarkLandPrices/" + id,
- method: "delete",
- });
- }
- // 查询基准地价分析结果列表
- export function listZtBenchmarkLandPriceResults(query) {
- return request({
- url: "/model/ZtBenchmarkLandPriceResults/list",
- method: "get",
- params: query,
- });
- }
- // 查询基准地价分析结果详细
- export function getZtBenchmarkLandPriceResults(id) {
- return request({
- url: "/model/ZtBenchmarkLandPriceResults/" + id,
- method: "get",
- });
- }
- // 新增基准地价分析结果
- export function addZtBenchmarkLandPriceResults(data) {
- return request({
- url: "/model/ZtBenchmarkLandPriceResults",
- method: "post",
- data: data,
- });
- }
- // 修改基准地价分析结果
- export function updateZtBenchmarkLandPriceResults(data) {
- return request({
- url: "/model/ZtBenchmarkLandPriceResults",
- method: "put",
- data: data,
- });
- }
- // 删除基准地价分析结果
- export function delZtBenchmarkLandPriceResults(id) {
- return request({
- url: "/model/ZtBenchmarkLandPriceResults/" + id,
- method: "delete",
- });
- }
- /*************************基准地价******************** end */
- /*************************征收补偿******************** start */
- // 01 征地补偿标准列表 list
- export function getZdBcbzList(query) {
- return request({
- url: "/model/zdbcbz/list",
- method: "get",
- params: query,
- });
- }
- // 征地 补偿标准 getbyid
- export function getZdBcbzById(id) {
- return request({
- url: "/model/zdbcbz/getInfo/" + id,
- method: "get",
- });
- }
- //添加 征地 补偿标准 add
- export function addZdBcbz(data) {
- return request({
- url: "/model/zdbcbz/",
- method: "post",
- data: data,
- });
- }
- // 更新 征地 补偿标准 update
- export function updateZdBcbz(data) {
- return request({
- url: "/model/zdbcbz/",
- method: "put",
- data: data,
- });
- }
- // 删除 征地 补偿标准 delbyid
- export function delZdBcbz(id) {
- return request({
- url: "/model/zdbcbz/" + id,
- method: "delete",
- });
- }
- // 02 青苗 补偿标准列表 list
- export function getQmbcbzList(query) {
- return request({
- url: "/model/qmbcbz/list",
- method: "get",
- params: query,
- });
- }
- // 青苗 补偿标准 getbyid
- export function getQmbcbzById(id) {
- return request({
- url: "/model/qmbcbz/" + id,
- method: "get",
- });
- }
- //添加 青苗 补偿标准 add
- export function addQmbcbz(data) {
- return request({
- url: "/model/qmbcbz",
- method: "post",
- data: data,
- });
- }
- // 更新 青苗 补偿标准 update
- export function updateQmbcbz(data) {
- return request({
- url: "/model/qmbcbz",
- method: "put",
- data: data,
- });
- }
- // 删除 青苗 补偿标准 delbyid
- export function delQmbcbz(id) {
- return request({
- url: "/model/qmbcbz/" + id,
- method: "delete",
- });
- }
- // 03 拆迁 补偿标准列表 list
- export function getCqBcbzList(query) {
- return request({
- url: "/model/cqbczd/list",
- method: "get",
- params: query,
- });
- }
- // 拆迁 补偿标准 getbyid
- export function getCqBcbzById(id) {
- return request({
- url: "/model/cqbcbz/" + id,
- method: "get",
- });
- }
- //添加 拆迁 补偿标准 add
- export function addCqBcbz(data) {
- return request({
- url: "/model/cqbcbz",
- method: "post",
- data: data,
- });
- }
- // 更新 拆迁 补偿标准 update
- export function updateCqBcbz(data) {
- return request({
- url: "/model/cqbcbz",
- method: "post",
- data: data,
- });
- }
- // 删除 拆迁 补偿标准 delbyid
- export function delCqBcbz(id) {
- return request({
- url: "/model/cqbcbz/" + id,
- method: "delete",
- });
- }
- // 03-1 拆迁 补偿标准项 list
- export function getCqBcbzItemList(query) {
- return request({
- url: "/model/cqbcbzitem/list",
- method: "get",
- params: query,
- });
- }
- // 拆迁 补偿标准项 getbyid
- export function getCqBcbzItemById(id) {
- return request({
- url: "/model/cqbcbzitem/" + id,
- method: "get",
- });
- }
- //添加 拆迁 补偿标准项 add
- export function addCqBcbzItem(data) {
- return request({
- url: "/model/cqbcbzitem",
- method: "post",
- data: data,
- });
- }
- // 更新 拆迁 补偿标准项 update
- export function updateCqBcbzItem(data) {
- return request({
- url: "/model/cqbcbzitem",
- method: "put",
- data: data,
- });
- }
- // 删除 拆迁 补偿标准项 delbyid
- export function delCqBcbzItem(id) {
- return request({
- url: "/model/cqbcbzitem/" + id,
- method: "delete",
- });
- }
- // 04 拆迁 分析结果 列表 list
- export function getCqResultList(query) {
- return request({
- url: "/model/cqresult/list",
- method: "get",
- params: query,
- });
- }
- // 拆迁 分析结果 getbyid
- export function getCqResultById(id) {
- return request({
- url: "/model/cqresult/" + id,
- method: "get",
- });
- }
- //添加 拆迁 分析结果 add
- export function addCqResult(data) {
- return request({
- url: "/model/cqresult",
- method: "post",
- data: data,
- });
- }
- // 更新 拆迁 分析结果 update
- export function updateCqResult(data) {
- return request({
- url: "/model/cqresult",
- method: "post",
- data: data,
- });
- }
- // 删除 拆迁 分析结果 delbyid
- export function delCqResult(id) {
- return request({
- url: "/model/cqresult/" + id,
- method: "delete",
- });
- }
- // 05 征地 分析结果 列表 list
- export function getZdResultList(query) {
- return request({
- url: "/model/zdresult/list",
- method: "get",
- params: query,
- });
- }
- // 征地 分析结果 getbyid
- export function getZdResultById(id) {
- return request({
- url: "/model/zdresult/" + id,
- method: "get",
- });
- }
- //添加 征地 分析结果 add
- export function addZdResult(data) {
- return request({
- url: "/model/zdresult",
- method: "post",
- data: data,
- });
- }
- // 更新 征地 分析结果 update
- export function updateZdResult(data) {
- return request({
- url: "/model/zdresult",
- method: "post",
- data: data,
- });
- }
- // 删除 征地 分析结果 delbyid
- export function delZdResult(id) {
- return request({
- url: "/model/zdresult/" + id,
- method: "delete",
- });
- }
- // 06 青苗 分析结果 列表 list
- export function getQmResultList(query) {
- return request({
- url: "/model/qmresult/list",
- method: "get",
- params: query,
- });
- }
- // 青苗 分析结果 getbyid
- export function getQmResultById(id) {
- return request({
- url: "/model/qmresult/" + id,
- method: "get",
- });
- }
- //添加 青苗 分析结果 add
- export function addQmResult(data) {
- return request({
- url: "/model/qmresult",
- method: "post",
- data: data,
- });
- }
- // 更新 青苗 分析结果 update
- export function updateQmResult(data) {
- return request({
- url: "/model/qmresult",
- method: "post",
- data: data,
- });
- }
- // 删除 青苗 分析结果 delbyid
- export function delQmResult(id) {
- return request({
- url: "/model/qmresult/" + id,
- method: "delete",
- });
- }
- // 07 征收补偿项目 列表 list
- export function getZdProjectList(query) {
- return request({
- url: "/model/zdproject/list",
- method: "get",
- params: query,
- });
- }
- // 征收补偿项目 getbyid
- export function getZdProjectById(id) {
- return request({
- url: "/model/zdproject/" + id,
- method: "get",
- });
- }
- //添加 征收补偿项目 add
- export function addZdProject(data) {
- return request({
- url: "/model/zdproject",
- method: "post",
- data: data,
- });
- }
- // 更新 征收补偿项目 update
- export function updateZdProject(data) {
- return request({
- url: "/model/zdproject",
- method: "post",
- data: data,
- });
- }
- // 删除 征收补偿项目 delbyid
- export function delZdProject(id) {
- return request({
- url: "/model/zdproject/" + id,
- method: "delete",
- });
- }
- export async function expotZDBCWord(data) {
- let response = await request({
- url: "/model/zdproject/exportWord",
- method: "post",
- responseType: "blob",
- data: data,
- });
- debugger;
- var fileName = "分析报告";
- if (data.projectName) fileName = data.projectName;
- debugger;
- const contentDisposition = response.headers["content-disposition"];
- if (contentDisposition) {
- fileName = window.decodeURI(
- response.headers["content-disposition"].split("=")[1],
- "UTF-8"
- );
- }
- const isBlob = blobValidate(response.data);
- debugger;
- if (isBlob) {
- const blob = new Blob([response.data]);
- saveAs(blob, fileName);
- } else {
- const resText = await response.text();
- const rspObj = JSON.parse(resText);
- const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
- Message.error(errMsg);
- }
- return;
- }
- // 08 权属 分析结果 列表 list
- export function getQsResultList(query) {
- return request({
- url: "/model/qsresult/list",
- method: "get",
- params: query,
- });
- }
- // 权属 分析结果 getbyid
- export function getQsResultById(id) {
- return request({
- url: "/model/qsresult/" + id,
- method: "get",
- });
- }
- //添加 权属 分析结果 add
- export function addQsResult(data) {
- return request({
- url: "/model/qsresult",
- method: "post",
- data: data,
- });
- }
- // 更新 权属 分析结果 update
- export function updateQsResult(data) {
- return request({
- url: "/model/qsresult",
- method: "post",
- data: data,
- });
- }
- // 删除 权属 分析结果 delbyid
- export function delQsResult(id) {
- return request({
- url: "/model/qsresult/" + id,
- method: "delete",
- });
- }
- /*************************征收补偿******************** end */
- /*************************夜景灯光******************** start */
- // 查询夜景灯光列列表
- export function listZtLightList(query) {
- return request({
- url: "/model/ZtLightList/list",
- method: "get",
- params: query,
- });
- }
- // 查询夜景灯光列详细
- export function getZtLightList(id) {
- return request({
- url: "/model/ZtLightList/" + id,
- method: "get",
- });
- }
- // 新增夜景灯光列
- export function addZtLightList(data) {
- return request({
- url: "/model/ZtLightList",
- method: "post",
- data: data,
- });
- }
- // 修改夜景灯光列
- export function updateZtLightList(data) {
- return request({
- url: "/model/ZtLightList",
- method: "put",
- data: data,
- });
- }
- // 删除夜景灯光列
- export function delZtLightList(id) {
- return request({
- url: "/model/ZtLightList/" + id,
- method: "delete",
- });
- }
- /*************************夜景灯光******************** end */
- /*************************广告信息******************** start */
- // 查询广告项目信息列表
- export function listZtBillboardInfoList(query) {
- return request({
- url: "/model/ZtBillboardInfoList/list",
- method: "get",
- params: query,
- });
- }
- // 查询广告项目信息详细
- export function getZtBillboardInfoList(id) {
- return request({
- url: "/model/ZtBillboardInfoList/" + id,
- method: "get",
- });
- }
- // 新增广告项目信息
- export function addZtBillboardInfoList(data) {
- return request({
- url: "/model/ZtBillboardInfoList",
- method: "post",
- data: data,
- });
- }
- // 修改广告项目信息
- export function updateZtBillboardInfoList(data) {
- return request({
- url: "/model/ZtBillboardInfoList",
- method: "put",
- data: data,
- });
- }
- // 删除广告项目信息
- export function delZtBillboardInfoList(id) {
- return request({
- url: "/model/ZtBillboardInfoList/" + id,
- method: "delete",
- });
- }
- // 查询广告模型信息列表
- export function listBillboardModelList(query) {
- return request({
- url: "/model/billboardModelList/list",
- method: "get",
- params: query,
- });
- }
- // 查询广告模型信息详细
- export function getBillboardModelList(id) {
- return request({
- url: "/model/billboardModelList/" + id,
- method: "get",
- });
- }
- // 新增广告模型信息
- export function addBillboardModelList(data) {
- return request({
- url: "/model/billboardModelList",
- method: "post",
- data: data,
- });
- }
- // 修改广告模型信息
- export function updateBillboardModelList(data) {
- return request({
- url: "/model/billboardModelList",
- method: "put",
- data: data,
- });
- }
- // 删除广告模型信息
- export function delBillboardModelList(id) {
- return request({
- url: "/model/billboardModelList/" + id,
- method: "delete",
- });
- }
- /*************************广告信息******************** end */
|