index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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 prop="name">
  11. <el-input
  12. v-model="queryParams.name"
  13. placeholder="请输入物品名称"
  14. clearable
  15. size="small"
  16. @input="handleQuery"
  17. />
  18. </el-form-item>
  19. <!-- <el-form-item label="物品类型" prop="wuPinType">
  20. <el-select v-model="queryParams.wuPinType" placeholder="请选择物品类型" clearable size="small">
  21. <el-option
  22. v-for="dict in dict.type.category"
  23. :key="dict.value"
  24. :label="dict.label"
  25. :value="dict.value"
  26. />
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="物品名称" prop="name">
  30. <el-input
  31. v-model="queryParams.name"
  32. placeholder="请输入物品名称"
  33. clearable
  34. size="small"
  35. @keyup.enter.native="handleQuery"
  36. />
  37. </el-form-item>
  38. <el-form-item label="物资规格" prop="materialSpecification">
  39. <el-input
  40. v-model="queryParams.materialSpecification"
  41. placeholder="请输入物资规格"
  42. clearable
  43. size="small"
  44. @keyup.enter.native="handleQuery"
  45. />
  46. </el-form-item>
  47. <el-form-item label="物资型号" prop="materialXh">
  48. <el-input
  49. v-model="queryParams.materialXh"
  50. placeholder="请输入物资型号"
  51. clearable
  52. size="small"
  53. @keyup.enter.native="handleQuery"
  54. />
  55. </el-form-item>
  56. <el-form-item label="营具类型" prop="yingJuType">
  57. <el-select v-model="queryParams.yingJuType" placeholder="请选择营具类型" clearable size="small">
  58. <el-option
  59. v-for="dict in dict.type.camp_equipment"
  60. :key="dict.value"
  61. :label="dict.label"
  62. :value="dict.value"
  63. />
  64. </el-select>
  65. </el-form-item> -->
  66. <!-- <el-form-item label="" prop="responsibilityUnit">
  67. <el-select
  68. v-model="queryParams.responsibilityUnit"
  69. placeholder="请选择责任单位"
  70. clearable
  71. size="small"
  72. >
  73. </el-select>
  74. </el-form-item> -->
  75. <!-- <el-form-item label="" prop="personLiable">
  76. <el-select
  77. v-model="queryParams.personLiable"
  78. placeholder="请选择责任人"
  79. clearable
  80. size="small"
  81. @change="handleQuery"
  82. >
  83. <el-option
  84. v-for="item in renYuans"
  85. :key="item.id"
  86. :label="item.name"
  87. :value="item.name"
  88. class="input_xiala"
  89. >
  90. </el-option>
  91. </el-select>
  92. </el-form-item> -->
  93. <!-- <el-form-item label="总数量" prop="materialTotal">
  94. <el-input
  95. v-model="queryParams.materialTotal"
  96. placeholder="请输入总数量"
  97. clearable
  98. size="small"
  99. @keyup.enter.native="handleQuery"
  100. />
  101. </el-form-item>
  102. <el-form-item label="库存数量" prop="materialInventory">
  103. <el-input
  104. v-model="queryParams.materialInventory"
  105. placeholder="请输入库存数量"
  106. clearable
  107. size="small"
  108. @keyup.enter.native="handleQuery"
  109. />
  110. </el-form-item>
  111. <el-form-item label="在用数量" prop="inUseTotal">
  112. <el-input
  113. v-model="queryParams.inUseTotal"
  114. placeholder="请输入在用数量"
  115. clearable
  116. size="small"
  117. @keyup.enter.native="handleQuery"
  118. />
  119. </el-form-item>
  120. <el-form-item label="创建人" prop="createName">
  121. <el-input
  122. v-model="queryParams.createName"
  123. placeholder="请输入创建人"
  124. clearable
  125. size="small"
  126. @keyup.enter.native="handleQuery"
  127. />
  128. </el-form-item>
  129. <el-form-item label="库房" prop="warehouse">
  130. <el-input
  131. v-model="queryParams.warehouse"
  132. placeholder="请输入库房"
  133. clearable
  134. size="small"
  135. @keyup.enter.native="handleQuery"
  136. />
  137. </el-form-item>
  138. <el-form-item label="单位id" prop="unitId">
  139. <el-input
  140. v-model="queryParams.unitId"
  141. placeholder="请输入单位id"
  142. clearable
  143. size="small"
  144. @keyup.enter.native="handleQuery"
  145. />
  146. </el-form-item>
  147. <el-form-item label="责任人id" prop="personLiableId">
  148. <el-input
  149. v-model="queryParams.personLiableId"
  150. placeholder="请输入责任人id"
  151. clearable
  152. size="small"
  153. @keyup.enter.native="handleQuery"
  154. />
  155. </el-form-item> -->
  156. <el-form-item>
  157. <!-- <el-button type="primary" size="btn" @click="handleQuery"
  158. >搜索</el-button
  159. > -->
  160. <el-button size="btr" @click="resetQuery">重置</el-button>
  161. </el-form-item>
  162. </el-form>
  163. <el-row :gutter="10" class="mb8">
  164. <el-col :span="1.5">
  165. <el-button
  166. type="primary"
  167. plain
  168. icon="el-icon-plus"
  169. size="mini"
  170. @click="handleAdd"
  171. v-hasPermi="['materialManagement:archives:add']"
  172. >新增</el-button
  173. >
  174. </el-col>
  175. <el-col :span="1.5">
  176. <el-button
  177. type="success"
  178. plain
  179. icon="el-icon-edit"
  180. size="mini"
  181. :disabled="single"
  182. @click="handleUpdate"
  183. v-hasPermi="['materialManagement:archives:edit']"
  184. >修改</el-button
  185. >
  186. </el-col>
  187. <el-col :span="1.5">
  188. <el-button
  189. type="danger"
  190. plain
  191. icon="el-icon-delete"
  192. size="mini"
  193. :disabled="multiple"
  194. @click="handleDelete"
  195. v-hasPermi="['materialManagement:archives:remove']"
  196. >删除</el-button
  197. >
  198. </el-col>
  199. <!-- <el-col :span="1.5">
  200. <el-button
  201. type="warning"
  202. plain
  203. icon="el-icon-download"
  204. size="mini"
  205. :loading="exportLoading"
  206. @click="handleExport"
  207. v-hasPermi="['materialManagement:archives:export']"
  208. >导出</el-button
  209. >
  210. </el-col> -->
  211. <!-- <right-toolbar
  212. :showSearch.sync="showSearch"
  213. @queryTable="getList"
  214. ></right-toolbar> -->
  215. </el-row>
  216. <el-table
  217. v-loading="loading"
  218. :data="archivesList"
  219. @selection-change="handleSelectionChange"
  220. :header-cell-style="{ background: '#003C69', color: 'white' }"
  221. >
  222. <el-table-column type="selection" width="55" align="center" />
  223. <el-table-column label="序号" align="center" prop="id" />
  224. <el-table-column label="物品类型" align="center" prop="wuPinType">
  225. <!-- <template slot-scope="scope">
  226. <dict-tag
  227. :options="dict.type.category"
  228. :value="scope.row.wuPinType"
  229. />
  230. </template> -->
  231. </el-table-column>
  232. <el-table-column label="物品名称" align="center" prop="name" />
  233. <el-table-column
  234. label="物品规格"
  235. align="center"
  236. prop="materialSpecification"
  237. />
  238. <el-table-column label="物品型号" align="center" prop="materialXh" />
  239. <el-table-column label="营具类型" align="center" prop="yingJuType">
  240. <!-- <template slot-scope="scope">
  241. <dict-tag
  242. :options="dict.type.camp_equipment"
  243. :value="scope.row.yingJuType"
  244. />
  245. </template> -->
  246. </el-table-column>
  247. <el-table-column
  248. label="责任单位"
  249. align="center"
  250. prop="responsibilityUnit"
  251. />
  252. <el-table-column label="责任人" align="center" prop="personLiable" />
  253. <el-table-column label="总数量" align="center" prop="materialTotal" />
  254. <el-table-column
  255. label="库存数量"
  256. align="center"
  257. prop="materialInventory"
  258. />
  259. <el-table-column label="在用数量" align="center" prop="inUseTotal" />
  260. <el-table-column
  261. label="操作"
  262. align="center"
  263. class-name="small-padding fixed-width"
  264. >
  265. <template slot-scope="scope">
  266. <el-button
  267. size="btu"
  268. type="text"
  269. @click="handleUpdate(scope.row)"
  270. v-hasPermi="['materialManagement:archives:edit']"
  271. >修改</el-button
  272. >
  273. <el-button
  274. size="btd"
  275. type="text"
  276. @click="handleDelete(scope.row)"
  277. v-hasPermi="['materialManagement:archives:remove']"
  278. >删除</el-button
  279. >
  280. </template>
  281. </el-table-column>
  282. </el-table>
  283. <pagination
  284. v-show="total > 0"
  285. :total="total"
  286. :page.sync="queryParams.pageNum"
  287. :limit.sync="queryParams.pageSize"
  288. @pagination="getList"
  289. />
  290. <!-- 添加或修改物资档案对话框 -->
  291. <el-dialog
  292. :title="title"
  293. :visible.sync="open"
  294. width="500px"
  295. append-to-body
  296. :close-on-click-modal="false"
  297. >
  298. <el-form
  299. ref="form"
  300. :model="form"
  301. :rules="rules"
  302. label-width="80px"
  303. :inline="true"
  304. >
  305. <el-form-item label="物品名称" prop="name">
  306. <el-input v-model="form.name" placeholder="请输入物品名称" />
  307. </el-form-item>
  308. <el-form-item label="类别" prop="wuPinType">
  309. <el-select v-model="form.wuPinType" placeholder="请选择类别">
  310. <el-option
  311. v-for="dict in dict.type.category"
  312. :key="dict.value"
  313. :label="dict.label"
  314. :value="dict.label"
  315. ></el-option>
  316. </el-select>
  317. </el-form-item>
  318. <el-form-item label="营具规格" prop="materialSpecification">
  319. <el-input
  320. v-model="form.materialSpecification"
  321. placeholder="请输入营具规格"
  322. />
  323. </el-form-item>
  324. <el-form-item label="营具型号" prop="materialXh">
  325. <el-input v-model="form.materialXh" placeholder="请输入营具型号" />
  326. </el-form-item>
  327. <el-form-item label="物品类型" prop="yingJuType">
  328. <el-select v-model="form.yingJuType" placeholder="请选择物品类型">
  329. <el-option
  330. v-for="dict in dict.type.camp_equipment"
  331. :key="dict.value"
  332. :label="dict.label"
  333. :value="dict.label"
  334. ></el-option>
  335. </el-select>
  336. </el-form-item>
  337. <el-form-item label="责任单位" prop="unitId">
  338. <treeselect
  339. v-model="form.unitId"
  340. placeholder="请选择责任单位"
  341. :options="deptOptions"
  342. @select="shuxing"
  343. ></treeselect>
  344. </el-form-item>
  345. <el-form-item label="责任人" prop="personLiableId">
  346. <el-select v-model="form.personLiableId" placeholder="请选择责任人">
  347. <el-option
  348. class="input_xiala"
  349. v-for="(item, i) in renYuan"
  350. :key="i"
  351. :value="item.id"
  352. :label="item.name"
  353. @click.native="xingMing(item.name)"
  354. >
  355. </el-option>
  356. </el-select>
  357. </el-form-item>
  358. <!-- <el-form-item label="总数量" prop="materialTotal">
  359. <el-input v-model="form.materialTotal" placeholder="请输入总数量" />
  360. </el-form-item>
  361. <el-form-item label="库存数量" prop="materialInventory">
  362. <el-input
  363. v-model="form.materialInventory"
  364. placeholder="请输入库存数量"
  365. />
  366. </el-form-item>
  367. <el-form-item label="在用数量" prop="inUseTotal">
  368. <el-input v-model="form.inUseTotal" placeholder="请输入在用数量" />
  369. </el-form-item>
  370. <el-form-item label="创建人" prop="createName">
  371. <el-input v-model="form.createName" placeholder="请输入创建人" />
  372. </el-form-item>
  373. <el-form-item label="库房" prop="warehouse">
  374. <el-input v-model="form.warehouse" placeholder="请输入库房" />
  375. </el-form-item>
  376. <el-form-item label="单位id" prop="unitId">
  377. <el-input v-model="form.unitId" placeholder="请输入单位id" />
  378. </el-form-item>
  379. <el-form-item label="责任人id" prop="personLiableId">
  380. <el-input
  381. v-model="form.personLiableId"
  382. placeholder="请输入责任人id"
  383. />
  384. </el-form-item> -->
  385. </el-form>
  386. <div slot="footer" class="dialog-footer">
  387. <el-button type="primary" @click="submitForm">确 定</el-button>
  388. <el-button @click="cancel" size="btn">取 消</el-button>
  389. </div>
  390. </el-dialog>
  391. </div>
  392. </template>
  393. <script>
  394. import {
  395. listArchives,
  396. getArchives,
  397. delArchives,
  398. addArchives,
  399. updateArchives,
  400. exportArchives,
  401. getDept,
  402. getZhuChiRen,
  403. } from "@/api/materialManagement/archives";
  404. // 导入树形结构
  405. import Treeselect from "@riophae/vue-treeselect";
  406. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  407. import { getAll } from "@/api/grassrootsregistration/bdglmeeting";
  408. export default {
  409. name: "Archives",
  410. components: {
  411. Treeselect,
  412. },
  413. dicts: ["category", "camp_equipment"],
  414. data() {
  415. return {
  416. // 遮罩层
  417. loading: true,
  418. // 导出遮罩层
  419. exportLoading: false,
  420. // 选中数组
  421. ids: [],
  422. // 非单个禁用
  423. single: true,
  424. // 非多个禁用
  425. multiple: true,
  426. // 显示搜索条件
  427. showSearch: true,
  428. // 总条数
  429. total: 0,
  430. // 物资档案表格数据
  431. archivesList: [],
  432. // 弹出层标题
  433. title: "",
  434. // 是否显示弹出层
  435. open: false,
  436. // 查询参数
  437. queryParams: {
  438. pageNum: 1,
  439. pageSize: 10,
  440. wuPinType: null,
  441. name: null,
  442. materialSpecification: null,
  443. materialXh: null,
  444. yingJuType: null,
  445. responsibilityUnit: null,
  446. personLiable: null,
  447. materialTotal: null,
  448. materialInventory: null,
  449. inUseTotal: null,
  450. createName: null,
  451. warehouse: null,
  452. unitId: null,
  453. personLiableId: null,
  454. },
  455. // 表单参数
  456. form: {},
  457. // 表单校验
  458. rules: {
  459. name: [{ required: true, message: "请填写物品名称", trigger: "blur" }],
  460. yingJuType: [
  461. { required: true, message: "请选择物品类型", trigger: "blur" },
  462. ],
  463. },
  464. // 树形单位
  465. deptOptions: [],
  466. // 人员列表
  467. renYuan: [],
  468. // 外面的人员
  469. renYuans: [],
  470. };
  471. },
  472. created() {
  473. this.getList();
  474. this.getSuo();
  475. },
  476. methods: {
  477. // 获取搜索所有人
  478. getSuo() {
  479. getAll().then((res) => {
  480. this.renYuans = res.rows;
  481. });
  482. },
  483. // 点击责任人触发
  484. xingMing(name) {
  485. this.form.personLiable = name;
  486. },
  487. /** 查询部门下拉树结构 */
  488. getTreeselect() {
  489. getDept().then((response) => {
  490. this.deptOptions = response.data;
  491. });
  492. },
  493. // 点击单位触发
  494. shuxing(data) {
  495. this.form.unitId = data.id;
  496. this.form.responsibilityUnit = data.label;
  497. this.getRenYuan(this.form.unitId);
  498. },
  499. // 获取人员
  500. getRenYuan(id) {
  501. getZhuChiRen(id).then((res) => {
  502. this.renYuan = res.data;
  503. });
  504. },
  505. /** 查询物资档案列表 */
  506. getList() {
  507. this.loading = true;
  508. listArchives(this.queryParams).then((response) => {
  509. this.archivesList = response.rows;
  510. this.total = response.total;
  511. this.loading = false;
  512. });
  513. },
  514. // 取消按钮
  515. cancel() {
  516. this.open = false;
  517. this.reset();
  518. },
  519. // 表单重置
  520. reset() {
  521. this.form = {
  522. id: null,
  523. wuPinType: null,
  524. name: null,
  525. materialSpecification: null,
  526. materialXh: null,
  527. yingJuType: null,
  528. responsibilityUnit: null,
  529. personLiable: null,
  530. materialTotal: null,
  531. materialInventory: null,
  532. inUseTotal: null,
  533. createName: null,
  534. createTime: null,
  535. warehouse: null,
  536. unitId: null,
  537. personLiableId: null,
  538. };
  539. this.resetForm("form");
  540. },
  541. /** 搜索按钮操作 */
  542. handleQuery() {
  543. this.queryParams.pageNum = 1;
  544. this.getList();
  545. },
  546. /** 重置按钮操作 */
  547. resetQuery() {
  548. this.resetForm("queryForm");
  549. this.handleQuery();
  550. },
  551. // 多选框选中数据
  552. handleSelectionChange(selection) {
  553. this.ids = selection.map((item) => item.id);
  554. this.single = selection.length !== 1;
  555. this.multiple = !selection.length;
  556. },
  557. /** 新增按钮操作 */
  558. handleAdd() {
  559. this.reset();
  560. this.getTreeselect();
  561. this.open = true;
  562. this.title = "添加物资档案";
  563. },
  564. /** 修改按钮操作 */
  565. handleUpdate(row) {
  566. this.reset();
  567. this.getTreeselect();
  568. const id = row.id || this.ids;
  569. getArchives(id).then((response) => {
  570. this.form = response.data;
  571. this.form.unitId = response.data.unitId;
  572. this.getRenYuan(this.form.unitId);
  573. this.open = true;
  574. this.title = "修改物资档案";
  575. });
  576. },
  577. /** 提交按钮 */
  578. submitForm() {
  579. this.$refs["form"].validate((valid) => {
  580. if (valid) {
  581. if (this.form.id != null) {
  582. updateArchives(this.form).then((response) => {
  583. this.$modal.msgSuccess("修改成功");
  584. this.open = false;
  585. this.getList();
  586. });
  587. } else {
  588. addArchives(this.form).then((response) => {
  589. this.$modal.msgSuccess("新增成功");
  590. this.open = false;
  591. this.getList();
  592. });
  593. }
  594. }
  595. });
  596. },
  597. /** 删除按钮操作 */
  598. handleDelete(row) {
  599. const ids = row.id || this.ids;
  600. this.$modal
  601. .confirm('是否确认删除物资档案编号为"' + ids + '"的数据项?')
  602. .then(function () {
  603. return delArchives(ids);
  604. })
  605. .then(() => {
  606. this.getList();
  607. this.$modal.msgSuccess("删除成功");
  608. })
  609. .catch(() => {});
  610. },
  611. /** 导出按钮操作 */
  612. handleExport() {
  613. const queryParams = this.queryParams;
  614. this.$modal
  615. .confirm("是否确认导出所有物资档案数据项?")
  616. .then(() => {
  617. this.exportLoading = true;
  618. return exportArchives(queryParams);
  619. })
  620. .then((response) => {
  621. this.$download.name(response.msg);
  622. this.exportLoading = false;
  623. })
  624. .catch(() => {});
  625. },
  626. },
  627. };
  628. </script>
  629. <style scoped>
  630. /* 对话框背景颜色 */
  631. ::v-deep .el-dialog {
  632. width: 800px !important;
  633. background: #004d86 !important;
  634. }
  635. ::v-deep .el-textarea__inner {
  636. width: 965px;
  637. height: 104px;
  638. }
  639. ::v-deep .el-dialog__header {
  640. border-bottom: 1px solid #718a9d;
  641. }
  642. ::v-deep .el-dialog__title {
  643. color: #fff;
  644. font: 18px;
  645. }
  646. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  647. color: #fff;
  648. }
  649. ::v-deep .el-form-item__label {
  650. font: 16px;
  651. color: #fff;
  652. width: 100px !important;
  653. }
  654. ::v-deep .el-dialog .el-input__inner {
  655. width: 200px !important;
  656. height: 36px;
  657. background: transparent;
  658. color: #fff;
  659. border: 1px solid white !important;
  660. border-color: #fff !important;
  661. }
  662. /* 单位框背景颜色 */
  663. ::v-deep .vue-treeselect__control {
  664. background: #004d86 !important;
  665. }
  666. /*调整表单间距 */
  667. ::v-deep .el-form-item__content {
  668. width: 200px;
  669. }
  670. ::v-deep .el-dialog__footer {
  671. margin-right: 94px !important;
  672. }
  673. .contents {
  674. padding: 0px 40px !important;
  675. }
  676. ::v-deep .el-form-item__label {
  677. width: 115px !important;
  678. }
  679. ::v-deep .el-dialog__body {
  680. padding: 30px 0px 30px 44px !important;
  681. }
  682. ::v-deep .vue-treeselect__single-value {
  683. color: #fff !important;
  684. }
  685. ::v-deep .el-form .el-input__inner {
  686. height: 36px !important;
  687. color: #fff;
  688. }
  689. </style>