李志伟 пре 2 година
родитељ
комит
c19d5b7461
3 измењених фајлова са 13 додато и 3 уклоњено
  1. 3
    1
      config/proxy.js
  2. 2
    2
      src/pages/Machinery/Machinery/index.jsx
  3. 8
    0
      src/services/machinery.js

+ 3
- 1
config/proxy.js Прегледај датотеку

@@ -11,7 +11,9 @@ export default {
11 11
     // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
12 12
     '/api/': {
13 13
       // 要代理的地址
14
-      target: 'http://192.168.89.147:7080',
14
+      // target: 'http://192.168.89.147:7080',
15
+      // target: 'http://192.168.89.25:7080',
16
+      target: 'http://machine.njyunzhi.com',
15 17
       // 配置了这个可以从 http 代理到 https
16 18
       // 依赖 origin 的功能可能需要这个,比如 cookie
17 19
       changeOrigin: true,

+ 2
- 2
src/pages/Machinery/Machinery/index.jsx Прегледај датотеку

@@ -4,7 +4,7 @@ import { Button, Popconfirm, message, Select, Modal } from 'antd';
4 4
 import { PlusOutlined } from '@ant-design/icons';
5 5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
6 6
 import PageTable from '@/components/PageTable';
7
-import { getMachineryList, deleteMachinery, updateMachinery } from '@/services/machinery';
7
+import { getMachineryList, deleteMachinery, updateMachinery, updateRepair } from '@/services/machinery';
8 8
 import { getMachineryTypeList } from '@/services/machineryType';
9 9
 import { getCooperativeList } from '@/services/cooperative';
10 10
 
@@ -37,7 +37,7 @@ export default (props) => {
37 37
       okText: '确认',
38 38
       cancelText: '取消',
39 39
       onOk() {
40
-        updateMachinery(record.machineryId, { ...record, status: record.status === 1 ? 0 : 1 })
40
+        updateRepair(record.machineryId, record.status === 1 ? 0 : 1)
41 41
           .then((res) => {
42 42
             message.success('操作成功');
43 43
             actionRef.current.reload();

+ 8
- 0
src/services/machinery.js Прегледај датотеку

@@ -14,6 +14,14 @@ export const addMachinery = (data) => request('/machinery', { method: 'post', da
14 14
  */
15 15
 export const updateMachinery = (id, data) => request(`/machinery/${id}`, { method: 'put', data });
16 16
 
17
+/**
18
+ * 维修/完成维修农机
19
+ * @param {*} data
20
+ * @returns
21
+ */
22
+export const updateRepair = (id, status) =>
23
+  request(`/machinery/${id}/status/${status}`, { method: 'put' });
24
+
17 25
 /**
18 26
  * 查询农机列表
19 27
  * @param {*} params