浏览代码

特征库v1.2

李志伟 3 年前
父节点
当前提交
34c1aae7ce

+ 2
- 1
src/App.vue 查看文件

@@ -12,7 +12,8 @@ export default {
12 12
 <style>
13 13
 .body_edit {
14 14
   padding: 20px;
15
-  width: 1000px;
15
+  width: 1500px;
16
+  margin: auto;
16 17
 }
17 18
 .box-card {
18 19
   margin-bottom: 20px;

+ 27
- 32
src/components/CharacterResult/edit.vue 查看文件

@@ -1,5 +1,6 @@
1 1
 <template>
2
-  <div class="body_edit">
2
+  <div style="padding: 20px">
3
+    实例详情
3 4
     <h2 style="text-align: center">
4 5
       特征实例{{ this.resultId ? "编辑" : "添加" }}
5 6
     </h2>
@@ -24,7 +25,6 @@
24 25
           filterable
25 26
           default-first-option
26 27
           placeholder="请选择"
27
-          @change="handleChange"
28 28
         >
29 29
           <el-option
30 30
             v-for="item in wordList"
@@ -37,8 +37,6 @@
37 37
       </el-form-item>
38 38
       <el-form-item>
39 39
         <el-button type="primary" @click="onSubmit">确定</el-button>
40
-        <el-button @click="onReset">重置</el-button>
41
-        <el-button @click="handleClose">关闭</el-button>
42 40
       </el-form-item>
43 41
     </el-form>
44 42
   </div>
@@ -68,21 +66,33 @@ export default {
68 66
         libId: undefined,
69 67
         wordList: [],
70 68
       },
71
-      nowList:[]
69
+      nowList: [],
72 70
     };
73 71
   },
74
-
75
-  methods: {
76
-    onReset() {
77
-      this.form = {
78
-        name: undefined,
79
-        thumb: undefined,
80
-        desc: undefined,
81
-        libId: undefined,
82
-        wordList: [],
83
-      };
72
+  watch: {
73
+    resultId: function () {
74
+      if (this.resultId) {
75
+        this.nowList = [];
76
+        getCharacterResultDetail(this.resultId).then((res) => {
77
+          this.form = res.data;
78
+          let list = res.data.wordList;
79
+          list.map((item) => {
80
+            this.nowList.push(item.wordId);
81
+          });
82
+        });
83
+      } else {
84
+        this.form = {
85
+          name: undefined,
86
+          thumb: undefined,
87
+          desc: undefined,
88
+          libId: undefined,
89
+          wordList: [],
90
+        };
91
+        this.nowList = [];
92
+      }
84 93
     },
85
-    handleChange(val) {},
94
+  },
95
+  methods: {
86 96
     onSubmit() {
87 97
       this.form.wordList = this.wordList.filter((item) =>
88 98
         this.nowList.some((v) => v == item.wordId)
@@ -90,7 +100,7 @@ export default {
90 100
       this.form.libId = this.libId;
91 101
       if (this.form.name) {
92 102
         if (this.resultId) {
93
-          UpdateCharacterResult(this.form,this.resultId).then((res) => {
103
+          UpdateCharacterResult(this.form, this.resultId).then((res) => {
94 104
             this.$message("修改实例成功");
95 105
             //告诉父页面实例表需要刷新并且关闭当前组件
96 106
             this.$emit("handleRefresh", true);
@@ -106,21 +116,6 @@ export default {
106 116
         this.$message("请输入实例名");
107 117
       }
108 118
     },
109
-    handleClose() {
110
-      this.$emit("handleClose", true);
111
-    },
112
-  },
113
-  //进入页面执行的方法
114
-  mounted: function () {
115
-    if (this.resultId) {
116
-      getCharacterResultDetail(this.resultId).then((res) => {
117
-        this.form = res.data;
118
-        let list=res.data.wordList
119
-        list.map((item)=>{
120
-          this.nowList.push(item.wordId)
121
-        })
122
-      });
123
-    }
124 119
   },
125 120
   components: {
126 121
     UploadImage,

+ 69
- 27
src/components/CharacterResult/index.vue 查看文件

@@ -1,18 +1,39 @@
1 1
 <template>
2 2
   <div class="body">
3
-    <el-card class="box-card">
4
-      实例名称:<el-input
5
-        v-model="name"
6
-        style="width: 200px; margin-right: 20px"
7
-      />
8
-      <el-button type="primary" @click="onSearch">查询</el-button>
9
-      <el-button @click="onReset">重置</el-button>
10
-    </el-card>
3
+    <div class="noshadowCard">
4
+      <el-card class="box-card">
5
+        实例名称:<el-input
6
+          v-model="name"
7
+          size="mini"
8
+          style="width: 150px; margin-right: 20px"
9
+        />
10
+        创建时间:
11
+      <el-date-picker
12
+        v-model="daterange"
13
+        size="mini"
14
+        type="daterange"
15
+        range-separator="至"
16
+        start-placeholder="开始日期"
17
+        end-placeholder="结束日期"
18
+        value-format="yyyy-MM-dd"
19
+        @change="dateChange"
20
+        style="width:220px; margin-right: 20px"
21
+      >
22
+      </el-date-picker>
23
+
24
+        <el-button type="primary" size="mini" @click="onSearch">查询</el-button>
25
+        <el-button size="mini" @click="onReset">重置</el-button>
26
+        <el-button type="primary" size="mini" @click="handleAddRusult">添加实例</el-button>
27
+      </el-card>
28
+    </div>
11 29
     <el-table stripe :data="tableData" border style="width: 100%">
12 30
       <el-table-column prop="name" label="实例名称" />
13 31
       <el-table-column prop="thumb" label="图片">
14 32
         <template slot-scope="scope">
15
-          <el-image :src="scope.row.thumb" style="width: 100px; height: 100px" />
33
+          <el-image
34
+            :src="scope.row.thumb"
35
+            style="width: 100px; height: 100px"
36
+          />
16 37
         </template>
17 38
       </el-table-column>
18 39
       <el-table-column fixed="right" label="操作">
@@ -22,7 +43,7 @@
22 43
             icon="el-icon-info"
23 44
             icon-color="red"
24 45
             title="这个实例确定删除吗?"
25
-            @onConfirm='handleDelete(scope.row)'
46
+            @onConfirm="handleDelete(scope.row)"
26 47
           >
27 48
             <el-button type="text" slot="reference">删除</el-button>
28 49
           </el-popconfirm>
@@ -32,48 +53,69 @@
32 53
   </div>
33 54
 </template>
34 55
 <script>
35
-import { getCharacterResultList, deleteCharacterResult } from "@/api/characterLib";
56
+import {
57
+  getCharacterResultList,
58
+  deleteCharacterResult,
59
+} from "@/api/characterLib";
36 60
 
37 61
 export default {
62
+  props: {
63
+    libId: String,
64
+  },
38 65
   data() {
39 66
     return {
40
-      name: undefined,
67
+      name: undefined,      
68
+      daterange:'',
41 69
       tableData: [],
70
+      endDate:undefined,
71
+      startDate:undefined
42 72
     };
43 73
   },
74
+  watch: {
75
+    libId: function () {
76
+      this.onSearch();
77
+    },
78
+  },
44 79
   methods: {
80
+    //添加实例
81
+    handleAddRusult() {
82
+      this.$emit("handleAddRusult", true);
83
+    },
45 84
     handleEdit(row) {
46 85
       // 向外传送数据row.resultId
47 86
       this.$emit("handleEdit", row.resultId);
48 87
     },
49 88
     handleDelete(row) {
50 89
       deleteCharacterResult(row.resultId).then(() => {
51
-        this.onRefresh();
52 90
         this.$message("删除实例成功");
91
+        this.onSearch();
53 92
         //关闭编辑实例页面防止编辑页面还没关闭就删除当前实例了
54 93
         this.$emit("handleClose", true);
55 94
       });
56 95
     },
57 96
     onSearch() {
58
-      getCharacterResultList({ name: this.name }).then((res) => {
59
-        this.tableData = res.data.records;
60
-      });
97
+      getCharacterResultList({ libId: this.libId, name: this.name ,startDate:this.startDate,endDate:this.endDate}).then(
98
+        (res) => {
99
+          this.tableData = res.data.records;
100
+        }
101
+      );
61 102
     },
62 103
     onReset() {
63
-      this.name = "";
64
-      this.onRefresh();
65
-    },
66
-    // 刷新表格
67
-    onRefresh() {
68
-      getCharacterResultList().then((res) => {
69
-        this.tableData = res.data.records;
70
-      });
104
+      this.name = "";      
105
+      this.daterange = "";
106
+      this.startDate = "";
107
+      this.endDate = "";
108
+      this.onSearch();
71 109
     },
72
-  },
73
-  mounted() {
74
-    this.onRefresh();
110
+    dateChange(val){
111
+      this.startDate=this.daterange[0]
112
+      this.endDate=this.daterange[1]
113
+    }
75 114
   },
76 115
 };
77 116
 </script>
78 117
 <style>
118
+.noshadowCard > .box-card {
119
+  box-shadow: none;
120
+}
79 121
 </style>

+ 1
- 1
src/components/TagComponents/index.vue 查看文件

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <div>
2
+  <div style="margin-top:20px">
3 3
     <el-tag
4 4
       :key="tag"
5 5
       v-for="tag in dynamicTags"

+ 36
- 27
src/components/UploadImage/index.vue 查看文件

@@ -1,34 +1,43 @@
1 1
 <template>
2
-<div>
3
-<el-upload
4
-  action="#"
5
-  list-type="picture-card"
6
-  :limit="1"
7
-  :on-remove="handleRemove"
8
-  :on-change='handleChange'
9
-  :auto-upload="false"
10
-  >
11
-  <i class="el-icon-plus"></i>
12
-</el-upload>
13
-</div>
2
+  <div class="uploadClass">
3
+    <el-upload
4
+      action="#"
5
+      list-type="picture-card"
6
+      :limit="1"
7
+      :on-remove="handleRemove"
8
+      :on-change="handleChange"
9
+      :auto-upload="false"
10
+    >
11
+      <i class="el-icon-plus"></i>
12
+    </el-upload>
13
+  </div>
14 14
 </template>
15 15
 <script>
16
-  export default {
17
-    data() {
18
-      return {
19
-        dialogImageUrl: '',
20
-        dialogVisible: false
21
-      };
16
+export default {
17
+  data() {
18
+    return {
19
+      dialogImageUrl: "",
20
+      dialogVisible: false,
21
+    };
22
+  },
23
+  methods: {
24
+    handleRemove(file, fileList) {
25
+      console.log(file, fileList);
22 26
     },
23
-    methods: {
24
-      handleRemove(file, fileList) {
25
-        console.log(file, fileList);
26
-      },
27
-      handleChange(file,fileList){
28
-        console.log(fileList[0].raw)
29
-      }
30
-    }
31
-  }
27
+    handleChange(file, fileList) {
28
+      console.log(fileList[0].raw);
29
+    },
30
+  },
31
+};
32 32
 </script>
33 33
 <style>
34
+.uploadClass .el-upload--picture-card {
35
+  width: 100px;
36
+  height: 100px;
37
+  line-height: 106px;
38
+}
39
+.el-upload-list--picture-card .el-upload-list__item {
40
+  width: 100px;
41
+  height: 100px;
42
+}
34 43
 </style> 

+ 1
- 1
src/views/characterLibManage/add.vue 查看文件

@@ -26,7 +26,7 @@
26 26
         </el-form>
27 27
       </el-col>
28 28
       <el-col :span="5">
29
-        特征词列表
29
+        特征词列表        
30 30
         <TagComponents
31 31
           :value="characterLib.wordList"
32 32
           @handleDelete="handleDelete"

+ 69
- 62
src/views/characterLibManage/edit.vue 查看文件

@@ -1,57 +1,65 @@
1 1
 <template>
2 2
   <div style="padding: 20px">
3
-    <h2 style="text-align: center">特征库编辑</h2>
4
-    <el-row :gutter="20">
5
-      <el-col :span="15">
6
-        <el-form
7
-          ref="form"
8
-          :model="characterLib"
9
-          label-width="150px"
10
-          size="mini"
11
-        >
12
-          <el-form-item label="特征库名称:">
13
-            <el-input v-model="characterLib.name"></el-input>
14
-          </el-form-item>
15
-          <el-form-item label="特征库图标:">
16
-            <UploadImage />
17
-          </el-form-item>
18
-          <el-form-item label="特征库描述:">
19
-            <el-input type="textarea" v-model="characterLib.remark"></el-input>
20
-          </el-form-item>
21
-          <el-form-item>
22
-            <el-button type="primary" @click="onEdit">修改</el-button>
23
-            <el-button @click="onCancel">取消</el-button>
24
-            <el-button type="primary" @click="handleAddRusult"
25
-              >添加实例</el-button
3
+    <el-tabs v-model="activeName">
4
+      <el-tab-pane label="特征库" name="characterLib">
5
+        <el-row :gutter="20">
6
+          <el-col :span="12">
7
+            <el-form
8
+              ref="form"
9
+              :model="characterLib"
10
+              label-width="150px"
11
+              size="mini"
26 12
             >
27
-          </el-form-item>
28
-        </el-form>
29
-      </el-col>
30
-      <el-col :span="5">
31
-        特征词列表
32
-        <TagComponents
33
-          :value="characterLib.wordList"
34
-          @handleDelete="handleDelete"
35
-          @handleAdd="handleAdd"
36
-        />
37
-      </el-col>
38
-    </el-row>
39
-    <el-row :gutter="20">
40
-      <el-col :span="10">
41
-        <CharacterResult ref="CharacterResult" @handleEdit="handleEdit" @handleClose="handleClose"/>
42
-      </el-col>
43
-      <el-col :span="10">
44
-        实例详情
45
-        <CharacterResultEdit
46
-          v-if="isDisplay"
47
-          :libId="characterLib.libId"
48
-          :resultId="resultId"
49
-          :wordList="this.characterLib.wordList"
50
-          @handleRefresh="handleRefresh"
51
-          @handleClose="handleClose"
52
-        />
53
-      </el-col>
54
-    </el-row>
13
+              <el-form-item label="特征库名称:">
14
+                <el-input v-model="characterLib.name"></el-input>
15
+              </el-form-item>
16
+              <el-form-item label="特征库图标:">
17
+                <UploadImage />
18
+              </el-form-item>
19
+              <el-form-item label="特征库描述:">
20
+                <el-input
21
+                  type="textarea"
22
+                  v-model="characterLib.remark"
23
+                ></el-input>
24
+              </el-form-item>
25
+              <el-form-item>
26
+                <el-button type="primary" @click="onEdit">修改</el-button>
27
+                <el-button @click="onCancel">取消</el-button>
28
+              </el-form-item>
29
+            </el-form>
30
+          </el-col>
31
+          <el-col :span="12">
32
+            特征词列表
33
+            <TagComponents
34
+              :value="characterLib.wordList"
35
+              @handleDelete="handleDelete"
36
+              @handleAdd="handleAdd"
37
+            />
38
+          </el-col>
39
+        </el-row>
40
+      </el-tab-pane>
41
+      <el-tab-pane label="特征实例" name="characterResult">
42
+        <el-row :gutter="20" style="padding-top: 20px">
43
+          <el-col :span="12">
44
+            <CharacterResult
45
+              :libId="characterLib.libId"
46
+              ref="CharacterResult"
47
+              @handleEdit="handleEdit"
48
+              @handleClose="handleClose"
49
+              @handleAddRusult="resultId = undefined"
50
+            />
51
+          </el-col>
52
+          <el-col :span="12">
53
+            <CharacterResultEdit
54
+              :resultId="resultId"
55
+              :libId="characterLib.libId"
56
+              :wordList="this.characterLib.wordList"
57
+              @handleRefresh="handleRefresh"
58
+            />
59
+          </el-col>
60
+        </el-row>
61
+      </el-tab-pane>
62
+    </el-tabs>
55 63
   </div>
56 64
 </template>
57 65
 <script>
@@ -65,7 +73,6 @@ import TagComponents from "@/components/TagComponents/index.vue";
65 73
 export default {
66 74
   data() {
67 75
     return {
68
-      isDisplay: false,
69 76
       characterLib: {
70 77
         libId: undefined,
71 78
         name: undefined,
@@ -74,6 +81,7 @@ export default {
74 81
         wordList: [],
75 82
       },
76 83
       resultId: undefined,
84
+      activeName: "characterLib",
77 85
     };
78 86
   },
79 87
 
@@ -89,12 +97,8 @@ export default {
89 97
         }
90 98
       );
91 99
     },
92
-    //添加实例
93
-    handleAddRusult() {
94
-      this.isDisplay = true;
95
-    },
96 100
 
97
-    //实例列表的方法
101
+    //特征词列表的方法
98 102
     handleDelete(val) {
99 103
       if (this.characterLib.libId) {
100 104
         let nowWordId = undefined;
@@ -143,19 +147,22 @@ export default {
143 147
         });
144 148
       }
145 149
     },
150
+
151
+    //实例列表的方法
152
+    //添加实例
153
+    handleAddRusult() {
154
+      this.resultId = undefined;
155
+    },
146 156
     handleEdit(val) {
147
-      this.isDisplay = true;
148 157
       this.resultId = val;
149 158
     },
150 159
 
151 160
     //实例编辑页面调用实例列表的刷新方法 兄弟组件调用方法
152 161
     handleRefresh() {
153
-      this.handleClose();
154
-      this.$refs.CharacterResult.onRefresh();
162
+      this.$refs.CharacterResult.onSearch();
155 163
     },
156 164
     handleClose() {
157
-      this.isDisplay = false;
158
-      this.resultId=undefined
165
+      this.resultId = undefined;
159 166
     },
160 167
   },
161 168
   //进入页面执行的方法

+ 28
- 11
src/views/characterLibManage/index.vue 查看文件

@@ -3,8 +3,21 @@
3 3
     <el-card class="box-card">
4 4
       特征库名称:<el-input
5 5
         v-model="name"
6
+        size='medium'
6 7
         style="width: 200px; margin-right: 20px"
7 8
       />
9
+      创建时间:
10
+      <el-date-picker
11
+        v-model="daterange"
12
+        type="daterange"
13
+        range-separator="至"
14
+        start-placeholder="开始日期"
15
+        end-placeholder="结束日期"
16
+        value-format="yyyy-MM-dd"
17
+        @change="dateChange"
18
+      >
19
+      </el-date-picker>
20
+
8 21
       <el-button type="primary" @click="onSearch">查询</el-button>
9 22
       <el-button @click="onReset">重置</el-button>
10 23
       <el-button type="primary" @click="handleAdd">添加特征库</el-button>
@@ -23,7 +36,7 @@
23 36
             icon="el-icon-info"
24 37
             icon-color="red"
25 38
             title="这个特征库确定删除吗?"
26
-            @onConfirm='handleDelete(scope.row)'
39
+            @onConfirm="handleDelete(scope.row)"
27 40
           >
28 41
             <el-button type="text" slot="reference">删除</el-button>
29 42
           </el-popconfirm>
@@ -39,7 +52,10 @@ export default {
39 52
   data() {
40 53
     return {
41 54
       name: undefined,
55
+      daterange:'',
42 56
       tableData: [],
57
+      endDate:undefined,
58
+      startDate:undefined
43 59
     };
44 60
   },
45 61
   methods: {
@@ -54,27 +70,28 @@ export default {
54 70
     },
55 71
     handleDelete(row) {
56 72
       deleteCharacterLib(row.libId).then(() => {
57
-        this.onRefresh();
73
+        this.onSearch();
58 74
       });
59 75
     },
60 76
     onSearch() {
61
-      getCharacterLibList({ name: this.name }).then((res) => {
77
+      getCharacterLibList({ name: this.name,startDate:this.startDate,endDate:this.endDate }).then((res) => {
62 78
         this.tableData = res.data.records;
63 79
       });
64 80
     },
65 81
     onReset() {
66 82
       this.name = "";
67
-      this.onRefresh();
68
-    },
69
-    // 刷新表格
70
-    onRefresh() {
71
-      getCharacterLibList().then((res) => {
72
-        this.tableData = res.data.records;
73
-      });
83
+      this.daterange = "";
84
+      this.startDate = "";
85
+      this.endDate = "";
86
+      this.onSearch();
74 87
     },
88
+    dateChange(val){
89
+      this.startDate=this.daterange[0]
90
+      this.endDate=this.daterange[1]
91
+    }
75 92
   },
76 93
   mounted() {
77
-    this.onRefresh();
94
+    this.onSearch();
78 95
   },
79 96
 };
80 97
 </script>