reserve_list.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :operation="operation()"
  6. :optionsEvensGroup="optionsEvensGroup"
  7. :exportList="exportList"
  8. :columnParsing="columnParsing"
  9. :tableAttributes="tableAttributes"
  10. :tableEvents="tableEvents"
  11. >
  12. <Popu v-if="isShowForm || isShowDetail">
  13. <ReserveDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  14. <ReserveForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  15. </Popu>
  16. </template-page>
  17. </template>
  18. <script>
  19. import TemplatePage from '@/components/template/template-page-1.vue'
  20. import Popu from '@/components/template/popu.vue'
  21. import import_mixin from '@/components/template/import_mixin.js'
  22. import {
  23. getList,
  24. closeData,
  25. getWarehouseList,
  26. reserveListV2,
  27. reserveListV2Export,
  28. reserveImportData,
  29. reserveImportDataExcel
  30. } from '@/api/supply/reserve'
  31. import ReserveDetail from '@/views/supply/reserve/components/reserve_detail'
  32. import ReserveForm from '@/views/supply/reserve/components/reserve_form'
  33. let that
  34. export default {
  35. mixins: [import_mixin],
  36. components: {
  37. ReserveDetail,
  38. ReserveForm,
  39. TemplatePage,
  40. Popu
  41. },
  42. filters: {
  43. statusFilter(val) {
  44. const obj = that.statusList.find(o => o.value === val)
  45. return obj ? obj.label : ''
  46. }
  47. },
  48. data() {
  49. return {
  50. // 事件组合
  51. optionsEvensGroup: [
  52. [
  53. [
  54. {
  55. name: '新增',
  56. click: () => {
  57. this.toForm()
  58. },
  59. isRole: this.$checkBtnRole('add', this.$route.meta.roles)
  60. }
  61. ]
  62. ],
  63. [
  64. [
  65. {
  66. name: '下载模板',
  67. click: () => {
  68. reserveImportDataExcel({}, `${this.$route.meta.title}`)
  69. .then(res => {
  70. this.$message({
  71. message: '下载成功',
  72. type: 'success'
  73. })
  74. })
  75. .catch(err => {
  76. this.$message.error('下载失败')
  77. })
  78. },
  79. isRole: !this.isDealer
  80. }
  81. ]
  82. ],
  83. [
  84. [
  85. {
  86. name: '',
  87. render: this.importButton(reserveImportData),
  88. isRole: !this.isDealer
  89. }
  90. ]
  91. ]
  92. ],
  93. // 表格属性
  94. tableAttributes: {
  95. // 启用勾选列
  96. selectColumn: true
  97. },
  98. // 表格事件
  99. tableEvents: {
  100. 'selection-change': this.selectionChange
  101. },
  102. recordSelected: [],
  103. currentPage: 1, // 当前页码
  104. pageSize: 10, // 每页数量
  105. listTotal: 0, // 列表总数
  106. dataList: null, // 列表数据
  107. listLoading: false, // 列表加载loading
  108. screenForm: {
  109. // 筛选表单数据
  110. goodsName: '',
  111. goodsNum: '',
  112. orderNum: '',
  113. jxsName: '',
  114. jxsNum: '',
  115. date: [],
  116. createMan: '',
  117. updateMan: '',
  118. saleNum: '',
  119. model: '',
  120. status: '',
  121. warehouse: ''
  122. },
  123. statusList: [
  124. { label: '执行中', value: 1 },
  125. { label: '已关闭', value: 0 }
  126. ],
  127. warehouseList: [],
  128. isCollapse: true,
  129. queryItem: {},
  130. isShowDetail: false,
  131. isShowForm: false
  132. }
  133. },
  134. computed: {
  135. exParams() {
  136. return {
  137. materialName: this.screenForm.goodsName,
  138. materialCode: this.screenForm.goodsNum,
  139. customerNumber: this.screenForm.jxsNum,
  140. customerName: this.screenForm.jxsName,
  141. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  142. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  143. createBy: this.screenForm.createMan,
  144. updateBy: this.screenForm.updateMan,
  145. id: this.screenForm.orderNum,
  146. orderId: this.screenForm.saleNum,
  147. specification: this.screenForm.model,
  148. status: this.screenForm.status,
  149. correspondId: this.screenForm.warehouse
  150. }
  151. },
  152. isDealer() {
  153. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  154. }
  155. },
  156. beforeCreate() {
  157. that = this
  158. },
  159. created() {
  160. // this.getWarehouseList()
  161. // this.getList()
  162. // console.log(this.$route.meta.roles)
  163. },
  164. methods: {
  165. // 列表请求函数
  166. getList: reserveListV2,
  167. // 列表导出函数
  168. exportList: reserveListV2Export,
  169. // 表格列解析渲染数据更改
  170. columnParsing(item, defaultData) {
  171. return defaultData
  172. },
  173. // 监听勾选变化
  174. selectionChange(data) {
  175. this.recordSelected = data
  176. },
  177. operation() {
  178. return (h, { row, index, column }) => {
  179. return (
  180. <div class="operation-btns">
  181. <el-button
  182. size="mini"
  183. type="text"
  184. onClick={async () => {
  185. this.toDetail(row)
  186. }}
  187. >
  188. 详情
  189. </el-button>
  190. {this.$checkBtnRole('edit', this.$route.meta.roles) && !row.printNum ? (
  191. <el-button
  192. size="mini"
  193. type="text"
  194. onClick={async () => {
  195. this.toForm(row)
  196. }}
  197. >
  198. 编辑
  199. </el-button>
  200. ) : (
  201. ''
  202. )}
  203. {this.$checkBtnRole('examine', this.$route.meta.roles) && row.status === 1 ? (
  204. <el-popconfirm
  205. onOnConfirm={async () => {
  206. this.handleClose(row.itemId)
  207. }}
  208. title="是否确定需要关闭该项内容?"
  209. >
  210. <el-button slot="reference" size="mini" type="text">
  211. 关闭
  212. </el-button>
  213. </el-popconfirm>
  214. ) : (
  215. ''
  216. )}
  217. </div>
  218. )
  219. }
  220. },
  221. // 获取仓库列表
  222. getWarehouseList() {
  223. getWarehouseList({
  224. pageNum: 1,
  225. pageSize: -1
  226. }).then(res => {
  227. this.warehouseList = res.data.records
  228. })
  229. },
  230. // 查询列表
  231. // getList() {
  232. // this.listLoading = true
  233. // let params = {
  234. // pageNum: this.currentPage,
  235. // pageSize: this.pageSize,
  236. // materialName: this.screenForm.goodsName,
  237. // materialCode: this.screenForm.goodsNum,
  238. // customerNumber: this.screenForm.jxsNum,
  239. // customerName: this.screenForm.jxsName,
  240. // startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  241. // endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  242. // createBy: this.screenForm.createMan,
  243. // updateBy: this.screenForm.updateMan,
  244. // id: this.screenForm.orderNum,
  245. // orderId: this.screenForm.saleNum,
  246. // specification: this.screenForm.model,
  247. // status: this.screenForm.status,
  248. // correspondId: this.screenForm.warehouse
  249. // }
  250. // getList(params).then(res => {
  251. // res.data.records.forEach(item => {
  252. // item.sums1 = ['oldNum', 'reservedNum', 'qty']
  253. // item.sums2 = []
  254. // })
  255. // this.dataList = res.data.records
  256. // this.listTotal = res.data.total
  257. // this.listLoading = false
  258. // })
  259. // },
  260. // 提交筛选表单
  261. submitScreenForm() {
  262. this.currentPage = 1
  263. this.getList()
  264. },
  265. // 重置筛选表单
  266. resetScreenForm() {
  267. this.$refs.screenForm.resetFields()
  268. this.currentPage = 1
  269. this.getList()
  270. },
  271. // 更改每页数量
  272. handleSizeChange(val) {
  273. this.pageSize = val
  274. this.currentPage = 1
  275. this.getList()
  276. },
  277. // 更改当前页
  278. handleCurrentChange(val) {
  279. this.currentPage = val
  280. this.getList()
  281. },
  282. // 进入表单
  283. toForm(item) {
  284. this.queryItem = item
  285. this.isShowForm = true
  286. },
  287. // 进入详情
  288. toDetail(item) {
  289. this.queryItem = item
  290. this.isShowDetail = true
  291. },
  292. backList() {
  293. this.queryItem = {}
  294. this.isShowDetail = false
  295. this.isShowForm = false
  296. this.$refs.pageRef.refreshList()
  297. },
  298. // 关闭
  299. handleClose(id) {
  300. closeData({ itemId: id }).then(res => {
  301. this.$successMsg()
  302. // this.getList()
  303. this.$refs.pageRef.refreshList()
  304. })
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .flex {
  311. display: flex;
  312. }
  313. .ml {
  314. margin-left: 10px;
  315. }
  316. </style>