list.vue 11 KB

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