index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="68px"
  10. >
  11. <el-form-item label="" prop="xingMing">
  12. <el-input
  13. v-model="queryParams.xingMing"
  14. placeholder="请输入姓名"
  15. clearable
  16. @input="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button size="btr" @click="resetQuery">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <el-row :gutter="10" class="mb8">
  24. <el-col :span="1.5">
  25. <el-button
  26. type="primary"
  27. plain
  28. icon="el-icon-plus"
  29. size="mini"
  30. @click="handleAdd"
  31. v-hasPermi="['barracksManagement:scadre:add']"
  32. >新增</el-button
  33. >
  34. </el-col>
  35. <!-- <el-col :span="1.5">
  36. <el-button
  37. type="success"
  38. plain
  39. icon="el-icon-edit"
  40. size="mini"
  41. :disabled="single"
  42. @click="handleUpdate"
  43. v-hasPermi="['barracksManagement:scadre:edit']"
  44. >修改</el-button
  45. >
  46. </el-col> -->
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. plain
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. v-hasPermi="['barracksManagement:scadre:remove']"
  56. >删除</el-button
  57. >
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-button
  61. type="warning"
  62. plain
  63. icon="el-icon-download"
  64. size="mini"
  65. :loading="exportLoading"
  66. @click="handleExport"
  67. v-hasPermi="['barracksManagement:scadre:export']"
  68. >导出</el-button
  69. >
  70. </el-col>
  71. <!-- <right-toolbar
  72. :showSearch.sync="showSearch"
  73. @queryTable="getList"
  74. ></right-toolbar> -->
  75. </el-row>
  76. <el-table
  77. v-loading="loading"
  78. :data="dormList"
  79. @selection-change="handleSelectionChange"
  80. >
  81. <el-table-column type="selection" width="55" align="center" />
  82. <el-table-column label="序号" type="index" width="50">
  83. <template scope="scope">
  84. <span>{{
  85. (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
  86. }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="姓名" align="center" prop="xingMing" />
  90. <el-table-column label="房间号" align="center" prop="roomNumber" />
  91. <el-table-column label="建筑面积" align="center" prop="area" />
  92. <el-table-column
  93. label="物业费标准"
  94. align="center"
  95. prop="propertyFeeStandard"
  96. />
  97. <el-table-column label="房租标准" align="center" prop="rentStandard" />
  98. <el-table-column label="月水费" align="center" prop="waterBil" />
  99. <el-table-column label="月房租" align="center" prop="monthlyRent" />
  100. <el-table-column
  101. label="月物业费"
  102. align="center"
  103. prop="monthlyPropertyFee"
  104. />
  105. <el-table-column label="总金额" align="center" prop="totalAmount" />
  106. <!-- <el-table-column
  107. label="录入时间"
  108. align="center"
  109. prop="createtime"
  110. width="150px"
  111. >
  112. <template slot-scope="scope">
  113. <span>{{
  114. dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.createtime)
  115. }}</span>
  116. </template>
  117. </el-table-column> -->
  118. <el-table-column
  119. label="操作"
  120. align="center"
  121. class-name="small-padding fixed-width"
  122. >
  123. <template slot-scope="scope">
  124. <el-button
  125. size="btu"
  126. type="text"
  127. @click="handleUpdate(scope.row)"
  128. v-hasPermi="['barracksManagement:scadre:edit']"
  129. >修改</el-button
  130. >
  131. <el-button
  132. size="btd"
  133. type="text"
  134. @click="handleDelete(scope.row)"
  135. v-hasPermi="['barracksManagement:scadre:remove']"
  136. >删除</el-button
  137. >
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <pagination
  142. v-show="total > 0"
  143. :total="total"
  144. :page.sync="queryParams.pageNum"
  145. :limit.sync="queryParams.pageSize"
  146. @pagination="getList"
  147. />
  148. <!-- 添加或修改单身干部宿舍对话框 -->
  149. <el-dialog
  150. :title="title"
  151. :visible.sync="open"
  152. width="800px"
  153. append-to-body
  154. :close-on-click-modal="false"
  155. >
  156. <el-form
  157. ref="form"
  158. :model="form"
  159. :rules="rules"
  160. label-width="90px"
  161. :inline="true"
  162. >
  163. <el-form-item label="姓名" prop="xingMing">
  164. <el-input v-model="form.xingMing" placeholder="" />
  165. </el-form-item>
  166. <el-form-item label="房间号" prop="roomNumber">
  167. <el-input v-model="form.roomNumber" placeholder="" />
  168. </el-form-item>
  169. <el-form-item label="建筑面积" prop="area">
  170. <el-input v-model="form.area" placeholder="" />
  171. </el-form-item>
  172. <el-form-item label="使用面积" prop="usageArea">
  173. <el-input v-model="form.usageArea" placeholder="" />
  174. </el-form-item>
  175. <el-form-item label="物业标准" prop="propertyFeeStandard">
  176. <el-input v-model="form.propertyFeeStandard" placeholder="" />
  177. </el-form-item>
  178. <el-form-item label="房租标准" prop="rentStandard">
  179. <el-input v-model="form.rentStandard" placeholder="" />
  180. </el-form-item>
  181. <el-form-item label="水电费" prop="waterBil">
  182. <el-input v-model="form.waterBil" placeholder="" />
  183. </el-form-item>
  184. <el-form-item label="月房租" prop="monthlyRent">
  185. <el-input v-model="form.monthlyRent" placeholder="" />
  186. </el-form-item>
  187. <el-form-item label="月物业费" prop="monthlyPropertyFee">
  188. <el-input v-model="form.monthlyPropertyFee" placeholder="" />
  189. </el-form-item>
  190. <el-form-item label="总金额" prop="totalAmount">
  191. <el-input v-model="form.totalAmount" placeholder="" />
  192. </el-form-item>
  193. <div class="jibens">备注</div>
  194. <el-form-item label="" prop="remark">
  195. <el-input
  196. v-model="form.remark"
  197. type="textarea"
  198. autosize
  199. placeholder="请输入备注"
  200. />
  201. </el-form-item>
  202. </el-form>
  203. <div slot="footer" class="dialog-footer">
  204. <el-button type="primary" @click="submitForm">确 定</el-button>
  205. <el-button @click="cancel" size="btn">取 消</el-button>
  206. </div>
  207. </el-dialog>
  208. </div>
  209. </template>
  210. <script>
  211. import {
  212. listDorm,
  213. getDorm,
  214. delDorm,
  215. addDorm,
  216. updateDorm,
  217. exportScadred,
  218. } from "@/api/barracksManagement/scadred";
  219. export default {
  220. name: "Dorm",
  221. data() {
  222. return {
  223. // 遮罩层
  224. loading: true,
  225. // 导出遮罩层
  226. exportLoading: false,
  227. // 选中数组
  228. ids: [],
  229. // 非单个禁用
  230. single: true,
  231. // 非多个禁用
  232. multiple: true,
  233. // 显示搜索条件
  234. showSearch: true,
  235. // 总条数
  236. total: 0,
  237. // 单身干部宿舍表格数据
  238. dormList: [],
  239. // 弹出层标题
  240. title: "",
  241. // 是否显示弹出层
  242. open: false,
  243. // 查询参数
  244. queryParams: {
  245. pageNum: 1,
  246. pageSize: 10,
  247. number: null,
  248. number1: null,
  249. name: null,
  250. behoof: null,
  251. statusQuo: null,
  252. period: null,
  253. area: null,
  254. createtime: null,
  255. updatetime: null,
  256. tier: null,
  257. roomNumber: null,
  258. element: null,
  259. xingMing: null,
  260. usageArea: null,
  261. propertyFeeStandard: null,
  262. rentStandard: null,
  263. waterBil: null,
  264. monthlyRent: null,
  265. monthlyPropertyFee: null,
  266. totalAmount: null,
  267. },
  268. // 表单参数
  269. form: {},
  270. // 表单校验
  271. rules: {
  272. xingMing: [
  273. { required: true, message: "姓名不能为空", trigger: "blur" },
  274. ],
  275. area: [
  276. { required: true, message: "建筑面积不能为空", trigger: "blur" },
  277. ],
  278. usageArea: [
  279. { required: true, message: "使用面积不能为空", trigger: "blur" },
  280. ],
  281. propertyFeeStandard: [
  282. { required: true, message: "物业标准不能为空", trigger: "blur" },
  283. ],
  284. rentStandard: [
  285. { required: true, message: "房租标准不能为空", trigger: "blur" },
  286. ],
  287. waterBil: [
  288. { required: true, message: "水电费不能为空", trigger: "blur" },
  289. ],
  290. monthlyRent: [
  291. { required: true, message: "月房租不能为空", trigger: "blur" },
  292. ],
  293. monthlyPropertyFee: [
  294. { required: true, message: "月物业费不能为空", trigger: "blur" },
  295. ],
  296. totalAmounnt: [
  297. { required: true, message: "总金额不能为空", trigger: "blur" },
  298. ],
  299. roomNumber: [
  300. { required: true, message: "房间号不能为空", trigger: "blur" },
  301. ],
  302. },
  303. };
  304. },
  305. created() {
  306. this.getList();
  307. },
  308. methods: {
  309. dateFormat(fmt, date) {
  310. let ret = "";
  311. date = new Date(date);
  312. const opt = {
  313. "Y+": date.getFullYear().toString(), // 年
  314. "m+": (date.getMonth() + 1).toString(), // 月
  315. "d+": date.getDate().toString(), // 日
  316. "H+": date.getHours().toString(), // 时
  317. "M+": date.getMinutes().toString(), // 分
  318. "S+": date.getSeconds().toString(), // 秒
  319. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  320. };
  321. for (let k in opt) {
  322. ret = new RegExp("(" + k + ")").exec(fmt);
  323. if (ret) {
  324. fmt = fmt.replace(
  325. ret[1],
  326. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
  327. );
  328. }
  329. }
  330. return fmt;
  331. },
  332. /** 查询单身干部宿舍列表 */
  333. getList() {
  334. this.loading = true;
  335. listDorm(this.queryParams).then((response) => {
  336. this.dormList = response.rows;
  337. this.total = response.total;
  338. this.loading = false;
  339. });
  340. },
  341. // 取消按钮
  342. cancel() {
  343. this.open = false;
  344. this.reset();
  345. },
  346. // 表单重置
  347. reset() {
  348. this.form = {
  349. id: null,
  350. number: null,
  351. number1: null,
  352. name: null,
  353. behoof: null,
  354. statusQuo: null,
  355. period: null,
  356. area: null,
  357. remark: null,
  358. createtime: null,
  359. updatetime: null,
  360. tier: null,
  361. roomNumber: null,
  362. element: null,
  363. xingMing: null,
  364. usageArea: null,
  365. propertyFeeStandard: null,
  366. rentStandard: null,
  367. waterBil: null,
  368. monthlyRent: null,
  369. monthlyPropertyFee: null,
  370. totalAmount: null,
  371. };
  372. this.resetForm("form");
  373. },
  374. /** 搜索按钮操作 */
  375. handleQuery() {
  376. this.queryParams.pageNum = 1;
  377. this.getList();
  378. },
  379. /** 重置按钮操作 */
  380. resetQuery() {
  381. this.resetForm("queryForm");
  382. this.handleQuery();
  383. },
  384. // 多选框选中数据
  385. handleSelectionChange(selection) {
  386. this.ids = selection.map((item) => item.id);
  387. this.single = selection.length !== 1;
  388. this.multiple = !selection.length;
  389. },
  390. /** 新增按钮操作 */
  391. handleAdd() {
  392. this.reset();
  393. this.open = true;
  394. this.title = "添加单身干部宿舍";
  395. },
  396. /** 修改按钮操作 */
  397. handleUpdate(row) {
  398. this.reset();
  399. const id = row.id || this.ids;
  400. getDorm(id).then((response) => {
  401. this.form = response.data;
  402. this.open = true;
  403. this.title = "修改单身干部宿舍";
  404. });
  405. },
  406. /** 提交按钮 */
  407. submitForm() {
  408. this.$refs["form"].validate((valid) => {
  409. if (valid) {
  410. if (this.form.id != null) {
  411. updateDorm(this.form).then((response) => {
  412. this.$modal.msgSuccess("修改成功");
  413. this.open = false;
  414. this.getList();
  415. });
  416. } else {
  417. addDorm(this.form).then((response) => {
  418. this.$modal.msgSuccess("新增成功");
  419. this.open = false;
  420. this.getList();
  421. });
  422. }
  423. }
  424. });
  425. },
  426. /** 删除按钮操作 */
  427. handleDelete(row) {
  428. const ids = row.id || this.ids;
  429. this.$modal
  430. .confirm('是否确认删除单身干部宿舍编号为"' + ids + '"的数据项?')
  431. .then(function () {
  432. return delDorm(ids);
  433. })
  434. .then(() => {
  435. this.getList();
  436. this.$modal.msgSuccess("删除成功");
  437. })
  438. .catch(() => {});
  439. },
  440. /** 导出按钮操作 */
  441. handleExport() {
  442. const queryParams = this.queryParams;
  443. this.$modal
  444. .confirm("是否确认导出所有公寓房档案数据项?")
  445. .then(() => {
  446. this.exportLoading = true;
  447. return exportScadred(queryParams);
  448. })
  449. .then((response) => {
  450. this.$download.name(response.msg);
  451. this.exportLoading = false;
  452. })
  453. .catch(() => {});
  454. },
  455. },
  456. };
  457. </script>
  458. <style scoped>
  459. ::v-deep .el-dialog {
  460. background-color: #004d86 !important;
  461. }
  462. /* 输入框 */
  463. ::v-deep .el-dialog .el-input__inner {
  464. background-color: #004d86 !important;
  465. color: white;
  466. margin-right: 20px;
  467. }
  468. /* 标题弹框 */
  469. ::v-deep .el-dialog__title {
  470. color: white;
  471. /* border-bottom: 1px solid white; */
  472. }
  473. ::v-deep .el-input__inner {
  474. border: 1px solid white !important;
  475. }
  476. /* 标题下划线 */
  477. ::v-deep .el-dialog__header {
  478. border-bottom: 1px solid white;
  479. }
  480. /* 文本域 */
  481. ::v-deep .el-textarea__inner {
  482. width: 610px;
  483. height: 80px;
  484. }
  485. ::v-deep .el-form-item__label {
  486. text-align: end;
  487. }
  488. ::v-deep .el-dialog__body {
  489. padding: 0px;
  490. margin-left: 96px;
  491. margin-top: 20px;
  492. }
  493. ::v-deep .el-table .el-table__header-wrapper th,
  494. .el-table .el-table__fixed-header-wrapper th {
  495. background-color: rgb(0, 60, 105);
  496. color: white;
  497. }
  498. ::v-deep .el-input--small .el-input__inner {
  499. color: white;
  500. }
  501. ::v-deep .el-table__cell .cell {
  502. text-align: center;
  503. }
  504. /* 文字多余部分省略 */
  505. ::v-deep .el-table__cell .cell {
  506. overflow: hidden;
  507. text-overflow: ellipsis;
  508. white-space: nowrap;
  509. }
  510. .jibens {
  511. width: 650px;
  512. height: 32px;
  513. background-image: url("/static/img/小标题底.b7c6f45a.png");
  514. background-size: 100%;
  515. margin-bottom: 25px;
  516. color: #fff;
  517. padding-left: 16px;
  518. line-height: 32px;
  519. }
  520. ::v-deep .el-dialog__footer {
  521. margin-right: 74px;
  522. }
  523. ::v-deep .el-form-item__content .el-input__inner {
  524. width: 200px;
  525. height: 36px;
  526. }
  527. ::v-deep .el-textarea__inner {
  528. min-height: 120px !important;
  529. }
  530. </style>