index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="100px"
  9. >
  10. <!-- <el-form-item label="单位名称" prop="unitName">
  11. <el-input
  12. v-model="queryParams.unitName"
  13. placeholder="请输入单位名称"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item> -->
  19. <!-- <el-form-item label="位置" prop="position">
  20. <el-input
  21. v-model="queryParams.position"
  22. placeholder="请输入位置"
  23. clearable
  24. size="small"
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item> -->
  28. <el-form-item prop="occupant">
  29. <el-input
  30. v-model="queryParams.occupant"
  31. clearable
  32. size="small"
  33. placeholder="请输入入住人姓名"
  34. @input="handleQuery"
  35. />
  36. </el-form-item>
  37. <!-- <el-form-item label="入住时间" prop="entryTime">
  38. <el-date-picker
  39. clearable
  40. size="small"
  41. v-model="queryParams.entryTime"
  42. type="date"
  43. value-format="yyyy-MM-dd"
  44. placeholder="选择入住时间"
  45. >
  46. </el-date-picker>
  47. </el-form-item> -->
  48. <!-- <el-form-item label="退房时间" prop="endTime">
  49. <el-date-picker
  50. clearable
  51. size="small"
  52. v-model="queryParams.endTime"
  53. type="date"
  54. value-format="yyyy-MM-dd"
  55. placeholder="选择退房时间"
  56. >
  57. </el-date-picker>
  58. </el-form-item> -->
  59. <el-form-item>
  60. <!-- <el-button size="btn" @click="handleQuery">搜索</el-button> -->
  61. <el-button size="btr" @click="resetQuery">重置</el-button>
  62. </el-form-item>
  63. </el-form>
  64. <el-row :gutter="10" class="mb8">
  65. <el-col :span="1.5">
  66. <el-button
  67. type="primary"
  68. plain
  69. icon="el-icon-plus"
  70. size="mini"
  71. @click="handleAdd"
  72. v-hasPermi="['barracksManagement:checkin:add']"
  73. >新增</el-button
  74. >
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="success"
  79. plain
  80. icon="el-icon-edit"
  81. size="mini"
  82. :disabled="single"
  83. @click="handleUpdate"
  84. v-hasPermi="['barracksManagement:checkin:edit']"
  85. >修改</el-button
  86. >
  87. </el-col>
  88. <el-col :span="1.5">
  89. <el-button
  90. type="danger"
  91. plain
  92. icon="el-icon-delete"
  93. size="mini"
  94. :disabled="multiple"
  95. @click="handleDelete"
  96. v-hasPermi="['barracksManagement:checkin:remove']"
  97. >删除</el-button
  98. >
  99. </el-col>
  100. <!-- <el-col :span="1.5">
  101. <el-button
  102. type="warning"
  103. plain
  104. icon="el-icon-download"
  105. size="mini"
  106. :loading="exportLoading"
  107. @click="handleExport"
  108. v-hasPermi="['barracksManagement:checkin:export']"
  109. >导出</el-button
  110. >
  111. </el-col> -->
  112. <!-- <right-toolbar
  113. :showSearch.sync="showSearch"
  114. @queryTable="getList"
  115. ></right-toolbar> -->
  116. </el-row>
  117. <el-table
  118. v-loading="loading"
  119. :data="checkinList"
  120. @selection-change="handleSelectionChange"
  121. >
  122. <el-table-column type="selection" width="55" align="center" />
  123. <el-table-column label="序号" type="index" width="50"> </el-table-column>
  124. <el-table-column label="单位名称" align="center" prop="unitName" />
  125. <el-table-column label="位置" align="center" prop="position" />
  126. <el-table-column label="入住人姓名" align="center" prop="occupant" />
  127. <el-table-column
  128. label="备注"
  129. align="center"
  130. prop="remark"
  131. show-overflow-tooltip
  132. />
  133. <el-table-column label="入住时间" align="center" prop="entryTime">
  134. <template slot-scope="scope">
  135. <span>{{ parseTime(scope.row.entryTime, "{y}-{m}-{d}") }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="退房时间" align="center" prop="endTime">
  139. <template slot-scope="scope">
  140. <span>{{ parseTime(scope.row.endTime, "{y}-{m}-{d}") }}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column
  144. label="操作"
  145. align="center"
  146. class-name="small-padding fixed-width"
  147. >
  148. <template slot-scope="scope">
  149. <el-button
  150. size="btu"
  151. type="text"
  152. @click="handleUpdate(scope.row)"
  153. v-hasPermi="['barracksManagement:checkin:edit']"
  154. >修改</el-button
  155. >
  156. <el-button
  157. size="btd"
  158. type="text"
  159. @click="handleDelete(scope.row)"
  160. v-hasPermi="['barracksManagement:checkin:remove']"
  161. >删除</el-button
  162. >
  163. </template>
  164. </el-table-column>
  165. </el-table>
  166. <pagination
  167. v-show="total > 0"
  168. :total="total"
  169. :page.sync="queryParams.pageNum"
  170. :limit.sync="queryParams.pageSize"
  171. @pagination="getList"
  172. />
  173. <!-- 添加或修改临时来队对话框 -->
  174. <el-dialog
  175. :title="title"
  176. :visible.sync="open"
  177. width="800px"
  178. append-to-body
  179. :close-on-click-modal="false"
  180. >
  181. <el-form
  182. ref="form"
  183. :model="form"
  184. :rules="rules"
  185. label-width="100px"
  186. :inline="true"
  187. >
  188. <el-form-item label="位置" prop="position">
  189. <el-input v-model="form.position" />
  190. </el-form-item>
  191. <el-form-item label="入驻单位" prop="unitName">
  192. <el-input v-model="form.unitName" />
  193. </el-form-item>
  194. <!-- <el-form-item label="单位id" prop="unitId">
  195. <el-input v-model="form.unitId" placeholder="请输入单位id" />
  196. </el-form-item> -->
  197. <!-- <el-form-item label="创建人id" prop="creatId">
  198. <el-input v-model="form.creatId" placeholder="请输入创建人id" />
  199. </el-form-item> -->
  200. <el-form-item label="入住人员" prop="occupant">
  201. <el-input v-model="form.occupant" />
  202. </el-form-item>
  203. <el-form-item label="入住时间" prop="entryTime">
  204. <el-date-picker
  205. clearable
  206. size="small"
  207. v-model="form.entryTime"
  208. type="date"
  209. value-format="yyyy-MM-dd"
  210. >
  211. </el-date-picker>
  212. </el-form-item>
  213. <el-form-item label="退房时间" prop="endTime">
  214. <el-date-picker
  215. clearable
  216. size="small"
  217. v-model="form.endTime"
  218. type="date"
  219. value-format="yyyy-MM-dd"
  220. >
  221. </el-date-picker>
  222. </el-form-item>
  223. <div class="jibens">备注</div>
  224. <el-form-item prop="remark">
  225. <el-input
  226. v-model="form.remark"
  227. type="textarea"
  228. placeholder="请输入内容"
  229. />
  230. </el-form-item>
  231. </el-form>
  232. <div slot="footer" class="dialog-footer">
  233. <el-button type="primary" @click="submitForm">确 定</el-button>
  234. <el-button @click="cancel">取 消</el-button>
  235. </div>
  236. </el-dialog>
  237. </div>
  238. </template>
  239. <script>
  240. import {
  241. listCheckin,
  242. getCheckin,
  243. delCheckin,
  244. addCheckin,
  245. updateCheckin,
  246. exportCheckin,
  247. } from "@/api/barracksManagement/checkin";
  248. export default {
  249. name: "Checkin",
  250. data() {
  251. return {
  252. // 遮罩层
  253. loading: true,
  254. // 导出遮罩层
  255. exportLoading: false,
  256. // 选中数组
  257. ids: [],
  258. // 非单个禁用
  259. single: true,
  260. // 非多个禁用
  261. multiple: true,
  262. // 显示搜索条件
  263. showSearch: true,
  264. // 总条数
  265. total: 0,
  266. // 临时来队表格数据
  267. checkinList: [],
  268. // 弹出层标题
  269. title: "",
  270. // 是否显示弹出层
  271. open: false,
  272. // 查询参数
  273. queryParams: {
  274. pageNum: 1,
  275. pageSize: 10,
  276. unitName: null,
  277. unitId: null,
  278. creatTime: null,
  279. creatId: null,
  280. position: null,
  281. occupant: null,
  282. entryTime: null,
  283. endTime: null,
  284. creatName: null,
  285. },
  286. // 表单参数
  287. form: {},
  288. // 表单校验
  289. rules: {},
  290. };
  291. },
  292. created() {
  293. this.getList();
  294. },
  295. methods: {
  296. /** 查询临时来队列表 */
  297. getList() {
  298. this.loading = true;
  299. listCheckin(this.queryParams).then((response) => {
  300. this.checkinList = response.rows;
  301. console.log(this.checkinList);
  302. this.total = response.total;
  303. this.loading = false;
  304. });
  305. },
  306. // 取消按钮
  307. cancel() {
  308. this.open = false;
  309. this.reset();
  310. },
  311. // 表单重置
  312. reset() {
  313. this.form = {
  314. id: null,
  315. unitName: null,
  316. unitId: null,
  317. creatTime: null,
  318. creatId: null,
  319. position: null,
  320. occupant: null,
  321. entryTime: null,
  322. endTime: null,
  323. creatName: null,
  324. };
  325. this.resetForm("form");
  326. },
  327. /** 搜索按钮操作 */
  328. handleQuery() {
  329. this.queryParams.pageNum = 1;
  330. this.getList();
  331. },
  332. /** 重置按钮操作 */
  333. resetQuery() {
  334. this.queryParams = {};
  335. this.resetForm("queryForm");
  336. this.handleQuery();
  337. this.getList();
  338. },
  339. // 多选框选中数据
  340. handleSelectionChange(selection) {
  341. this.ids = selection.map((item) => item.id);
  342. this.single = selection.length !== 1;
  343. this.multiple = !selection.length;
  344. },
  345. /** 新增按钮操作 */
  346. handleAdd() {
  347. this.reset();
  348. this.open = true;
  349. this.title = "添加临时来队";
  350. },
  351. /** 修改按钮操作 */
  352. handleUpdate(row) {
  353. this.reset();
  354. const id = row.id || this.ids;
  355. getCheckin(id).then((response) => {
  356. this.form = response.data;
  357. this.open = true;
  358. this.title = "修改临时来队";
  359. });
  360. },
  361. /** 提交按钮 */
  362. submitForm() {
  363. console.log(this.form);
  364. this.$refs["form"].validate((valid) => {
  365. if (valid) {
  366. if (this.form.id != null) {
  367. updateCheckin(this.form).then((response) => {
  368. this.$modal.msgSuccess("修改成功");
  369. this.open = false;
  370. this.getList();
  371. });
  372. } else {
  373. addCheckin(this.form).then((response) => {
  374. this.$modal.msgSuccess("新增成功");
  375. this.open = false;
  376. this.getList();
  377. });
  378. }
  379. }
  380. });
  381. },
  382. /** 删除按钮操作 */
  383. handleDelete(row) {
  384. const ids = row.id || this.ids;
  385. this.$modal
  386. .confirm("是否确认删除?")
  387. .then(function () {
  388. return delCheckin(ids);
  389. })
  390. .then(() => {
  391. this.getList();
  392. this.$modal.msgSuccess("删除成功");
  393. })
  394. .catch(() => {});
  395. },
  396. /** 导出按钮操作 */
  397. handleExport() {
  398. const queryParams = this.queryParams;
  399. this.$modal
  400. .confirm("是否确认导出所有临时来队数据项?")
  401. .then(() => {
  402. this.exportLoading = true;
  403. return exportCheckin(queryParams);
  404. })
  405. .then((response) => {
  406. this.$download.name(response.msg);
  407. this.exportLoading = false;
  408. })
  409. .catch(() => {});
  410. },
  411. },
  412. };
  413. </script>
  414. <style scoped>
  415. ::v-deep .el-dialog {
  416. background-color: #004d86 !important;
  417. }
  418. /* 输入框 */
  419. ::v-deep .el-dialog .el-input__inner {
  420. background-color: #004d86 !important;
  421. width: 220px;
  422. color: white;
  423. margin-right: 20px;
  424. }
  425. /* 标题弹框 */
  426. ::v-deep .el-dialog__title {
  427. color: white;
  428. /* border-bottom: 1px solid white; */
  429. }
  430. ::v-deep .el-input__inner{
  431. border: 1px solid white !important;
  432. }
  433. /* 标题下划线 */
  434. ::v-deep .el-dialog__header {
  435. border-bottom: 1px solid white;
  436. }
  437. /* 文本域 */
  438. ::v-deep .el-textarea__inner {
  439. width: 670px;
  440. height: 80px;
  441. }
  442. ::v-deep .el-form-item__label {
  443. text-align: end;
  444. }
  445. ::v-deep .el-dialog__body {
  446. padding: 0px;
  447. margin-left: 63px;
  448. margin-top: 20px;
  449. }
  450. ::v-deep .el-table .el-table__header-wrapper th,
  451. .el-table .el-table__fixed-header-wrapper th {
  452. background-color: rgb(0, 60, 105);
  453. color: white;
  454. }
  455. ::v-deep .el-date-editor .el-input__inner {
  456. height: 36px;
  457. }
  458. ::v-deep .el-input--small .el-input__inner {
  459. color: white;
  460. }
  461. ::v-deep .el-table__cell .cell {
  462. text-align: center;
  463. }
  464. /* 文字多余部分省略 */
  465. ::v-deep .el-table__cell .cell {
  466. overflow: hidden;
  467. text-overflow: ellipsis;
  468. white-space: nowrap;
  469. }
  470. .jibens {
  471. width: 670px;
  472. height: 32px;
  473. background-image: url("/static/img/小标题底.b7c6f45a.png");
  474. background-size: 100%;
  475. margin-bottom: 25px;
  476. color: #fff;
  477. padding-left: 16px;
  478. line-height: 32px;
  479. }
  480. .dialog-footer {
  481. margin-right: 46px;
  482. }
  483. ::v-deep .el-form-item__content .el-input__inner{
  484. width: 200px ;
  485. height: 36px;
  486. }
  487. </style>