DelegationEnData.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div>
  5. <div class="communal-title">
  6. <div>团长英文资料</div>
  7. </div>
  8. <div style="display: flex;">
  9. <div style="width: 70%;display: flex;">
  10. <div style="width: 35%;">
  11. <el-input clearable placeholder="区域" v-model="Area">
  12. </el-input>
  13. </div>
  14. <div style="width: 35%; margin-left: 2%;">
  15. <el-input clearable placeholder="职位" v-model="job">
  16. </el-input>
  17. </div>
  18. <div style="width: 30%;margin-left: 5%;">
  19. <el-button type="primary" @click="QueryDelegationEnData">查询</el-button>
  20. </div>
  21. </div>
  22. <div style="width: 30%;text-align: right;">
  23. <router-link to="/home/OpDelegationEnData">
  24. <el-button type="primary" style="margin-left: 10px;">新增</el-button>
  25. </router-link>
  26. </div>
  27. </div>
  28. </div>
  29. <hr style='background-color:#5555; height:1px; border:none;margin: 10px 0;' />
  30. <template>
  31. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  32. style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
  33. <el-table-column prop="num" label="序 号" width="55">
  34. <template slot-scope="scope">
  35. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="area" label="区域">
  39. </el-table-column>
  40. <el-table-column prop="job" label="职务">
  41. </el-table-column>
  42. <el-table-column prop="jobEn" label="职务(英文)">
  43. </el-table-column>
  44. <el-table-column prop="delegationSetting" label="团组背景">
  45. </el-table-column>
  46. <el-table-column prop="delegationSettingEn" label="团组背景(英文)">
  47. </el-table-column>
  48. <el-table-column label="操作" width="280">
  49. <template slot-scope="scope">
  50. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  51. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </template>
  56. <div class="block">
  57. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  58. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  59. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  60. </el-pagination>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. loading: false,
  70. tableDatas: [],
  71. tableData: [],
  72. currentPage: 1, // 当前页码
  73. pageSize: 12,// 每页的数据条数
  74. input: '',
  75. token: '',
  76. userId: 0,
  77. DiId: '',
  78. job: '',
  79. Area: '',
  80. }
  81. },
  82. methods: {
  83. //每页条数改变时触发 选择一页显示多少行
  84. handleSizeChange(val) {
  85. this.currentPage = 1;
  86. this.pageSize = val;
  87. },
  88. //当前页改变时触发 跳转其他页
  89. handleCurrentChange(val) {
  90. this.currentPage = val;
  91. },
  92. //页面初始化
  93. QueryDelegationEnData() {
  94. var url = "/api/Groups/QueryDelegationEnData"
  95. var that = this
  96. this.$axios({
  97. method: 'post',
  98. url: url,
  99. headers: {
  100. Authorization: 'Bearer ' + this.token
  101. },
  102. data: {
  103. Area: that.Area,
  104. job: that.job
  105. }
  106. }).then(function (res) {
  107. if (res.data.code == 200) {
  108. debugger
  109. that.tableDatas = res.data.data;
  110. that.tableData = that.tableDatas
  111. if (that.tableDatas.length != 0) {
  112. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  113. if (that.currentPage > 1) {
  114. that.currentPage = that.currentPage - 1;
  115. }
  116. }
  117. }
  118. }
  119. }).catch(function (error) {
  120. that.$message.error("网络错误,请稍后重试");
  121. });
  122. },
  123. upDate(index, row) {
  124. this.$router.push({
  125. path: "/home/OpDelegationEnData",
  126. query: {
  127. id: row.id
  128. }
  129. })
  130. },
  131. del(index, row) {
  132. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  133. confirmButtonText: '确定',
  134. cancelButtonText: '取消',
  135. type: 'warning'
  136. }).then(() => {
  137. var url = "/api/Op/DelDelegationEnData"
  138. var that = this
  139. this.$axios({
  140. method: 'post',
  141. url: url,
  142. headers: {
  143. Authorization: 'Bearer ' + this.token
  144. },
  145. data: {
  146. Id: row.id,
  147. DeleteUserId: this.userId
  148. }
  149. }).then(function (res) {
  150. console.log(res)
  151. if (res.data.code == 200) {
  152. that.$message({
  153. message: '删除成功',
  154. type: 'success'
  155. });
  156. that.QueryOfficialActivitiesByDiId();
  157. } else {
  158. that.$message.error('删除失败!');
  159. }
  160. that.loading = false
  161. }).catch(function (error) {
  162. that.loading = false
  163. that.$message.error("网络错误,请稍后重试");
  164. });
  165. }).catch(() => {
  166. this.$message({
  167. type: 'info',
  168. message: '操作已取消!'
  169. });
  170. });
  171. },
  172. handleSelectionChange(val) {
  173. console.log(val)
  174. },
  175. },
  176. mounted() {
  177. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  178. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  179. this.QueryDelegationEnData();
  180. //this.AirTicketResList()
  181. }
  182. }
  183. </script>
  184. <style>
  185. .communal-list {
  186. background-color: #fff;
  187. padding: 10px;
  188. box-shadow: 0 0 5px #0005;
  189. border-radius: 10px;
  190. }
  191. .communal-title {
  192. display: flex;
  193. font-size: 17px;
  194. font-weight: 600;
  195. color: #555;
  196. margin-top: 8px;
  197. margin-bottom: 10px;
  198. justify-content: space-between;
  199. align-items: center;
  200. }
  201. .communal-box {
  202. display: flex;
  203. }
  204. .communal-box>button {
  205. margin-left: 10px;
  206. padding: 8px 20px;
  207. }
  208. .title {
  209. width: 90%;
  210. overflow: hidden;
  211. text-overflow: ellipsis;
  212. white-space: nowrap;
  213. cursor: pointer;
  214. }
  215. </style>