SimilarName.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div>
  3. <crumbs title="别名维护系统">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标签名称:">
  6. <el-input size="mini" v-model="filter.proName" placeholder="标签名称"></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <el-button size="mini" @click="uploadClick">导入</el-button>
  11. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
  12. <router-link to="/admin/LT-YXSJWH-TJBM" style="margin:0 10px">
  13. <el-button size="mini" type="warning">添加别名</el-button>
  14. </router-link>
  15. </el-form-item>
  16. </el-form>
  17. </crumbs>
  18. <div class="contents">
  19. <el-table :data="list"
  20. border
  21. style="width: 100%">
  22. <el-table-column
  23. :resizable = "false"
  24. type="index"
  25. :index="indexMethod"
  26. label="编号"
  27. width="60">
  28. </el-table-column>
  29. <el-table-column
  30. :resizable = "false"
  31. prop="gmtOperate"
  32. label="操作时间"
  33. :show-overflow-tooltip="true">
  34. </el-table-column>
  35. <el-table-column
  36. :resizable = "false"
  37. prop="questionName"
  38. label="标签名称"
  39. show-overflow-tooltip>
  40. </el-table-column>
  41. <el-table-column
  42. :resizable = "false"
  43. prop="retrievalSelfName"
  44. label="本体"
  45. show-overflow-tooltip>
  46. </el-table-column>
  47. <el-table-column
  48. :resizable = "false"
  49. prop="retrievalNames"
  50. label="别名"
  51. show-overflow-tooltip>
  52. </el-table-column>
  53. <el-table-column
  54. :resizable = "false"
  55. prop="retrievalSonNames"
  56. label="子项"
  57. show-overflow-tooltip>
  58. </el-table-column>
  59. <el-table-column
  60. :resizable = "false"
  61. prop="operatorName"
  62. label="操作人">
  63. </el-table-column>
  64. <el-table-column
  65. :resizable = "false"
  66. label="操作" width="160">
  67. <template slot-scope="scope">
  68. <el-button type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  69. <span style="margin:0 3px;">|</span>
  70. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.questionId)">删除</el-button>
  71. </template>
  72. </el-table-column>
  73. <!-- <el-table-column
  74. label="详情">
  75. <template slot-scope="scope">
  76. <el-button type="text" size="small" @click="getDetailList(scope.row.questionId)">详情</el-button>
  77. </template>
  78. </el-table-column> -->
  79. </el-table>
  80. <el-pagination v-if="total>pageSize"
  81. :current-page.sync="currentPage"
  82. @current-change="currentChange"
  83. background
  84. :page-size="pageSize"
  85. layout="total,prev, pager, next, jumper"
  86. :total="total">
  87. </el-pagination>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. import api from '@api/icss.js';
  93. import utils from '@api/utils.js';
  94. import axios from 'axios';
  95. export default {
  96. name: 'SimilarName',
  97. data: function () {
  98. return {
  99. list: [],
  100. cacheData: {},
  101. currentPage: 1,
  102. pageSize: 10,
  103. total: 0,
  104. linkIn:[],
  105. pays:[],
  106. filter: {
  107. proName: ''
  108. }
  109. }
  110. },
  111. created() {
  112. this.getDataList();
  113. },
  114. methods: {
  115. toEditProduct(row){
  116. this.$router.push({
  117. name:'AddSimilarName',
  118. params: {id:row.questionId,name:row.questionName}
  119. })
  120. },
  121. filterDatas(){
  122. this.currentPage = 1;
  123. this.getDataList();
  124. },
  125. getDataList() {
  126. const param = this.getFilterItems();
  127. api.similarName(param).then((res) => {
  128. if (res.data.code == '0') {
  129. const data = res.data.data;
  130. this.list = data.records;
  131. this.cacheData[param.current] = data.records;
  132. this.total = data.total;
  133. }
  134. }).catch((error) => {
  135. console.log(error);
  136. });
  137. },
  138. getDetailList(id) {
  139. const param = {'id': id,};
  140. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  141. /*api.getDeptInfoDetials(param).then((res) => {
  142. if (res.data.code == '0') {
  143. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  144. // console.log("详情接口调用成功");
  145. } else {
  146. this.$message({
  147. showClose: true,
  148. message:res.data.msg,
  149. type:'warning'
  150. });
  151. this.getDataList() //刷新列表
  152. }
  153. }).catch((error) => {
  154. console.log(error);
  155. });*/
  156. },
  157. getFilterItems() {
  158. const param = {
  159. questionName: this.filter.proName,
  160. current: this.currentPage,
  161. size: this.pageSize
  162. };
  163. return param;
  164. },
  165. indexMethod(index) {
  166. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  167. },
  168. currentChange(next) {
  169. this.currentPage = next;
  170. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  171. this.list = this.cacheData[next];
  172. } else {
  173. this.getDataList();
  174. }
  175. },
  176. warning(msg,type){
  177. this.$message({
  178. showClose: true,
  179. message:msg,
  180. type:type||'warning'
  181. })
  182. },
  183. showConfirmDialog(msg,resolve){
  184. this.$alert(msg, '提示', {
  185. confirmButtonText: '确定',
  186. type: 'warning'
  187. }).then(() => {
  188. resolve();
  189. }).catch(() => {});
  190. },
  191. showDelDialog(id){
  192. this.showConfirmDialog('是否删除该标签名?',()=>{
  193. api.delSimilarName({questionId:id}).then((res)=>{
  194. if(res.data.code=='0'){
  195. this.warning(res.data.msg||'操作成功','success');
  196. this.getDataList();
  197. }else{
  198. this.warning(res.data.msg);
  199. }
  200. }).catch((error)=>{
  201. this.warning(error);
  202. })
  203. });
  204. },
  205. uploadClick(){
  206. let inp = document.getElementById("upFile");
  207. inp.click();
  208. },
  209. uploadFile(e){
  210. let fileInfo = e.target.files[0];
  211. e.preventDefault();
  212. let formData = new FormData();
  213. formData.append('uploadfile', fileInfo);
  214. console.log(123,fileInfo,formData);
  215. const header = {
  216. headers:{
  217. 'Content-Type': 'multipart/form-data'
  218. }
  219. }
  220. api.uploadFile(formData,header).then((res)=>{
  221. if(res.data.code==0){
  222. this.$message({
  223. message: '上传成功',
  224. type: 'success',
  225. });
  226. }else{
  227. this.$message.error(res.data.msg);
  228. }
  229. })
  230. this.getDataList();
  231. /*//解决上传相同文件不触发change
  232. let inp = document.getElementById("upFile");
  233. inp.value = "";
  234. */
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="less" scoped>
  240. @import "../../less/admin.less";
  241. .delete{
  242. color: red;
  243. }
  244. .el-table .cell{
  245. overflow: hidden;
  246. white-space: nowrap;
  247. }
  248. #upFile{
  249. display: none !important;
  250. }
  251. </style>