list.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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-primary"
  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-error"
  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 { commonMixin } from '@/utils/mixin'
  74. import { STable, VSelect } from '@/components'
  75. import rangeDate from '@/views/common/rangeDate.vue'
  76. import inventoryCheckingDetailModal from '@/views/inventoryManagement/inventoryChecking/detailModal.vue'
  77. import { checkWarehouseAuditList, checkWarehouseFinanceAudit, checkWarehouseReInventory } from '@/api/checkWarehouse'
  78. export default {
  79. name: 'InventoryCheckingList',
  80. components: { STable, VSelect, rangeDate, inventoryCheckingDetailModal },
  81. mixins: [commonMixin],
  82. data () {
  83. return {
  84. spinning: false,
  85. disabled: false, // 查询、重置按钮是否可操作
  86. tableHeight: 0,
  87. // 查询参数
  88. queryParam: {
  89. beginDate: undefined,
  90. endDate: undefined,
  91. checkWarehouseNo: ''
  92. },
  93. // 表头
  94. columns: [
  95. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  96. { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
  97. { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  98. { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '总成本', dataIndex: 'totalStockCost', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '盘盈数量', dataIndex: 'totalProfitQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '盘亏数量', scopedSlots: { customRender: 'totalLossQty' }, width: '7%', align: 'center' },
  102. { title: '盘点完成时间', dataIndex: 'checkTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  103. { title: '财务审核时间', dataIndex: 'financeAuditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  104. { title: '财务审核状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  105. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  106. ],
  107. // 加载数据方法 必须为 Promise 对象
  108. loadData: parameter => {
  109. this.disabled = true
  110. this.spinning = true
  111. return checkWarehouseAuditList(Object.assign(parameter, this.queryParam)).then(res => {
  112. let data
  113. if (res.status == 200) {
  114. data = res.data
  115. const no = (data.pageNo - 1) * data.pageSize
  116. for (var i = 0; i < data.list.length; i++) {
  117. data.list[i].no = no + i + 1
  118. data.list[i].financeFinishTime = data.list[i].financeAuditTime
  119. }
  120. this.disabled = false
  121. }
  122. this.spinning = false
  123. return data
  124. })
  125. },
  126. productTotal: null,
  127. openDetailModal: false,
  128. itemSn: null
  129. }
  130. },
  131. methods: {
  132. // 时间 change
  133. dateChange (date) {
  134. this.queryParam.beginDate = date[0]
  135. this.queryParam.endDate = date[1]
  136. },
  137. // 详情
  138. handleDetail (row) {
  139. this.itemSn = row.checkWarehouseSn
  140. this.openDetailModal = true
  141. },
  142. handleDetailClose () {
  143. this.itemSn = null
  144. this.openDetailModal = false
  145. },
  146. // 审核
  147. handleExamine (row, type) {
  148. const _this = this
  149. this.$confirm({
  150. title: '提示',
  151. content: '确定要进行' + (type ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  152. centered: true,
  153. onOk () {
  154. _this.spinning = true
  155. checkWarehouseFinanceAudit({ id: row.id, auditFlag: type }).then(res => {
  156. if (res.status == 200) {
  157. _this.$message.success(res.message)
  158. _this.$refs.table.refresh()
  159. _this.spinning = false
  160. } else {
  161. _this.spinning = false
  162. }
  163. })
  164. }
  165. })
  166. },
  167. // 重盘
  168. handleAgain (row) {
  169. const _this = this
  170. this.$confirm({
  171. title: '提示',
  172. content: '重新盘点后,盘点单状态回退到待提交。确认重新盘点吗?',
  173. centered: true,
  174. onOk () {
  175. checkWarehouseReInventory({ id: row.id }).then(res => {
  176. if (res.status == 200) {
  177. _this.$message.success(res.message)
  178. _this.$refs.table.refresh()
  179. }
  180. })
  181. }
  182. })
  183. },
  184. // 重置
  185. resetSearchForm () {
  186. this.$refs.rangeDate.resetDate()
  187. this.queryParam.beginDate = undefined
  188. this.queryParam.endDate = undefined
  189. this.queryParam.checkWarehouseNo = ''
  190. this.$refs.table.refresh(true)
  191. },
  192. pageInit () {
  193. const _this = this
  194. this.$nextTick(() => { // 页面渲染完成后的回调
  195. _this.setTableH()
  196. })
  197. },
  198. setTableH () {
  199. const tableSearchH = this.$refs.tableSearch.offsetHeight
  200. this.tableHeight = window.innerHeight - tableSearchH - 195
  201. }
  202. },
  203. watch: {
  204. advanced (newValue, oldValue) {
  205. const _this = this
  206. this.$nextTick(() => { // 页面渲染完成后的回调
  207. _this.setTableH()
  208. })
  209. },
  210. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  211. this.setTableH()
  212. }
  213. },
  214. mounted () {
  215. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  216. this.pageInit()
  217. this.resetSearchForm()
  218. }
  219. },
  220. activated () {
  221. // 如果是新页签打开,则重置当前页面
  222. if (this.$store.state.app.isNewTab) {
  223. this.pageInit()
  224. this.resetSearchForm()
  225. }
  226. },
  227. beforeRouteEnter (to, from, next) {
  228. next(vm => {})
  229. }
  230. }
  231. </script>