DecreasePayments.vue 10 KB

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