checkinInfo-list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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="/base/checkinInfo">租户管理</a>
  10. </el-breadcrumb-item>
  11. </el-breadcrumb>
  12. <el-divider></el-divider>
  13. <!--
  14. 要resetFields起作用,必须配置:model和prop
  15. -->
  16. <el-form
  17. ref="queryForm"
  18. :model="queryModel"
  19. inline
  20. class="demo-form-inline"
  21. >
  22. <el-form-item label="楼栋" prop="building">
  23. <el-input
  24. type="text"
  25. size="mini"
  26. v-model="queryModel.building"
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item label="企业名称" prop="name">
  30. <el-input type="text" size="mini" v-model="queryModel.name"></el-input>
  31. </el-form-item>
  32. <el-form-item label="费用到期" prop="feeExpirationTime">
  33. <el-date-picker v-model="queryModel.feeExpirationTime" value-format="yyyy-MM-dd" type="date" size="mini" placeholder="选择日期"></el-date-picker>
  34. </el-form-item>
  35. <el-form-item label="合同到期" prop="contractExpirationTime">
  36. <el-date-picker v-model="queryModel.contractExpirationTime" value-format="yyyy-MM-dd" type="date" size="mini" placeholder="选择日期"></el-date-picker>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button
  40. type="primary"
  41. size="mini"
  42. icon="ios-search"
  43. @click="changePage(1)"
  44. :loading="loading"
  45. >查询</el-button
  46. >&nbsp;
  47. <el-button
  48. type="info"
  49. size="mini"
  50. style="margin-left: 8px"
  51. @click="handleReset('queryForm')"
  52. >重置</el-button
  53. >&nbsp;
  54. </el-form-item>
  55. </el-form>
  56. <el-divider></el-divider>
  57. <el-row class="button-group">
  58. <el-button
  59. type="primary"
  60. size="small"
  61. plain
  62. icon="el-icon-circle-plus"
  63. @click="handleAdd"
  64. >新增</el-button
  65. >
  66. <el-button
  67. type="primary"
  68. size="small"
  69. plain
  70. icon="el-icon-circle-plus"
  71. :disabled="multipleSelection.length == 0"
  72. @click="handleBatchDelete"
  73. >删除选中项</el-button
  74. >
  75. <el-button
  76. type="primary"
  77. size="small"
  78. plain
  79. icon="el-icon-upload2"
  80. @click="batchImportVisible = true"
  81. >导入</el-button
  82. >
  83. </el-row>
  84. <el-table
  85. :data="tableData"
  86. style="min-height: 400px"
  87. v-loading="loading"
  88. stripe
  89. @sort-change="sortChange"
  90. @selection-change="handleSelectionChange"
  91. >
  92. <el-table-column type="selection" width="55"></el-table-column>
  93. <el-table-column
  94. prop="companyName"
  95. label="企业名称"
  96. width="180"
  97. fixed="left"
  98. ></el-table-column>
  99. <el-table-column
  100. prop="building"
  101. label="楼栋"
  102. width="180"
  103. ></el-table-column>
  104. <el-table-column prop="room" label="房号" width="180"></el-table-column>
  105. <el-table-column
  106. prop="boss"
  107. label="法人"
  108. width="180"
  109. ></el-table-column>
  110. <el-table-column
  111. prop="artificialPersonN"
  112. label="联系人"
  113. width="180"
  114. ></el-table-column>
  115. <el-table-column
  116. prop="artificialPersonPhone"
  117. label="联系电话"
  118. width="180"
  119. ></el-table-column>
  120. <el-table-column prop="area" label="面积(㎡)" width="180"></el-table-column>
  121. <el-table-column
  122. prop="checkinTime"
  123. label="入驻时间"
  124. width="180"
  125. ></el-table-column>
  126. <el-table-column
  127. prop="feeExpirationTime"
  128. label="费用到期时间"
  129. width="180"
  130. ></el-table-column>
  131. <el-table-column
  132. prop="contractExpirationTime"
  133. label="合同到期时间"
  134. width="180"
  135. ></el-table-column>
  136. <el-table-column
  137. prop="leaseTerm"
  138. label="租赁期限"
  139. width="180"
  140. ></el-table-column>
  141. <el-table-column prop="wechatPay" fixed="right" label="微信支付" width="80">
  142. <template slot-scope="{row}">
  143. <el-switch
  144. v-model="row.wechatPay"
  145. active-color="#13ce66"
  146. inactive-color="#ff4949"
  147. @change="handlChange(row)">
  148. </el-switch>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="aliPay" fixed="right" label="支付宝支付" width="90">
  152. <template slot-scope="{row}">
  153. <el-switch
  154. v-model="row.aliPay"
  155. active-color="#13ce66"
  156. inactive-color="#ff4949"
  157. @change="handlChange(row)">
  158. </el-switch>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="操作" fixed="right" width="220">
  162. <template slot-scope="{ row }">
  163. <el-button size="mini" type="primary" @click="handlePayment(row)"
  164. >收费项</el-button
  165. >
  166. <el-button size="mini" type="warning" @click="handleEdit(row)"
  167. >编辑</el-button
  168. >
  169. <el-button size="mini" type="danger" @click="handleDelete(row)"
  170. >删除</el-button
  171. >
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <el-pagination
  176. :current-page.sync="pageIndex"
  177. :total="totalElements"
  178. :page-sizes="pageSizeList"
  179. @current-change="changePage"
  180. @size-change="pageSizeChange"
  181. layout="total, sizes, prev, pager, next, jumper"
  182. ></el-pagination>
  183. <checkinInfo-detail
  184. v-if="showModal"
  185. :businessKey="businessKey"
  186. :title="modalTitle"
  187. @close="onDetailModalClose"
  188. ></checkinInfo-detail>
  189. <checkinInfo-payment
  190. v-if="showModal1"
  191. :businessKey="businessKey"
  192. :title="modalTitle"
  193. @close="onDetailModalClose"
  194. ></checkinInfo-payment>
  195. <el-dialog
  196. title="批量导入租户"
  197. :visible.sync="batchImportVisible"
  198. :modal-append-to-body="false"
  199. style="text-align: left"
  200. :close-on-click-modal="false"
  201. >
  202. <el-form label-width="150px">
  203. <el-form-item label="模板下载">
  204. <el-link
  205. href="http://rccs.oss-cn-hangzhou.aliyuncs.com/smart_school/personInfo/2020/10/%E5%B0%8F%E9%B9%8F%E7%AE%A1%E5%AE%B6%E7%A7%9F%E6%88%B7%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xls"
  206. type="primary"
  207. target="_blank"
  208. >点击下载模板</el-link
  209. >
  210. </el-form-item>
  211. <el-form-item label="上传文件">
  212. <el-upload
  213. class="upload-demo"
  214. accept=".xls"
  215. :action="uploadUrlXls"
  216. :headers="headers"
  217. :on-preview="handleBatchImportPreview"
  218. name="uploadFile"
  219. :multiple="true"
  220. :limit="1"
  221. :on-remove="handleBatchImportRemove"
  222. :before-remove="beforeBatchImportRemove"
  223. :before-upload="beforeUpload"
  224. :on-exceed="handleBatchImportExceed"
  225. :on-success="handleBatchImportSuccess"
  226. :file-list="batchImportFileList"
  227. >
  228. <el-button size="small" type="primary" :loading="xlsLoading"
  229. >点击上传</el-button
  230. >
  231. <div slot="tip" class="el-upload__tip">
  232. 只能上传xls文件,且不超过500kb
  233. </div>
  234. </el-upload>
  235. </el-form-item>
  236. </el-form>
  237. <div slot="footer" class="dialog-footer">
  238. <el-button type="primary" @click="batchImportVisible = false"
  239. >关 闭</el-button
  240. >
  241. </div>
  242. </el-dialog>
  243. </div>
  244. </template>
  245. <script>
  246. import Constant from "@/constant";
  247. import CheckinInfoDetail from "./checkinInfo-detail";
  248. import CheckinInfoPayment from "./checkinInfo-payment";
  249. import checkinInfoApi from "@/api/base/checkinInfo";
  250. import NProgress from "nprogress"; // progress bar
  251. import "nprogress/nprogress.css"; // progress bar style
  252. import { getToken } from "@/utils/auth";
  253. export default {
  254. data() {
  255. var self = this;
  256. return {
  257. queryModel: {
  258. id: "",
  259. building: "",
  260. name: "",
  261. feeExpirationTime: "",
  262. contractExpirationTime: "",
  263. },
  264. loading: false,
  265. tableData: [],
  266. pageIndex: 1,
  267. pageSize: 10,
  268. totalPages: 0,
  269. totalElements: 0,
  270. field: "",
  271. direction: "",
  272. pageSizeList: [10, 20, 30],
  273. multipleSelection: [],
  274. showModal: false,
  275. showModal1: false,
  276. modalTitle: "",
  277. businessKey: "",
  278. batchImportVisible: false,
  279. uploadUrlXls: Constant.serverUrl + "/base/checkinInfo/importXls",
  280. batchImportFileList: [],
  281. xlsLoading: false,
  282. headers: {
  283. Authorization: getToken(),
  284. },
  285. };
  286. },
  287. methods: {
  288. changePage(pageIndex) {
  289. var self = this;
  290. self.loading = true;
  291. self.pageIndex = pageIndex;
  292. var formData = new FormData();
  293. formData.append("pageIndex", self.pageIndex);
  294. formData.append("pageSize", self.pageSize);
  295. formData.append("id", self.queryModel.id);
  296. formData.append("building", self.queryModel.building);
  297. formData.append("name", self.queryModel.name);
  298. formData.append("feeExpirationTime", self.queryModel.feeExpirationTime);
  299. formData.append("contractExpirationTime", self.queryModel.contractExpirationTime);
  300. if (this.field != null) {
  301. formData.append("field", this.field);
  302. }
  303. if (this.direction != null) {
  304. formData.append("direction", this.direction);
  305. }
  306. checkinInfoApi
  307. .pageList(formData)
  308. .then(function (response) {
  309. self.loading = false;
  310. var jsonData = response.data.data;
  311. self.tableData = jsonData.data;
  312. self.totalPages = jsonData.totalPages;
  313. self.totalElements = jsonData.recordsTotal;
  314. })
  315. .catch((error) => {
  316. self.loading = false;
  317. // self.$message.error(error + "");
  318. });
  319. },
  320. pageSizeChange(pageSize) {
  321. this.pageSize = pageSize;
  322. this.$nextTick(() => {
  323. this.changePage(this.pageIndex);
  324. });
  325. },
  326. sortChange(data) {
  327. this.field = data.column.field;
  328. this.direction = data.order == "ascending" ? "asc" : "desc";
  329. this.changePage(this.pageIndex);
  330. },
  331. handleSelectionChange(val) {
  332. this.multipleSelection = val;
  333. },
  334. handleReset(name) {
  335. this.$refs[name].resetFields();
  336. },
  337. handleAdd() {
  338. this.modalTitle = "新增";
  339. this.businessKey = "";
  340. this.showModal = true;
  341. },
  342. handleEdit(record) {
  343. this.modalTitle = "编辑";
  344. this.businessKey = record.id;
  345. this.showModal = true;
  346. },
  347. handlePayment(record) {
  348. this.modalTitle = "收费项";
  349. this.businessKey = record.id;
  350. this.showModal1 = true;
  351. },
  352. handleDelete(record) {
  353. var self = this;
  354. self
  355. .$confirm("是否确认删除?", "提示", {
  356. confirmButtonText: "确定",
  357. cancelButtonText: "取消",
  358. type: "warning",
  359. })
  360. .then(() => {
  361. checkinInfoApi.remove(record.id).then(function (response) {
  362. var jsonData = response.data;
  363. if (jsonData.result) {
  364. // var index = self.tableData.indexOf(record);
  365. // self.tableData.splice(index, 1);
  366. self.changePage(self.pageIndex);
  367. self.$message({
  368. type: "success",
  369. message: "删除成功!",
  370. });
  371. }
  372. });
  373. });
  374. },
  375. handleBatchDelete() {
  376. var self = this;
  377. var idList = this.multipleSelection.map((record) => {
  378. return record.id;
  379. });
  380. this.$confirm("是否确认删除选中项?", "提示", {
  381. confirmButtonText: "确定",
  382. cancelButtonText: "取消",
  383. type: "warning",
  384. }).then(() => {
  385. checkinInfoApi.batchRemove(idList).then(function (response) {
  386. var jsonData = response.data;
  387. if (jsonData.result) {
  388. self.changePage(self.pageIndex);
  389. self.$message({
  390. type: "success",
  391. message: "删除成功!",
  392. });
  393. }
  394. });
  395. });
  396. },
  397. onDetailModalClose(refreshed) {
  398. //保存成功后回调
  399. this.showModal = false;
  400. this.showModal1 = false;
  401. if (refreshed) {
  402. this.changePage(this.pageIndex);
  403. }
  404. },
  405. handlChange(record){
  406. var self = this;
  407. var formData = new FormData();
  408. self.loading = true;
  409. formData.append("id", record.id);
  410. formData.append("wechatPay", !!record.wechatPay);
  411. formData.append("aliPay", !!record.aliPay);
  412. checkinInfoApi.updateWechatPayOrAliPay(formData).then(function (response) {
  413. var jsonData = response.data;
  414. self.loading = false;
  415. if (jsonData.result) {
  416. self.changePage(self.pageIndex);
  417. }
  418. else{
  419. self.$message.error(jsonData.message + "");
  420. }
  421. });
  422. },
  423. beforeUpload(file, fileList) {
  424. //导入前判断
  425. var self = this;
  426. self.xlsLoading = true;
  427. return true;
  428. },
  429. //批量导入-上传成功
  430. handleBatchImportSuccess(response, file, fileList) {
  431. var self = this;
  432. self.xlsLoading = false;
  433. if (response.result) {
  434. self.$message.success(response.message);
  435. this.batchImportFileList = [];
  436. this.changePage(1);
  437. this.batchImportVisible = false;
  438. } else {
  439. //this.$message.error(response.message);
  440. this.batchImportFileList = [];
  441. this.changePage(1);
  442. if (response.data != null) {
  443. //下载有错误信息提示的报表
  444. //window.open(response.data);
  445. self.$message({
  446. showClose: true,
  447. dangerouslyUseHTMLString: true,
  448. message:
  449. response.message +
  450. `,<a href="${response.data}" target="_blank">点击下载未导入的数据报表</a>&nbsp;`,
  451. duration: 30000,
  452. });
  453. }
  454. }
  455. },
  456. //批量导入-预览
  457. handleBatchImportPreview(file) {
  458. console.log(file.url);
  459. },
  460. //批量导入-移除
  461. handleBatchImportRemove(file, fileList) {
  462. console.log(file, fileList);
  463. },
  464. //批量导入-移除前操作
  465. beforeBatchImportRemove(file, fileList) {
  466. console.log(file, fileList);
  467. },
  468. //批量导入-文件超出个数限制时的钩子
  469. handleBatchImportExceed(files, fileList) {
  470. this.$message.warning(
  471. `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
  472. files.length + fileList.length
  473. } 个文件`
  474. );
  475. },
  476. },
  477. mounted: function () {
  478. this.changePage(1);
  479. },
  480. components: {
  481. "checkinInfo-detail": CheckinInfoDetail,
  482. "checkinInfo-payment": CheckinInfoPayment,
  483. },
  484. };
  485. </script>
  486. <style lang="scss" scoped>
  487. .el-breadcrumb {
  488. margin: 10px;
  489. line-height: 20px;
  490. }
  491. .el-divider {
  492. margin: 5px 0;
  493. }
  494. .demo-form-inline {
  495. margin-left: 10px;
  496. text-align: left;
  497. }
  498. .button-group {
  499. margin-left: 10px;
  500. text-align: left;
  501. }
  502. </style>