index.vue 19 KB

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