list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  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="inventoryConfirmationList-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-model-item label="仓库">
  15. <chooseWarehouse ref="warehouse" isPermission v-model="queryParam.warehouseSn"></chooseWarehouse>
  16. </a-form-model-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryConfirmationList-refresh">查询</a-button>
  20. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryConfirmationList-reset">重置</a-button>
  21. </a-col>
  22. </a-row>
  23. </a-form>
  24. </div>
  25. </a-card>
  26. <a-card size="small" :bordered="false" class="inventoryConfirmationList-wrap">
  27. <a-spin :spinning="spinning" tip="Loading...">
  28. <!-- 标签页 -->
  29. <a-tabs :default-active-key="queryParam.state" @change="handleTabChange" class="inventoryConfirmationList-tabs">
  30. <a-tab-pane v-for="item in tabPaneData" :key="item.type">
  31. <span slot="tab">{{ item.name }}</span>
  32. </a-tab-pane>
  33. </a-tabs>
  34. <!-- 列表 -->
  35. <s-table
  36. class="sTable fixPagination"
  37. ref="table"
  38. :style="{ height: tableHeight+70+'px' }"
  39. size="small"
  40. :rowKey="(record) => record.id"
  41. :columns="columns"
  42. :data="loadData"
  43. :pageSize="30"
  44. :scroll="{ y: tableHeight }"
  45. :defaultLoadData="false"
  46. bordered>
  47. <!-- 单号 -->
  48. <template slot="checkWarehouseNo" slot-scope="text, record">
  49. <span v-if="$hasPermissions('B_inventoryConfirmationDetail')" class="link-bule" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
  50. <span v-else>{{ record.checkWarehouseNo }}</span>
  51. </template>
  52. <!-- 操作 -->
  53. <template slot="action" slot-scope="text, record">
  54. <a-button
  55. size="small"
  56. type="link"
  57. class="button-info"
  58. v-if="$hasPermissions('B_inventoryConfirmationConfirm')"
  59. @click="handleConfirm(record)"
  60. id="inventoryConfirmationList-audit-btn">盘点确认</a-button>
  61. <a-button
  62. size="small"
  63. type="link"
  64. class="button-success"
  65. v-if="$hasPermissions('B_inventoryConfirmationCheck')"
  66. @click="handleCheck(record)"
  67. id="inventoryConfirmationList-audit-btn">重新盘点</a-button>
  68. <span v-if="!($hasPermissions('B_inventoryConfirmationConfirm') && $hasPermissions('B_inventoryConfirmationCheck'))">--</span>
  69. </template>
  70. </s-table>
  71. </a-spin>
  72. </a-card>
  73. </div>
  74. </template>
  75. <script>
  76. import { commonMixin } from '@/utils/mixin'
  77. import { STable, VSelect } from '@/components'
  78. import chooseWarehouse from '@/views/common/chooseWarehouse'
  79. import { verifyQueryPage, checkWarehouseReCheck, checkWarehouseFinanceAudit } from '@/api/checkWarehouse'
  80. export default {
  81. name: 'InventoryConfirmationList',
  82. mixins: [commonMixin],
  83. components: { STable, VSelect, chooseWarehouse },
  84. data () {
  85. return {
  86. spinning: false,
  87. tableHeight: 0,
  88. queryParam: { // 查询条件
  89. deleteFlag: '0',
  90. state: 'WAIT_FINANCE_AUDIT',
  91. checkWarehouseNo: '',
  92. warehouseSn: undefined
  93. },
  94. disabled: false, // 查询、重置按钮是否可操作
  95. tabPaneData: [
  96. { name: '未完结', type: 'WAIT_FINANCE_AUDIT' },
  97. { name: '已完结', type: 'FINISH' }
  98. ],
  99. // 加载数据方法 必须为 Promise 对象
  100. loadData: parameter => {
  101. this.disabled = true
  102. this.spinning = true
  103. return verifyQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
  104. let data
  105. if (res.status == 200) {
  106. data = res.data
  107. const no = (data.pageNo - 1) * data.pageSize
  108. for (var i = 0; i < data.list.length; i++) {
  109. data.list[i].no = no + i + 1
  110. }
  111. this.disabled = false
  112. }
  113. this.spinning = false
  114. return data
  115. })
  116. }
  117. }
  118. },
  119. computed: {
  120. columns () {
  121. let arr = []
  122. if (this.queryParam.state == 'WAIT_FINANCE_AUDIT') { // 未完结
  123. arr = [
  124. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  125. { title: '盘点单号', dataIndex: 'checkWarehouseNo', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
  126. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
  129. { title: '仓库', dataIndex: 'warehouseName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
  130. { title: '盘点时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '14%', customRender: function (text) { return text || '--' }, ellipsis: true },
  132. { title: '监盘时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
  134. ]
  135. } else if (this.queryParam.state == 'FINISH') { // 已完结
  136. arr = [
  137. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  138. { title: '盘点单号', dataIndex: 'checkWarehouseNo', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '14%', align: 'center' },
  139. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  140. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  141. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
  142. { title: '仓库', dataIndex: 'warehouseName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
  143. { title: '盘点时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '16%', customRender: function (text) { return text || '--' }, ellipsis: true },
  145. { title: '监盘时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  146. { title: '财务确认时间', dataIndex: 'financeAuditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  147. ]
  148. }
  149. return arr
  150. }
  151. },
  152. methods: {
  153. // 选择类型
  154. handleTabChange (key) {
  155. this.queryParam.state = key
  156. this.$refs.table.refresh(true)
  157. },
  158. // 详情
  159. handleDetail (row) {
  160. if (this.$hasPermissions('B_inventoryConfirmationDetail')) {
  161. this.$router.push({ name:"inventoryConfirmationDetail",params:{sn:row.checkWarehouseSn} })
  162. }
  163. },
  164. // 盘点确认
  165. handleConfirm (row) {
  166. const _this = this
  167. this.$confirm({
  168. title: '提示',
  169. content: '确认盘点结果正确无误吗?',
  170. centered: true,
  171. closable: true,
  172. onOk () {
  173. _this.spinning = true
  174. checkWarehouseFinanceAudit({ checkWarehouseSn: row.checkWarehouseSn }).then(res => {
  175. if (res.status == 200) {
  176. _this.$message.success(res.message)
  177. _this.$refs.table.refresh(true)
  178. _this.spinning = false
  179. } else {
  180. _this.spinning = false
  181. }
  182. })
  183. }
  184. })
  185. },
  186. // 重新盘点
  187. handleCheck (row) {
  188. const _this = this
  189. this.$confirm({
  190. title: '提示',
  191. content: '确认要重新盘点吗?',
  192. centered: true,
  193. closable: true,
  194. onOk () {
  195. _this.spinning = true
  196. checkWarehouseReCheck({ checkWarehouseSn: row.checkWarehouseSn }).then(res => {
  197. if (res.status == 200) {
  198. _this.$message.success(res.message)
  199. _this.$refs.table.refresh(true)
  200. _this.spinning = false
  201. } else {
  202. _this.spinning = false
  203. }
  204. })
  205. }
  206. })
  207. },
  208. resetSearchForm () {
  209. this.queryParam.checkWarehouseNo = ''
  210. this.queryParam.warehouseSn = undefined
  211. this.$refs.table.refresh(true)
  212. },
  213. pageInit () {
  214. const _this = this
  215. this.$nextTick(() => { // 页面渲染完成后的回调
  216. _this.setTableH()
  217. })
  218. },
  219. setTableH () {
  220. this.tableHeight = window.innerHeight - 290
  221. }
  222. },
  223. watch: {
  224. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  225. this.setTableH()
  226. }
  227. },
  228. mounted () {
  229. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  230. this.pageInit()
  231. this.$refs.table.refresh(true)
  232. }
  233. },
  234. activated () {
  235. // 如果是新页签打开,则重置当前页面
  236. if (this.$store.state.app.isNewTab) {
  237. this.pageInit()
  238. this.$refs.table.refresh(true)
  239. }
  240. // 仅刷新列表,不重置页面
  241. if (this.$store.state.app.updateList) {
  242. this.pageInit()
  243. this.$refs.table.refresh()
  244. }
  245. },
  246. beforeRouteEnter (to, from, next) {
  247. next(vm => {})
  248. }
  249. }
  250. </script>
  251. <style lang="less">
  252. .inventoryConfirmationList-wrap{
  253. .ant-card-body{
  254. &:last-child{
  255. padding-top: 0;
  256. }
  257. }
  258. // tab样式
  259. .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  260. height: 30px!important;
  261. }
  262. .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  263. height: 30px!important;
  264. }
  265. .inventoryConfirmationList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  266. line-height: 26px!important;
  267. height: 30px!important;
  268. }
  269. }
  270. </style>