billInfo-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <div>
  3. <el-breadcrumb separator=">">
  4. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item>
  6. <a href="#">系统管理</a>
  7. </el-breadcrumb-item>
  8. <el-breadcrumb-item>
  9. <a href="/billInfo">账单推送管理</a>
  10. </el-breadcrumb-item>
  11. </el-breadcrumb>
  12. <el-divider></el-divider>
  13. <el-form
  14. ref="queryForm"
  15. :model="queryModel"
  16. inline
  17. class="demo-form-inline"
  18. >
  19. <el-form-item label="账单名称" prop="billName">
  20. <el-input
  21. type="text"
  22. size="mini"
  23. v-model="queryModel.billName"
  24. ></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button
  28. type="primary"
  29. size="mini"
  30. icon="ios-search"
  31. @click="changePage(1)"
  32. :loading="loading"
  33. >查询</el-button
  34. >&nbsp;
  35. <el-button
  36. type="info"
  37. size="mini"
  38. style="margin-left: 8px"
  39. @click="handleReset('queryForm')"
  40. >重置</el-button
  41. >&nbsp;
  42. </el-form-item>
  43. </el-form>
  44. <el-divider></el-divider>
  45. <el-row class="button-group">
  46. <el-button
  47. type="primary"
  48. size="small"
  49. plain
  50. icon="el-icon-circle-plus"
  51. @click="handleAdd"
  52. >新增</el-button
  53. >
  54. <el-button
  55. type="primary"
  56. size="small"
  57. plain
  58. icon="el-icon-circle-plus"
  59. :disabled="multipleSelection.length == 0"
  60. @click="handleBatchDelete"
  61. >删除选中项</el-button
  62. >
  63. </el-row>
  64. <el-table
  65. :data="tableData"
  66. style="min-height: 400px"
  67. v-loading="loading"
  68. stripe
  69. @sort-change="sortChange"
  70. @selection-change="handleSelectionChange"
  71. >
  72. <el-table-column type="selection" width="55"></el-table-column>
  73. <el-table-column
  74. type="index"
  75. label="序号"
  76. :index="indexMethod"
  77. ></el-table-column>
  78. <el-table-column
  79. prop="billName"
  80. label="账单名称"
  81. ></el-table-column>
  82. <el-table-column
  83. prop="billRemark"
  84. label="账单备注"
  85. ></el-table-column>
  86. <el-table-column prop="wxShow" label="手机端会费公示">
  87. <template slot-scope="{ row }">
  88. <span v-if="row.wxShow">是</span>
  89. <span v-else>否</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column prop="picUrl" label="图片">
  93. <template slot-scope="{ row }">
  94. <a :href="row.picUrl" target="_blank" v-if="row.picUrl">
  95. <el-avatar
  96. :size="48"
  97. shape="circle"
  98. :src="
  99. row.picUrl +
  100. '?x-oss-process=image/resize,m_fill,w_64,h_64'
  101. "
  102. :key="row.id"
  103. ></el-avatar>
  104. </a>
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="status" label="推送状态">
  108. <template slot-scope="{ row }">
  109. <span v-if="row.status=='0'">未推送</span>
  110. <span v-if="row.status=='1'">已推送</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="操作" width="200">
  114. <template slot-scope="{ row }">
  115. <el-col :span="12">
  116. <el-link size="mini" type="primary" @click="handleBillDetail(row)"
  117. >子账单</el-link
  118. >
  119. </el-col>
  120. <el-col :span="12">
  121. <el-link size="mini" type="success" @click="pushMessage(row)"
  122. >推送账单消息</el-link
  123. >
  124. </el-col>
  125. <el-col :span="12">
  126. <el-link size="mini" type="warning" @click="handleEdit(row)"
  127. >编辑</el-link
  128. >
  129. </el-col>
  130. <el-col :span="12">
  131. <el-link size="mini" type="danger" @click="handleDelete(row)"
  132. >删除</el-link
  133. >
  134. </el-col>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. <el-pagination
  139. :current-page.sync="pageIndex"
  140. :total="totalElements"
  141. :page-sizes="pageSizeList"
  142. @current-change="changePage"
  143. @size-change="pageSizeChange"
  144. layout="total, sizes, prev, pager, next, jumper"
  145. ></el-pagination>
  146. <billInfo-detail
  147. v-if="showModal"
  148. :businessKey="businessKey"
  149. :title="modalTitle"
  150. @close="onDetailModalClose"
  151. ></billInfo-detail>
  152. <billDetail-list
  153. v-if="showModal2"
  154. :businessKey="businessKey"
  155. :title="modalTitle2"
  156. @close="onDetailModalClose2"
  157. ></billDetail-list>
  158. </div>
  159. </template>
  160. <script>
  161. import Constant from "@/constant";
  162. import billInfoDetail from "./billInfo-detail";
  163. import billDetailList from "./billDetail-list";
  164. import billInfoApi from "@/api/base/billInfo";
  165. import billDetailApi from "@/api/base/billDetail";
  166. export default {
  167. name: "BaseBillInfoList",
  168. data() {
  169. return{
  170. queryModel: {
  171. billName:"",
  172. },
  173. loading: false,
  174. tableData: [],
  175. pageIndex: 1,
  176. pageSize: 10,
  177. totalPages: 0,
  178. totalElements: 0,
  179. field: "",
  180. direction: "",
  181. pageSizeList: [10, 20, 30],
  182. multipleSelection: [],
  183. showModal: false,
  184. showModal2: false,
  185. }
  186. },
  187. methods:{
  188. indexMethod(index) {
  189. return (this.pageIndex - 1) * this.pageSize + (index + 1);
  190. },
  191. changePage(pageIndex) {
  192. var self = this;
  193. self.loading = true;
  194. self.pageIndex = pageIndex;
  195. var formData = new FormData();
  196. formData.append("pageIndex", self.pageIndex);
  197. formData.append("pageSize", self.pageSize);
  198. formData.append("billName", self.queryModel.billName);
  199. billInfoApi
  200. .pageList(formData)
  201. .then(function (response) {
  202. self.loading = false;
  203. var jsonData = response.data.data;
  204. self.tableData = jsonData.data;
  205. self.totalPages = jsonData.totalPages;
  206. self.totalElements = jsonData.recordsTotal;
  207. })
  208. .catch((error) => {
  209. self.loading = false;
  210. // self.$message.error(error + "");
  211. });
  212. },
  213. pageSizeChange(pageSize) {
  214. this.pageSize = pageSize;
  215. this.$nextTick(() => {
  216. this.changePage(this.pageIndex);
  217. });
  218. },
  219. sortChange(data) {
  220. this.field = data.column.field;
  221. this.direction = data.order;
  222. this.changePage(this.pageIndex);
  223. },
  224. handleSelectionChange(val) {
  225. this.multipleSelection = val;
  226. },
  227. handleReset(name) {
  228. this.$refs[name].resetFields();
  229. },
  230. handleAdd() {
  231. this.modalTitle = "新增";
  232. this.businessKey = "";
  233. this.showModal = true;
  234. },
  235. handleEdit(record) {
  236. this.modalTitle = "编辑";
  237. this.businessKey = record.id;
  238. this.showModal = true;
  239. },
  240. handleBillDetail(record){
  241. this.modalTitle2 = "子账单";
  242. this.businessKey = record.id;
  243. this.showModal2 = true;
  244. },
  245. handleDelete(record) {
  246. var self = this;
  247. self
  248. .$confirm("是否确认删除?", "提示", {
  249. confirmButtonText: "确定",
  250. cancelButtonText: "取消",
  251. type: "warning",
  252. })
  253. .then(() => {
  254. billInfoApi.remove(record.id).then(function (response) {
  255. var jsonData = response.data;
  256. if (jsonData.result) {
  257. // var index = self.tableData.indexOf(record);
  258. // self.tableData.splice(index, 1);
  259. self.changePage(self.pageIndex);
  260. self.$message({
  261. type: "success",
  262. message: "删除成功!",
  263. });
  264. }
  265. });
  266. });
  267. },
  268. handleBatchDelete() {
  269. var self = this;
  270. var idList = this.multipleSelection.map((record) => {
  271. return record.id;
  272. });
  273. this.$confirm("是否确认删除选中项?", "提示", {
  274. confirmButtonText: "确定",
  275. cancelButtonText: "取消",
  276. type: "warning",
  277. }).then(() => {
  278. billInfoApi.batchRemove(idList).then(function (response) {
  279. var jsonData = response.data;
  280. if (jsonData.result) {
  281. self.changePage(self.pageIndex);
  282. self.$message({
  283. type: "success",
  284. message: "删除成功!",
  285. });
  286. }
  287. });
  288. });
  289. },
  290. onDetailModalClose(refreshed) {
  291. //保存成功后回调
  292. this.showModal = false;
  293. if (refreshed) {
  294. this.changePage(this.pageIndex);
  295. }
  296. },
  297. onDetailModalClose2(refreshed) {
  298. //保存成功后回调
  299. this.showModal2 = false;
  300. if (refreshed) {
  301. this.changePage(this.pageIndex);
  302. }
  303. },
  304. pushMessage(record){
  305. var self = this;
  306. var billId = record.id
  307. self.$confirm("是否确认推送消息?", "提示", {
  308. confirmButtonText: "确定",
  309. cancelButtonText: "取消",
  310. type: "warning",
  311. })
  312. .then(() => {
  313. billDetailApi.pushMessage(billId).then(function (response) {
  314. var jsonData = response.data;
  315. if (jsonData.result) {
  316. // var index = self.tableData.indexOf(record);
  317. // self.tableData.splice(index, 1);
  318. self.changePage(self.pageIndex);
  319. self.$message({
  320. type: "success",
  321. message: "推送消息成功!",
  322. });
  323. }
  324. });
  325. });
  326. }
  327. },
  328. mounted: function () {
  329. this.changePage(1);
  330. },
  331. components: {
  332. "billInfo-detail": billInfoDetail,
  333. "billDetail-list":billDetailList,
  334. },
  335. }
  336. </script>
  337. <style scoped>
  338. .el-breadcrumb {
  339. margin: 10px;
  340. line-height: 20px;
  341. }
  342. .el-divider {
  343. margin: 5px 0;
  344. }
  345. .demo-form-inline {
  346. margin-left: 10px;
  347. text-align: left;
  348. }
  349. .button-group {
  350. margin-left: 10px;
  351. text-align: left;
  352. }
  353. </style>