DecreasePayments.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. }
  121. }).then(function (res) {
  122. if (res.data.code == 200) {
  123. that.delegationInfoList = res.data.data.groupName;
  124. that.DiId = that.delegationInfoList[0].id;
  125. that.delegationInfo = that.delegationInfoList[0];
  126. that.DecreasePaymentsList()
  127. }
  128. }).catch(function (error) {
  129. that.$message.error("网络错误,请稍后重试");
  130. });
  131. },
  132. DecreasePaymentsChange() {
  133. for (let index = 0; index < this.delegationInfoList.length; index++) {
  134. if (this.delegationInfoList[index].id == this.DiId) {
  135. this.delegationInfo = this.delegationInfoList[index];
  136. break;
  137. }
  138. }
  139. this.DecreasePaymentsList();
  140. },
  141. //团组信息绑定
  142. DecreasePaymentsList() {
  143. var url = "/api/Groups/DecreasePaymentsList"
  144. var that = this
  145. this.$axios({
  146. method: 'post',
  147. url: url,
  148. headers: {
  149. Authorization: 'Bearer ' + this.token
  150. },
  151. data: {
  152. diId: that.DiId
  153. }
  154. }).then(function (res) {
  155. if (res.data.code == 200) {
  156. that.tableDatas = res.data.data;
  157. that.tableData = that.tableDatas
  158. if (that.tableDatas.length != 0) {
  159. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  160. if (that.currentPage > 1) {
  161. that.currentPage = that.currentPage - 1;
  162. }
  163. }
  164. }
  165. }
  166. }).catch(function (error) {
  167. that.$message.error("网络错误,请稍后重试");
  168. });
  169. },
  170. upDate(index, row) {
  171. if (row.isAudit == 3 || row.isAudit == 0 || row.isAudit == 2) {
  172. this.$router.push({
  173. path: "/home/OpDecreasePayments",
  174. query: {
  175. DiId: this.DiId,
  176. id: row.id
  177. }
  178. })
  179. } else if (row.isAudit == 1) {
  180. this.$message('审核已通过,不可编辑!');
  181. }
  182. },
  183. del(index, row) {
  184. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  185. confirmButtonText: '确定',
  186. cancelButtonText: '取消',
  187. type: 'warning'
  188. }).then(() => {
  189. var url = "/api/Groups/DelDecreasePayments"
  190. var that = this
  191. this.$axios({
  192. method: 'post',
  193. url: url,
  194. headers: {
  195. Authorization: 'Bearer ' + this.token
  196. },
  197. data: {
  198. Id: row.id,
  199. DeleteUserId: this.userId
  200. }
  201. }).then(function (res) {
  202. console.log(res)
  203. if (res.data.code == 200) {
  204. that.$message({
  205. message: '删除成功',
  206. type: 'success'
  207. });
  208. that.DecreasePaymentsSelect();
  209. } else {
  210. that.$message.error('删除失败!');
  211. }
  212. that.loading = false
  213. }).catch(function (error) {
  214. that.loading = false
  215. that.$message.error("网络错误,请稍后重试");
  216. });
  217. }).catch(() => {
  218. this.$message({
  219. type: 'info',
  220. message: '操作已取消!'
  221. });
  222. });
  223. },
  224. download(index, row) {
  225. if (row.filePath != "") {
  226. window.location.href = "http://132.232.92.186:24/Office/GrpFile/" + row.filePath
  227. } else {
  228. this.$message.error("暂未上传附件");
  229. }
  230. }
  231. },
  232. mounted() {
  233. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  234. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  235. this.DecreasePaymentsSelect();
  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. }
  247. .communal-title {
  248. display: flex;
  249. font-size: 17px;
  250. font-weight: 600;
  251. color: #555;
  252. margin-top: 8px;
  253. margin-bottom: 10px;
  254. justify-content: space-between;
  255. align-items: center;
  256. }
  257. .communal-box {
  258. display: flex;
  259. }
  260. .communal-box>button {
  261. margin-left: 10px;
  262. padding: 8px 20px;
  263. }
  264. </style>