list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <a-card size="small" :bordered="false" class="accountManagementList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="36">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <a-range-picker
  11. :value="time"
  12. allowClear
  13. :disabledDate="disabledDate"
  14. format="YYYY-MM-DD"
  15. style="width: 100%;"
  16. @change="dateChange"/>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="调拨单号">
  21. <a-input allowClear placeholder="请输入调拨单号" v-model.tirm="queryParam.danhao"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="货架名称">
  26. <a-select placeholder="请搜索货架名称" allowClear style="width: 100%;">
  27. <a-select-option v-for="item in goodsShelveList">
  28. {{ }}
  29. </a-select-option>
  30. </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <template v-if="advanced">
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="产品编码">
  36. <a-input allowClear placeholder="请输入产品编码" v-model.tirm="queryParam.code"/>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="24">
  40. <a-form-item label="产品名称">
  41. <a-input allowClear placeholder="请输入产品名称" v-model.tirm="queryParam.name"/>
  42. </a-form-item>
  43. </a-col>
  44. </template>
  45. <a-col :md="6" :sm="24" style="padding-top: 4px;">
  46. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
  47. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  48. <a @click="advanced=!advanced" style="margin-left: 5px" v-if="activeKey==0">
  49. {{ advanced ? '收起' : '展开' }}
  50. <a-icon :type="advanced ? 'up' : 'down'"/>
  51. </a>
  52. </a-col>
  53. </a-row>
  54. </a-form>
  55. </div>
  56. <a-tabs v-model="activeKey" type="card" size="small" @change="callback">
  57. <a-tab-pane :key="0" tab="全部">
  58. </a-tab-pane>
  59. <a-tab-pane :key="1">
  60. <span slot="tab">
  61. 待退库
  62. <a-badge count="5" :offset="[0,-20]"/>
  63. </span>
  64. </a-tab-pane>
  65. <a-tab-pane :key="2" tab="已完成">
  66. </a-tab-pane>
  67. <a-tab-pane :key="3" tab="已取消">
  68. </a-tab-pane>
  69. </a-tabs>
  70. <!-- <a-tabs v-model="activeKey" type="card" @change="callback" size="small">
  71. <a-tab-pane :key="item.code" :tab="item.name" v-for="item in tabsList">
  72. <span slot="tab">
  73. <a-badge count="5" :offset="[0,-20]"/>
  74. </span>
  75. </a-tab-pane>
  76. </a-tabs> -->
  77. <a-table
  78. class="sTable fixPagination"
  79. ref="table"
  80. :style="{ height: tableHeight+77+'px' }"
  81. size="small"
  82. :rowKey="(record) => record.id"
  83. :columns="columns"
  84. :data="loadData"
  85. :scroll="{ y:tableHeight }"
  86. :showPagination="false"
  87. :defaultLoadData="false"
  88. :expandIconColumnIndex="-1"
  89. :expandIconAsCell="false"
  90. :defaultExpandAllRows="true"
  91. bordered>
  92. <template slot="action" slot-scope="text, record">
  93. <a-button
  94. size="small"
  95. type="link"
  96. class="button-primary"
  97. @click="handleEdit(record)"
  98. id="shelfMonitoringList-warehousing-btn">退库</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. class="button-primary"
  103. @click="handleCancel(record)"
  104. id="shelfMonitoringList-warehousing-btn">取消调回单</a-button>
  105. </template>
  106. <a-table
  107. class="inner-table"
  108. slot="expandedRowRender"
  109. slot-scope="text"
  110. :columns="innerColumns"
  111. :data-source="innerData"
  112. :pagination="false"
  113. >
  114. </a-table>
  115. </a-table>
  116. </a-spin>
  117. <!-- 申请提现 -->
  118. <confirmModal :isOpenModal="showModal" :currentData="currentData" @close="showModal=false" @refresh="$refs.table.refresh(true)"></confirmModal>
  119. </a-card>
  120. </template>
  121. <script>
  122. import moment from 'moment'
  123. import { STable } from '@/components'
  124. import confirmModal from './confirmModal.vue'
  125. import getDate from '@/libs/getDate.js'
  126. export default {
  127. components: { STable, confirmModal },
  128. data () {
  129. return {
  130. spinning: false,
  131. disabled: false,
  132. tableHeight: 0,
  133. showModal: false,
  134. advanced: false,
  135. currentData: null,
  136. activeKey: 0, // 默认的tab
  137. tabsList: [{ code: 0, name: '全部' }, { code: 1, name: '待退库' }, { code: 2, name: '已完成' }, { code: 3, name: '已取消' }],
  138. time: [
  139. getDate.getCurrMonthDays().starttime,
  140. getDate.getCurrMonthDays().endtime
  141. ],
  142. goodsShelveList: [], // 货架数据
  143. queryParam: {
  144. beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
  145. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  146. danhao: '',
  147. name: '',
  148. code: ''
  149. },
  150. columns: [
  151. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  152. { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center' },
  153. { title: '调回单号', dataIndex: 'name', width: '30%', align: 'center' },
  154. { title: '货架名称', dataIndex: 'remarks', width: '10%', align: 'center', scopedSlots: { customRender: 'remarks' } },
  155. { title: '状态', width: '10%', align: 'center' },
  156. { title: '调回总量', width: '10%', align: 'center' },
  157. { title: '实退总量', width: '10%', align: 'center' },
  158. { title: '操作', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
  159. ],
  160. innerColumns: [
  161. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  162. { title: '产品编码', dataIndex: 'createDate', width: '15%', align: 'center' },
  163. { title: '产品名称', dataIndex: 'createDate', width: '15%', align: 'center' },
  164. { title: '调回数量', dataIndex: 'createDate', width: '15%', align: 'center' },
  165. { title: '实退数量', dataIndex: 'createDate', width: '15%', align: 'center' },
  166. { title: '单位', dataIndex: 'createDate', width: '15%', align: 'center' }
  167. ],
  168. innerData: [],
  169. // 加载数据方法 必须为 Promise 对象
  170. loadData: parameter => {
  171. // this.disabled = true
  172. // this.spinning = true
  173. return new Promise(function (resolve, reject) {
  174. const data = {
  175. list: [{ id: 1, createDate: '2020-08-09' }]
  176. }
  177. for (var i = 0; i < data.list.length; i++) {
  178. data.list[i].no = i + 1
  179. }
  180. // this.spinning = false
  181. // this.disabled = false
  182. resolve(data)
  183. })
  184. // return employeeList(Object.assign(parameter, this.queryParam)).then(res => {
  185. // let data
  186. // if (res.status == 200) {
  187. // data = res.data
  188. // const no = (data.pageNo - 1) * data.pageSize
  189. // for (var i = 0; i < data.list.length; i++) {
  190. // data.list[i].no = no + i + 1
  191. // }
  192. // this.disabled = false
  193. // }
  194. // this.spinning = false
  195. // return data
  196. // })
  197. }
  198. }
  199. },
  200. methods: {
  201. // 时间改变
  202. dateChange (date) {
  203. this.queryParam.beginDate = date[0]
  204. this.queryParam.endDate = date[1]
  205. },
  206. // 禁止选择今天之后的日期
  207. disabledDate (current) {
  208. return current && current > moment().endOf('day')
  209. },
  210. // 切换tab
  211. callback (key) {
  212. console.log(key)
  213. this.activeKey = key
  214. },
  215. // 重置
  216. resetSearchForm () {
  217. this.time = []
  218. },
  219. // 申请提现
  220. handleTX () {
  221. this.showModal = true
  222. },
  223. // 退库
  224. handleEdit (row) {
  225. this.showModal = true
  226. this.currentData = row
  227. },
  228. // 取消掉回单
  229. handleCancel (row) {
  230. this.$confirm({
  231. title: '提示',
  232. content: '确定取消调回单吗?',
  233. centered: true,
  234. onOk: () => {
  235. //
  236. }
  237. })
  238. },
  239. setTableH () {
  240. const tableSearchH = this.$refs.tableSearch.offsetHeight
  241. this.tableHeight = window.innerHeight - tableSearchH - 265
  242. },
  243. pageInit () {
  244. const _this = this
  245. this.$nextTick(() => { // 页面渲染完成后的回调
  246. _this.setTableH()
  247. })
  248. }
  249. },
  250. mounted () {
  251. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  252. this.pageInit()
  253. this.resetSearchForm()
  254. }
  255. },
  256. watch: {
  257. advanced (newValue, oldValue) {
  258. const _this = this
  259. setTimeout(() => {
  260. _this.setTableH()
  261. }, 400)
  262. },
  263. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  264. this.setTableH()
  265. }
  266. },
  267. activated () {
  268. // 如果是新页签打开,则重置当前页面
  269. if (this.$store.state.app.isNewTab) {
  270. this.pageInit()
  271. this.resetSearchForm()
  272. }
  273. // 仅刷新列表,不重置页面
  274. if (this.$store.state.app.updateList) {
  275. this.pageInit()
  276. this.$refs.table.refresh()
  277. }
  278. },
  279. beforeRouteEnter (to, from, next) {
  280. next(vm => {})
  281. }
  282. }
  283. </script>
  284. <style lang="less">
  285. .accountManagementList-wrap{
  286. .inner-table{
  287. background-color: #fff;
  288. .ant-table{
  289. margin: 10px 150px;
  290. border-left: 1px solid #eee;
  291. border-bottom: 1px solid #eee;
  292. }
  293. }
  294. }
  295. </style>