index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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="5">
  7. <el-form-item label="入库时间" prop="time">
  8. <el-date-picker
  9. class="w100"
  10. size="small"
  11. v-model="formData.time"
  12. type="daterange"
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. end-placeholder="结束日期"
  16. value-format="yyyy-MM-dd"
  17. ></el-date-picker> </el-form-item
  18. ></el-col>
  19. <el-col :span="4">
  20. <el-form-item label="入库单号" prop="bizNum">
  21. <el-input
  22. size="small"
  23. class="w100"
  24. placeholder="请输入"
  25. v-model="formData.bizNum"
  26. ></el-input> </el-form-item
  27. ></el-col>
  28. <el-col :span="4">
  29. <el-form-item label="编码" prop="assetCode">
  30. <el-input
  31. size="small"
  32. class="w100"
  33. placeholder="请输入"
  34. v-model="formData.assetCode"
  35. ></el-input> </el-form-item
  36. ></el-col>
  37. <el-col :span="4">
  38. <el-form-item label="名称" prop="assetName">
  39. <el-input
  40. size="small"
  41. class="w100"
  42. placeholder="请输入"
  43. v-model="formData.assetName"
  44. ></el-input> </el-form-item
  45. ></el-col>
  46. <el-col :span="4">
  47. <el-form-item label="状态" prop="verifyStatus">
  48. <el-select
  49. filterable
  50. size="small"
  51. class="w100"
  52. v-model="formData.verifyStatus"
  53. placeholder="请选择"
  54. clearable
  55. >
  56. <el-option
  57. v-for="item in auditStatus"
  58. :key="item.code"
  59. :value="item.code"
  60. :label="item.label"
  61. ></el-option>
  62. </el-select> </el-form-item
  63. ></el-col>
  64. <!-- <el-col :lg="6" :sm="8" :xs="8">
  65. <el-form-item label="创建时间" prop="time">
  66. <el-date-picker
  67. class="w100"
  68. size="small"
  69. v-model="formData.time"
  70. type="daterange"
  71. range-separator="至"
  72. start-placeholder="开始日期"
  73. end-placeholder="结束日期"
  74. value-format="yyyy-MM-dd"
  75. ></el-date-picker> </el-form-item
  76. ></el-col> -->
  77. <el-col :span="3">
  78. <div>
  79. <el-button icon="el-icon-refresh-left" size="small" @click="reset"
  80. >重置</el-button
  81. >
  82. <el-button
  83. type="primary"
  84. icon="el-icon-search"
  85. size="small"
  86. @click="search"
  87. >搜索</el-button
  88. >
  89. </div></el-col
  90. >
  91. </el-row>
  92. </el-form>
  93. <ele-pro-table
  94. ref="table"
  95. :columns="columns"
  96. :datasource="datasource"
  97. cache-key="systemRoleTable"
  98. >
  99. <!-- 表头工具栏 -->
  100. <template v-slot:toolbar>
  101. <el-button icon="el-icon-plus" type="primary" @click="add"
  102. >新建</el-button
  103. >
  104. <!-- v-if="clientEnvironmentId == 2" -->
  105. <el-button
  106. icon="el-icon-plus"
  107. v-if="clientEnvironmentId == 4"
  108. type="primary"
  109. @click="exportExcel"
  110. >导入</el-button
  111. >
  112. </template>
  113. <!-- 状态 -->
  114. <template v-slot:verifyStatus="{ row }">
  115. <span :class="status[row.verifyStatus].class">
  116. {{ status[row.verifyStatus].label }}
  117. </span>
  118. </template>
  119. <!-- 单号链接 -->
  120. <template v-slot:bizNo="{ row }">
  121. <el-link @click="details(row)">
  122. {{ row.bizNo }}
  123. </el-link>
  124. </template>
  125. <!-- 操作列 -->
  126. <template v-slot:action="{ row }">
  127. <el-link
  128. type="success"
  129. :underline="false"
  130. icon="el-icon-position"
  131. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  132. @click="submit(row)"
  133. >
  134. 提交
  135. </el-link>
  136. <!-- <el-link
  137. type="warning"
  138. :underline="false"
  139. icon="el-icon-edit"
  140. v-if="row.verifyStatus == 3"
  141. @click="edit(row)"
  142. >
  143. 修改
  144. </el-link> -->
  145. <el-link
  146. type="primary"
  147. :underline="false"
  148. icon="el-icon-view"
  149. @click="details(row)"
  150. >
  151. 详情
  152. </el-link>
  153. <el-link
  154. type="primary"
  155. v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
  156. :underline="false"
  157. icon="el-icon-delete"
  158. @click="deleted(row)"
  159. >
  160. 删除
  161. </el-link>
  162. </template>
  163. <template v-slot:bizType="{ row }">
  164. {{ handleBizType(row.bizType) }}
  165. </template>
  166. <template v-slot:assetType="{ row }">
  167. {{ handleAssetType(row.extInfo.assetType) }}
  168. </template>
  169. </ele-pro-table>
  170. </el-card>
  171. </div>
  172. </template>
  173. <script>
  174. import outin from '@/api/warehouseManagement/outin';
  175. import { allCategoryLevel } from '@/api/classifyManage';
  176. import {
  177. warehousingType,
  178. sceneState,
  179. auditStatus,
  180. useDict
  181. } from '@/utils/dict/index';
  182. // import { getPage } from '@/api/stockManagement'
  183. // import { deepClone } from '@/utils'
  184. export default {
  185. // components: { tablePagination },
  186. data() {
  187. return {
  188. auditStatus,
  189. warehousingType,
  190. sceneState,
  191. codeList: [],
  192. tableData: [],
  193. formData: {
  194. bizNum: '',
  195. deliveryName: '',
  196. time: [],
  197. verifyStatus: ''
  198. // type: 1
  199. },
  200. total: 0,
  201. status: [
  202. { label: '未审核', class: 'ele-text-info' },
  203. { label: '审核中', class: 'ele-text-primary' },
  204. { label: '审核通过', class: 'ele-text-success' },
  205. { label: '驳回', class: 'ele-text-danger' }
  206. ],
  207. columns: [
  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: 150
  229. },
  230. {
  231. prop: 'assetType',
  232. slot: 'assetType',
  233. label: '入库物品类型',
  234. align: 'center',
  235. showOverflowTooltip: true,
  236. width: 150
  237. },
  238. {
  239. prop: 'sourceBizNo',
  240. label: '来源单据',
  241. align: 'center',
  242. showOverflowTooltip: true
  243. },
  244. {
  245. prop: 'createUserName',
  246. label: '入库人',
  247. align: 'center',
  248. showOverflowTooltip: true
  249. },
  250. {
  251. width: 160,
  252. prop: 'createTime',
  253. label: '入库时间',
  254. align: 'center',
  255. showOverflowTooltip: true
  256. },
  257. {
  258. prop: 'verifyName',
  259. label: '审核人',
  260. align: 'center',
  261. showOverflowTooltip: true
  262. },
  263. {
  264. prop: 'verifyStatus',
  265. label: '状态',
  266. align: 'center',
  267. slot: 'verifyStatus',
  268. showOverflowTooltip: true,
  269. width: 100
  270. },
  271. {
  272. columnKey: 'action',
  273. label: '操作',
  274. width: 250,
  275. align: 'center',
  276. slot: 'action',
  277. showOverflowTooltip: true
  278. }
  279. ]
  280. };
  281. },
  282. computed: {
  283. clientEnvironmentId() {
  284. return this.$store.state.user.info.clientEnvironmentId;
  285. }
  286. },
  287. mounted() {
  288. this.getTypeList();
  289. },
  290. methods: {
  291. handleAssetType(r) {
  292. const code = this.codeList.find((item) => item.dictCode == r);
  293. return code?.dictValue;
  294. },
  295. async getTypeList() {
  296. const { data } = await allCategoryLevel();
  297. this.codeList = data.map((item) => {
  298. return { dictCode: item.id, dictValue: item.name };
  299. });
  300. },
  301. submit(row) {
  302. this.$confirm('此操作将提交流程, 是否继续?', '提示', {
  303. confirmButtonText: '确定',
  304. cancelButtonText: '取消',
  305. type: 'warning'
  306. })
  307. .then(async () => {
  308. const data = await outin.outApproves({ outInId: row.id });
  309. if (data) {
  310. this.$message.success('流程发起成功!');
  311. this.getList();
  312. }
  313. })
  314. .catch(() => {});
  315. },
  316. handleBizType(code) {
  317. for (const key in this.sceneState) {
  318. if (this.sceneState[key].code == code) {
  319. return this.sceneState[key].label;
  320. }
  321. }
  322. },
  323. async datasource({ page, limit, where }) {
  324. const params = Object.assign({}, this.formData);
  325. if (params.time?.length) {
  326. params.startTime = params.time[0];
  327. params.endTime = params.time[1];
  328. }
  329. delete params.time;
  330. // params.bizStatus = 1;
  331. const res = await outin.list({
  332. pageNum: page,
  333. size: limit,
  334. type: 1,
  335. ...params,
  336. bizStatus: 1
  337. });
  338. return res;
  339. },
  340. getAuditStatus: useDict(auditStatus),
  341. getList() {
  342. this.$refs.table.reload();
  343. },
  344. add(row) {
  345. const query = {};
  346. if (row?.id) {
  347. query.id = row.id;
  348. }
  349. this.$router.push({
  350. path: '/warehouseManagement/stockManagement/add'
  351. // query
  352. });
  353. },
  354. exportExcel() {
  355. this.$router.push({
  356. path: '/warehouseManagement/stockManagement/add_export'
  357. // query
  358. });
  359. },
  360. edit(row) {
  361. this.$router.push({
  362. path: '/warehouseManagement/stockManagement/edit',
  363. query: {
  364. id: row.id
  365. }
  366. });
  367. },
  368. details(row) {
  369. this.$router.push({
  370. path: '/warehouseManagement/stockManagement/details',
  371. query: {
  372. id: row.id
  373. }
  374. });
  375. },
  376. async deleted(row) {
  377. this.$confirm('是否确定删除?', '提示', {
  378. confirmButtonText: '确定',
  379. cancelButtonText: '取消',
  380. type: 'warning'
  381. })
  382. .then(async () => {
  383. const data = await outin.delete([row.id]);
  384. if (data.code == '0') {
  385. this.$message.success('删除成功!');
  386. this.getList();
  387. }
  388. })
  389. .catch(() => {});
  390. },
  391. handleCurrentChange() {
  392. this.getList();
  393. },
  394. handleSizeChange() {
  395. this.formData.page = 1;
  396. this.getList();
  397. },
  398. search() {
  399. this.formData.page = 1;
  400. this.getList();
  401. },
  402. reset() {
  403. this.$refs.formName.resetFields();
  404. this.search();
  405. }
  406. }
  407. };
  408. </script>
  409. <style lang="scss" scoped>
  410. #stockManagement_index {
  411. height: 100%;
  412. width: 100%;
  413. padding: 10px;
  414. box-sizing: border-box;
  415. // element-ui样式穿透
  416. ::v-deep .el-card {
  417. height: 100%;
  418. .el-card__body {
  419. height: 100%;
  420. box-sizing: border-box;
  421. display: flex;
  422. flex-direction: column;
  423. .ele-pro-table {
  424. flex: 1;
  425. display: flex;
  426. flex-direction: column;
  427. .el-table {
  428. display: flex;
  429. flex-direction: column;
  430. .el-table__body-wrapper {
  431. flex: 1;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. .w100 {
  438. width: 100% !important;
  439. }
  440. .p20 {
  441. padding: 20px;
  442. }
  443. .mt20 {
  444. margin-top: 20px;
  445. }
  446. .mt10 {
  447. margin-top: 10px;
  448. }
  449. .el-form {
  450. overflow: hidden;
  451. }
  452. .float-right {
  453. float: right;
  454. text-align: right;
  455. margin-right: 20px;
  456. }
  457. .right {
  458. text-align: right;
  459. }
  460. .col {
  461. color: #aaa;
  462. }
  463. .pr10 {
  464. padding-right: 10px;
  465. }
  466. }
  467. </style>