IndeptLabel.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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="primary" @click="addIndeptTag">添加独立标签</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="controlTypeCn"
  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. prop="modifier"
  60. label="操作人">
  61. </el-table-column>
  62. <el-table-column
  63. :resizable = "false"
  64. prop="operate"
  65. label="操作">
  66. <template slot-scope="scope">
  67. <el-button @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
  68. <el-button @click="showDelDialog(scope.row.id)" class="delete" type="text" size="small">删除</el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <el-pagination v-if="total>pageSize"
  73. :current-page.sync="currentPage"
  74. @current-change="currentChange"
  75. background
  76. :page-size="pageSize"
  77. layout="total,prev, pager, next, jumper"
  78. :total="total">
  79. </el-pagination>
  80. </div>
  81. <!-- <div class="pagination">
  82. <el-pagination v-if="total>pageSize"
  83. :current-page.sync="currentPage"
  84. @current-change="currentChange"
  85. background
  86. :page-size="pageSize"
  87. layout="total,prev, pager, next, jumper"
  88. :total="total">
  89. </el-pagination>
  90. </div> -->
  91. </div>
  92. </template>
  93. <script>
  94. import api from '@api/icss.js';
  95. export default {
  96. name: 'tag-group',
  97. data: function() {
  98. return {
  99. list: [],
  100. tagTypes: [],
  101. Adscriptions: [],
  102. tagTypesList: [],
  103. filter: {
  104. tagType: [], //标签类型
  105. tagAdscription: '', //标签归属
  106. tagSysName: '', //标签系统名称
  107. },
  108. currentPage: 1,
  109. pageSize: 10,
  110. total: 0,
  111. }
  112. },
  113. created() {
  114. this.getDropList().then(() => {
  115. this.getDataList()
  116. })
  117. },
  118. methods: {
  119. getValue(val) {
  120. console.log('changeVal', val, this.filter.tagAdscription)
  121. },
  122. getDropList() {
  123. return api.getDropList().then((res) =>{
  124. console.log('dropList', res)
  125. if(res.data.code === '0') {
  126. this.Adscriptions = res.data.data[1];
  127. this.tagTypes = res.data.data[6];
  128. for (var i = 0; i < this.tagTypes.length; i++) {
  129. this.tagTypesList.push(this.tagTypes[i].val)
  130. }
  131. }
  132. })
  133. },
  134. getDataList() {
  135. const param = this.getFilterItems();
  136. console.log('param', param)
  137. api.getTagList(param).then((res) => {
  138. const list = res.data.data.records
  139. for (var i = 0; i < list.length; i++) {
  140. for (var z = 0; z < this.Adscriptions.length; z++) {
  141. if(list[i].type == this.Adscriptions[z].val) {
  142. list[i].typeCn = this.Adscriptions[z].name
  143. }
  144. }
  145. }
  146. this.list = list;
  147. this.total = res.data.data.total;
  148. console.log('tagGroup',res)
  149. })
  150. },
  151. filterDatas() {
  152. this.currentPage = 1;
  153. this.getDataList();
  154. },
  155. addIndeptTag() {
  156. this.$router.push({path:'LT-YXSJWH-TJDLBQ'})
  157. },
  158. modifyIndeptTag(row) {
  159. api.detailsTag({id:row.id}).then((res)=>{
  160. const {code,data,msg} = res.data;
  161. if(code=='0'){
  162. const item = Object.assign({},row,data);
  163. this.$router.push({name:'AddIndeptLabel',params:{isEdit:true,data:item}});
  164. }else{
  165. this.$message({
  166. message: msg,
  167. type: 'warning'
  168. });
  169. }
  170. });
  171. //this.$router.push({name:'AddIndeptLabel',params:{isEdit:true,data:row}});
  172. },
  173. currentChange(next) {
  174. this.currentPage = next;
  175. this.getDataList();
  176. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  177. // this.list = this.cacheData[next];
  178. // } else {
  179. // this.getDataList();
  180. // }
  181. },
  182. getFilterItems() {
  183. const param = {
  184. tagTypeList: [1],
  185. current: this.currentPage,
  186. size: this.pageSize,
  187. type: this.filter.tagAdscription,
  188. tagName: this.filter.tagSysName
  189. };
  190. return param;
  191. },
  192. indexMethod(index) {
  193. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  194. },
  195. getTagType(val) {
  196. return val
  197. },
  198. warning(msg,type){
  199. this.$message({
  200. showClose: true,
  201. message:msg,
  202. type:type||'warning'
  203. })
  204. },
  205. showConfirmDialog(msg,resolve){
  206. this.$alert(msg, '提示', {
  207. confirmButtonText: '确定',
  208. type: 'warning'
  209. }).then(() => {
  210. resolve();
  211. }).catch(() => {});
  212. },
  213. showDelDialog(id){
  214. this.showConfirmDialog('是否删除该标签?',()=>{
  215. api.deleteTagGroup({ids:id}).then((res)=>{
  216. if(res.data.code=='0'){
  217. this.getDataList();
  218. this.warning(res.data.msg || '操作成功','success');
  219. }else{
  220. this.warning(res.data.msg);
  221. }
  222. }).catch((error)=>{
  223. this.warning(error);
  224. })
  225. });
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="less">
  231. @import "../../less/admin.less";
  232. .delete{
  233. color: red;
  234. }
  235. .delete:hover {
  236. color: red;
  237. }
  238. </style>