index.vue 20 KB

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