list.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
  60. type="link"
  61. class="button-warning"
  62. @click="handleExamine(record, false)"
  63. id="warehousingAudit-unadopt-btn">不通过</a-button>
  64. <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit'))">--</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 } 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: '17%', 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: '7%', 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: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', 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. const data = res.data
  110. const no = (data.pageNo - 1) * data.pageSize
  111. for (var i = 0; i < data.list.length; i++) {
  112. data.list[i].no = no + i + 1
  113. data.list[i].financeFinishTime = data.list[i].financeAuditTime
  114. }
  115. this.disabled = false
  116. this.spinning = false
  117. return data
  118. })
  119. },
  120. productTotal: null,
  121. openDetailModal: false,
  122. itemSn: null
  123. }
  124. },
  125. methods: {
  126. // 时间 change
  127. dateChange (date) {
  128. this.queryParam.beginDate = date[0]
  129. this.queryParam.endDate = date[1]
  130. },
  131. // 详情
  132. handleDetail (row) {
  133. this.itemSn = row.checkWarehouseSn
  134. this.openDetailModal = true
  135. },
  136. handleDetailClose () {
  137. this.itemSn = null
  138. this.openDetailModal = false
  139. },
  140. // 审核
  141. handleExamine (row, type) {
  142. const _this = this
  143. this.$confirm({
  144. title: '提示',
  145. content: '确定要进行' + (type ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  146. centered: true,
  147. onOk () {
  148. _this.spinning = true
  149. checkWarehouseFinanceAudit({ id: row.id, auditFlag: type }).then(res => {
  150. if (res.status == 200) {
  151. _this.$message.success(res.message)
  152. _this.$refs.table.refresh()
  153. _this.spinning = false
  154. } else {
  155. _this.spinning = false
  156. }
  157. })
  158. }
  159. })
  160. },
  161. // 重置
  162. resetSearchForm () {
  163. this.$refs.rangeDate.resetDate()
  164. this.queryParam.beginDate = undefined
  165. this.queryParam.endDate = undefined
  166. this.queryParam.checkWarehouseNo = ''
  167. this.$refs.table.refresh(true)
  168. },
  169. pageInit () {
  170. const _this = this
  171. this.$nextTick(() => { // 页面渲染完成后的回调
  172. _this.setTableH()
  173. })
  174. },
  175. setTableH () {
  176. const tableSearchH = this.$refs.tableSearch.offsetHeight
  177. this.tableHeight = window.innerHeight - tableSearchH - 195
  178. }
  179. },
  180. watch: {
  181. advanced (newValue, oldValue) {
  182. const _this = this
  183. setTimeout(() => {
  184. _this.setTableH()
  185. }, 400)
  186. },
  187. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  188. this.setTableH()
  189. }
  190. },
  191. mounted () {
  192. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  193. this.pageInit()
  194. this.resetSearchForm()
  195. }
  196. },
  197. activated () {
  198. // 如果是新页签打开,则重置当前页面
  199. if (this.$store.state.app.isNewTab) {
  200. this.pageInit()
  201. this.resetSearchForm()
  202. }
  203. },
  204. beforeRouteEnter (to, from, next) {
  205. next(vm => {})
  206. }
  207. }
  208. </script>