LabelGroup.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div>
  3. <crumbs title="标签组维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标签类型:">
  6. <el-select size="mini" v-model="filter.tagType[0]" placeholder="标签类型" clearable>
  7. <el-option v-for="item in tagTypes" :label="item.name" :value="item.val" :key="item.id"></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="标签归属:">
  11. <el-select size="mini" v-model="filter.tagAdscription" @change="getValue" placeholder="标签归属" clearable>
  12. <el-option v-for="item in Adscriptions" :label="item.name" :value="item.val" :key="item.id" ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="标签系统名称:">
  16. <el-input size="mini" v-model="filter.tagSysName" placeholder="标签系统名称" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button size="mini" @click="filterDatas">确认</el-button>
  20. <el-button size="mini" type="warning" @click="addTagGroup">添加标签组</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </crumbs>
  24. <div class="contents">
  25. <el-table
  26. :data="list"
  27. border
  28. style="width: 100%">
  29. <el-table-column
  30. :resizable = "false"
  31. type="index"
  32. :index = 'indexMethod'
  33. label="编号"
  34. width="60">
  35. </el-table-column>
  36. <el-table-column
  37. :resizable = "false"
  38. prop="gmtModified"
  39. label="操作时间"
  40. width="180">
  41. </el-table-column>
  42. <el-table-column
  43. :resizable = "false"
  44. prop="typeCn"
  45. label="标签归属">
  46. </el-table-column>
  47. <el-table-column
  48. :resizable = "false"
  49. prop="tagTypeCn"
  50. label="标签类型">
  51. </el-table-column>
  52. <el-table-column
  53. :resizable = "false"
  54. prop="tagName"
  55. label="标签系统名称">
  56. </el-table-column>
  57. <el-table-column
  58. :resizable = "false"
  59. label="标签名称是否存在于标准术语中">
  60. <template slot-scope="scope" >
  61. <span v-if="scope.row.itemType == 0">
  62. {{scope.row.exist ? "已存在" : "未存在"}}
  63. </span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. :resizable = "false"
  68. prop="modifier"
  69. label="操作人">
  70. </el-table-column>
  71. <el-table-column
  72. :resizable = "false"
  73. prop="operate"
  74. label="操作">
  75. <template slot-scope="scope">
  76. <el-button @click="modifyTagGroup(scope.row)" type="text" size="small">修改</el-button>
  77. <span style="margin:0 3px;">|</span>
  78. <el-button @click="showDelDialog(scope.row.id,scope.row.type)" class="delete" type="text" size="small">删除</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <div class="pagination">
  83. <el-pagination v-if="total>pageSize"
  84. :current-page.sync="currentPage"
  85. @current-change="currentChange"
  86. background
  87. :page-size="pageSize"
  88. layout="total,prev, pager, next, jumper"
  89. :total="total">
  90. </el-pagination>
  91. </div>
  92. </div>
  93. <!-- <div class="pagination">
  94. <el-pagination v-if="total>pageSize"
  95. :current-page.sync="currentPage"
  96. @current-change="currentChange"
  97. background
  98. :page-size="pageSize"
  99. layout="total,prev, pager, next, jumper"
  100. :total="total">
  101. </el-pagination>
  102. </div> -->
  103. </div>
  104. </template>
  105. <script>
  106. import api from '@api/icss.js';
  107. export default {
  108. name: 'tag-group',
  109. data: function() {
  110. return {
  111. list: [],
  112. tagTypes: [],
  113. Adscriptions: [], //标签归属列表
  114. tagTypesList: [], //标签类型列表
  115. filter: {
  116. tagType: [], //标签类型
  117. tagAdscription: '', //标签归属
  118. tagSysName: '', //标签系统名称
  119. },
  120. currentPage: 1,
  121. pageSize: 10,
  122. total: 0,
  123. }
  124. },
  125. created() {
  126. this.getDropList().then(() => {
  127. this.getDataList()
  128. })
  129. },
  130. methods: {
  131. getValue(val) {
  132. // console.log('changeVal', val, this.filter.tagAdscription)
  133. },
  134. getDropList() {
  135. return api.getDropList().then((res) =>{
  136. // console.log('dropList', res)
  137. if(res.data.code === '0') {
  138. // this.Adscriptions = res.data.data[1];
  139. let tmpLis = res.data.data[1]
  140. this.Adscriptions = tmpLis.filter(item => item.val != 7);
  141. this.tagTypes = res.data.data[2];
  142. for (var i = 0; i < this.tagTypes.length; i++) {
  143. this.tagTypesList.push(this.tagTypes[i].val)
  144. }
  145. }
  146. })
  147. },
  148. getDataList() {
  149. const param = this.getFilterItems();
  150. api.getTagList(param).then((res) => {
  151. const list = res.data.data.records
  152. for (var i = 0; i < list.length; i++) {
  153. for (var j = 0; j < this.tagTypes.length; j++) {
  154. if(list[i].tagType == this.tagTypes[j].val) {
  155. list[i].tagTypeCn = this.tagTypes[j].name
  156. }
  157. }
  158. for (var z = 0; z < this.Adscriptions.length; z++) {
  159. if(list[i].type == this.Adscriptions[z].val) {
  160. list[i].typeCn = this.Adscriptions[z].name
  161. }
  162. }
  163. }
  164. this.list = list;
  165. this.total = res.data.data.total;
  166. })
  167. },
  168. filterDatas() {
  169. this.currentPage = 1;
  170. this.getDataList();
  171. },
  172. addTagGroup() {
  173. this.$router.push({path:'LT-YXSJWH-TJBQZ'})
  174. },
  175. modifyTagGroup(row) {
  176. api.detailsTag({id:row.id}).then((res)=>{
  177. const {code,data,msg} = res.data;
  178. if(code=='0'){
  179. const item = Object.assign({},row,data);
  180. // console.log('item', item)
  181. this.$router.push({name:'AddLabelGroup',params:{isEdit:true,data:item}});
  182. }else{
  183. this.$message({
  184. message: msg,
  185. type: 'warning'
  186. });
  187. }
  188. });
  189. },
  190. currentChange(next) {
  191. this.currentPage = next;
  192. this.getDataList();
  193. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  194. // this.list = this.cacheData[next];
  195. // } else {
  196. // this.getDataList();
  197. // }
  198. },
  199. getFilterItems() {
  200. const param = {
  201. tagTypeList: this.filter.tagType[0] && this.filter.tagType|| this.tagTypesList,
  202. current: this.currentPage,
  203. size: this.pageSize,
  204. type: this.filter.tagAdscription,
  205. tagName: this.filter.tagSysName,
  206. notTypeList: [7]
  207. };
  208. return param;
  209. },
  210. indexMethod(index) {
  211. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  212. },
  213. getTagType(val) {
  214. return val
  215. },
  216. warning(msg,type){
  217. this.$message({
  218. showClose: true,
  219. message:msg,
  220. type:type||'warning'
  221. })
  222. },
  223. showConfirmDialog(msg,resolve){
  224. this.$alert(msg, '提示', {
  225. confirmButtonText: '确定',
  226. type: 'warning'
  227. }).then(() => {
  228. resolve();
  229. }).catch(() => {});
  230. },
  231. showDelDialog(id,type){
  232. this.showConfirmDialog('是否删除该标签组?',()=>{
  233. api.deleteTagGroup({ids:id,type:type}).then((res)=>{
  234. if(res.data.code=='0'){
  235. this.getDataList();
  236. this.warning(res.data.msg || '操作成功','success');
  237. }else{
  238. this.warning(res.data.msg);
  239. }
  240. }).catch((error)=>{
  241. this.warning(error);
  242. })
  243. });
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="less">
  249. @import "../../less/admin.less";
  250. .delete{
  251. color: red;
  252. }
  253. .delete:hover {
  254. color: red;
  255. }
  256. .pagination {
  257. min-width: 1010px;
  258. }
  259. </style>