index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <div id="stockManagement_index">
  3. <el-card shadow="never">
  4. <el-form :model="formData" ref="formName" label-width="80px">
  5. <el-row :gutter="10">
  6. <el-col :span="6">
  7. <el-form-item label="入库时间" prop="time">
  8. <el-date-picker class="w100" size="small" v-model="formData.time" type="daterange" range-separator="至"
  9. start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"></el-date-picker>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="6">
  13. <el-form-item label="入库单号" prop="sourceBizNo">
  14. <el-input size="small" class="w100" placeholder="请输入" v-model="formData.sourceBizNo"></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="6">
  18. <el-form-item label="入库类型" prop="bizType">
  19. <el-select style="width: 100%" filterable placeholder="请选择" v-model="formData.bizType" clearable>
  20. <el-option v-for="item in sceneState" :key="item.code" :value="item.code + ''"
  21. :label="item.label"></el-option>
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="6">
  26. <el-form-item label="物品编码" prop="categoryCode">
  27. <el-input size="small" class="w100" placeholder="请输入" v-model="formData.categoryCode"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="物品名称" prop="categoryName">
  32. <el-input size="small" class="w100" placeholder="请输入" v-model="formData.categoryName"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="6">
  36. <el-form-item label="状态" prop="status">
  37. <el-select filterable size="small" class="w100" v-model="formData.status" placeholder="请选择" clearable>
  38. <el-option v-for="item in auditStatus" :key="item.code" :value="item.code"
  39. :label="item.label"></el-option>
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. <!-- <el-col :span="6">
  44. <el-form-item label="组织机构:" prop="deptIds">
  45. <auth-selection
  46. v-model="formData.deptIds"
  47. style="width: 100%"
  48. ></auth-selection>
  49. </el-form-item>
  50. </el-col> -->
  51. <el-col :span="6">
  52. <el-form-item label="所属工厂" prop="factoryId">
  53. <el-select filterable placeholder="请选择" v-model="formData.factoryId" clearable class="w100">
  54. <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  55. </el-select>
  56. </el-form-item>
  57. </el-col>
  58. <!-- <el-col :lg="6" :sm="8" :xs="8">
  59. <el-form-item label="创建时间" prop="time">
  60. <el-date-picker
  61. class="w100"
  62. size="small"
  63. v-model="formData.time"
  64. type="daterange"
  65. range-separator="至"
  66. start-placeholder="开始日期"
  67. end-placeholder="结束日期"
  68. value-format="yyyy-MM-dd"
  69. ></el-date-picker> </el-form-item
  70. ></el-col> -->
  71. <el-col style="
  72. display: flex;
  73. justify-content: flex-end;
  74. margin-bottom: 10px;
  75. ">
  76. <div>
  77. <el-button icon="el-icon-refresh-left" size="small" @click="reset">重置</el-button>
  78. <el-button type="primary" icon="el-icon-search" size="small" @click="search">搜索</el-button>
  79. </div>
  80. </el-col>
  81. </el-row>
  82. </el-form>
  83. <ele-pro-table ref="table" :columns="columns" height="calc(100vh-300px)" :pageSize="20" :datasource="datasource"
  84. @cell-click="cellClick">
  85. <template v-slot:selection="{ row }">
  86. <el-radio class="radio" v-model="currentRow.id" :label="row.id"><i></i></el-radio>
  87. </template>
  88. <!-- 表头工具栏 -->
  89. <template v-slot:toolbar>
  90. <el-button icon="el-icon-plus" type="primary" @click="add">新建</el-button>
  91. <el-button icon="el-icon-edit-outline" type="primary" @click="priceMaintenance">单价维护</el-button>
  92. <!-- <el-button icon="el-icon-top" type="primary" @click="shelves"
  93. >上下架</el-button
  94. > -->
  95. <el-button icon="el-icon-receiving" type="primary" @click="outbound">出库</el-button>
  96. <!-- <el-button
  97. icon="el-icon-plus"
  98. v-if="clientEnvironmentId == 4"
  99. type="primary"
  100. @click="exportExcel"
  101. >导入</el-button
  102. > -->
  103. </template>
  104. <!-- 状态 -->
  105. <template v-slot:verifyStatus="{ row }">
  106. <span :class="status[row.verifyStatus]?.class">
  107. {{ status[row.verifyStatus]?.label }}
  108. </span>
  109. </template>
  110. <!-- 单号链接 -->
  111. <template v-slot:bizNo="{ row }">
  112. <el-link type="primary" @click="details(row)">
  113. {{ row.bizNo }}
  114. </el-link>
  115. </template>
  116. <!-- 操作列 -->
  117. <template v-slot:action="{ row }">
  118. <el-link type="success" :underline="false" icon="el-icon-position"
  119. v-if="row.verifyStatus == 0 || row.verifyStatus == 3" @click="submit(row)">
  120. 提交
  121. </el-link>
  122. <el-link
  123. type="primary"
  124. :underline="false"
  125. icon="el-icon-view"
  126. @click="edit(row)"
  127. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  128. >
  129. 修改
  130. </el-link>
  131. <!-- <el-link v-if="row.verifyStatus == 2 && clientEnvironmentId == 3" type="primary" :underline="false"
  132. icon="el-icon-view" @click="quality(row)">
  133. 质检
  134. </el-link> -->
  135. <el-link v-if="row.verifyStatus == 2" type="primary" :underline="false" icon="el-icon-sort-up"
  136. @click="details(row)">
  137. 上架
  138. </el-link>
  139. <el-link v-if="row.verifyStatus == 2" type="primary" :underline="false" icon="el-icon-sort-down"
  140. @click="details(row)">
  141. 下架
  142. </el-link>
  143. <el-link type="primary" v-if="row.verifyStatus == 0 || row.verifyStatus == 3" :underline="false"
  144. icon="el-icon-delete" @click="deleted(row)">
  145. 删除
  146. </el-link>
  147. </template>
  148. <template v-slot:bizType="{ row }">
  149. {{ handleBizType(row.bizType) }}
  150. </template>
  151. <template v-slot:assetType="{ row }">
  152. {{ handleAssetType(row.extInfo.assetType) }}
  153. </template>
  154. </ele-pro-table>
  155. </el-card>
  156. <!-- <priceMaintenanceDialog ref="priceMaintenanceDialogRef" /> -->
  157. </div>
  158. </template>
  159. <script>
  160. import storageApi from '@/api/warehouseManagement';
  161. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  162. /* import priceMaintenanceDialog from './components/priceMaintenanceDialog.vue'; */
  163. import { allCategoryLevel } from '@/api/classifyManage';
  164. ('@/view/warehouseManagement/stockManagement/components/priceMaintenanceDialog.vue');
  165. import {
  166. warehousingType,
  167. sceneState,
  168. auditStatus,
  169. useDict
  170. } from '@/utils/dict/index';
  171. export default {
  172. components: {},
  173. data() {
  174. return {
  175. auditStatus,
  176. warehousingType,
  177. sceneState,
  178. codeList: [],
  179. factoryList: [],
  180. tableData: [],
  181. formData: {
  182. deptIds: '',
  183. categoryCode: '',
  184. categoryName: '',
  185. sourceBizNo: '',
  186. startTime: '',
  187. endTime: '',
  188. status: '',
  189. factoryId: '',
  190. time: []
  191. // type: 1
  192. },
  193. total: 0,
  194. status: [
  195. { label: '未审核', class: 'ele-text-info' },
  196. { label: '审核中', class: 'ele-text-primary' },
  197. { label: '审核通过', class: 'ele-text-success' },
  198. { label: '驳回', class: 'ele-text-danger' }
  199. ],
  200. currentRow: {},
  201. columns: [
  202. {
  203. slot: 'selection',
  204. label: '选择',
  205. width: 50,
  206. align: 'center'
  207. },
  208. {
  209. type: 'index',
  210. label: '序号',
  211. width: 50,
  212. align: 'center'
  213. },
  214. {
  215. prop: 'bizNo',
  216. label: '单号',
  217. align: 'center',
  218. slot: 'bizNo',
  219. showOverflowTooltip: true,
  220. width: 150
  221. },
  222. {
  223. prop: 'bizType',
  224. slot: 'bizType',
  225. label: '入库类型',
  226. align: 'center',
  227. showOverflowTooltip: true,
  228. width: 100
  229. },
  230. {
  231. prop: 'assetType',
  232. slot: 'assetType',
  233. label: '物品类型',
  234. align: 'center',
  235. showOverflowTooltip: true,
  236. width: 120
  237. },
  238. {
  239. prop: 'categoryNames',
  240. label: '物品名称',
  241. align: 'center',
  242. showOverflowTooltip: true,
  243. width: 150
  244. },
  245. {
  246. prop: 'categoryCodes',
  247. label: '物品编码',
  248. align: 'center',
  249. showOverflowTooltip: true,
  250. width: 150
  251. },
  252. {
  253. prop: 'sourceBizNo',
  254. label: '来源单据',
  255. align: 'center',
  256. showOverflowTooltip: true
  257. },
  258. {
  259. prop: 'createUserName',
  260. label: '入库人',
  261. align: 'center',
  262. showOverflowTooltip: true
  263. },
  264. {
  265. width: 160,
  266. prop: 'storageTime',
  267. label: '入库时间',
  268. align: 'center',
  269. showOverflowTooltip: true
  270. },
  271. {
  272. prop: 'verifyName',
  273. label: '审核人',
  274. align: 'center',
  275. showOverflowTooltip: true
  276. },
  277. // {
  278. // prop: 'startTime',
  279. // label: '开始时间',
  280. // align: 'center',
  281. // showOverflowTooltip: true
  282. // },
  283. {
  284. prop: 'outInStatus',
  285. label: '入库状态',
  286. align: 'center',
  287. showOverflowTooltip: true,
  288. width: 100,
  289. formatter: (row, column, cellValue) => {
  290. if (row.verifyStatus == 2) {
  291. return row.outInStatus == 1 ? '预入库' : row.outInStatus == 2 ? '部分入库' : row.outInStatus == 3 ? '已入库' : '';
  292. }
  293. }
  294. },
  295. {
  296. prop: 'verifyStatus',
  297. label: '状态',
  298. align: 'center',
  299. slot: 'verifyStatus',
  300. showOverflowTooltip: true,
  301. width: 100
  302. },
  303. {
  304. columnKey: 'action',
  305. label: '操作',
  306. width: 250,
  307. align: 'center',
  308. slot: 'action',
  309. showOverflowTooltip: true
  310. }
  311. ]
  312. };
  313. },
  314. computed: {
  315. clientEnvironmentId() {
  316. return this.$store.state.user.info.clientEnvironmentId;
  317. }
  318. },
  319. mounted() {
  320. this.getTypeList();
  321. this.getFactoryList();
  322. },
  323. methods: {
  324. //获取工厂列表
  325. async getFactoryList() {
  326. const res = await warehouseDefinition.getFactoryarea({
  327. pageNum: 1,
  328. size: 9999,
  329. type: 1
  330. });
  331. this.factoryList = res.list;
  332. },
  333. // 单击获取id
  334. cellClick(row) {
  335. this.currentRow = row;
  336. },
  337. shelves() {
  338. console.log('上架');
  339. },
  340. unShelves() {
  341. console.log('下架');
  342. },
  343. priceMaintenance() {
  344. if (Object.keys(this.currentRow).length == 0) {
  345. return this.$message.error('请选择单据');
  346. } else {
  347. if (this.currentRow.verifyStatus == 2) {
  348. this.$router.push({
  349. path: '/warehouseManagement/stockManagement/priceMaintenance',
  350. query: {
  351. ids: this.currentRow.id
  352. }
  353. });
  354. /* this.$refs.priceMaintenanceDialogRef.open(this.currentRow.id); */
  355. } else {
  356. this.$message.error('该单据未审核通过');
  357. }
  358. }
  359. },
  360. async outbound() {
  361. if (Object.keys(this.currentRow).length == 0) {
  362. return this.$message.error('请选择单据');
  363. } else {
  364. if (this.currentRow.verifyStatus == 2) {
  365. const res = await storageApi.getInboundDetailsById(
  366. this.currentRow.id
  367. );
  368. const arr = [];
  369. for (const key in res.outInDetailList) {
  370. for (const k in res.outInDetailList[key]
  371. .outInDetailRecordRequestList) {
  372. arr.push({
  373. ...res.outInDetailList[key].outInDetailRecordRequestList[k]
  374. });
  375. }
  376. }
  377. let ids = arr.map((item) => item.id).join(',');
  378. this.$router.push({
  379. path: '/warehouseManagement/outgoingManagement/add',
  380. query: {
  381. ids,
  382. bizType: this.currentRow.bizType,
  383. assetType: this.currentRow.extInfo.assetType
  384. }
  385. });
  386. } else {
  387. this.$message.error('该单据未审核通过');
  388. }
  389. }
  390. },
  391. handleAssetType(r) {
  392. let arr = r.split(',');
  393. const filteredData = this.codeList.filter((item) =>
  394. arr.includes(item.dictCode)
  395. );
  396. return filteredData.map((item) => item.dictValue).join(',');
  397. },
  398. async getTypeList() {
  399. const { data } = await allCategoryLevel();
  400. this.codeList = data.map((item) => {
  401. return { dictCode: item.id, dictValue: item.name };
  402. });
  403. },
  404. submit(row) {
  405. this.$confirm('此操作将提交流程, 是否继续?', '提示', {
  406. confirmButtonText: '确定',
  407. cancelButtonText: '取消',
  408. type: 'warning'
  409. })
  410. .then(async () => {
  411. const data = await storageApi.submitTwo({ outInId: row.id });
  412. if (data) {
  413. this.$message.success('流程发起成功!');
  414. this.getList();
  415. }
  416. })
  417. .catch(() => { });
  418. },
  419. handleBizType(code) {
  420. for (const key in this.sceneState) {
  421. if (this.sceneState[key].code == code) {
  422. return this.sceneState[key].label;
  423. }
  424. }
  425. },
  426. async datasource({ page, limit, where }) {
  427. const params = Object.assign({}, this.formData);
  428. if (params.time?.length) {
  429. params.startTime = params.time[0];
  430. params.endTime = params.time[1];
  431. }
  432. delete params.time;
  433. // params.bizStatus = 1;
  434. const res = await storageApi.getInboundList({
  435. pageNum: page,
  436. size: limit,
  437. type: 1,
  438. ...params
  439. });
  440. return res;
  441. },
  442. getAuditStatus: useDict(auditStatus),
  443. getList() {
  444. this.$refs.table.reload();
  445. },
  446. add(row) {
  447. const query = {};
  448. if (row?.id) {
  449. query.id = row.id;
  450. }
  451. this.$router.push({
  452. path: '/warehouseManagement/stockManagement/add'
  453. // query
  454. });
  455. },
  456. quality(row) {
  457. this.$router.push({
  458. path: '/warehouseManagement/stockManagement/quality',
  459. query: {
  460. id: row.id
  461. }
  462. });
  463. },
  464. exportExcel() {
  465. this.$router.push({
  466. path: '/warehouseManagement/stockManagement/add_export'
  467. // query
  468. });
  469. },
  470. edit(row) {
  471. this.$router.push({
  472. path: '/warehouseManagement/stockManagement/add',
  473. query: {
  474. detailId: row.id
  475. }
  476. });
  477. },
  478. details(row) {
  479. this.$router.push({
  480. path: '/warehouseManagement/stockManagement/details',
  481. query: {
  482. id: row.id,
  483. verifyStatus: row.verifyStatus
  484. }
  485. });
  486. },
  487. async deleted(row) {
  488. this.$confirm('是否确定删除?', '提示', {
  489. confirmButtonText: '确定',
  490. cancelButtonText: '取消',
  491. type: 'warning'
  492. })
  493. .then(async () => {
  494. const data = await storageApi.delete([row.id]);
  495. if (data.code == '0') {
  496. this.$message.success('删除成功!');
  497. this.getList();
  498. }
  499. })
  500. .catch(() => { });
  501. },
  502. handleCurrentChange() {
  503. this.getList();
  504. },
  505. handleSizeChange() {
  506. this.formData.page = 1;
  507. this.getList();
  508. },
  509. search() {
  510. this.formData.page = 1;
  511. this.getList();
  512. },
  513. reset() {
  514. this.$refs.formName.resetFields();
  515. this.search();
  516. }
  517. }
  518. };
  519. </script>
  520. <style lang="scss" scoped>
  521. #stockManagement_index {
  522. height: calc(100vh - 96px);
  523. width: 100%;
  524. padding: 10px;
  525. box-sizing: border-box;
  526. // element-ui样式穿透
  527. :deep(.el-card) {
  528. height: 100%;
  529. .el-card__body {
  530. height: 100%;
  531. box-sizing: border-box;
  532. display: flex;
  533. flex-direction: column;
  534. .ele-pro-table {
  535. flex: 1;
  536. display: flex;
  537. flex-direction: column;
  538. .el-table {
  539. flex: 1;
  540. // display: flex;
  541. // flex-direction: column;
  542. // .el-table__body-wrapper {
  543. // flex: 1;
  544. // }
  545. }
  546. }
  547. }
  548. .el-form-item {
  549. margin-bottom: 5px !important;
  550. }
  551. }
  552. .w100 {
  553. width: 100% !important;
  554. }
  555. .p20 {
  556. padding: 20px;
  557. }
  558. .mt20 {
  559. margin-top: 20px;
  560. }
  561. .mt10 {
  562. margin-top: 10px;
  563. }
  564. .el-form {
  565. overflow: hidden;
  566. }
  567. .float-right {
  568. float: right;
  569. text-align: right;
  570. margin-right: 20px;
  571. }
  572. .right {
  573. text-align: right;
  574. }
  575. .col {
  576. color: #aaa;
  577. }
  578. .pr10 {
  579. padding-right: 10px;
  580. }
  581. }
  582. </style>