CheckList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <a-row :gutter="24">
  3. <a-col :md="24">
  4. <a-card :bordered="false">
  5. <!-- 查询区域 -->
  6. <filter-form
  7. @search="getList"
  8. :queryParam="queryParam"
  9. :spinnerList="spinnerList"
  10. :deoptData="deoptData"
  11. ></filter-form>
  12. <div style="margin-bottom: 6px">
  13. <a-button type="primary" icon="plus" @click="addTask('add')">开始盘点</a-button>
  14. <!-- <a-popconfirm style="margin: 0 6px" title="确定取消选中的盘点任务吗?" @confirm="() => cancelTask()">
  15. <a-button :disabled="!selectedRowKeys.length">取消盘点</a-button>
  16. </a-popconfirm>
  17. <a-popconfirm title="确定删除选中的盘点任务吗?" @confirm="() => handleDelete()">
  18. <a-button :disabled="!selectedRowKeys.length">批量删除</a-button>
  19. </a-popconfirm> -->
  20. <!-- <a-button style="margin-left: 6px">导出任务</a-button> -->
  21. </div>
  22. <a-table
  23. ref="table"
  24. size="middle"
  25. bordered
  26. rowKey="id"
  27. :columns="columns"
  28. :dataSource="dataSource"
  29. :pagination="ipagination"
  30. :scroll="scroll"
  31. :loading="loading"
  32. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  33. @change="handleTableChange"
  34. >
  35. <template slot="taskType" slot-scope="value">
  36. {{ value === 1 ? '全盘' : '抽盘' }}
  37. </template>
  38. <template slot="taskStatus" slot-scope="value">
  39. {{ formateTaskStatus(value) }}
  40. </template>
  41. <span slot="action" slot-scope="text, record">
  42. <a @click="addTask('detail', record)">查看</a>
  43. <a-divider type="vertical" />
  44. <a @click="addTask('edit', record)">编辑</a>
  45. <a-divider type="vertical" />
  46. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  47. <a>删除</a>
  48. </a-popconfirm>
  49. </span>
  50. </a-table>
  51. </a-card>
  52. </a-col>
  53. <check-modal
  54. :spinnerList="spinnerList"
  55. :deoptData="deoptData"
  56. :stockVisible.sync="stockVisible"
  57. :title="title"
  58. :rules="rules"
  59. :taskId="taskId"
  60. :openType="openType"
  61. ref="stockF"
  62. ></check-modal>
  63. </a-row>
  64. </template>
  65. <script>
  66. // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  67. import FilterForm from './components/FilterForm.vue'
  68. import table from './utils/table'
  69. // import StockModal from './components/stockModal.vue'
  70. import { getAction, postAction } from '@/api/manage'
  71. import { newTableMixin } from '@/mixins/newTableMixin'
  72. import CheckModal from './components/checkModal.vue'
  73. export default {
  74. components: { FilterForm, CheckModal },
  75. mixins: [newTableMixin],
  76. data() {
  77. return {
  78. description: '盘点任务列表',
  79. // 表头
  80. scroll: { x: 1500 },
  81. // 权限按钮集合
  82. btnEnableList: [1, 1, 1],
  83. queryParam: {
  84. taskStatus: '',
  85. number: '',
  86. depotId: '',
  87. createBy: '',
  88. },
  89. // stockTable: {
  90. // loading: false,
  91. // dataSource: [],
  92. // columns: table.taskColumns,
  93. // },
  94. columns: table.taskColumns,
  95. dataSource: [],
  96. loading: false,
  97. rules: {
  98. taskType: { rules: [{ required: true, message: '请选择盘点类型' }] },
  99. depotId: { rules: [{ required: true, message: '请选择盘点仓库' }] },
  100. taskName: { rules: [{ required: true, message: '请输入盘点任务名称' }] },
  101. },
  102. // rules: {
  103. // number: { rules: [{ required: true, message: '请输入盘点编号' }] },
  104. // },
  105. url: {
  106. list: '/stocktaking/list',
  107. add: '/stocktaking/add',
  108. detailList: '/stocktaking/detail',
  109. spinnerList: '/stocktaking/creatorSpinnerList',
  110. depotList: '/depot/findDepotByCurrentUser',
  111. detailByItemList: '/stocktaking/detailByItemList',
  112. delete: '/stocktaking/taskDelete/',
  113. cancel: '/stocktaking/taskCancel/',
  114. },
  115. stockVisible: false,
  116. title: '',
  117. spinnerList: [],
  118. deoptData: [],
  119. taskId: '',
  120. openType: 'add',
  121. }
  122. },
  123. watch: {
  124. stockVisible(val) {
  125. if (!val) {
  126. this.getList()
  127. }
  128. },
  129. },
  130. created() {
  131. this.getList()
  132. this.getSpinnerList(), this.getDepotList()
  133. },
  134. methods: {
  135. addTask(type, data) {
  136. this.taskId = ''
  137. this.openType = type
  138. this.title = type === 'add' ? '新增' : type === 'edit' ? '编辑' : '查看'
  139. if (type !== 'add') {
  140. this.getDetailList(data.id)
  141. }
  142. this.stockVisible = true
  143. },
  144. getList(type) {
  145. if (type === 'search') this.ipagination.current = 1 // 重新加载数据时,重置当前页为第一页
  146. if (type === 'reset') {
  147. for (let i in this.queryParam) {
  148. this.$set(this.queryParam, i, null)
  149. }
  150. }
  151. const url = this.url.list + '?pageNum=' + this.ipagination.current + '&pageSize=' + this.ipagination.pageSize
  152. this.loading = true
  153. const params = { ...this.queryParam }
  154. postAction(url, params).then((res) => {
  155. this.dataSource = res.data.rows
  156. this.ipagination.total = Number(res.data.total)
  157. this.loading = false
  158. })
  159. },
  160. getDetailList(id) {
  161. this.taskId = id
  162. },
  163. getSpinnerList() {
  164. getAction(this.url.spinnerList).then((res) => {
  165. this.spinnerList = res.data || []
  166. })
  167. },
  168. getDepotList() {
  169. getAction(this.url.depotList).then((res) => {
  170. this.deoptData = res.data.map((item) => {
  171. return {
  172. label: item.depotName,
  173. value: item.id,
  174. }
  175. })
  176. })
  177. },
  178. handleDelete(id) {
  179. const ids = id || this.selectedRowKeys
  180. const url = this.url.delete + ids
  181. getAction(url).then((res) => {
  182. this.$message.success('删除成功')
  183. this.getList()
  184. })
  185. },
  186. cancelTask() {
  187. const ids = this.selectedRowKeys
  188. const url = this.url.cancel + ids
  189. getAction(url).then((res) => {
  190. this.$message.success('取消成功')
  191. this.getList()
  192. })
  193. },
  194. },
  195. }
  196. </script>
  197. <style></style>