index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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="68px"
  9. >
  10. <el-form-item label="" prop="unitId">
  11. <el-select
  12. v-model="queryParams.unitId"
  13. placeholder="请选择单位"
  14. @change="host"
  15. >
  16. <el-option
  17. v-for="(item, i) in deptOptionss"
  18. :key="i"
  19. :label="item.deptName"
  20. :value="item.deptId"
  21. >
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button size="btr" @click="resetQuery" icon="el-icon-refresh"
  27. >重置</el-button
  28. >
  29. </el-form-item>
  30. </el-form>
  31. <el-row :gutter="10" class="mb8">
  32. <el-col :span="1.5">
  33. <el-button
  34. type="primary"
  35. plain
  36. icon="el-icon-plus"
  37. size="mini"
  38. @click="handleAdd"
  39. v-hasPermi="['grassrootsregistration:bdglpublicproperty:add']"
  40. >新增</el-button
  41. >
  42. </el-col>
  43. <!-- <el-col :span="1.5">
  44. <el-button
  45. type="success"
  46. plain
  47. icon="el-icon-edit"
  48. size="mini"
  49. :disabled="single"
  50. @click="handleUpdate"
  51. v-hasPermi="['grassrootsregistration:bdglpublicproperty:edit']"
  52. >修改</el-button
  53. >
  54. </el-col>
  55. <el-col :span="1.5">
  56. <el-button
  57. type="danger"
  58. plain
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['grassrootsregistration:bdglpublicproperty:remove']"
  64. >删除</el-button
  65. >
  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="['grassrootsregistration:bdglpublicproperty:export']"
  76. >导出</el-button
  77. >
  78. </el-col> -->
  79. </el-row>
  80. <el-table
  81. v-loading="loading"
  82. :data="bdglpublicpropertyList"
  83. @selection-change="handleSelectionChange"
  84. :header-cell-style="{ background: '#003C69', color: 'white' }"
  85. style="width: 100%"
  86. >
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column label="序号" align="center" prop="id" />
  89. <el-table-column label="单位" align="center" prop="unitName" />
  90. <el-table-column label="名称" align="center" prop="name" />
  91. <el-table-column label="规格型号" align="center" prop="version" />
  92. <el-table-column label="数量" align="center" prop="quantity" />
  93. <el-table-column label="单价" align="center" prop="price" />
  94. <el-table-column label="总价" align="center" prop="totalPrice" />
  95. <el-table-column
  96. label="装备时间"
  97. align="center"
  98. prop="equipTime"
  99. width="180"
  100. >
  101. <template slot-scope="scope">
  102. <span>{{ parseTime(scope.row.equipTime, "{y}-{m}-{d}") }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="保管人" align="center" prop="peopleName" />
  106. <el-table-column label="取得方式" align="center" prop="acquire" />
  107. <el-table-column label="质量状况" align="center" prop="quality" />
  108. <el-table-column label="放置地点" align="center" prop="address" />
  109. <el-table-column
  110. label="操作"
  111. align="center"
  112. class-name="small-padding fixed-width"
  113. width="200"
  114. >
  115. <template slot-scope="scope">
  116. <el-button
  117. size="btk"
  118. type="text"
  119. @click="handleChakan(scope.row)"
  120. v-hasPermi="['grassrootsregistration:bdgldiary:edit']"
  121. ><span class="chakan">查看</span></el-button
  122. >
  123. <el-button
  124. size="btu"
  125. type="text"
  126. @click="handleUpdate(scope.row)"
  127. v-hasPermi="['grassrootsregistration:bdglpublicproperty:edit']"
  128. ><span class="edit">修改</span></el-button
  129. >
  130. <el-button
  131. size="btd"
  132. type="text"
  133. @click="handleDelete(scope.row)"
  134. v-hasPermi="['grassrootsregistration:bdglpublicproperty:remove']"
  135. ><span class="delete">删除</span></el-button
  136. >
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <pagination
  141. v-show="total > 0"
  142. :total="total"
  143. :page.sync="queryParams.pageNum"
  144. :limit.sync="queryParams.pageSize"
  145. @pagination="getList"
  146. />
  147. <!-- 添加或修改营产,公物管理登记簿对话框 -->
  148. <el-dialog
  149. :title="title"
  150. :visible.sync="open"
  151. width="1016px"
  152. append-to-body
  153. >
  154. <el-form
  155. ref="form"
  156. :model="form"
  157. :rules="rules"
  158. label-width="80px"
  159. :inline="true"
  160. >
  161. <div class="jiben">基本信息</div>
  162. <el-form-item label="单位" prop="unitId">
  163. <treeselect
  164. v-model="form.unitId"
  165. :options="deptOptions"
  166. placeholder="选择单位"
  167. @select="selectPeo"
  168. />
  169. </el-form-item>
  170. <el-form-item label="名称" prop="name">
  171. <el-input v-model="form.name" placeholder="请输入名称" />
  172. </el-form-item>
  173. <el-form-item label="规格型号" prop="version">
  174. <el-input v-model="form.version" placeholder="请输入规格型号" />
  175. </el-form-item>
  176. <el-form-item label="数量" prop="quantity">
  177. <el-input
  178. v-model="form.quantity"
  179. controls-position="right"
  180. oninput="value=value.replace(/[^\d]/g,'')"
  181. @blur="shuLiang"
  182. ></el-input>
  183. </el-form-item>
  184. <el-form-item label="单价" prop="price">
  185. <el-input
  186. v-model="form.price"
  187. controls-position="right"
  188. oninput="value=value.replace(/[^\d]/g,'')"
  189. @blur="danJia"
  190. ></el-input>
  191. </el-form-item>
  192. <el-form-item label="总价" prop="totalPrice">
  193. <el-input
  194. v-model="form.totalPrice"
  195. controls-position="right"
  196. readonly
  197. ></el-input>
  198. </el-form-item>
  199. <el-form-item label="装备时间" prop="equipTime">
  200. <el-date-picker
  201. clearable
  202. size="small"
  203. v-model="form.equipTime"
  204. type="date"
  205. :editable="false"
  206. value-format="yyyy-MM-dd"
  207. placeholder="选择装备时间"
  208. >
  209. </el-date-picker>
  210. </el-form-item>
  211. <el-form-item label="保管人" prop="peopleId">
  212. <el-select v-model="form.peopleId" placeholder="请选择保管人">
  213. <el-option
  214. v-for="item in roleOptions"
  215. :key="item.id"
  216. :label="item.name"
  217. :value="item.id"
  218. :disabled="item.status == 1"
  219. @click.native="baoGuan(item.name)"
  220. ></el-option>
  221. </el-select>
  222. </el-form-item>
  223. <el-form-item label="取得方式" prop="acquire">
  224. <el-input v-model="form.acquire" placeholder="请输入取得方式" />
  225. </el-form-item>
  226. <el-form-item label="质量状况" prop="quality">
  227. <el-input v-model="form.quality" placeholder="请输入质量状况" />
  228. </el-form-item>
  229. <el-form-item label="放置地点" prop="address">
  230. <el-input v-model="form.address" placeholder="请输入放置地点" />
  231. </el-form-item>
  232. <div class="jiben">备注</div>
  233. <div class="box4">
  234. <el-input
  235. type="textarea"
  236. :rows="3"
  237. placeholder="请输入内容"
  238. v-model="form.remark"
  239. autosize
  240. >
  241. </el-input>
  242. </div>
  243. </el-form>
  244. <div slot="footer" class="dialog-footer">
  245. <el-button @click="resertwo">重置</el-button>
  246. <el-button type="primary" @click="submitForm(1)">确 定</el-button>
  247. </div>
  248. </el-dialog>
  249. <el-dialog
  250. :visible.sync="menuRoleVisible"
  251. :title="title"
  252. append-to-body
  253. id="chakan"
  254. >
  255. <bdglpublicproperty
  256. v-if="menuRoleVisible"
  257. ref="menuRole"
  258. :message="wordInfo"
  259. ></bdglpublicproperty>
  260. </el-dialog>
  261. </div>
  262. </template>
  263. <script>
  264. import bdglpublicproperty from "@/components/look_word/bdglpublicproperty.vue";
  265. import {
  266. listBdglpublicproperty,
  267. getBdglpublicproperty,
  268. delBdglpublicproperty,
  269. addBdglpublicproperty,
  270. updateBdglpublicproperty,
  271. exportBdglpublicproperty,
  272. } from "@/api/grassrootsregistration/bdglpublicproperty";
  273. import { getZhuChiRen } from "@/api/grassrootsregistration/bdglmeeting";
  274. // 导入树形结构
  275. import Treeselect from "@riophae/vue-treeselect";
  276. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  277. import { getDept } from "@/api/grassrootsregistration/bdgleven";
  278. export default {
  279. name: "Bdglpublicproperty",
  280. components: {
  281. Treeselect,
  282. bdglpublicproperty,
  283. },
  284. data() {
  285. return {
  286. //查看页面
  287. menuRoleVisible: false,
  288. wordInfo: {},
  289. //判断关闭
  290. style: "2",
  291. // 遮罩层
  292. loading: true,
  293. // 导出遮罩层
  294. exportLoading: false,
  295. // 选中数组
  296. ids: [],
  297. // 非单个禁用
  298. single: true,
  299. // 非多个禁用
  300. multiple: true,
  301. // 显示搜索条件
  302. showSearch: true,
  303. // 总条数
  304. total: 0,
  305. // 营产,公物管理登记簿表格数据
  306. bdglpublicpropertyList: [],
  307. // 弹出层标题
  308. title: "",
  309. // 是否显示弹出层
  310. open: false,
  311. // 查询参数
  312. queryParams: {
  313. pageNum: 1,
  314. pageSize: 10,
  315. name: null,
  316. version: null,
  317. quantity: null,
  318. price: null,
  319. totalPrice: null,
  320. equipTime: null,
  321. peopleId: null,
  322. acquire: null,
  323. quality: null,
  324. address: null,
  325. unitId: null,
  326. createtime: null,
  327. updatetime: null,
  328. },
  329. // 表单参数
  330. form: {},
  331. // 表单校验
  332. rules: {
  333. unitId: [
  334. { required: true, message: "单位名称不能为空", trigger: "blur" },
  335. ],
  336. equipTime: [
  337. { required: true, message: "装备时间不能为空", trigger: "blur" },
  338. ],
  339. },
  340. //下拉
  341. options: [],
  342. // 获取单位树形
  343. deptOptions: [],
  344. // 人员的列表
  345. roleOptions: [],
  346. // 获取单位列表
  347. deptOptionss: [],
  348. };
  349. },
  350. created() {
  351. this.getList();
  352. this.getdept();
  353. },
  354. methods: {
  355. // 数量输入完毕失去焦点触发
  356. shuLiang() {
  357. if (this.form.price !== null && this.form.quantity !== null) {
  358. this.form.totalPrice = this.form.price * this.form.quantity;
  359. }
  360. },
  361. // 单价失去焦点触发
  362. danJia() {
  363. if (this.form.price !== null && this.form.quantity !== null) {
  364. this.form.totalPrice = this.form.price * this.form.quantity;
  365. }
  366. },
  367. // 搜索单位触发
  368. host() {
  369. this.getList();
  370. },
  371. // //获取部门列表
  372. getdept() {
  373. getDept().then((response) => {
  374. this.deptOptionss = response.data;
  375. });
  376. },
  377. // 选中保管人触发
  378. baoGuan(name) {
  379. this.form.peopleName = name;
  380. },
  381. // 重置表单人员
  382. ChongZhiRen() {
  383. this.form.peopleId = null;
  384. },
  385. // 单位选择触发
  386. selectPeo(val) {
  387. this.ChongZhiRen();
  388. this.form.unitId = val.id;
  389. this.getZhuChi(this.form.unitId);
  390. },
  391. // 获取人员
  392. getZhuChi(id) {
  393. getZhuChiRen(id).then((res) => {
  394. this.roleOptions = res.data;
  395. });
  396. },
  397. /** 查询部门下拉树结构 */
  398. getTreeselect() {
  399. getDept().then((response) => {
  400. this.deptOptions = response.data;
  401. });
  402. },
  403. /** 查询营产,公物管理登记簿列表 */
  404. getList() {
  405. this.loading = true;
  406. listBdglpublicproperty(this.queryParams).then((response) => {
  407. this.bdglpublicpropertyList = response.rows;
  408. this.total = response.total;
  409. this.loading = false;
  410. });
  411. },
  412. // 取消按钮
  413. cancel() {
  414. this.open = false;
  415. this.reset();
  416. },
  417. // 表单重置
  418. reset() {
  419. this.form = {
  420. id: null,
  421. name: null,
  422. version: null,
  423. quantity: null,
  424. price: null,
  425. totalPrice: null,
  426. equipTime: null,
  427. peopleId: null,
  428. acquire: null,
  429. quality: null,
  430. address: null,
  431. remark: null,
  432. unitId: null,
  433. createtime: null,
  434. updatetime: null,
  435. };
  436. this.resetForm("form");
  437. },
  438. /** 搜索按钮操作 */
  439. handleQuery() {
  440. this.queryParams.pageNum = 1;
  441. this.getList();
  442. },
  443. /** 重置按钮操作 */
  444. resetQuery() {
  445. this.resetForm("queryForm");
  446. this.handleQuery();
  447. },
  448. /** 对话框重置按钮操作 */
  449. resertwo() {
  450. this.reset();
  451. },
  452. // 多选框选中数据
  453. handleSelectionChange(selection) {
  454. this.ids = selection.map((item) => item.id);
  455. this.single = selection.length !== 1;
  456. this.multiple = !selection.length;
  457. },
  458. /** 新增按钮操作 */
  459. handleAdd() {
  460. // 人员的列表
  461. (this.roleOptions = []), this.getTreeselect();
  462. this.reset();
  463. this.open = true;
  464. this.style = 2;
  465. this.title = "添加营产,公物管理登记簿";
  466. },
  467. /** 修改按钮操作 */
  468. handleUpdate(row) {
  469. this.getTreeselect();
  470. this.reset();
  471. this.form.unitId = row.unitId;
  472. this.getZhuChi(this.form.unitId);
  473. const id = row.id || this.ids;
  474. getBdglpublicproperty(id).then((response) => {
  475. this.form = response.data;
  476. this.open = true;
  477. this.title = "修改营产,公物管理登记簿";
  478. });
  479. },
  480. //查看按钮操作
  481. handleChakan(row) {
  482. // 是否隐藏按钮
  483. this.opens = false;
  484. const id = row.id || this.ids;
  485. getBdglpublicproperty(id).then((response) => {
  486. this.wordInfo = response.data;
  487. this.title = "查看营产/公物管理登记簿";
  488. this.menuRoleVisible = true;
  489. });
  490. },
  491. /** 提交按钮 */
  492. submitForm(style) {
  493. this.style = style;
  494. this.$refs["form"].validate((valid) => {
  495. if (valid) {
  496. if (this.form.id != null) {
  497. updateBdglpublicproperty(this.form).then((response) => {
  498. this.$modal.msgSuccess("修改成功");
  499. this.open = false;
  500. this.getList();
  501. });
  502. } else {
  503. addBdglpublicproperty(this.form).then((response) => {
  504. this.$modal.msgSuccess("新增成功");
  505. this.open = false;
  506. this.getList();
  507. });
  508. }
  509. }
  510. });
  511. },
  512. /** 删除按钮操作 */
  513. handleDelete(row) {
  514. const ids = row.id || this.ids;
  515. this.$modal
  516. // .confirm(
  517. // '是否确认删除营产,公物管理登记簿编号为"' + ids + '"的数据项?'
  518. // )
  519. .confirm('是否确认删除该数据?')
  520. .then(function () {
  521. return delBdglpublicproperty(ids);
  522. })
  523. .then(() => {
  524. this.getList();
  525. this.$modal.msgSuccess("删除成功");
  526. })
  527. .catch(() => {});
  528. },
  529. /** 导出按钮操作 */
  530. handleExport() {
  531. const queryParams = this.queryParams;
  532. this.$modal
  533. .confirm("是否确认导出所有营产,公物管理登记簿数据项?")
  534. .then(() => {
  535. this.exportLoading = true;
  536. return exportBdglpublicproperty(queryParams);
  537. })
  538. .then((response) => {
  539. this.$download.name(response.msg);
  540. this.exportLoading = false;
  541. })
  542. .catch(() => {});
  543. },
  544. },
  545. };
  546. </script>
  547. <style scoped>
  548. /* 对话框背景颜色 */
  549. ::v-deep .el-dialog {
  550. background: #004d86 !important;
  551. }
  552. ::v-deep .el-textarea__inner {
  553. width: 920px;
  554. height: 104px;
  555. }
  556. ::v-deep .el-dialog__header {
  557. border-bottom: 1px solid #718a9d;
  558. }
  559. ::v-deep .el-dialog__title {
  560. color: #fff;
  561. font: 18px;
  562. }
  563. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  564. color: #fff;
  565. }
  566. ::v-deep .el-form-item__label {
  567. font: 16px;
  568. color: #fff;
  569. width: 100px !important;
  570. }
  571. ::v-deep .el-input__inner {
  572. /* width: 200px !important;
  573. height: 36px; */
  574. background: transparent;
  575. color: #fff;
  576. border: 1px solid white !important;
  577. }
  578. /* 单位框背景颜色 */
  579. ::v-deep .vue-treeselect__control {
  580. background: #004d86 !important;
  581. }
  582. /* 基本信息背景 */
  583. .jiben {
  584. width: 920px;
  585. height: 32px;
  586. background-image: url(../../../images/小标题底.png);
  587. margin-bottom: 25px;
  588. color: #fff;
  589. padding-left: 16px;
  590. line-height: 32px;
  591. }
  592. /*调整表单间距 */
  593. ::v-deep .el-form-item__content {
  594. width: 200px;
  595. }
  596. ::v-deep .el-input__inner {
  597. cursor: pointer !important;
  598. }
  599. /* 底部确定取消按钮 */
  600. ::v-deep .el-dialog__footer {
  601. padding: 30px 50px;
  602. }
  603. ::v-deep .el-dialog__body {
  604. margin: 10px 30px 20px 50px;
  605. padding-top: 20px !important;
  606. box-sizing: border-box;
  607. /* padding: 30px 12px 30px 28px; */
  608. }
  609. .contents {
  610. padding: 0px 40px !important;
  611. }
  612. /* 下拉菜单 */
  613. .el-dropdown-link {
  614. cursor: pointer;
  615. color: #409eff;
  616. }
  617. .el-icon-arrow-down {
  618. font-size: 12px;
  619. }
  620. /* 刷新图标 */
  621. /* .el-icon-refresh {
  622. width: 76px;
  623. height: 36px;
  624. color: #fff;
  625. background-color: #1d96ff !important;
  626. border-radius: 4px;
  627. border: none;
  628. margin-left: 20px;
  629. font-size: 14px;
  630. } */
  631. /* 下拉菜单字体/背景颜色 */
  632. .el-select-dropdown__item.hover,
  633. .el-select-dropdown__item:hover {
  634. background-color: #004d86;
  635. color: #fff;
  636. }
  637. .el-select-dropdown__item {
  638. color: #fff;
  639. }
  640. /* 时间选择 */
  641. ::v-deep .el-input--small .el-input__inner {
  642. width: 200px;
  643. height: 36px;
  644. line-height: 36px;
  645. }
  646. .el-date-editor.el-input {
  647. width: 200px;
  648. height: 36px;
  649. line-height: 36px;
  650. }
  651. ::v-deep .el-date-editor.el-input .el-input__inner {
  652. height: 36px;
  653. line-height: 36px;
  654. }
  655. /* 单位框背景颜色 */
  656. ::v-deep .vue-treeselect__control {
  657. background: #004d86 !important;
  658. color: #fff;
  659. }
  660. /* 单位下拉菜单选中字体颜色 */
  661. ::v-deep .vue-treeselect__single-value {
  662. color: #fff !important;
  663. }
  664. /* 分页按钮 */
  665. ::v-deep .el-pagination.is-background .el-pager li {
  666. background-color: #004d86;
  667. color: #fff;
  668. }
  669. ::v-deep .el-pagination.is-background .btn-next {
  670. background-color: #004d86;
  671. color: #fff;
  672. }
  673. /* 计数器按钮 */
  674. ::v-deep .el-input-number__increase {
  675. background-color: transparent !important;
  676. border: none;
  677. color: #cccccc;
  678. border-bottom: none !important;
  679. }
  680. ::v-deep .el-input-number__decrease {
  681. background-color: transparent !important;
  682. border: none !important;
  683. color: #cccccc;
  684. }
  685. /* 底部确定取消按钮 */
  686. ::v-deep .el-dialog__footer {
  687. padding: 18px 42px 30px 0px;
  688. margin-right: 30px;
  689. }
  690. /* 增加按钮弹框 */
  691. ::v-deep .el-dialog {
  692. width: 1060px !important;
  693. }
  694. ::v-deep .el-dialog__body {
  695. padding: none !important;
  696. }
  697. /* ::v-deep .el-table--enable-row-transition .el-table__body td.el-table__cell{
  698. background: #004d86;
  699. } */
  700. ::v-deep .box4 .el-textarea__inner {
  701. min-height: 120px !important;
  702. }
  703. /* 调整输入框提示文字颜色 */
  704. ::v-deep .vue-treeselect__placeholder {
  705. color: #bdbdbd4f !important;
  706. }
  707. ::v-deep input::-webkit-input-placeholder {
  708. color: #bdbdbd4f !important;
  709. }
  710. ::v-deep input:-moz-placeholder {
  711. color: #bdbdbd4f !important;
  712. }
  713. </style>