IndeptLabel.vue 8.1 KB

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