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="标签名称" clearable></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. export default {
  94. name: 'SimilarName',
  95. data: function () {
  96. return {
  97. list: [],
  98. cacheData: {},
  99. currentPage: 1,
  100. pageSize: 10,
  101. total: 0,
  102. linkIn:[],
  103. pays:[],
  104. filter: {
  105. proName: ''
  106. }
  107. }
  108. },
  109. created() {
  110. this.getDataList();
  111. },
  112. methods: {
  113. toEditProduct(row){
  114. this.$router.push({
  115. name:'AddSimilarName',
  116. params: {id:row.questionId,name:row.questionName}
  117. })
  118. },
  119. filterDatas(){
  120. this.currentPage = 1;
  121. this.getDataList();
  122. },
  123. getDataList() {
  124. const param = this.getFilterItems();
  125. api.similarName(param).then((res) => {
  126. if (res.data.code == '0') {
  127. const data = res.data.data;
  128. this.list = data.records;
  129. this.cacheData[param.current] = data.records;
  130. this.total = data.total;
  131. }
  132. }).catch((error) => {
  133. console.log(error);
  134. });
  135. },
  136. getDetailList(id) {
  137. const param = {'id': id,};
  138. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  139. /*api.getDeptInfoDetials(param).then((res) => {
  140. if (res.data.code == '0') {
  141. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  142. // console.log("详情接口调用成功");
  143. } else {
  144. this.$message({
  145. showClose: true,
  146. message:res.data.msg,
  147. type:'warning'
  148. });
  149. this.getDataList() //刷新列表
  150. }
  151. }).catch((error) => {
  152. console.log(error);
  153. });*/
  154. },
  155. getFilterItems() {
  156. const param = {
  157. questionName: this.filter.proName,
  158. current: this.currentPage,
  159. size: this.pageSize
  160. };
  161. return param;
  162. },
  163. indexMethod(index) {
  164. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  165. },
  166. currentChange(next) {
  167. this.currentPage = next;
  168. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  169. this.list = this.cacheData[next];
  170. } else {
  171. this.getDataList();
  172. }
  173. },
  174. warning(msg,type){
  175. this.$message({
  176. showClose: true,
  177. message:msg,
  178. type:type||'warning'
  179. })
  180. },
  181. showConfirmDialog(msg,resolve){
  182. this.$alert(msg, '提示', {
  183. confirmButtonText: '确定',
  184. type: 'warning'
  185. }).then(() => {
  186. resolve();
  187. }).catch(() => {});
  188. },
  189. showDelDialog(id){
  190. this.showConfirmDialog('是否删除该标签名?',()=>{
  191. api.delSimilarName({questionId:id}).then((res)=>{
  192. if(res.data.code=='0'){
  193. this.warning(res.data.msg||'操作成功','success');
  194. this.getDataList();
  195. }else{
  196. this.warning(res.data.msg);
  197. }
  198. }).catch((error)=>{
  199. this.warning(error);
  200. })
  201. });
  202. },
  203. uploadClick(){
  204. let inp = document.getElementById("upFile");
  205. inp.click();
  206. },
  207. uploadFile(e){
  208. let fileInfo = e.target.files[0];
  209. e.preventDefault();
  210. let formData = new FormData();
  211. formData.append('uploadfile', fileInfo);
  212. const header = {
  213. headers:{
  214. 'Content-Type': 'multipart/form-data'
  215. }
  216. }
  217. api.uploadFile(formData,header).then((res)=>{
  218. if(res.data.code==0){
  219. this.$message({
  220. message: '上传成功',
  221. type: 'success',
  222. });
  223. }else{
  224. this.$message({
  225. dangerouslyUseHTMLString: true,
  226. message:res.data.msg,
  227. type:'warning'
  228. });
  229. }
  230. })
  231. this.getDataList();
  232. //解决上传相同文件不触发change
  233. let inp = document.getElementById("upFile");
  234. inp.value = "";
  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>