AirTicketAgent.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div class="communal-title">
  5. <div>代理出票合作方资料</div>
  6. <div class="communal-box">
  7. <el-input @input="Inquireclick()" placeholder="代理方名称" v-model="input" clearable
  8. style="width: 350px;">
  9. </el-input>
  10. <el-button type="primary" @click="addData" style="margin-left: 10px;">新增</el-button>
  11. </div>
  12. </div>
  13. <template>
  14. <el-table :data="tableDatas" border style="width: 100%" v-loading="loading"
  15. element-loading-text="拼命加载中...">
  16. <el-table-column prop="num" label="序 号" width="55">
  17. <template slot-scope="scope">
  18. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="name" label="名称">
  22. </el-table-column>
  23. <el-table-column prop="bank" label="开户行">
  24. </el-table-column>
  25. <el-table-column prop="account" label="账户">
  26. </el-table-column>
  27. <el-table-column label="操作">
  28. <template slot-scope="scope">
  29. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  30. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. </template>
  35. <div class="block">
  36. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  37. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  38. layout="total, sizes, prev, pager, next" :total="total">
  39. </el-pagination>
  40. </div>
  41. </div>
  42. <el-dialog :title="title" :visible.sync="OpVisible" width="30%" :before-close="handleClose"
  43. :close-on-click-modal="false">
  44. <div>
  45. <el-form :model="OpData" :rules="rules" ref="OpData" label-width="100px" class="demo-ruleForm">
  46. <el-form-item label="名称" prop="name">
  47. <el-input placeholder="请输入名称" v-model="OpData.name">
  48. </el-input>
  49. </el-form-item>
  50. <el-form-item label="开户行" prop="bank">
  51. <el-input placeholder="请输入开户行" v-model="OpData.bank">
  52. </el-input>
  53. </el-form-item>
  54. <el-form-item label="账户" prop="account">
  55. <el-input placeholder="请输入账户" v-model="OpData.account">
  56. </el-input>
  57. </el-form-item>
  58. <el-form-item label="备 注" prop="remark">
  59. <el-input type="textarea" :rows="3" placeholder="请输入备注" v-model="OpData.remark"></el-input>
  60. </el-form-item>
  61. </el-form>
  62. </div>
  63. <span slot="footer" class="dialog-footer">
  64. <el-button @click="OpVisible = false">取 消</el-button>
  65. <el-button type="primary" @click="OpDateBtn">确 定</el-button>
  66. </span>
  67. </el-dialog>
  68. </div>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. loading: false,
  75. tableDatas: [],
  76. tableData: [],
  77. currentPage: 1, // 当前页码
  78. pageSize: 12,// 每页的数据条数
  79. total: 0,
  80. input: '',
  81. token: '',
  82. userId: 0,
  83. OpVisible: false,
  84. title: '添加代理出票合作方',
  85. OpData: {
  86. status: 0,
  87. id: 0,
  88. name: "",
  89. account: "",
  90. bank: "",
  91. createUserId: 0,
  92. remark: ""
  93. },
  94. rules: {
  95. name: [
  96. { required: true, message: '请输入合作方名称', trigger: 'blur' },
  97. ],
  98. account: [
  99. { required: true, message: '请输入合作方开户账户', trigger: 'blur' },
  100. ],
  101. bank: [
  102. { required: true, message: '请输入合作方开户银行', trigger: 'blur' },
  103. ],
  104. },
  105. }
  106. },
  107. methods: {
  108. //每页条数改变时触发 选择一页显示多少行
  109. handleSizeChange(val) {
  110. this.currentPage = 1;
  111. this.pageSize = val;
  112. this.QueryAirTicketAgent();
  113. },
  114. //当前页改变时触发 跳转其他页
  115. handleCurrentChange(val) {
  116. this.currentPage = val;
  117. this.QueryAirTicketAgent();
  118. },
  119. QueryAirTicketAgent() {
  120. this.loading = true
  121. var url = "/api/Resource/QueryAirTicketAgent"
  122. var that = this
  123. this.$axios({
  124. method: 'post',
  125. url: url,
  126. headers: {
  127. Authorization: 'Bearer ' + this.token
  128. },
  129. data: {
  130. portType: 1,
  131. PageIndex: that.currentPage,
  132. PageSize: that.pageSize
  133. }
  134. }).then(function (res) {
  135. console.log(res)
  136. if (res.data.code == 200) {
  137. that.tableData = res.data.data.pageSource;
  138. that.pageSize = res.data.data.pageSize;
  139. that.currentPage = res.data.data.pageIndex;
  140. that.total = res.data.data.pageCount;
  141. that.tableDatas = that.tableData;
  142. if (that.tableDatas.length == 0) {
  143. if (that.currentPage > 1) {
  144. that.currentPage = that.currentPage - 1;
  145. that.QueryAirTicketAgent();
  146. }
  147. }
  148. }
  149. that.loading = false
  150. }).catch(function (error) {
  151. that.loading = false
  152. that.$message.error("网络错误,请稍后重试");
  153. });
  154. },
  155. //搜索框处理
  156. Inquireclick() {
  157. var newarr = [];
  158. if (this.input == "") {
  159. newarr = this.tableData;
  160. this.total = this.tableData.length;
  161. } else {
  162. for (var i = 0; i < this.tableData.length; i++) {
  163. if (this.tableData[i].name.indexOf(this.input) != -1) {
  164. newarr.push(this.tableData[i]);
  165. }
  166. }
  167. this.total = newarr.length;
  168. }
  169. this.tableDatas = newarr;
  170. this.currentPage = 1;
  171. },
  172. upDate(index, row) {
  173. this.OpVisible = true;
  174. this.title = '修改代理出票合作方资料'
  175. this.OpData.status = 2
  176. this.OpData.id = row.id
  177. this.OpData.name = row.name
  178. this.OpData.account = row.account
  179. this.OpData.bank = row.bank
  180. this.OpData.createUserId = this.userId
  181. this.OpData.remark = row.remark
  182. },
  183. addData() {
  184. this.title = '添加代理出票合作方资料'
  185. this.OpVisible = true;
  186. this.OpData.status = 1
  187. this.OpData.id = 0
  188. this.OpData.createUserId = this.userId
  189. },
  190. OpDateBtn() {
  191. this.$refs.OpData.validate((valid) => {
  192. if (valid) {
  193. var that = this;
  194. var url = "/api/Resource/OpAirTicketAgent"
  195. that.$axios({
  196. method: 'post',
  197. url: url,
  198. headers: {
  199. Authorization: 'Bearer ' + that.token
  200. },
  201. data: that.OpData
  202. }).then(function (res) {
  203. console.log(res)
  204. if (res.data.code == 200) {
  205. that.$message({
  206. message: res.data.msg,
  207. type: 'success'
  208. });
  209. that.OpVisible = false;
  210. that.QueryAirTicketAgent();
  211. } else {
  212. that.$message.error(res.data.msg,);
  213. }
  214. })
  215. }
  216. })
  217. },
  218. del(index, row) {
  219. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  220. confirmButtonText: '确定',
  221. cancelButtonText: '取消',
  222. type: 'warning'
  223. }).then(() => {
  224. var url = "/api/Resource/DelAirTicketAgent"
  225. var that = this
  226. this.$axios({
  227. method: 'post',
  228. url: url,
  229. headers: {
  230. Authorization: 'Bearer ' + this.token
  231. },
  232. data: {
  233. Id: row.id,
  234. DeleteUserId: this.userId
  235. }
  236. }).then(function (res) {
  237. console.log(res)
  238. if (res.data.code == 200) {
  239. that.$message({
  240. message: '删除成功',
  241. type: 'success'
  242. });
  243. that.QueryAirTicketAgent();
  244. } else {
  245. that.$message.error('删除失败!');
  246. }
  247. that.loading = false
  248. }).catch(function (error) {
  249. that.loading = false
  250. that.$message.error("网络错误,请稍后重试");
  251. });
  252. }).catch(() => {
  253. this.$message({
  254. type: 'info',
  255. message: '操作已取消!'
  256. });
  257. });
  258. }
  259. },
  260. mounted() {
  261. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  262. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  263. this.QueryAirTicketAgent();
  264. }
  265. }
  266. </script>
  267. <style>
  268. .communal-list {
  269. background-color: #fff;
  270. padding: 10px;
  271. box-shadow: 0 0 5px #0005;
  272. border-radius: 10px;
  273. }
  274. .communal-title {
  275. display: flex;
  276. font-size: 17px;
  277. font-weight: 600;
  278. color: #555;
  279. margin-top: 8px;
  280. margin-bottom: 10px;
  281. justify-content: space-between;
  282. align-items: center;
  283. }
  284. .communal-box {
  285. display: flex;
  286. }
  287. .communal-box>button {
  288. margin-left: 10px;
  289. padding: 8px 20px;
  290. }
  291. </style>