list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <a-card size="small" :bordered="false" class="inventoryCheckAuditList-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="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="盘点单号">
  10. <a-input id="inventoryCheckAuditList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="盘点完成时间">
  15. <rangeDate ref="rangeDate" @change="dateChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <span class="table-page-search-submitButtons">
  20. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckAuditList-refresh">查询</a-button>
  21. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="inventoryCheckAuditList-reset">重置</a-button>
  22. </span>
  23. </a-col>
  24. </a-row>
  25. </a-form>
  26. </div>
  27. <!-- 列表 -->
  28. <s-table
  29. class="sTable fixPagination"
  30. ref="table"
  31. :style="{ height: tableHeight+84.5+'px' }"
  32. size="small"
  33. :rowKey="(record) => record.id"
  34. :columns="columns"
  35. :data="loadData"
  36. :scroll="{ y: tableHeight }"
  37. :defaultLoadData="false"
  38. bordered>
  39. <!-- 单号 -->
  40. <template slot="checkWarehouseNo" slot-scope="text, record">
  41. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_inventoryCheckingDetail')" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
  42. <span v-else>{{ record.checkWarehouseNo }}</span>
  43. </template>
  44. <!-- 盈亏数量 -->
  45. <template slot="totalLossQty" slot-scope="text, record">
  46. <span>{{ (record.totalLossQty || record.totalLossQty==0) ? Math.abs(record.totalLossQty) : '--' }}</span>
  47. </template>
  48. <!-- 操作 -->
  49. <template slot="action" slot-scope="text, record">
  50. <a-button
  51. size="small"
  52. v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
  53. type="link"
  54. class="button-info"
  55. @click="handleExamine(record, true)"
  56. id="warehousingAudit-adopt-btn">通过</a-button>
  57. <a-button
  58. size="small"
  59. type="link"
  60. v-if="record.state == 'WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckingAgain')"
  61. class="button-warning"
  62. @click="handleAgain(record)"
  63. >重盘</a-button>
  64. <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && ($hasPermissions('B_inventoryCheckAuditAudit') || $hasPermissions('B_inventoryCheckingAgain')))">--</span>
  65. </template>
  66. </s-table>
  67. </a-spin>
  68. <!-- 详情 -->
  69. <inventoryChecking-detail-modal :openModal="openDetailModal" :itemSn="itemSn" @close="handleDetailClose" />
  70. </a-card>
  71. </template>
  72. <script>
  73. import { STable, VSelect } from '@/components'
  74. import rangeDate from '@/views/common/rangeDate.vue'
  75. import inventoryCheckingDetailModal from '@/views/inventoryManagement/inventoryChecking/detailModal.vue'
  76. import { checkWarehouseAuditList, checkWarehouseFinanceAudit, checkWarehouseReInventory } from '@/api/checkWarehouse'
  77. export default {
  78. components: { STable, VSelect, rangeDate, inventoryCheckingDetailModal },
  79. data () {
  80. return {
  81. spinning: false,
  82. disabled: false, // 查询、重置按钮是否可操作
  83. tableHeight: 0,
  84. // 查询参数
  85. queryParam: {
  86. beginDate: undefined,
  87. endDate: undefined,
  88. checkWarehouseNo: ''
  89. },
  90. // 表头
  91. columns: [
  92. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  93. { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
  94. { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  95. { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  96. { title: '总成本', dataIndex: 'totalStockCost', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  97. { title: '盘盈数量', dataIndex: 'totalProfitQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  98. { title: '盘亏数量', scopedSlots: { customRender: 'totalLossQty' }, width: '7%', align: 'center' },
  99. { title: '盘点完成时间', dataIndex: 'checkTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '财务审核时间', dataIndex: 'financeAuditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '财务审核状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  103. ],
  104. // 加载数据方法 必须为 Promise 对象
  105. loadData: parameter => {
  106. this.disabled = true
  107. this.spinning = true
  108. return checkWarehouseAuditList(Object.assign(parameter, this.queryParam)).then(res => {
  109. let data
  110. if (res.status == 200) {
  111. data = res.data
  112. const no = (data.pageNo - 1) * data.pageSize
  113. for (var i = 0; i < data.list.length; i++) {
  114. data.list[i].no = no + i + 1
  115. data.list[i].financeFinishTime = data.list[i].financeAuditTime
  116. }
  117. this.disabled = false
  118. }
  119. this.spinning = false
  120. return data
  121. })
  122. },
  123. productTotal: null,
  124. openDetailModal: false,
  125. itemSn: null
  126. }
  127. },
  128. methods: {
  129. // 时间 change
  130. dateChange (date) {
  131. this.queryParam.beginDate = date[0]
  132. this.queryParam.endDate = date[1]
  133. },
  134. // 详情
  135. handleDetail (row) {
  136. this.itemSn = row.checkWarehouseSn
  137. this.openDetailModal = true
  138. },
  139. handleDetailClose () {
  140. this.itemSn = null
  141. this.openDetailModal = false
  142. },
  143. // 审核
  144. handleExamine (row, type) {
  145. const _this = this
  146. this.$confirm({
  147. title: '提示',
  148. content: '确定要进行' + (type ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  149. centered: true,
  150. onOk () {
  151. _this.spinning = true
  152. checkWarehouseFinanceAudit({ id: row.id, auditFlag: type }).then(res => {
  153. if (res.status == 200) {
  154. _this.$message.success(res.message)
  155. _this.$refs.table.refresh()
  156. _this.spinning = false
  157. } else {
  158. _this.spinning = false
  159. }
  160. })
  161. }
  162. })
  163. },
  164. // 重盘
  165. handleAgain (row) {
  166. const _this = this
  167. this.$confirm({
  168. title: '提示',
  169. content: '重新盘点后,盘点单状态回退到待提交。确认重新盘点吗?',
  170. centered: true,
  171. onOk () {
  172. checkWarehouseReInventory({ id: row.id }).then(res => {
  173. if (res.status == 200) {
  174. _this.$message.success(res.message)
  175. _this.$refs.table.refresh()
  176. }
  177. })
  178. }
  179. })
  180. },
  181. // 重置
  182. resetSearchForm () {
  183. this.$refs.rangeDate.resetDate()
  184. this.queryParam.beginDate = undefined
  185. this.queryParam.endDate = undefined
  186. this.queryParam.checkWarehouseNo = ''
  187. this.$refs.table.refresh(true)
  188. },
  189. pageInit () {
  190. const _this = this
  191. this.$nextTick(() => { // 页面渲染完成后的回调
  192. _this.setTableH()
  193. })
  194. },
  195. setTableH () {
  196. const tableSearchH = this.$refs.tableSearch.offsetHeight
  197. this.tableHeight = window.innerHeight - tableSearchH - 195
  198. }
  199. },
  200. watch: {
  201. advanced (newValue, oldValue) {
  202. const _this = this
  203. setTimeout(() => {
  204. _this.setTableH()
  205. }, 400)
  206. },
  207. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  208. this.setTableH()
  209. }
  210. },
  211. mounted () {
  212. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  213. this.pageInit()
  214. this.resetSearchForm()
  215. }
  216. },
  217. activated () {
  218. // 如果是新页签打开,则重置当前页面
  219. if (this.$store.state.app.isNewTab) {
  220. this.pageInit()
  221. this.resetSearchForm()
  222. }
  223. },
  224. beforeRouteEnter (to, from, next) {
  225. next(vm => {})
  226. }
  227. }
  228. </script>