CheckList.vue 7.0 KB

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