index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="到访单位" prop="unitId">
  5. <!-- <el-input
  6. v-model="queryParams.unitId"
  7. placeholder="请输入到访单位"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. /> -->
  12. <treeselect
  13. v-model="queryParams.unitId"
  14. :options="users"
  15. placeholder="请选择到访单位"
  16. class="threeselects"
  17. @select="selectPeo1"
  18. />
  19. </el-form-item>
  20. <el-form-item label="到访人员姓名" prop="name">
  21. <el-input
  22. class="daofang"
  23. v-model="queryParams.name"
  24. clearable
  25. size="small"
  26. @keyup.enter.native="handleQuery"
  27. />
  28. </el-form-item>
  29. <el-form-item class="search">
  30. <el-button type="btr1" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  31. <el-button icon="el-icon-refresh" size="btr2" @click="resetQuery">重置</el-button>
  32. </el-form-item>
  33. </el-form>
  34. <el-row :gutter="10" class="mb8">
  35. <el-col :span="1.5">
  36. <el-button
  37. type="primary"
  38. plain
  39. icon="el-icon-plus"
  40. size="mini"
  41. @click="handleAdd"
  42. v-hasPermi="['doormanManage:bdglVisit:add']"
  43. >新增</el-button>
  44. </el-col>
  45. <el-col :span="1.5">
  46. <el-button
  47. type="success"
  48. plain
  49. icon="el-icon-edit"
  50. size="mini"
  51. :disabled="single"
  52. @click="handleUpdate"
  53. v-hasPermi="['doormanManage:bdglVisit:edit']"
  54. >修改</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. plain
  60. icon="el-icon-delete"
  61. size="mini"
  62. :disabled="multiple"
  63. @click="handleDelete"
  64. v-hasPermi="['doormanManage:bdglVisit:remove']"
  65. >删除</el-button>
  66. </el-col>
  67. <!-- <el-col :span="1.5">
  68. <el-button
  69. type="warning"
  70. plain
  71. icon="el-icon-download"
  72. size="mini"
  73. :loading="exportLoading"
  74. @click="handleExport"
  75. v-hasPermi="['doormanManage:bdglVisit:export']"
  76. >导出</el-button>
  77. </el-col> -->
  78. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  79. </el-row>
  80. <el-table v-loading="loading" :data="bdglVisitList" @selection-change="handleSelectionChange">
  81. <el-table-column type="selection" width="55" align="center" />
  82. <!-- <el-table-column label="接待人姓名" align="center" prop="id" /> -->
  83. <el-table-column label="到访单位" align="center" prop="unitId" :formatter="unit2Format"/>
  84. <el-table-column label="接待人" align="center" prop="peopleName" />
  85. <el-table-column label="到访人员姓名" align="center" prop="name" />
  86. <el-table-column label="到访时间" align="center" prop="arriveTime" width="180">
  87. <template slot-scope="scope">
  88. <!-- <span>{{ parseTime(scope.row.arriveTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> -->
  89. <span>{{ dateFormat('YYYY-mm-dd HH:MM:SS',scope.row.arriveTime) }}</span>
  90. <!-- rTime -->
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="离队时间" align="center" prop="endTime" width="180">
  94. <template slot-scope="scope">
  95. <!-- <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> -->
  96. <span>{{ dateFormat('YYYY-mm-dd HH:MM:SS',scope.row.endTime) }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="到访车牌号" align="center" prop="numberPlate" />
  100. <el-table-column label="来访原因" align="center" prop="contents" show-overflow-tooltip/>
  101. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  102. <template slot-scope="scope">
  103. <el-button
  104. size="btu"
  105. type="text"
  106. @click="handleUpdate(scope.row)"
  107. v-hasPermi="['doormanManage:bdglVisit:edit']"
  108. >修改</el-button>
  109. <el-button
  110. size="btd"
  111. type="text"
  112. @click="handleDelete(scope.row)"
  113. v-hasPermi="['doormanManage:bdglVisit:remove']"
  114. >删除</el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <pagination
  119. v-show="total>0"
  120. :total="total"
  121. :page.sync="queryParams.pageNum"
  122. :limit.sync="queryParams.pageSize"
  123. @pagination="getList"
  124. />
  125. <!-- 添加或修改人员来访登记对话框 -->
  126. <el-dialog :title="title" :visible.sync="open" width="1090px" append-to-body>
  127. <el-form ref="form" :model="form" :rules="rules" label-width="110px" :inline="true">
  128. <el-form-item label="到访单位" prop="unitId" style="margin-left:20px">
  129. <treeselect
  130. v-model="form.unitId"
  131. :options="users"
  132. placeholder="请选择到访单位"
  133. class="threeselects"
  134. @select="selectPeo"
  135. />
  136. <!-- <el-input v-model="form.unitId" placeholder="请输入到访单位" /> -->
  137. </el-form-item>
  138. <el-form-item label="接待人" prop="peopleId" class="jiedai">
  139. <!-- <el-input v-model="form.peopleId" placeholder="请输入接待人" /> -->
  140. <el-select
  141. v-model="form.peopleName"
  142. ref="peoplenames"
  143. >
  144. <el-option
  145. v-for="item in executor"
  146. :key="item.id"
  147. :label="item.name"
  148. :value="item.name"
  149. @click.native="peopleIds(item.id)"
  150. id="execute"
  151. />
  152. </el-select>
  153. </el-form-item>
  154. <el-form-item label="到访人员姓名" prop="name">
  155. <el-input v-model="form.name" />
  156. </el-form-item>
  157. <el-form-item label="到访时间" prop="arriveTime" style="margin-left:20px">
  158. <el-date-picker clearable size="small"
  159. v-model="form.arriveTime"
  160. type="datetime"
  161. >
  162. </el-date-picker>
  163. </el-form-item>
  164. <el-form-item label="离队时间" prop="endTime">
  165. <el-date-picker clearable size="small"
  166. v-model="form.endTime"
  167. type="datetime"
  168. >
  169. </el-date-picker>
  170. </el-form-item>
  171. <el-form-item label="到访车牌号" prop="numberPlate">
  172. <el-input v-model="form.numberPlate" />
  173. </el-form-item>
  174. <div class="jiben" style="margin-left:20px">来访原因</div>
  175. <el-form-item prop="contents" class="daofang" style="margin-left:20px" >
  176. <el-input v-model="form.contents" type="textarea" />
  177. </el-form-item>
  178. </el-form>
  179. <div slot="footer" class="dialog-footer">
  180. <el-button type="primary" @click="submitForm">确 定</el-button>
  181. <el-button @click="cancel">取 消</el-button>
  182. </div>
  183. </el-dialog>
  184. </div>
  185. </template>
  186. <script>
  187. import { listBdglVisit, getBdglVisit, delBdglVisit, addBdglVisit, updateBdglVisit, exportBdglVisit, deptUser } from "@/api/doormanManage/bdglVisit";
  188. import Treeselect from "@riophae/vue-treeselect";
  189. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  190. import { getDept2 } from "@/api/grassrootsregistration/bdglmeeting";
  191. import {allUser} from "@/api/workingArrangements/workTask"
  192. export default {
  193. name: "BdglVisit",
  194. components: { Treeselect },
  195. computed:{
  196. },
  197. data() {
  198. return {
  199. // 遮罩层
  200. loading: true,
  201. // 导出遮罩层
  202. exportLoading: false,
  203. // 选中数组
  204. ids: [],
  205. // 非单个禁用
  206. single: true,
  207. // 非多个禁用
  208. multiple: true,
  209. // 显示搜索条件
  210. showSearch: true,
  211. // 总条数
  212. total: 0,
  213. // 人员来访登记表格数据
  214. bdglVisitList: [],
  215. // 弹出层标题
  216. title: "",
  217. // 是否显示弹出层
  218. open: false,
  219. // 查询参数
  220. queryParams: {
  221. pageNum: 1,
  222. pageSize: 10,
  223. unitId: null,
  224. peopleId: null,
  225. name: null,
  226. arriveTime: null,
  227. endTime: null,
  228. adminId: null,
  229. contents: null,
  230. createtime: null,
  231. updatetime: null,
  232. numberPlate: null,
  233. unitName: null,
  234. peopleName: null
  235. },
  236. // 表单参数
  237. form: {},
  238. // 表单校验
  239. rules: {
  240. unitId: [{ required: true, message: "到访单位不能为空", trigger: "blur" }],
  241. // peopleId: [{ required: true, message: "接待人不能为空", trigger: "blur" }],
  242. name: [{ required: true, message: "到访人员姓名不能为空", trigger: "blur" }],
  243. arriveTime: [{ required: true, message: "到访时间不能为空", trigger: "blur" }],
  244. endTime: [{ required: true, message: "离队时间不能为空", trigger: "blur" }],
  245. numberPlate: [{ required: true, message: "到访车牌号不能为空", trigger: "blur" }],
  246. },
  247. // 执行单位列表
  248. users: [],
  249. // 接待人
  250. executor:[],
  251. // 人员列表
  252. rylist:[]
  253. };
  254. },
  255. created() {
  256. this.getList();
  257. allUser().then((res) => {
  258. this.rylist = res.rows;
  259. });
  260. this.selectPeo1()
  261. },
  262. methods: {
  263. dateFormat(fmt, date) {
  264. let ret="";
  265. date=new Date(date);
  266. const opt = {
  267. 'Y+': date.getFullYear().toString(), // 年
  268. 'm+': (date.getMonth() + 1).toString(), // 月
  269. 'd+': date.getDate().toString(), // 日
  270. 'H+': date.getHours().toString(), // 时
  271. 'M+': date.getMinutes().toString(), // 分
  272. 'S+': date.getSeconds().toString() // 秒
  273. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  274. }
  275. for (let k in opt) {
  276. ret = new RegExp('(' + k + ')').exec(fmt)
  277. if (ret) {
  278. fmt = fmt.replace(
  279. ret[1],
  280. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  281. )
  282. }
  283. }
  284. return fmt
  285. },
  286. unit2Format(row, column) {
  287. console.log(row)
  288. var deptName = "";
  289. deptName=row.unitName
  290. // if(this.bdglVisitList[0].unitId==row.unitId){
  291. // deptName=row.unitName
  292. // }
  293. return deptName;
  294. },
  295. peopleIds(id){
  296. this.form.peopleId=id
  297. console.log(id)
  298. },
  299. // 获取执行人
  300. getZhuChi(id) {
  301. // console.log(id)
  302. deptUser(id).then((res) => {
  303. this.executor = res.data;
  304. // console.log(this.executor)
  305. // this.form.unitName=this.executor
  306. });
  307. },
  308. // 到访单位选中触发
  309. selectPeo(val) {
  310. console.log(val)
  311. this.form.unitId = val.id;
  312. this.form.peopleName=""
  313. this.form.unitName=val.label
  314. // console.log(this.form.unitId)
  315. this.getZhuChi(this.form.unitId);
  316. },
  317. // 到访单位选中触发
  318. selectPeo1(val) {
  319. // this.getDept2()
  320. // this.handleAdd()
  321. // 获取执行单位列表
  322. getDept2().then((res) => {
  323. // console.log(res,2)
  324. this.users = res.data;
  325. console.log(this.users);
  326. });
  327. this.queryParams.unitId = val.id;
  328. this.queryParams.peopleName=""
  329. this.queryParams.unitName=val.label
  330. console.log(this.queryParams)
  331. this.getZhuChi(this.queryParams.unitId);
  332. },
  333. /** 查询人员来访登记列表 */
  334. getList() {
  335. this.loading = true;
  336. listBdglVisit(this.queryParams).then(response => {
  337. // console.log(response)
  338. this.bdglVisitList = response.rows;
  339. console.log(this.bdglVisitList)
  340. this.total = response.total;
  341. this.loading = false;
  342. });
  343. },
  344. // 取消按钮
  345. cancel() {
  346. this.open = false;
  347. this.reset();
  348. },
  349. // 表单重置
  350. reset() {
  351. this.form = {
  352. id: null,
  353. unitId: null,
  354. peopleId: null,
  355. name: null,
  356. arriveTime: null,
  357. endTime: null,
  358. adminId: null,
  359. contents: null,
  360. createtime: null,
  361. updatetime: null,
  362. numberPlate: null,
  363. unitName: null,
  364. peopleName: null
  365. };
  366. this.resetForm("form");
  367. },
  368. /** 搜索按钮操作 */
  369. handleQuery() {
  370. console.log(this.queryParams)
  371. this.queryParams.pageNum = 1;
  372. this.getList();
  373. },
  374. /** 重置按钮操作 */
  375. resetQuery() {
  376. this.queryParams={}
  377. this.resetForm("queryForm");
  378. this.handleQuery();
  379. this.getList()
  380. },
  381. // 多选框选中数据
  382. handleSelectionChange(selection) {
  383. this.ids = selection.map(item => item.id)
  384. this.single = selection.length!==1
  385. this.multiple = !selection.length
  386. },
  387. /** 新增按钮操作 */
  388. handleAdd() {
  389. this.reset();
  390. this.open = true;
  391. this.title = "添加人员来访登记";
  392. // 获取执行单位列表
  393. getDept2().then((res) => {
  394. // console.log(res,2)
  395. this.users = res.data;
  396. console.log(this.users);
  397. });
  398. },
  399. /** 修改按钮操作 */
  400. handleUpdate(row) {
  401. this.reset();
  402. getDept2().then((res) => {
  403. // console.log(res)
  404. // console.log(res,2)
  405. this.users = res.data;
  406. console.log(this.users);
  407. });
  408. const id = row.id || this.ids
  409. // console.log(row)
  410. getBdglVisit(id).then(response => {
  411. console.log(response.data)
  412. this.form = response.data;
  413. this.open = true;
  414. this.title = "修改人员来访登记";
  415. });
  416. },
  417. /** 提交按钮 */
  418. submitForm() {
  419. console.log(this.form)
  420. this.$refs["form"].validate(valid => {
  421. if (valid) {
  422. if (this.form.id != null) {
  423. console.log(this.form)
  424. updateBdglVisit(this.form).then(response => {
  425. this.$modal.msgSuccess("修改成功");
  426. this.open = false;
  427. this.getList();
  428. });
  429. } else {
  430. addBdglVisit(this.form).then(response => {
  431. this.$modal.msgSuccess("新增成功");
  432. this.open = false;
  433. this.getList();
  434. });
  435. }
  436. }
  437. });
  438. },
  439. /** 删除按钮操作 */
  440. handleDelete(row) {
  441. const ids = row.id || this.ids;
  442. this.$modal.confirm('是否确认删除人员来访登记编号为"' + ids + '"的数据项?').then(function() {
  443. return delBdglVisit(ids);
  444. }).then(() => {
  445. this.getList();
  446. this.$modal.msgSuccess("删除成功");
  447. }).catch(() => {});
  448. },
  449. /** 导出按钮操作 */
  450. handleExport() {
  451. const queryParams = this.queryParams;
  452. this.$modal.confirm('是否确认导出所有人员来访登记数据项?').then(() => {
  453. this.exportLoading = true;
  454. return exportBdglVisit(queryParams);
  455. }).then(response => {
  456. this.$download.name(response.msg);
  457. this.exportLoading = false;
  458. }).catch(() => {});
  459. }
  460. }
  461. };
  462. </script>
  463. <style scoped>
  464. ::v-deep .el-dialog{
  465. background-color: #004d86 !important;
  466. }
  467. /* 输入框 */
  468. ::v-deep .el-dialog .el-input__inner{
  469. background-color: #004D86 !important;
  470. width: 220px;
  471. color: white;
  472. }
  473. /* 标题弹框 */
  474. ::v-deep .el-dialog__title{
  475. color: white;
  476. /* border-bottom: 1px solid white; */
  477. }
  478. /* 标题下划线 */
  479. ::v-deep .el-dialog__header{
  480. border-bottom: 1px solid white;
  481. }
  482. ::v-deep .el-form-item__content{
  483. width: 220px;
  484. }
  485. ::v-deep .el-form-item__label{
  486. text-align: start;
  487. }
  488. ::v-deep .jiedai .el-form-item__label{
  489. padding-left: 10px;
  490. }
  491. /* ::v-deep .el-form-item{
  492. width: 200px;
  493. } */
  494. /* ::v-deep .jiedainame .el-form-item__label{
  495. width: 90px !important;
  496. }
  497. ::v-deep .el-input--small .el-input__inner{
  498. width: 230px;
  499. } */
  500. ::v-deep .el-textarea .el-textarea__inner{
  501. /* text-align: center; */
  502. width: 1010px;
  503. height: auto !important;
  504. min-height: 130px !important;
  505. }
  506. /* 到访单位 */
  507. ::v-deep .el-form-item__content .el-input--small .el-input__inner{
  508. width: 220px;
  509. }
  510. /* 表格头部 */
  511. v-deep .el-table thead tr{
  512. background-color: #004d86 !important;
  513. }
  514. /* 树形 */
  515. .threeselects {
  516. width: 200px;
  517. }
  518. .threeselects .vue-treeselect__input {
  519. background-color: #004d86;
  520. /* color: white; */
  521. }
  522. ::v-deep .search .el-form-item__content{
  523. margin-top: 0px;
  524. }
  525. ::v-deep .el-picker-panel__body{
  526. background-color: #004d86 !important;
  527. }
  528. ::v-deep .vue-treeselect__control{
  529. background-color: transparent;
  530. color: white;
  531. }
  532. ::v-deep .vue-treeselect__single-value{
  533. color: white;
  534. }
  535. ::v-deep .threeselects{
  536. width: 220px;
  537. }
  538. /* #execute{
  539. background: white !important;
  540. /* color: white !important; */
  541. /* } */
  542. .el-scrollbar__view {
  543. background: white !important;
  544. }
  545. /* 修改按钮btu */
  546. .el-button--btus {
  547. width: 60px !important;
  548. border: 1px solid transparent;
  549. padding: 3px 8px;
  550. font-size: 14px;
  551. line-height: 1.5;
  552. border-radius: 3px;
  553. color: #fff;
  554. background-color: #13ce66;
  555. }
  556. /* 删除按钮btu */
  557. .el-button--btds {
  558. width: 60px !important;
  559. border: 1px solid transparent;
  560. padding: 3px 8px;
  561. font-size: 14px;
  562. line-height: 1.5;
  563. border-radius: 3px;
  564. color: #fff;
  565. background-color: #ff4949;
  566. }
  567. ::v-deep .el-time-spinner__list .el-scrollbar li{
  568. color: white !important;
  569. }
  570. ::v-deep .el-select--medium{
  571. background-color: white !important;;
  572. }
  573. ::v-deep .el-table .el-table__header-wrapper th, .el-table .el-table__fixed-header-wrapper th {
  574. background-color:rgb(0, 60, 105);
  575. color: white;
  576. }
  577. ::v-deep .daofang .el-input__inner{
  578. width: 230px;
  579. height: 38px;
  580. background: transparent;
  581. line-height: 38px;
  582. color: white;
  583. }
  584. /* 文字多余部分省略 */
  585. ::v-deep .el-table__cell .cell {
  586. overflow: hidden;
  587. text-overflow: ellipsis;
  588. white-space: nowrap;
  589. }
  590. .el-button--btr1 {
  591. /* border-color: #20B2AA; */
  592. color: #FFFFFF;
  593. width: 76px;
  594. height: 36px;
  595. background-color: #1d96ff;
  596. border-radius: 4px;
  597. font-size: 14px;
  598. text-align: center;
  599. /* line-height: 36px; */
  600. /* margin-top: 1px; */
  601. padding-top: 11px !important;
  602. }
  603. .el-button--btr2 {
  604. /* border-color: #20B2AA; */
  605. color: #FFFFFF;
  606. width: 76px;
  607. height: 36px;
  608. background-color: #1d96ff;
  609. border-radius: 4px;
  610. font-size: 14px;
  611. text-align: center;
  612. /* margin-top: 1px; */
  613. /* padding-top: 12px; */
  614. padding-top: 12px !important;
  615. }
  616. ::v-deep .el-picker-panel__link-btn span{
  617. display: none !important;
  618. }
  619. ::v-deep .el-select--medium{
  620. border-radius: 5px;
  621. }
  622. ::v-deep .el-date-editor .el-input__inner{
  623. height: 36px;
  624. }
  625. ::v-deep .el-date-picker__editor-wrap .el-input__inner{
  626. width: 30px;
  627. }
  628. </style>