OfficialActivities.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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: 18%;">
  10. <el-select v-model="DiId" placeholder="团组选择" clearable filterable @change="delegationSelectChange">
  11. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  12. :value="item.id">
  13. </el-option>
  14. </el-select>
  15. </div>
  16. <div style="width: 82%;text-align: right;">
  17. <router-link :to="{ path: '/home/OpOfficialActivities', query: { DiId } }">
  18. <el-button type="primary">新增</el-button>
  19. </router-link>
  20. </div>
  21. </div>
  22. <div class="communal-box-title">
  23. <span style="font-weight: bold;">团队名称:</span>
  24. {{ delegationInfo.teamName }}&nbsp;&nbsp;&nbsp;
  25. <span style="font-weight: bold;">客户:</span>
  26. {{ delegationInfo.clientName }}&nbsp;&nbsp;&nbsp;
  27. <span style="font-weight: bold;">出访国家:</span>
  28. {{ delegationInfo.visitCountry }}&nbsp;&nbsp;&nbsp;
  29. <span style="font-weight: bold;">起止日期:</span>
  30. {{ delegationInfo.visitStartDate|capitalize }}~{{ delegationInfo.visitEndDate|capitalize }}&nbsp;&nbsp;&nbsp;
  31. <span style="font-weight: bold;">天数/人数:</span>
  32. {{ delegationInfo.visitDays }}天/{{ delegationInfo.visitPNumber }}人
  33. </div>
  34. </div>
  35. <template>
  36. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  37. style="width: 100%" v-loading="loading" element-loading-text="拼命加载中...">
  38. <el-table-column prop="num" label="序 号" width="55">
  39. <template slot-scope="scope">
  40. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="client" label="公务单位">
  44. </el-table-column>
  45. <el-table-column prop="date" label="公务时间">
  46. </el-table-column>
  47. <el-table-column prop="address" label="公务地址">
  48. </el-table-column>
  49. <el-table-column prop="contact" label="联系人">
  50. </el-table-column>
  51. <el-table-column prop="createUserName" label="记录者">
  52. </el-table-column>
  53. <el-table-column prop="createTime" label="记录时间">
  54. </el-table-column>
  55. <el-table-column label="操作" width="280">
  56. <template slot-scope="scope">
  57. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  58. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </template>
  63. <div class="block">
  64. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  65. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  66. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  67. </el-pagination>
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. loading: false,
  77. tableDatas: [],
  78. tableData: [],
  79. currentPage: 1, // 当前页码
  80. pageSize: 12,// 每页的数据条数
  81. input: '',
  82. token: '',
  83. userId: 0,
  84. DiId: '',
  85. diids:'',
  86. delegationInfoList: [],
  87. delegationInfo: {},
  88. }
  89. },
  90. methods: {
  91. //每页条数改变时触发 选择一页显示多少行
  92. handleSizeChange(val) {
  93. this.currentPage = 1;
  94. this.pageSize = val;
  95. },
  96. //当前页改变时触发 跳转其他页
  97. handleCurrentChange(val) {
  98. this.currentPage = val;
  99. },
  100. //团组下拉框
  101. GetGroupAllList() {
  102. var url = "/api/Resource/GetGroupAllList"
  103. var that = this
  104. this.$axios({
  105. method: 'post',
  106. url: url,
  107. headers: {
  108. Authorization: 'Bearer ' + this.token
  109. },
  110. data: {
  111. portType: 1,
  112. pageIndex: 1,
  113. pageSize: 10000
  114. }
  115. }).then(function (res) {
  116. if (res.data.code == 200) {
  117. that.delegationInfoList = res.data.data.delegation;
  118. if(that.diids!=that.diids){
  119. that.DiId = that.delegationInfoList[0].id;
  120. that.delegationInfo = that.delegationInfoList[0];
  121. }else{
  122. that.DiId=that.diids;
  123. }
  124. that.delegationSelectChange();
  125. // that.QueryOfficialActivitiesByDiId();
  126. }
  127. }).catch(function (error) {
  128. that.$message.error("网络错误,请稍后重试");
  129. });
  130. },
  131. delegationSelectChange() {
  132. for (let index = 0; index < this.delegationInfoList.length; index++) {
  133. if (this.delegationInfoList[index].id == this.DiId) {
  134. this.delegationInfo = this.delegationInfoList[index];
  135. break;
  136. }
  137. }
  138. this.QueryOfficialActivitiesByDiId();
  139. },
  140. //团组信息绑定
  141. QueryOfficialActivitiesByDiId() {
  142. var url = "/api/Resource/QueryOfficialActivitiesByDiId"
  143. var that = this
  144. if (that.DiId == "" && that.DiId == null && that.DiId == undefined) { that.DiId = 0 }
  145. this.$axios({
  146. method: 'post',
  147. url: url,
  148. headers: {
  149. Authorization: 'Bearer ' + this.token
  150. },
  151. data: {
  152. portType: 1,
  153. pageIndex: 0,
  154. pageSize: 0,
  155. diId: that.DiId
  156. }
  157. }).then(function (res) {
  158. if (res.data.code == 200) {
  159. that.tableDatas = res.data.data;
  160. that.tableData = that.tableDatas
  161. if (that.tableDatas.length != 0) {
  162. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  163. if (that.currentPage > 1) {
  164. that.currentPage = that.currentPage - 1;
  165. }
  166. }
  167. }
  168. }
  169. }).catch(function (error) {
  170. //that.$message.error("网络错误,请稍后重试");
  171. });
  172. },
  173. upDate(index, row) {
  174. this.$router.push({
  175. path: "/home/OpOfficialActivities",
  176. query: {
  177. DiId: this.DiId,
  178. id: row.id
  179. }
  180. })
  181. },
  182. del(index, row) {
  183. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  184. confirmButtonText: '确定',
  185. cancelButtonText: '取消',
  186. type: 'warning'
  187. }).then(() => {
  188. var url = "/api/Resource/DelOfficialActivities"
  189. var that = this
  190. this.$axios({
  191. method: 'post',
  192. url: url,
  193. headers: {
  194. Authorization: 'Bearer ' + this.token
  195. },
  196. data: {
  197. Id: row.id,
  198. DeleteUserId: this.userId
  199. }
  200. }).then(function (res) {
  201. console.log(res)
  202. if (res.data.code == 200) {
  203. that.$message({
  204. message: '删除成功',
  205. type: 'success'
  206. });
  207. that.QueryOfficialActivitiesByDiId();
  208. } else {
  209. that.$message.error('删除失败!');
  210. }
  211. that.loading = false
  212. }).catch(function (error) {
  213. that.loading = false
  214. that.$message.error("网络错误,请稍后重试");
  215. });
  216. }).catch(() => {
  217. this.$message({
  218. type: 'info',
  219. message: '操作已取消!'
  220. });
  221. });
  222. },
  223. },
  224. filters: {
  225. capitalize: function (value) {
  226. return value.split(" ")[0]
  227. }
  228. },
  229. created(){
  230. this.diids = Number(this.$route.query.DiId);
  231. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  232. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  233. this.GetGroupAllList();
  234. },
  235. mounted() {
  236. //this.AirTicketResList()
  237. }
  238. }
  239. </script>
  240. <style>
  241. .communal-list {
  242. background-color: #fff;
  243. padding: 10px;
  244. box-shadow: 0 0 5px #0005;
  245. border-radius: 10px;
  246. min-height: 830px;
  247. }
  248. .communal-title {
  249. display: flex;
  250. font-size: 17px;
  251. font-weight: 600;
  252. color: #555;
  253. margin-top: 8px;
  254. margin-bottom: 10px;
  255. justify-content: space-between;
  256. align-items: center;
  257. }
  258. .communal-box {
  259. display: flex;
  260. }
  261. .communal-box>button {
  262. margin-left: 10px;
  263. padding: 8px 20px;
  264. }
  265. .communal-box-title{
  266. margin: 10px 0;
  267. }
  268. .communal-box-title span{
  269. font-size: 16px;
  270. font-weight: 600;
  271. color: #555;
  272. }
  273. </style>