list.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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="{ x: 1150, y: tableHeight }"
  37. bordered>
  38. <!-- 单号 -->
  39. <template slot="checkWarehouseNo" slot-scope="text, record">
  40. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_inventoryCheckingDetail')" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
  41. <span v-else>{{ record.checkWarehouseNo }}</span>
  42. </template>
  43. <!-- 盈亏数量 -->
  44. <template slot="totalLossQty" slot-scope="text, record">
  45. <span :style="{ color: record.totalLossQty>0?'red':record.totalLossQty<0?'green':'', fontWeight: record.totalLossQty!=0?'bold':'' }">{{ (record.totalLossQty || record.totalLossQty==0) ? Math.abs(record.totalLossQty) : '--' }}</span>
  46. </template>
  47. <!-- 操作 -->
  48. <template slot="action" slot-scope="text, record">
  49. <a-button
  50. size="small"
  51. v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
  52. type="link"
  53. class="button-info"
  54. @click="handleExamine(record, true)"
  55. id="warehousingAudit-adopt-btn">通过</a-button>
  56. <a-button
  57. size="small"
  58. v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
  59. type="link"
  60. class="button-warning"
  61. @click="handleExamine(record, false)"
  62. id="warehousingAudit-unadopt-btn">不通过</a-button>
  63. <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit'))">--</span>
  64. </template>
  65. </s-table>
  66. </a-spin>
  67. <!-- 详情 -->
  68. <inventoryChecking-detail-modal :openModal="openDetailModal" :itemSn="itemSn" @close="handleDetailClose" />
  69. </a-card>
  70. </template>
  71. <script>
  72. import { STable, VSelect } from '@/components'
  73. import rangeDate from '@/views/common/rangeDate.vue'
  74. import inventoryCheckingDetailModal from '@/views/inventoryManagement/inventoryChecking/detailModal.vue'
  75. import { checkWarehouseAuditList, checkWarehouseFinanceAudit } from '@/api/checkWarehouse'
  76. export default {
  77. components: { STable, VSelect, rangeDate, inventoryCheckingDetailModal },
  78. data () {
  79. return {
  80. spinning: false,
  81. disabled: false, // 查询、重置按钮是否可操作
  82. tableHeight: 0,
  83. // 查询参数
  84. queryParam: {
  85. beginDate: undefined,
  86. endDate: undefined,
  87. checkWarehouseNo: ''
  88. },
  89. // 表头
  90. columns: [
  91. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  92. { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, align: 'center' },
  93. { title: '总款数', dataIndex: 'productTotalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  94. { title: '总数量', dataIndex: 'totalStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  95. { title: '总成本', dataIndex: 'totalStockCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  96. { title: '盘盈数量', dataIndex: 'totalProfitQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  97. { title: '盘亏数量', scopedSlots: { customRender: 'totalLossQty' }, width: 80, align: 'center' },
  98. { title: '盘点完成时间', dataIndex: 'checkTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  99. { title: '财务审核时间', dataIndex: 'financeAuditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '财务审核状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '操作', scopedSlots: { customRender: 'action' }, width: 110, align: 'center', fixed: 'right' }
  102. ],
  103. // 加载数据方法 必须为 Promise 对象
  104. loadData: parameter => {
  105. this.disabled = true
  106. this.spinning = true
  107. return checkWarehouseAuditList(Object.assign(parameter, this.queryParam)).then(res => {
  108. const data = res.data
  109. const no = (data.pageNo - 1) * data.pageSize
  110. for (var i = 0; i < data.list.length; i++) {
  111. data.list[i].no = no + i + 1
  112. data.list[i].financeFinishTime = data.list[i].financeAuditTime
  113. }
  114. this.disabled = false
  115. this.spinning = false
  116. return data
  117. })
  118. },
  119. productTotal: null,
  120. openDetailModal: false,
  121. itemSn: null
  122. }
  123. },
  124. methods: {
  125. // 时间 change
  126. dateChange (date) {
  127. this.queryParam.beginDate = date[0]
  128. this.queryParam.endDate = date[1]
  129. },
  130. // 详情
  131. handleDetail (row) {
  132. this.itemSn = row.checkWarehouseSn
  133. this.openDetailModal = true
  134. },
  135. handleDetailClose () {
  136. this.itemSn = null
  137. this.openDetailModal = false
  138. },
  139. // 审核
  140. handleExamine (row, type) {
  141. const _this = this
  142. this.$confirm({
  143. title: '提示',
  144. content: '确定要进行' + (type ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  145. centered: true,
  146. onOk () {
  147. _this.spinning = true
  148. checkWarehouseFinanceAudit({ id: row.id, auditFlag: type }).then(res => {
  149. if (res.status == 200) {
  150. _this.$message.success(res.message)
  151. _this.$refs.table.refresh()
  152. _this.spinning = false
  153. } else {
  154. _this.spinning = false
  155. }
  156. })
  157. }
  158. })
  159. },
  160. // 重置
  161. resetSearchForm () {
  162. this.$refs.rangeDate.resetDate()
  163. this.queryParam.beginDate = undefined
  164. this.queryParam.endDate = undefined
  165. this.queryParam.checkWarehouseNo = ''
  166. this.$refs.table.refresh(true)
  167. },
  168. setTableH () {
  169. const tableSearchH = this.$refs.tableSearch.offsetHeight
  170. this.tableHeight = window.innerHeight - tableSearchH - 195
  171. }
  172. },
  173. mounted () {
  174. const _this = this
  175. this.$nextTick(() => { // 页面渲染完成后的回调
  176. _this.setTableH()
  177. })
  178. },
  179. watch: {
  180. advanced (newValue, oldValue) {
  181. const _this = this
  182. setTimeout(() => {
  183. _this.setTableH()
  184. }, 400)
  185. }
  186. }
  187. }
  188. </script>