index.vue 13 KB

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