Skip to content

Commit 13e9131

Browse files
committed
fix api
1 parent bb75366 commit 13e9131

File tree

2 files changed

+29
-105
lines changed

2 files changed

+29
-105
lines changed

web/aflow/controllers/Flow.php

+1-70
Original file line numberDiff line numberDiff line change
@@ -316,51 +316,7 @@ public function show_flow($id) {
316316
$this->data['products'] = $products;
317317
$this->load->view('flow/show_flow', $this->data);
318318
}
319-
/*
320-
public function api() {
321-
if ($this->input->server('REQUEST_METHOD')!="POST") {
322-
var_dump($this->input->server('REQUEST_METHOD'));
323-
return;
324-
}
325-
if (!$this->check_auth('group_user')) {
326-
$this->load->view('comm/noright',$this->data);
327-
return;
328-
}
329-
330-
$url = 'http://localhost/data_flow/api';
331-
$data = file_get_contents('php://input');
332319

333-
$headers = array();
334-
foreach (getallheaders() as $name => $value) {
335-
array_push($headers, "$name: $value");
336-
}
337-
338-
$ch = curl_init($url);
339-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
340-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
341-
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
342-
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
343-
curl_setopt($ch, CURLOPT_HEADER, 1);
344-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
345-
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
346-
$response = curl_exec($ch);
347-
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
348-
$headers = substr($response, 0, $header_size);
349-
$body = substr($response, $header_size);
350-
351-
if(curl_errno($ch)) {
352-
show_error(curl_error($ch));
353-
} else {
354-
foreach (explode("\r\n", $headers) as $header) {
355-
$header = trim($header);
356-
if ($header) header($header);
357-
}
358-
echo $body;
359-
}
360-
curl_close($ch);
361-
return;
362-
}
363-
*/
364320
public function get_task_state_text($id)
365321
{
366322
$text = "";
@@ -384,29 +340,4 @@ public function get_task_state_text($id)
384340
}
385341
return $text;
386342
}
387-
}
388-
389-
if (!function_exists('getallheaders'))
390-
{
391-
function getallheaders()
392-
{
393-
$headers = array();
394-
foreach ($_SERVER as $name => $value)
395-
{
396-
$iname = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
397-
// var_dump($iname);
398-
if (substr($name, 0, 5) == 'HTTP_')
399-
{
400-
$headers[$iname] = $value;
401-
}
402-
}
403-
return $headers;
404-
}
405-
}
406-
407-
if (!function_exists('json_exception'))
408-
{
409-
function json_exception($code, $message) {
410-
throw new Exception($message, $code);
411-
}
412-
}
343+
}

web2/src/components/ElementTable.vue

+28-35
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22
<div class="main">
33
<h1 class="page-header"><span id="page_title">流程实例列表</span> <div class="pull-right"></div></h1>
44
<div class="table-responsive">
5-
<form class="navbar-form navbar-left" role="form" method="post">
5+
<form class="navbar-form navbar-left" id='form' role="form" method="post">
66
<div class="form-group">
7-
<input type="text" class="input-date form-control" id="begin_date" value="2019-03-29" name="begin_date">
7+
<input type="text" class="input-date form-control" v-model="formdata.begin_date" value="2019-03-29">
88
<span>至</span>
9-
<input type="text" class="input-date form-control" id="end_date" value="2019-03-31" name="end_date">
9+
<input type="text" class="input-date form-control" v-model="formdata.end_date" value="2019-03-31">
1010
<input type="hidden" class="form-control" name="env" value="data_flow">
11-
<select name="set_nu" id="set_nu" class="form-control">
11+
<select name="set_nu" v-model="formdata.set_nu" class="form-control">
1212
<Option v-for="item in set_nu" :value="item.value" :key="item.value" name="set_type">
1313
{{ item.label }}
1414
</Option>
1515
</select>
16-
<select name="process_type" id="process_type" class="form-control">
16+
<select name="process_type" v-model="formdata.process_type" class="form-control">
1717
<option value="all">所有流程</option>
1818
<option value="NEW_FLOW">新流程</option>
1919
<option value="NEW_FLOW2">新流程</option>
2020
</select>
21-
<Select name="process_state_type" id="process_state_type" class="form-control">
21+
<Select name="process_state_type" v-model="formdata.process_state_type" class="form-control">
2222
<Option v-for="item in process_state_type" :value="item.value" :key="item.value" name="state_type">
2323
{{ item.label }}
2424
</Option>
2525
</Select>
26-
<select class="chosen-select" style="width: 200px; display: none;" tabindex="-1" id="pid">
26+
<select class="chosen-select" style="width: 200px; display: none;" tabindex="-1" v-model="formdata.pid">
2727
<option value=""></option>
2828
<option selected="selected" value="all">所有业务</option><option value="222">222(223)</option>
2929
</select>
3030

31-
<select class="form-control" mame="pids" id="pids">
31+
<select class="form-control" mame="pids" v-model="formdata.pids">
3232
<option value="all">所有</option>
3333
<Option v-for="item in pids" :value="item.value" :key="item.value" name="state_type">
3434
{{ item.label }}
3535
</Option>
3636
</select>
37-
<button type="button" class="btn btn-success" onclick="show_flow_list()">查询</button>
37+
<button type="button" class="btn btn-success" v-on:click="show_flow_list()">查询</button>
3838
</div>
3939
</form>
4040
<div id="processes_detail"></div>
@@ -61,35 +61,28 @@ export default {
6161
data () {
6262
return {
6363
process_state_type: [
64-
{
65-
value: '-1', label: '未成功'
66-
},
67-
{
68-
value: 'all', label: '所有状态'
69-
},
70-
{
71-
value: '2', label: '成功'
72-
},
73-
{
74-
value: '3', label: '失败'
75-
},
64+
{value: '-1', label: '未成功'},
65+
{value: 'all', label: '所有状态'},
66+
{value: '2', label: '成功'},
67+
{value: '3', label: '失败'},
7668
],
7769
set_nu: [
78-
{
79-
value: 'all', label: '所有集群'
80-
},
81-
{
82-
value: '0', label: 'set0'
83-
},
84-
{
85-
value: '1', label: 'set1'
86-
},
70+
{value: 'all', label: '所有集群'},
71+
{value: '0', label: 'set0'},
72+
{value: '1', label: 'set1'},
8773
],
8874
pids: [
89-
{
90-
value: '222', label: '222'
91-
},
92-
75+
{value: '222', label: '222'},
76+
],
77+
formdata: {
78+
begin_date: "",
79+
end_date: "",
80+
process_type: {value:"all", label:"所有流程"},
81+
process_state_type: {},
82+
pids: ""
83+
},
84+
headers:[
85+
{"Content-Type": "application/json"}
9386
],
9487
info: null
9588
}
@@ -101,7 +94,7 @@ export default {
10194
show_flow_list: function () {
10295
let params = { project_id: 1};
10396
let headers = {"Content-Type": "application/json"};
104-
axios.get(`${test}/oneflow/getInst`, { params: params, headers:headers}).then(
97+
axios.get(`${test}/oneflow/GetFlowInsts`, { params: this.formdata, headers:headers}).then(
10598
res => (this.info = res.data));
10699
}
107100
}

0 commit comments

Comments
 (0)