rewrite pro dict page
This commit is contained in:
parent
a7e315d573
commit
814405709f
|
@ -1,72 +1,156 @@
|
||||||
package index_management
|
package index_management
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"infini.sh/framework/core/api"
|
"infini.sh/framework/core/api"
|
||||||
httprouter "infini.sh/framework/core/api/router"
|
httprouter "infini.sh/framework/core/api/router"
|
||||||
"infini.sh/framework/core/orm"
|
"infini.sh/framework/core/orm"
|
||||||
"infini.sh/framework/core/util"
|
"infini.sh/framework/core/util"
|
||||||
model2 "infini.sh/search-center/model"
|
model2 "infini.sh/search-center/model"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type APIHandler struct {
|
type APIHandler struct {
|
||||||
api.Handler
|
api.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (handler APIHandler) GetDictListAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
|
var (
|
||||||
|
fromStr = handler.GetParameterOrDefault(req, "from", "0")
|
||||||
|
sizeStr = handler.GetParameterOrDefault(req, "size", "6")
|
||||||
|
tag = handler.GetParameterOrDefault(req, "tags", "")
|
||||||
|
name = handler.GetParameterOrDefault(req, "name", "")
|
||||||
|
from, _ = strconv.Atoi(fromStr)
|
||||||
|
size, _ = strconv.Atoi(sizeStr)
|
||||||
|
tags = strings.Split(tag, ",")
|
||||||
|
)
|
||||||
|
if len(tags) > 3 {
|
||||||
|
tags = tags[0:3]
|
||||||
|
}
|
||||||
|
rel, err := model2.GetDictList(from, size, name, tags)
|
||||||
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
}
|
||||||
|
resp := map[string]interface{}{
|
||||||
|
"errno": "0",
|
||||||
|
"errmsg": "",
|
||||||
|
"data": rel,
|
||||||
|
}
|
||||||
|
handler.WriteJSON(w, resp, http.StatusOK)
|
||||||
|
}
|
||||||
|
|
||||||
func (handler APIHandler)CreateDictItemAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
func (handler APIHandler) CreateDictItemAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
//id := ps.ByName("id")
|
//id := ps.ByName("id")
|
||||||
dict:=model2.Dict{}
|
jq, err := handler.GetJSON(req)
|
||||||
dict.ID = util.GetUUID()
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name, err := jq.String("name")
|
||||||
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tags, err := jq.ArrayOfStrings("tags")
|
||||||
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := orm.Save(dict)
|
content, err := jq.String("content")
|
||||||
if err!=nil{
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
createdAt := time.Now()
|
||||||
|
|
||||||
|
dict := model2.Dict{
|
||||||
|
ID: util.GetUUID(),
|
||||||
|
Name: name,
|
||||||
|
Tags: tags,
|
||||||
|
Content: []byte(content),
|
||||||
|
CreatedAt: createdAt,
|
||||||
|
UpdatedAt: createdAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = orm.Save(dict)
|
||||||
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
handler.WriteJSON(w, map[string]interface{}{
|
||||||
|
"payload": dict,
|
||||||
|
"errno": "0",
|
||||||
|
"errmsg": "",
|
||||||
|
}, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler APIHandler) DeleteDictItemAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
func (handler APIHandler) DeleteDictItemAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
id := ps.ByName("id")
|
id := ps.ByName("id")
|
||||||
dict:=model2.Dict{}
|
dict := model2.Dict{}
|
||||||
dict.ID = id
|
dict.ID = id
|
||||||
|
|
||||||
|
|
||||||
err := orm.Delete(dict)
|
err := orm.Delete(dict)
|
||||||
if err!=nil{
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
handler.WriteJSON(w, map[string]interface{}{
|
||||||
|
"errno": "0",
|
||||||
|
"errmsg": "",
|
||||||
|
}, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler APIHandler) DeleteDictItemAction2(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
func (handler APIHandler) UpdateDictItemAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
|
jq, err := handler.GetJSON(req)
|
||||||
field:=handler.GetParameterOrDefault(req,"help","help message")
|
if err != nil {
|
||||||
fmt.Println(field)
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
json,err:=handler.GetJSON(req)
|
}
|
||||||
if err!=nil{
|
id, err := jq.String("id")
|
||||||
handler.Error(w,err)
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name, err := jq.String("name")
|
||||||
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tags, err := jq.ArrayOfStrings("tags")
|
||||||
|
if err != nil {
|
||||||
|
handler.Error(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
id,err:=json.String("id")
|
content, err := jq.String("content")
|
||||||
if err!=nil{
|
if err != nil {
|
||||||
handler.Error(w,err)
|
handler.Error(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dict:=model2.Dict{}
|
updatedAt := time.Now()
|
||||||
dict.ID = id
|
|
||||||
|
|
||||||
|
dict := model2.Dict{
|
||||||
err = orm.Delete(dict)
|
ID: id,
|
||||||
if err!=nil{
|
Name: name,
|
||||||
handler.Error(w,err)
|
Tags: tags,
|
||||||
|
Content: []byte(content),
|
||||||
|
UpdatedAt: updatedAt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = orm.Update(dict)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
handler.WriteJSON(w, map[string]interface{}{
|
||||||
|
"payload": dict,
|
||||||
|
"errno": "0",
|
||||||
|
"errmsg": "",
|
||||||
|
}, http.StatusOK)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TaskAction handle task creation and return task list which support parameter: `from`, `size` and `host`, eg:
|
// TaskAction handle task creation and return task list which support parameter: `from`, `size` and `host`, eg:
|
||||||
//curl -XGET http://127.0.0.1:8001/task?from=100&size=10&host=elasticsearch.cn
|
//curl -XGET http://127.0.0.1:8001/task?from=100&size=10&host=elasticsearch.cn
|
||||||
func (handler APIHandler) TaskAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
func (handler APIHandler) TaskAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||||
|
@ -91,5 +175,4 @@ func (handler APIHandler) TaskAction(w http.ResponseWriter, req *http.Request, p
|
||||||
// handler.Error(w, err)
|
// handler.Error(w, err)
|
||||||
//} else {
|
//} else {
|
||||||
// handler.WriteJSONListResult(w, total, tasks, http.StatusOK)
|
// handler.WriteJSONListResult(w, total, tasks, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
api/init.go
12
api/init.go
|
@ -6,11 +6,13 @@ import (
|
||||||
"infini.sh/search-center/api/index_management"
|
"infini.sh/search-center/api/index_management"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init() {
|
func Init() {
|
||||||
handler:=index_management.APIHandler{}
|
handler := index_management.APIHandler{}
|
||||||
//ui.HandleUIMethod(api.POST, "/api/get_indices",index_management.API1)
|
//ui.HandleUIMethod(api.POST, "/api/get_indices",index_management.API1)
|
||||||
ui.HandleUIMethod(api.POST, "/api/dict/_create",handler.CreateDictItemAction)
|
ui.HandleUIMethod(api.GET, "/api/dict/_search", handler.GetDictListAction)
|
||||||
|
ui.HandleUIMethod(api.POST, "/api/dict/_create", handler.CreateDictItemAction)
|
||||||
//ui.HandleUIMethod(api.GET, "/api/dict/:id",handler.GetDictItemAction)
|
//ui.HandleUIMethod(api.GET, "/api/dict/:id",handler.GetDictItemAction)
|
||||||
ui.HandleUIMethod(api.DELETE, "/api/dict/:id",handler.DeleteDictItemAction)
|
ui.HandleUIMethod(api.DELETE, "/api/dict/:id", handler.DeleteDictItemAction)
|
||||||
ui.HandleUIMethod(api.DELETE, "/api/dict/",handler.DeleteDictItemAction2)
|
//ui.HandleUIMethod(api.DELETE, "/api/dict/", handler.DeleteDictItemAction2)
|
||||||
|
ui.HandleUIMethod(api.POST, "/api/dict/_update", handler.UpdateDictItemAction)
|
||||||
}
|
}
|
||||||
|
|
1
main.go
1
main.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
_ "expvar"
|
_ "expvar"
|
||||||
|
|
||||||
"infini.sh/framework"
|
"infini.sh/framework"
|
||||||
"infini.sh/framework/core/env"
|
"infini.sh/framework/core/env"
|
||||||
"infini.sh/framework/core/module"
|
"infini.sh/framework/core/module"
|
||||||
|
|
|
@ -1,6 +1,69 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"infini.sh/framework/core/orm"
|
||||||
|
)
|
||||||
|
|
||||||
|
//Dict model
|
||||||
type Dict struct {
|
type Dict struct {
|
||||||
ID string `json:"id" elastic_meta:"_id"`
|
ID string `json:"id" elastic_meta:"_id"`
|
||||||
Url string `json:"title,omitempty"`
|
Name string `json:"name,omitempty" elastic_mapping:"name:{type:text}"`
|
||||||
|
Tags []string `json:"tags" elastic_mapping:"tags:{type:text}"`
|
||||||
|
Content []byte `json:"content" elastic_mapping:"content:{type:binary}"`
|
||||||
|
CreatedAt time.Time `json:"created_at" elastic_mapping:"created_at:{type:date}"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at" elastic_mapping:"updated_at:{type:date}"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDictList(from, size int, name string, tags []string) (orm.Result, error) {
|
||||||
|
//sort := []orm.Sort{}
|
||||||
|
//sort = append(sort, orm.Sort{Field: "created_at", SortType: orm.DESC})
|
||||||
|
var (
|
||||||
|
sort = `[{
|
||||||
|
"created_at": {
|
||||||
|
"order": "desc"
|
||||||
|
}}]`
|
||||||
|
query = `{
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
%s
|
||||||
|
],
|
||||||
|
"should": [
|
||||||
|
%s
|
||||||
|
],
|
||||||
|
"minimum_should_match": %d
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
should = ""
|
||||||
|
must = ""
|
||||||
|
minShould = 0
|
||||||
|
)
|
||||||
|
if name = strings.Trim(name, " "); name != "" {
|
||||||
|
must = fmt.Sprintf(`{"match":{"name": "%s"}}`, name)
|
||||||
|
}
|
||||||
|
for i, tag := range tags {
|
||||||
|
if tag == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
should += fmt.Sprintf(`{"match":{"tags":"%s"}}`, tag)
|
||||||
|
if i != len(tags)-1 {
|
||||||
|
should += ","
|
||||||
|
}
|
||||||
|
minShould = 1
|
||||||
|
}
|
||||||
|
query = fmt.Sprintf(query, must, should, minShould)
|
||||||
|
rq := fmt.Sprintf(`{"from":%d, "size":%d, "sort": %s, "query": %s}`, from, size, sort, query)
|
||||||
|
//fmt.Println(rq)
|
||||||
|
q := &orm.Query{
|
||||||
|
//From: from,
|
||||||
|
//Size: size,
|
||||||
|
//Sort: &sort,
|
||||||
|
RawQuery: []byte(rq),
|
||||||
|
}
|
||||||
|
//var dictList = []Dict{}
|
||||||
|
err, sr := orm.Search(Dict{}, nil, q)
|
||||||
|
return sr, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
type PageResult struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
Data interface{} `json:"data"`
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
- name: default
|
- name: default
|
||||||
enabled: true
|
enabled: true
|
||||||
endpoint: https://192.168.3.98:9200
|
endpoint: http://localhost:9200
|
||||||
index_prefix: infini-
|
index_prefix: infini-
|
||||||
basic_auth:
|
basic_auth:
|
||||||
username: elastic
|
username: elastic
|
||||||
|
|
12
ui.go
12
ui.go
|
@ -2,15 +2,15 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
log "github.com/cihub/seelog"
|
log "github.com/cihub/seelog"
|
||||||
"infini.sh/framework/core/api"
|
"infini.sh/framework/core/api"
|
||||||
"infini.sh/framework/core/ui"
|
"infini.sh/framework/core/ui"
|
||||||
"infini.sh/framework/core/util"
|
"infini.sh/framework/core/util"
|
||||||
"infini.sh/framework/core/vfs"
|
"infini.sh/framework/core/vfs"
|
||||||
"infini.sh/search-center/.public"
|
|
||||||
uiapi "infini.sh/search-center/api"
|
uiapi "infini.sh/search-center/api"
|
||||||
"infini.sh/search-center/config"
|
"infini.sh/search-center/config"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UI struct {
|
type UI struct {
|
||||||
|
@ -20,22 +20,22 @@ type UI struct {
|
||||||
|
|
||||||
func (h UI) InitUI() {
|
func (h UI) InitUI() {
|
||||||
|
|
||||||
vfs.RegisterFS(public.StaticFS{StaticFolder: h.config.UILocalPath, TrimLeftPath: h.config.UILocalPath , CheckLocalFirst: h.config.UILocalEnabled, SkipVFS: !h.config.UIVFSEnabled})
|
// vfs.RegisterFS(public.StaticFS{StaticFolder: h.config.UILocalPath, TrimLeftPath: h.config.UILocalPath , CheckLocalFirst: h.config.UILocalEnabled, SkipVFS: !h.config.UIVFSEnabled})
|
||||||
|
|
||||||
ui.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
ui.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
||||||
|
|
||||||
uiapi.Init()
|
uiapi.Init()
|
||||||
|
|
||||||
ui.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
ui.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
||||||
log.Warn("api: ",req.URL," not implemented")
|
log.Warn("api: ", req.URL, " not implemented")
|
||||||
request, err := h.GetRawBody(req)
|
request, err := h.GetRawBody(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
response:=map[string]interface{}{}
|
response := map[string]interface{}{}
|
||||||
response["request"]=string(request)
|
response["request"] = string(request)
|
||||||
|
|
||||||
w.Write(util.ToJSONBytes(request))
|
w.Write(util.ToJSONBytes(request))
|
||||||
})
|
})
|
||||||
|
|
|
@ -67,6 +67,13 @@ export default {
|
||||||
// pathRewrite: { '^/server': '' },
|
// pathRewrite: { '^/server': '' },
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
|
proxy: {
|
||||||
|
'/api/': {
|
||||||
|
target: 'http://localhost:2900',
|
||||||
|
changeOrigin: true,
|
||||||
|
// pathRewrite: { '^/server': '' },
|
||||||
|
},
|
||||||
|
},
|
||||||
ignoreMomentLocale: true,
|
ignoreMomentLocale: true,
|
||||||
lessLoaderOptions: {
|
lessLoaderOptions: {
|
||||||
javascriptEnabled: true,
|
javascriptEnabled: true,
|
||||||
|
|
|
@ -188,7 +188,7 @@ export default [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/search/dict/professional',
|
path: '/search/dict/professional',
|
||||||
component: './SearchManage/dict/Professional',
|
component: './SearchManage/dict/Pro',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/search/dict/common',
|
path: '/search/dict/common',
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { func } from "prop-types";
|
||||||
|
|
||||||
|
let dictList = [{
|
||||||
|
name: '道路词汇大全',
|
||||||
|
content: '晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总',
|
||||||
|
tags: ['铁路']
|
||||||
|
},{
|
||||||
|
name: '铁路词汇',
|
||||||
|
content: '晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总',
|
||||||
|
tags: ['铁路']
|
||||||
|
},{
|
||||||
|
name: '中国国道省道高速公路名录',
|
||||||
|
content: ''
|
||||||
|
},{
|
||||||
|
name: '民用航空',
|
||||||
|
content: ''
|
||||||
|
},{
|
||||||
|
name: '铁路常用词',
|
||||||
|
content: ''
|
||||||
|
},{
|
||||||
|
name: '铁路词汇',
|
||||||
|
content: ''
|
||||||
|
},{
|
||||||
|
name: '铁路工务',
|
||||||
|
content: ''
|
||||||
|
},];
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
'post /search/dictlist': function(req, res){
|
||||||
|
res.send(dictList);
|
||||||
|
},
|
||||||
|
// 'post /api/dict/_create': function(req, res){
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,333 @@
|
||||||
|
import React from 'react';
|
||||||
|
import {Form, Row, Col, Select,Input, Button, Card,List,Avatar, Modal} from 'antd';
|
||||||
|
import Link from 'umi/link';
|
||||||
|
import {connect} from 'dva'
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const {Option} = Select;
|
||||||
|
import styles from './Pro.less';
|
||||||
|
|
||||||
|
|
||||||
|
const UpdateForm = Form.create()(props => {
|
||||||
|
const { handleUpdateModalVisible, handleUpdate,values,form, title} = props;
|
||||||
|
|
||||||
|
const okHandle = () => {
|
||||||
|
form.validateFields((err, fieldsValue) => {
|
||||||
|
if (err) return;
|
||||||
|
form.resetFields();
|
||||||
|
let upVals = Object.assign(values, fieldsValue);
|
||||||
|
handleUpdate(upVals);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
destroyOnClose
|
||||||
|
title={title}
|
||||||
|
width={640}
|
||||||
|
visible={true}
|
||||||
|
onOk={okHandle}
|
||||||
|
onCancel={() => handleUpdateModalVisible()}
|
||||||
|
>
|
||||||
|
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="词典名称">
|
||||||
|
{form.getFieldDecorator('name', {
|
||||||
|
initialValue: values.name,
|
||||||
|
rules: [{ required: true, message: '请输入至少五个字符的名称!' }],
|
||||||
|
})(<Input placeholder="请输入名称" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="词典标签">
|
||||||
|
{form.getFieldDecorator('tags', {
|
||||||
|
initialValue: values.tags,
|
||||||
|
rules: [{ required: false }],
|
||||||
|
})(<Select mode="multiple" style={{width:'100%'}}>
|
||||||
|
<Option value="铁路">铁路</Option>
|
||||||
|
<Option value="客运">客运</Option>
|
||||||
|
<Option value="货运">货运</Option>
|
||||||
|
<Option value="线路">线路</Option>
|
||||||
|
</Select>)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="内容">
|
||||||
|
{form.getFieldDecorator('content', {
|
||||||
|
initialValue: values.content,
|
||||||
|
rules: [{ required: true }],
|
||||||
|
})(<Input.TextArea
|
||||||
|
style={{ minHeight: 24 }}
|
||||||
|
placeholder="请输入"
|
||||||
|
rows={9}
|
||||||
|
/>)}
|
||||||
|
</Form.Item>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(({dict})=>({
|
||||||
|
dict
|
||||||
|
}))
|
||||||
|
@Form.create()
|
||||||
|
class Pro extends React.Component {
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.handleUpdate = this.handleUpdate.bind(this);
|
||||||
|
}
|
||||||
|
state = {
|
||||||
|
updateFormValues: null,
|
||||||
|
currentFormOp: null,
|
||||||
|
data: [],
|
||||||
|
search: {
|
||||||
|
size: 6,
|
||||||
|
name: "",
|
||||||
|
tags: "",
|
||||||
|
pageIndex: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
componentDidMount(){
|
||||||
|
this.fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleReset = ()=>{
|
||||||
|
const {form} = this.props;
|
||||||
|
form.resetFields();
|
||||||
|
this.setState({
|
||||||
|
search: {
|
||||||
|
size: 6,
|
||||||
|
name: "",
|
||||||
|
tags: "",
|
||||||
|
pageIndex: 1,
|
||||||
|
}
|
||||||
|
},()=>{
|
||||||
|
this.fetchData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSearch = ()=>{
|
||||||
|
const {form} = this.props;
|
||||||
|
let me = this;
|
||||||
|
form.validateFields((err, fieldsValue) => {
|
||||||
|
if (err) return;
|
||||||
|
me.setState({search:{
|
||||||
|
...me.state.search,
|
||||||
|
pageIndex: 1,
|
||||||
|
name: fieldsValue.name,
|
||||||
|
tags: fieldsValue.tags.join(',')
|
||||||
|
}},()=>{
|
||||||
|
me.fetchData();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
renderForm() {
|
||||||
|
const {
|
||||||
|
form: { getFieldDecorator },
|
||||||
|
} = this.props;
|
||||||
|
const formItemLayout = {
|
||||||
|
labelCol: { span: 10 },
|
||||||
|
wrapperCol: { span: 14 },
|
||||||
|
style: {marginBottom: 0}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
<Row gutter={{md:16, sm:8}}>
|
||||||
|
<Col md={10} sm={8}>
|
||||||
|
<Form.Item {...formItemLayout} label="词典标签" >
|
||||||
|
{getFieldDecorator('tags', {
|
||||||
|
// rules: [{ required: true, message: '请选择词典标签' }],
|
||||||
|
})(
|
||||||
|
<Select placeholder="请选择词典标签" mode="multiple">
|
||||||
|
<Option value="铁路">铁路</Option>
|
||||||
|
<Option value="客运">客运</Option>
|
||||||
|
<Option value="货运">货运</Option>
|
||||||
|
<Option value="线路">线路</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col md={6} sm={8}>
|
||||||
|
<Form.Item {...formItemLayout} label="词典名称">
|
||||||
|
{getFieldDecorator('name')(<Input placeholder="请输入词典名称" />)}
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col md={8} sm={8}>
|
||||||
|
<div style={{paddingTop:4}}>
|
||||||
|
<Button type="primary" onClick={this.handleSearch}>
|
||||||
|
查询
|
||||||
|
</Button>
|
||||||
|
<Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
|
||||||
|
重置
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
handleNewClick = () => {
|
||||||
|
this.setState({
|
||||||
|
currentFormOp: 'NEW',
|
||||||
|
updateFormValues: {},
|
||||||
|
formTitle: '添加词典'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDelete = (item) =>{
|
||||||
|
const {dispatch} = this.props;
|
||||||
|
Modal.confirm({
|
||||||
|
title: '删除Pipeline',
|
||||||
|
content: '确定删除该Pipeline吗?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
dispatch({
|
||||||
|
type: 'dict/deleteDictItem',
|
||||||
|
payload: {
|
||||||
|
id: item.id,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
handleModifyClick = (item)=>{
|
||||||
|
this.setState({
|
||||||
|
updateFormValues: item,
|
||||||
|
formTitle: '修改词典',
|
||||||
|
currentFormOp: 'UPDATE',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleUpdate(values){
|
||||||
|
let {currentFormOp, data} = this.state;
|
||||||
|
const {dispatch} = this.props;
|
||||||
|
let me = this;
|
||||||
|
switch(currentFormOp){
|
||||||
|
case "NEW":
|
||||||
|
dispatch({
|
||||||
|
type: 'dict/addDictItem',
|
||||||
|
payload: values,
|
||||||
|
callback: ()=>{
|
||||||
|
me.setState({
|
||||||
|
updateFormValues: null,
|
||||||
|
currentFormOp: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "UPDATE":
|
||||||
|
dispatch({
|
||||||
|
type: 'dict/updateDictItem',
|
||||||
|
payload: values,
|
||||||
|
callback: ()=>{
|
||||||
|
me.setState({
|
||||||
|
updateFormValues: null,
|
||||||
|
currentFormOp: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchData = ()=>{
|
||||||
|
const {dispatch} = this.props;
|
||||||
|
let {size, pageIndex} = this.state.search;
|
||||||
|
let me = this;
|
||||||
|
dispatch({
|
||||||
|
type: 'dict/fetchDictList',
|
||||||
|
payload: {
|
||||||
|
from: (pageIndex - 1) * size,
|
||||||
|
...this.state.search
|
||||||
|
},
|
||||||
|
callback: ()=>{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handlePageChange = (p)=>{
|
||||||
|
this.setState({
|
||||||
|
search: {
|
||||||
|
...this.state.search,
|
||||||
|
pageIndex: p,
|
||||||
|
}
|
||||||
|
},()=>{
|
||||||
|
this.fetchData();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
let data = this.props.dict ? this.props.dict.dictList : [];
|
||||||
|
let total = this.props.dict ? this.props.dict.total: 0;
|
||||||
|
let updateFormValues = this.state.updateFormValues;
|
||||||
|
let size = this.state.search.size;
|
||||||
|
const updateMethods = {
|
||||||
|
handleUpdate: this.handleUpdate,
|
||||||
|
handleUpdateModalVisible: ()=>{
|
||||||
|
this.setState({
|
||||||
|
updateFormValues: null,
|
||||||
|
currentFormOp: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
console.log('render');
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Card bordered={false} bodyStyle={{paddingBottom:0}} >
|
||||||
|
{this.renderForm()}
|
||||||
|
</Card>
|
||||||
|
<Card title="专业词典"
|
||||||
|
bodyStyle={{padding:0, paddingBottom: 24}}
|
||||||
|
extra={<div><Button type="primary" icon="plus" onClick={this.handleNewClick}>新建</Button></div>}
|
||||||
|
bordered={false}>
|
||||||
|
<List
|
||||||
|
className="dic-list"
|
||||||
|
dataSource={data}
|
||||||
|
pagination={{
|
||||||
|
pageSize: size,
|
||||||
|
total: total,
|
||||||
|
current: this.state.search.pageIndex,
|
||||||
|
onChange: this.handlePageChange
|
||||||
|
}}
|
||||||
|
grid={{
|
||||||
|
gutter: 0,
|
||||||
|
xs: 1,
|
||||||
|
sm: 2,
|
||||||
|
md: 3,
|
||||||
|
lg: 3,
|
||||||
|
xl: 3,
|
||||||
|
xxl: 3,
|
||||||
|
}}
|
||||||
|
renderItem={item => (
|
||||||
|
<List.Item className={styles['list-item']}>
|
||||||
|
<div className={styles.cardTitle}>
|
||||||
|
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
||||||
|
<Link to="">{item.name}</Link>
|
||||||
|
</div>
|
||||||
|
<div className={styles.desc}>词条样例:{item.content}
|
||||||
|
</div>
|
||||||
|
<div style={{paddingBottom: 10}}>
|
||||||
|
<span className={styles.datetime}>
|
||||||
|
更新时间: {moment(item.updated_at).format("YYYY-MM-DD HH:mm") }
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
<Button type="primary" htmlType="submit" onClick={()=>this.handleModifyClick(item)}>修改</Button>
|
||||||
|
<Button style={{ marginLeft: 8 }} onClick={()=>{this.handleDelete(item)}}>删除</Button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</List.Item>
|
||||||
|
)}>
|
||||||
|
|
||||||
|
</List>
|
||||||
|
</Card>
|
||||||
|
{updateFormValues ? (
|
||||||
|
<UpdateForm
|
||||||
|
title={this.state.formTitle}
|
||||||
|
{...updateMethods}
|
||||||
|
values={updateFormValues}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Pro;
|
|
@ -0,0 +1,26 @@
|
||||||
|
.list-item{
|
||||||
|
padding: 24px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: 1px 0 0 0 #e8e8e8, 0 1px 0 0 #e8e8e8, 1px 1px 0 0 #e8e8e8, 1px 0 0 0 #e8e8e8 inset, 0 1px 0 0 #e8e8e8 inset;
|
||||||
|
transition: all 0.3s;
|
||||||
|
padding-top: 24px !important;
|
||||||
|
padding-bottom: 24px !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item:hover { z-index: 1; box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 8px; }
|
||||||
|
|
||||||
|
.list-item .desc {
|
||||||
|
color: rgba(0, 0, 0, 0.45);
|
||||||
|
height: 44px;
|
||||||
|
line-height: 22px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin:5px auto;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.list-item .datetime{
|
||||||
|
color: rgba(0, 0, 0, 0.25);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,606 +0,0 @@
|
||||||
import React, { PureComponent, Fragment } from 'react';
|
|
||||||
import { connect } from 'dva';
|
|
||||||
import {
|
|
||||||
Row,
|
|
||||||
Col,
|
|
||||||
Card,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Button,
|
|
||||||
Modal,
|
|
||||||
message,
|
|
||||||
Divider,
|
|
||||||
Icon,
|
|
||||||
DatePicker,
|
|
||||||
TimePicker,
|
|
||||||
Select,
|
|
||||||
Popover,
|
|
||||||
Avatar
|
|
||||||
} from 'antd';
|
|
||||||
import Link from 'umi/link';
|
|
||||||
import StandardTable from '@/components/StandardTable';
|
|
||||||
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
|
|
||||||
|
|
||||||
import styles from './Professional.less';
|
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
|
||||||
const { TextArea } = Input;
|
|
||||||
const fieldLabels = {
|
|
||||||
keyword_type: '词典标签'
|
|
||||||
|
|
||||||
};
|
|
||||||
const CreateForm = Form.create()(props => {
|
|
||||||
const { modalVisible, form, handleAdd, handleModalVisible } = props;
|
|
||||||
const okHandle = () => {
|
|
||||||
form.validateFields((err, fieldsValue) => {
|
|
||||||
if (err) return;
|
|
||||||
form.resetFields();
|
|
||||||
handleAdd(fieldsValue);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
destroyOnClose
|
|
||||||
title="新建模板"
|
|
||||||
visible={modalVisible}
|
|
||||||
width={640}
|
|
||||||
onOk={okHandle}
|
|
||||||
onCancel={() => handleModalVisible()}>
|
|
||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
|
|
||||||
{form.getFieldDecorator('name', {
|
|
||||||
rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
|
|
||||||
})(<Input placeholder="请输入关键词" />)}
|
|
||||||
</FormItem>
|
|
||||||
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label='关键词分类'>
|
|
||||||
{form.getFieldDecorator('keyword_type', {
|
|
||||||
rules: [{ required: true, message: '请选择关键词类型' }],
|
|
||||||
})(
|
|
||||||
<Select placeholder="请选择关键词类型">
|
|
||||||
<Option value="keyun">客运</Option>
|
|
||||||
<Option value="huoyun">货运</Option>
|
|
||||||
<Option value="xianlu">线路</Option>
|
|
||||||
</Select>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const UpdateForm = Form.create()(props => {
|
|
||||||
const { updateModalVisible, handleUpdateModalVisible, handleUpdate,values,form } = props;
|
|
||||||
|
|
||||||
const okHandle = () => {
|
|
||||||
form.validateFields((err, fieldsValue) => {
|
|
||||||
if (err) return;
|
|
||||||
form.resetFields();
|
|
||||||
handleUpdate(fieldsValue);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal destroyOnClose title="新增关键词" visible={updateModalVisible} width={640} onOk={okHandle}
|
|
||||||
onCancel={() => handleUpdateModalVisible()}>
|
|
||||||
|
|
||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="关键词">
|
|
||||||
{form.getFieldDecorator('keyword', {
|
|
||||||
initialValue: values.keyword,
|
|
||||||
rules: [{ required: true, message: '请输入至少一个字符的名称!', min: 1 }],
|
|
||||||
})(<Input placeholder="请输入关键词" />)}
|
|
||||||
</FormItem>
|
|
||||||
|
|
||||||
<Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label={fieldLabels.keyword_type}>
|
|
||||||
{form.getFieldDecorator('keyword_type', {
|
|
||||||
initialValue: values.value,
|
|
||||||
rules: [{ required: true, message: '请选择关键词类型' }],
|
|
||||||
})(
|
|
||||||
<Select placeholder="请选择关键词类型">
|
|
||||||
<Option value="keyun">客运</Option>
|
|
||||||
<Option value="huoyun">货运</Option>
|
|
||||||
<Option value="xianlu">线路</Option>
|
|
||||||
</Select>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* eslint react/no-multi-comp:0 */
|
|
||||||
@connect(({ pipeline, loading }) => ({
|
|
||||||
pipeline,
|
|
||||||
loading: loading.models.pipeline,
|
|
||||||
}))
|
|
||||||
@Form.create()
|
|
||||||
class Professional extends PureComponent {
|
|
||||||
state = {
|
|
||||||
modalVisible: false,
|
|
||||||
updateModalVisible: false,
|
|
||||||
expandForm: false,
|
|
||||||
selectedRows: [],
|
|
||||||
formValues: {},
|
|
||||||
updateFormValues: {},
|
|
||||||
};
|
|
||||||
datasource = `
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"keyword" : "验收标准",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyword" : "桥梁施工技术规范",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},{
|
|
||||||
"keyword" : "路规",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},{
|
|
||||||
"keyword" : "遂规",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyword" : "铁路技术管理规则",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},{
|
|
||||||
"keyword" : "行车组织规则",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyword" : "铁路交通事故调查处理规则",
|
|
||||||
"type" : "客运",
|
|
||||||
"value": "keyun"
|
|
||||||
}]`;
|
|
||||||
|
|
||||||
columns = [
|
|
||||||
{
|
|
||||||
title: '关键词名称',
|
|
||||||
dataIndex: 'keyword',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关键词分类',
|
|
||||||
dataIndex: 'type',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
render: (text, record) => (
|
|
||||||
<Fragment>
|
|
||||||
<a onClick={() => this.handleUpdateModalVisible(true, record)}>修改</a>
|
|
||||||
<Divider type="vertical" />
|
|
||||||
<a onClick={() => {
|
|
||||||
this.state.selectedRows.push(record);
|
|
||||||
this.handleDeleteClick();
|
|
||||||
}}>删除</a>
|
|
||||||
</Fragment>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const { dispatch } = this.props;
|
|
||||||
// dispatch({
|
|
||||||
// type: 'pipeline/fetch',
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
handleStandardTableChange = (pagination, filtersArg, sorter) => {
|
|
||||||
const { dispatch } = this.props;
|
|
||||||
const { formValues } = this.state;
|
|
||||||
|
|
||||||
const filters = Object.keys(filtersArg).reduce((obj, key) => {
|
|
||||||
const newObj = { ...obj };
|
|
||||||
newObj[key] = getValue(filtersArg[key]);
|
|
||||||
return newObj;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
currentPage: pagination.current,
|
|
||||||
pageSize: pagination.pageSize,
|
|
||||||
...formValues,
|
|
||||||
...filters,
|
|
||||||
};
|
|
||||||
if (sorter.field) {
|
|
||||||
params.sorter = `${sorter.field}_${sorter.order}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: 'pipeline/fetch',
|
|
||||||
payload: params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleFormReset = () => {
|
|
||||||
const { form, dispatch } = this.props;
|
|
||||||
form.resetFields();
|
|
||||||
this.setState({
|
|
||||||
formValues: {},
|
|
||||||
});
|
|
||||||
dispatch({
|
|
||||||
type: 'pipeline/fetch',
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleDeleteClick = e => {
|
|
||||||
const { dispatch } = this.props;
|
|
||||||
const { selectedRows } = this.state;
|
|
||||||
|
|
||||||
if (!selectedRows) return;
|
|
||||||
dispatch({
|
|
||||||
type: 'pipeline/delete',
|
|
||||||
payload: {
|
|
||||||
key: selectedRows.map(row => row.name),
|
|
||||||
},
|
|
||||||
callback: () => {
|
|
||||||
this.setState({
|
|
||||||
selectedRows: [],
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleSelectRows = rows => {
|
|
||||||
this.setState({
|
|
||||||
selectedRows: rows,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleSearch = e => {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const { dispatch, form } = this.props;
|
|
||||||
|
|
||||||
form.validateFields((err, fieldsValue) => {
|
|
||||||
if (err) return;
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
...fieldsValue,
|
|
||||||
updatedAt: fieldsValue.updatedAt && fieldsValue.updatedAt.valueOf(),
|
|
||||||
};
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
formValues: values,
|
|
||||||
});
|
|
||||||
|
|
||||||
dispatch({
|
|
||||||
type: 'rule/fetch',
|
|
||||||
payload: values,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleModalVisible = flag => {
|
|
||||||
this.setState({
|
|
||||||
modalVisible: !!flag,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleUpdateModalVisible = (flag, record) => {
|
|
||||||
this.setState({
|
|
||||||
updateModalVisible: !!flag,
|
|
||||||
updateFormValues: record || {},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleAdd = fields => {
|
|
||||||
const { dispatch } = this.props;
|
|
||||||
dispatch({
|
|
||||||
type: 'pipeline/add',
|
|
||||||
payload: {
|
|
||||||
name: fields.name,
|
|
||||||
desc: fields.desc,
|
|
||||||
processors: fields.processors,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
message.success('添加成功');
|
|
||||||
this.handleModalVisible();
|
|
||||||
};
|
|
||||||
|
|
||||||
handleUpdate = fields => {
|
|
||||||
const { dispatch } = this.props;
|
|
||||||
dispatch({
|
|
||||||
type: 'pipeline/update',
|
|
||||||
payload: {
|
|
||||||
name: fields.name,
|
|
||||||
desc: fields.desc,
|
|
||||||
processors: fields.processors,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
message.success('修改成功');
|
|
||||||
this.handleUpdateModalVisible();
|
|
||||||
};
|
|
||||||
|
|
||||||
renderSimpleForm() {
|
|
||||||
const {
|
|
||||||
form: { getFieldDecorator },
|
|
||||||
} = this.props;
|
|
||||||
return (
|
|
||||||
<Form onSubmit={this.handleSearch} layout="inline">
|
|
||||||
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
|
|
||||||
<Col lg={6} md={12} sm={24}>
|
|
||||||
<Form.Item label={fieldLabels.keyword_type}>
|
|
||||||
{getFieldDecorator('keyword_type', {
|
|
||||||
rules: [{ required: true, message: '请选择关键词类型' }],
|
|
||||||
})(
|
|
||||||
<Select placeholder="请选择关键词类型">
|
|
||||||
<Option value="keyun">客运</Option>
|
|
||||||
<Option value="huoyun">货运</Option>
|
|
||||||
<Option value="xianlu">线路</Option>
|
|
||||||
</Select>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
<Col md={8} sm={24}>
|
|
||||||
<FormItem label="词典名称">
|
|
||||||
{getFieldDecorator('name')(<Input placeholder="请输入词典名称" />)}
|
|
||||||
</FormItem>
|
|
||||||
</Col>
|
|
||||||
<Col md={8} sm={24}>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
查询
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
重置
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderForm() {
|
|
||||||
return this.renderSimpleForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const data = {
|
|
||||||
list: JSON.parse(this.datasource),
|
|
||||||
pagination: {
|
|
||||||
pageSize: 5,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const { selectedRows, modalVisible, updateModalVisible, updateFormValues } = this.state;
|
|
||||||
const parentMethods = {
|
|
||||||
handleAdd: this.handleAdd,
|
|
||||||
handleModalVisible: this.handleModalVisible,
|
|
||||||
};
|
|
||||||
const updateMethods = {
|
|
||||||
handleUpdateModalVisible: this.handleUpdateModalVisible,
|
|
||||||
handleUpdate: this.handleUpdate,
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
<Card bordered={false}>
|
|
||||||
<div className={styles.tableListForm}>{this.renderForm()}</div>
|
|
||||||
</Card>
|
|
||||||
<Card className={styles.projectList}
|
|
||||||
style={{ marginBottom: 24 }}
|
|
||||||
title="专业词典"
|
|
||||||
bordered={false}
|
|
||||||
extra={<Link to="/">全部词典</Link>}
|
|
||||||
bodyStyle={{ padding: 0 }} >
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">道路词汇大全</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">中国国道省道高速公路名录</Link>
|
|
||||||
</div> }
|
|
||||||
description="中国国道省道高速公路名录词条样例:京福高速公路、同三高速公路、青银高速公路、日东高速公路、潍莱高速公路、威乌高速公路、济青高速公路、青红高速公路、京珠高速公路、济菏高速公路、沪瑞高速公路、赣粤高速公路、连霍高速公路、丹拉高速公路"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">物流货运专业术语</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:物流、物流活动、物流作业、物流模数、物流技术、物流成本、物流管理、物流中心、物流网络、物流信息、物流企业、物流单证、物流联盟、供应物流、生产物流、销售物流、回收物流、废弃物物流、绿色物流"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">铁路词汇</Link>
|
|
||||||
</div> }
|
|
||||||
description="铁路词汇词条样例:铁路、铁道、铁道部、铁路局、太原铁路局、北京铁路局、车务段、机务段、工务段、供电段、电务段、列车段、车辆段、铁通、车务、机务、工务、供电、电务"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">客运专线铁路</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:验收标准、验标、桥梁施工技术规范、桥规、路规、遂规、铁路技术管理规则、行车组织规则、铁路交通事故调查处理规则、运输组织、铁路安全管理规则、铁路行车操作规则、铁路运用组织规程、区段号、司机号、总重、辆数"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">民用航空</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">物流术语</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">民航业词库</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:晨明、作业段、作业标志、左开道岔、左港、遵义南、遵义北、俎上之肉、组合辙叉、阻工、走马岭、纵向间距、纵向轨枕、纵向标线、纵梁桥、纵断面高程、总监代表处、总监办、总概算汇总"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
|
|
||||||
<Card.Grid className={styles.projectGrid} key="1">
|
|
||||||
<Card bodyStyle={{ padding: 0 }} bordered={false}>
|
|
||||||
<Card.Meta
|
|
||||||
title={<div className={styles.cardTitle}>
|
|
||||||
<Avatar size="small" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606239682187&di=8dcf007d76393225eea97898cb87401e&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F16%2F78%2F8756af452585a1b.jpg" />
|
|
||||||
<Link to="">港口列表</Link>
|
|
||||||
</div> }
|
|
||||||
description="词条样例:阿比让、阿布扎比、阿德莱德、阿尔及尔、阿卡胡特拉、阿拉木图、阿里卡、阿帕帕、阿什杜德、阿什哈巴特、阿特利斯科、埃德蒙顿、安科纳、安特卫普、敖德萨、奥胡斯、奥克兰、奥兰、巴尔的摩"/>
|
|
||||||
<div className={styles.projectItemContent}>
|
|
||||||
<span className={styles.datetime} title="2020-10-11">
|
|
||||||
更新时间: 2009-12-28 19:34:26
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<span className={styles.submitButtons}>
|
|
||||||
<Button type="primary" htmlType="submit">
|
|
||||||
修改
|
|
||||||
</Button>
|
|
||||||
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Card>
|
|
||||||
</Card.Grid>
|
|
||||||
</Card>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Professional;
|
|
|
@ -1,227 +0,0 @@
|
||||||
@import '~antd/lib/style/themes/default.less';
|
|
||||||
@import '~@/utils/utils.less';
|
|
||||||
|
|
||||||
.activitiesList {
|
|
||||||
padding: 0 24px 8px 24px;
|
|
||||||
.username {
|
|
||||||
color: @text-color;
|
|
||||||
}
|
|
||||||
.event {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.pageHeaderContent {
|
|
||||||
display: flex;
|
|
||||||
.avatar {
|
|
||||||
flex: 0 1 72px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
& > span {
|
|
||||||
border-radius: 72px;
|
|
||||||
display: block;
|
|
||||||
width: 72px;
|
|
||||||
height: 72px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
position: relative;
|
|
||||||
top: 4px;
|
|
||||||
margin-left: 24px;
|
|
||||||
flex: 1 1 auto;
|
|
||||||
color: @text-color-secondary;
|
|
||||||
line-height: 22px;
|
|
||||||
.contentTitle {
|
|
||||||
font-size: 20px;
|
|
||||||
line-height: 28px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: @heading-color;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.extraContent {
|
|
||||||
.clearfix();
|
|
||||||
float: right;
|
|
||||||
white-space: nowrap;
|
|
||||||
.statItem {
|
|
||||||
padding: 0 32px;
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
> p:first-child {
|
|
||||||
color: @text-color-secondary;
|
|
||||||
font-size: @font-size-base;
|
|
||||||
line-height: 22px;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
> p {
|
|
||||||
color: @heading-color;
|
|
||||||
font-size: 30px;
|
|
||||||
line-height: 38px;
|
|
||||||
margin: 0;
|
|
||||||
> span {
|
|
||||||
color: @text-color-secondary;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:after {
|
|
||||||
background-color: @border-color-split;
|
|
||||||
position: absolute;
|
|
||||||
top: 8px;
|
|
||||||
right: 0;
|
|
||||||
width: 1px;
|
|
||||||
height: 40px;
|
|
||||||
content: '';
|
|
||||||
}
|
|
||||||
&:last-child {
|
|
||||||
padding-right: 0;
|
|
||||||
&:after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.members {
|
|
||||||
a {
|
|
||||||
display: block;
|
|
||||||
margin: 12px 0;
|
|
||||||
height: 24px;
|
|
||||||
color: @text-color;
|
|
||||||
transition: all 0.3s;
|
|
||||||
.textOverflow();
|
|
||||||
.member {
|
|
||||||
font-size: @font-size-base;
|
|
||||||
line-height: 24px;
|
|
||||||
vertical-align: top;
|
|
||||||
margin-left: 12px;
|
|
||||||
}
|
|
||||||
&:hover {
|
|
||||||
color: @primary-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.projectList {
|
|
||||||
:global {
|
|
||||||
.ant-card-meta-description {
|
|
||||||
color: @text-color-secondary;
|
|
||||||
height: 44px;
|
|
||||||
line-height: 22px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.cardTitle {
|
|
||||||
font-size: 0;
|
|
||||||
a {
|
|
||||||
color: @heading-color;
|
|
||||||
margin-left: 12px;
|
|
||||||
line-height: 24px;
|
|
||||||
height: 24px;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
font-size: @font-size-base;
|
|
||||||
&:hover {
|
|
||||||
color: @primary-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.projectGrid {
|
|
||||||
width: 33.33%;
|
|
||||||
}
|
|
||||||
.projectItemContent {
|
|
||||||
display: flex;
|
|
||||||
margin-top: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
font-size: 12px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
.textOverflow();
|
|
||||||
a {
|
|
||||||
color: @text-color-secondary;
|
|
||||||
display: inline-block;
|
|
||||||
flex: 1 1 0;
|
|
||||||
.textOverflow();
|
|
||||||
&:hover {
|
|
||||||
color: @primary-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.datetime {
|
|
||||||
color: @disabled-color;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.datetime {
|
|
||||||
color: @disabled-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: @screen-xl) and (min-width: @screen-lg) {
|
|
||||||
.activeCard {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
.members {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.extraContent {
|
|
||||||
margin-left: -44px;
|
|
||||||
.statItem {
|
|
||||||
padding: 0 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: @screen-lg) {
|
|
||||||
.activeCard {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
.members {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.extraContent {
|
|
||||||
float: none;
|
|
||||||
margin-right: 0;
|
|
||||||
.statItem {
|
|
||||||
padding: 0 16px;
|
|
||||||
text-align: left;
|
|
||||||
&:after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: @screen-md) {
|
|
||||||
.extraContent {
|
|
||||||
margin-left: -16px;
|
|
||||||
}
|
|
||||||
.projectList {
|
|
||||||
.projectGrid {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: @screen-sm) {
|
|
||||||
.pageHeaderContent {
|
|
||||||
display: block;
|
|
||||||
.content {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.extraContent {
|
|
||||||
.statItem {
|
|
||||||
float: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: @screen-xs) {
|
|
||||||
.projectList {
|
|
||||||
.projectGrid {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { getDictList, addDict, deleteDict,updateDict } from '@/services/search';
|
||||||
|
|
||||||
|
const utf8 = {
|
||||||
|
encode: function (string) {
|
||||||
|
string = string.replace(/\r\n/g,"\n");
|
||||||
|
var utftext = "";
|
||||||
|
for (var n = 0; n < string.length; n++) {
|
||||||
|
var c = string.charCodeAt(n);
|
||||||
|
if (c < 128) {
|
||||||
|
utftext += String.fromCharCode(c);
|
||||||
|
} else if((c > 127) && (c < 2048)) {
|
||||||
|
utftext += String.fromCharCode((c >> 6) | 192);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
} else {
|
||||||
|
utftext += String.fromCharCode((c >> 12) | 224);
|
||||||
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return utftext;
|
||||||
|
} ,
|
||||||
|
decode: function (utftext) {
|
||||||
|
var string = "";
|
||||||
|
var i = 0;
|
||||||
|
var c1, c2,c3;
|
||||||
|
var c = c1 = c2 = 0;
|
||||||
|
while ( i < utftext.length ) {
|
||||||
|
c = utftext.charCodeAt(i);
|
||||||
|
if (c < 128) {
|
||||||
|
string += String.fromCharCode(c);
|
||||||
|
i++;
|
||||||
|
} else if((c > 191) && (c < 224)) {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||||
|
i += 2;
|
||||||
|
} else {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
c3 = utftext.charCodeAt(i+2);
|
||||||
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespace: 'dict',
|
||||||
|
|
||||||
|
state: {
|
||||||
|
},
|
||||||
|
effects: {
|
||||||
|
*fetchDictList({payload, callback}, {call, put}){
|
||||||
|
const resp = yield call(getDictList, payload);
|
||||||
|
if(resp.errno != "0" || !resp.data.Result){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp.data.Result = resp.data.Result.map((item)=>{
|
||||||
|
item.content = utf8.decode(atob(item.content))
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
yield put({
|
||||||
|
type: 'saveData',
|
||||||
|
payload: {
|
||||||
|
dictList: resp.data.Result,
|
||||||
|
total: resp.data.Total,
|
||||||
|
...payload,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if(callback && typeof callback == 'function'){
|
||||||
|
callback(resp);
|
||||||
|
}
|
||||||
|
//message.loading('数据加载完成', 'initdata');
|
||||||
|
},
|
||||||
|
*addDictItem({payload, callback}, {call, put}){
|
||||||
|
const rel = yield call(addDict, payload);
|
||||||
|
if(rel.errno != "0"){
|
||||||
|
message.warn('添加失败:'+ rel.errmsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rel.payload.content = utf8.decode(atob(rel.payload.content));
|
||||||
|
yield put({
|
||||||
|
type: 'addDict',
|
||||||
|
payload: rel.payload,
|
||||||
|
})
|
||||||
|
if(callback && typeof callback == 'function'){
|
||||||
|
callback(rel);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
*updateDictItem({payload, callback}, {call, put}){
|
||||||
|
const rel = yield call(updateDict, payload);
|
||||||
|
if(rel.errno != "0"){
|
||||||
|
message.warn('修改:'+ rel.errmsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
yield put({
|
||||||
|
type: 'updateDict',
|
||||||
|
payload: payload,
|
||||||
|
})
|
||||||
|
if(callback && typeof callback == 'function'){
|
||||||
|
callback(rel);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
*deleteDictItem({payload}, {call, put, select}){
|
||||||
|
let rel = yield call(deleteDict, payload);
|
||||||
|
if(typeof rel !== 'object'){
|
||||||
|
rel = JSON.parse(rel);
|
||||||
|
}
|
||||||
|
if(rel.errno != "0"){
|
||||||
|
message.warn('删除失败:'+ rel.errmsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const state = yield select(state => state.dict)
|
||||||
|
yield put({
|
||||||
|
type: 'fetchDictList',
|
||||||
|
payload: {
|
||||||
|
from: state.from,
|
||||||
|
size: state.size,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
reducers: {
|
||||||
|
saveData(state, {payload}){
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
...payload
|
||||||
|
};
|
||||||
|
},
|
||||||
|
addDict(state, {payload}){
|
||||||
|
let dictList = state.dictList || [];
|
||||||
|
dictList.unshift(payload);
|
||||||
|
state.dictList = dictList;
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
updateDict(state, {payload}){
|
||||||
|
let cdata = state.dictList;
|
||||||
|
let idx = cdata.findIndex((item)=>{
|
||||||
|
return item.id == payload.id;
|
||||||
|
})
|
||||||
|
idx > -1 && (cdata[idx] = values);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,49 +0,0 @@
|
||||||
import { routerRedux } from 'dva/router';
|
|
||||||
import { message } from 'antd';
|
|
||||||
import { getLogstashConfig, saveLogstashConfig } from '@/services/datamanagement';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespace: 'logstash',
|
|
||||||
|
|
||||||
state: {
|
|
||||||
logstash: {
|
|
||||||
jdbc:{},
|
|
||||||
kafka:{},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
effects: {
|
|
||||||
*queryInitialLogstashConfig(_, {call, put}){
|
|
||||||
const istate = yield call(getLogstashConfig);
|
|
||||||
yield put({
|
|
||||||
type: 'initLogstashState',
|
|
||||||
payload: istate,
|
|
||||||
});
|
|
||||||
message.loading('数据加载完成', 'initdata');
|
|
||||||
},
|
|
||||||
*submitLogstashConfig({payload}, {call, put}){
|
|
||||||
console.log(payload);
|
|
||||||
const rel = yield call(saveLogstashConfig, payload);
|
|
||||||
if(rel.message == "Ok") {
|
|
||||||
message.success('提交成功');
|
|
||||||
yield put({
|
|
||||||
type: 'updateState',
|
|
||||||
payload: payload,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
reducers: {
|
|
||||||
initLogstashState(state, { payload: istate }) {
|
|
||||||
return {
|
|
||||||
logstash: istate
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updateState(state, {payload: newState}){
|
|
||||||
var obj = {
|
|
||||||
...state,
|
|
||||||
logstash: Object.assign(state.logstash, newState),
|
|
||||||
};
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
export async function getDictList(payload){
|
||||||
|
let url = `/api/dict/_search?from=${payload.from}&size=${payload.size}`;
|
||||||
|
payload.name && (url+= `&name=${payload.name}`);
|
||||||
|
payload.tags && (url+=`&tags=${payload.tags}`);
|
||||||
|
return request(url,{
|
||||||
|
method: 'GET',
|
||||||
|
// body: payload,
|
||||||
|
expirys: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addDict(payload){
|
||||||
|
return request('/api/dict/_create',{
|
||||||
|
method: 'POST',
|
||||||
|
body: payload,
|
||||||
|
expirys: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteDict(payload){
|
||||||
|
return request(`/api/dict/${payload.id}`,{
|
||||||
|
method: 'DELETE',
|
||||||
|
expirys: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateDict(payload){
|
||||||
|
return request('/api/dict/_update',{
|
||||||
|
method: 'POST',
|
||||||
|
body: payload,
|
||||||
|
expirys: 0,
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue