index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <reportloss-search @search="reload"> </reportloss-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. >
  12. <template v-slot:code="{ row }">
  13. <el-link type="primary" @click="goDetail(row)">
  14. {{ row.code }}
  15. </el-link>
  16. </template>
  17. <!-- 表头工具栏 -->
  18. <template v-slot:toolbar>
  19. <el-button
  20. size="small"
  21. type="primary"
  22. icon="el-icon-plus"
  23. class="ele-btn-icon"
  24. @click="openEdit()"
  25. >
  26. 新建
  27. </el-button>
  28. </template>
  29. <template v-slot:action="{ row }">
  30. <el-link
  31. v-if="row.status == 0"
  32. type="primary"
  33. :underline="false"
  34. icon="el-icon-edit"
  35. @click="openEdit(row)"
  36. >
  37. 修改
  38. </el-link>
  39. </template>
  40. </ele-pro-table>
  41. </el-card>
  42. <!-- 新建或编辑弹窗 -->
  43. <AddReportDialog
  44. ref="addInventoryDialogRef"
  45. :dialogTile="dialogTitle"
  46. :id="inventoryId"
  47. @refreshList="reload"
  48. :isBindPlan="isBindPlan"
  49. />
  50. </div>
  51. </template>
  52. <script>
  53. import ReportlossSearch from './components/reportloss-search.vue';
  54. import AddReportDialog from './components/addReportDialog.vue';
  55. import { getReportsList } from '@/api/inventory';
  56. export default {
  57. components: {
  58. ReportlossSearch,
  59. AddReportDialog
  60. },
  61. data() {
  62. return {
  63. // 0待审核,1=审核中,2=已审核
  64. statusOptions: [
  65. {
  66. value: 0,
  67. label: '待审核'
  68. },
  69. {
  70. value: 1,
  71. label: '审核中'
  72. },
  73. {
  74. value: 2,
  75. label: '已审核'
  76. }
  77. ],
  78. dialogTitle: '',
  79. inventoryId: '',
  80. isBindPlan: false,
  81. // 表格列配置
  82. columns: [
  83. {
  84. columnKey: 'index',
  85. label: '序号',
  86. type: 'index',
  87. width: 55,
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. fixed: 'left'
  91. },
  92. {
  93. slot: 'code',
  94. prop: 'code',
  95. label: '单号',
  96. align: 'center',
  97. showOverflowTooltip: true,
  98. minWidth: 110
  99. },
  100. {
  101. prop: 'name',
  102. label: '名称',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 110
  106. },
  107. {
  108. prop: 'warehouseName',
  109. label: '仓库',
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. minWidth: 110
  113. },
  114. {
  115. prop: 'executeGroupName',
  116. label: '报损报溢部门',
  117. align: 'center',
  118. showOverflowTooltip: true,
  119. minWidth: 110
  120. },
  121. {
  122. prop: 'executorName',
  123. label: '报损报溢人',
  124. align: 'center',
  125. showOverflowTooltip: true,
  126. minWidth: 110
  127. },
  128. {
  129. prop: 'createTime',
  130. label: '报损时间',
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. minWidth: 110
  134. },
  135. {
  136. prop: 'status',
  137. label: '状态',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. formatter: (row) => {
  141. return this.statusOptions.filter(
  142. (item) => item.value == row.status
  143. )[0].label;
  144. }
  145. },
  146. {
  147. columnKey: 'action',
  148. label: '操作',
  149. width: 230,
  150. align: 'center',
  151. resizable: false,
  152. slot: 'action',
  153. showOverflowTooltip: true
  154. }
  155. ],
  156. // 加载状态
  157. loading: false
  158. };
  159. },
  160. computed: {},
  161. methods: {
  162. openEdit(row) {
  163. if (row) {
  164. this.dialogTitle = '修改报损报溢';
  165. this.inventoryId = row.id;
  166. } else {
  167. this.dialogTitle = '新增报损报溢';
  168. this.inventoryId = '';
  169. }
  170. this.isBindPlan = false;
  171. this.$refs.addInventoryDialogRef.dialogVisible = true;
  172. },
  173. /* 表格数据源 */
  174. datasource({ page, limit, where, order }) {
  175. return getReportsList({ pageNum: page, size: limit, ...where });
  176. },
  177. async changeEnable(row) {
  178. const res = await putRoles(row);
  179. if (res.code == 0) {
  180. this.$message({
  181. type: 'success',
  182. message: '修改成功',
  183. customClass: 'ele-message-border'
  184. });
  185. this.reload();
  186. }
  187. },
  188. /* 刷新表格 */
  189. reload(where) {
  190. this.$refs.table.reload({ page: 1, where });
  191. },
  192. // 详情
  193. goDetail(row) {
  194. this.dialogTitle = '报损报溢详情';
  195. this.inventoryId = row.id;
  196. this.isBindPlan = true;
  197. this.$refs.addInventoryDialogRef.dialogVisible = true;
  198. },
  199. // 新增
  200. addClick() {
  201. this.$router.push({
  202. path: '/warehouseManagement/stocktaking/reportLoss/add'
  203. // query: {
  204. // id
  205. // }
  206. });
  207. },
  208. // 撤回
  209. editRow(row) {}
  210. }
  211. };
  212. </script>
  213. <style lang="scss" scoped></style>