list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <a-card size="small" :bordered="false" class="inventoryCheckList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 标签页 -->
  5. <a-tabs type="card" :default-active-key="queryParam.deleteFlag" @change="handleTabChange" class="inventoryCheckList-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="inventoryCheckList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="4" :sm="24">
  20. <a-form-item label="仓库">
  21. <warehouse
  22. v-model="queryParam.warehouseSn"
  23. id="inventoryCheckList-warehouseSn"
  24. placeholder="请选择仓库"
  25. />
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="4" :sm="24">
  29. <a-form-item label="盘点状态">
  30. <v-select
  31. v-model="queryParam.checkState"
  32. ref="checkState"
  33. id="inventoryCheckList-checkState"
  34. code="CHECK_WAREHOUSE_STATE"
  35. placeholder="请选择盘点状态"
  36. allowClear
  37. ></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="4" :sm="24">
  41. <a-form-item label="监盘状态">
  42. <v-select
  43. v-model="queryParam.checkSuperviseState"
  44. ref="checkSuperviseState"
  45. id="inventoryCheckList-checkSuperviseState"
  46. code="CHECK_WAREHOUSE_SUPERVISE_STATE"
  47. placeholder="请选择监盘状态"
  48. allowClear
  49. ></v-select>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckList-refresh">查询</a-button>
  54. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckList-reset">重置</a-button>
  55. </a-col>
  56. </a-row>
  57. </a-form>
  58. </div>
  59. <!-- 操作按钮 -->
  60. <div class="table-operator">
  61. <a-button v-if="$hasPermissions('B_inventoryCheckAdd')" id="inventoryCheckList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
  62. </div>
  63. <!-- 列表 -->
  64. <s-table
  65. class="sTable fixPagination"
  66. ref="table"
  67. :style="{ height: tableHeight+84.5+'px' }"
  68. size="small"
  69. :rowKey="(record) => record.id"
  70. :columns="columns"
  71. :data="loadData"
  72. :scroll="{ y: tableHeight }"
  73. :defaultLoadData="false"
  74. bordered>
  75. <!-- 操作 -->
  76. <template slot="action" slot-scope="text, record">
  77. <a-button
  78. size="small"
  79. type="link"
  80. v-if="$hasPermissions('B_inventoryCheckDetail')"
  81. class="button-success"
  82. @click="handleDetail(record)"
  83. id="inventoryCheckList-audit-btn">详情</a-button>
  84. <span v-else>--</span>
  85. </template>
  86. </s-table>
  87. </a-spin>
  88. <!-- 新增盘点单 -->
  89. <inventory-check-add-modal :openModal="openAddModal" @ok="handleAddOk" @close="openAddModal=false" />
  90. <!-- 盘点校验 -->
  91. <common-modal
  92. :openModal="openCommonModal"
  93. :modalHtml="modalHtml"
  94. okText="好的"
  95. :isCancel="false"
  96. @ok="openCommonModal=false"
  97. @cancel="openCommonModal=false" />
  98. </a-card>
  99. </template>
  100. <script>
  101. import { commonMixin } from '@/utils/mixin'
  102. import { STable, VSelect } from '@/components'
  103. import inventoryCheckAddModal from './addModal.vue'
  104. import commonModal from '@/views/common/commonModal.vue'
  105. import warehouse from '@/views/common/chooseWarehouse.js'
  106. import { checkWarehouseList, checkWarehouseStartCheck } from '@/api/checkWarehouse'
  107. export default {
  108. name: 'InventoryCheckList',
  109. mixins: [commonMixin],
  110. components: { STable, VSelect, inventoryCheckAddModal, commonModal, warehouse },
  111. data () {
  112. return {
  113. spinning: false,
  114. tableHeight: 0,
  115. queryParam: { // 查询条件
  116. deleteFlag: this.$route.params.type,
  117. checkWarehouseNo: '',
  118. checkState: undefined,
  119. warehouseSn: undefined,
  120. checkSuperviseState: undefined
  121. },
  122. disabled: false, // 查询、重置按钮是否可操作
  123. tabPaneData: [
  124. { name: '正常', type: '0' },
  125. { name: '已作废', type: '1' }
  126. ],
  127. // 加载数据方法 必须为 Promise 对象
  128. loadData: parameter => {
  129. this.disabled = true
  130. this.spinning = true
  131. return checkWarehouseList(Object.assign(parameter, this.queryParam)).then(res => {
  132. let data
  133. if (res.status == 200) {
  134. data = res.data
  135. const no = (data.pageNo - 1) * data.pageSize
  136. for (var i = 0; i < data.list.length; i++) {
  137. data.list[i].no = no + i + 1
  138. }
  139. this.disabled = false
  140. }
  141. this.spinning = false
  142. return data
  143. })
  144. },
  145. openModal: false,
  146. itemSn: '',
  147. openAddModal: false,
  148. openCommonModal: false,
  149. modalHtml: ''
  150. }
  151. },
  152. computed: {
  153. columns () {
  154. let arr = []
  155. if (this.queryParam.deleteFlag == '0') { // 正常
  156. arr = [
  157. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  158. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '10%', align: 'center' },
  159. { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '8%', customRender: function (text) { return text || '--' }, ellipsis: true },
  163. { title: '盘点提交时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '8%', customRender: function (text) { return text || '--' }, ellipsis: true },
  165. { title: '监盘提交时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '财务确认时间', dataIndex: 'financeAuditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  167. { title: '盘点单创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  168. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  169. ]
  170. } else if (this.queryParam.deleteFlag == '1') { // 已作废
  171. arr = [
  172. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  173. { title: '盘点单号', dataIndex: 'checkWarehouseNo', width: '10%', align: 'center' },
  174. { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  175. { title: '盘点状态', dataIndex: 'checkStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  176. { title: '监盘状态', dataIndex: 'checkSuperviseStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  177. { title: '盘点人', dataIndex: 'checkPersonName', align: 'center', width: '8%', customRender: function (text) { return text || '--' }, ellipsis: true },
  178. { title: '盘点提交时间', dataIndex: 'checkTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  179. { title: '监盘人', dataIndex: 'checkSupervisePersonName', align: 'center', width: '8%', customRender: function (text) { return text || '--' }, ellipsis: true },
  180. { title: '监盘提交时间', dataIndex: 'checkSuperviseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  181. { title: '盘点单创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  182. { title: '盘点单作废时间', dataIndex: 'deleteTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  183. { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
  184. ]
  185. }
  186. return arr
  187. }
  188. },
  189. methods: {
  190. // 新增
  191. handleAdd () {
  192. this.spinning = true
  193. checkWarehouseStartCheck({}).then(res => {
  194. this.spinning = false
  195. if (res.status == 200) {
  196. if (res.data && res.data.length > 0) {
  197. // this.modalHtml = `<div style="width: 100%">
  198. // <h3 style="font-size: 15px;font-weight: bold;margin: 20px 0 5px;text-align: center;">存在以下状态的销售单,无法盘点。</h3>
  199. // <h3 style="font-size: 15px;font-weight: bold;margin-bottom: 25px;text-align: center;">请先检查并处理完以下单据再试。</h3>
  200. // ${res.data.indexOf('WAIT_AUDIT') != -1 ? '<p>销售单-待审核(总部自建)</p>' : ''}
  201. // ${res.data.indexOf('AUDIT_REJECT') != -1 ? '<p>销售单-审核不通过(总部自建)</p>' : ''}
  202. // ${res.data.indexOf('HQ_CHANGE') != -1 ? '<p>销售单-总公司改单</p>' : ''}
  203. // ${res.data.indexOf('WAIT_PUSH') != -1 ? '<p>销售单-待下推</p>' : ''}
  204. // </div>`
  205. this.modalHtml = `<div style="width: 100%">
  206. ${res.data.indexOf('WAIT_PUSH') != -1 ? '<p>存在“待下推”状态的销售单,无法盘点。</p>' : ''}
  207. </div>`
  208. this.openCommonModal = true
  209. } else {
  210. this.openAddModal = true
  211. }
  212. }
  213. })
  214. },
  215. // 新增 成功
  216. handleAddOk (data) {
  217. this.$router.push({ path: `/inventoryManagement/inventoryCheck/detail/${data.checkWarehouseSn}` })
  218. },
  219. // 选择类型
  220. handleTabChange (key) {
  221. this.queryParam.deleteFlag = key
  222. this.$refs.table.refresh(true)
  223. },
  224. // 详情
  225. handleDetail (row) {
  226. if (this.$hasPermissions('B_inventoryCheckDetail')) {
  227. this.$router.push({ path: `/inventoryManagement/inventoryCheck/detail/${row.checkWarehouseSn}` })
  228. }
  229. },
  230. resetSearchForm () {
  231. this.queryParam.checkWarehouseNo = ''
  232. this.queryParam.checkState = undefined
  233. this.queryParam.checkSuperviseState = undefined
  234. this.$refs.table.refresh(true)
  235. },
  236. closeModal () {
  237. this.itemSn = ''
  238. this.openModal = false
  239. },
  240. pageInit () {
  241. const _this = this
  242. this.$nextTick(() => { // 页面渲染完成后的回调
  243. _this.setTableH()
  244. })
  245. },
  246. setTableH () {
  247. this.tableHeight = window.innerHeight - 332
  248. }
  249. },
  250. watch: {
  251. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  252. this.setTableH()
  253. }
  254. },
  255. mounted () {
  256. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  257. this.pageInit()
  258. this.$refs.table.refresh(true)
  259. }
  260. },
  261. activated () {
  262. // 如果是新页签打开,则重置当前页面
  263. if (this.$store.state.app.isNewTab) {
  264. this.pageInit()
  265. this.$refs.table.refresh(true)
  266. }
  267. // 仅刷新列表,不重置页面
  268. if (this.$store.state.app.updateList) {
  269. this.pageInit()
  270. this.$refs.table.refresh()
  271. }
  272. },
  273. beforeRouteEnter (to, from, next) {
  274. next(vm => {
  275. const _this = vm
  276. if (_this.$route.params.type == '1') {
  277. setTimeout(() => {
  278. _this.$refs.table.refresh(true)
  279. }, 300)
  280. }
  281. })
  282. }
  283. }
  284. </script>
  285. <style lang="less">
  286. .inventoryCheckList-wrap{
  287. .active{
  288. color: #ed1c24;
  289. cursor: pointer;
  290. }
  291. .common{
  292. color: rgba(0, 0, 0);
  293. }
  294. // tab样式
  295. .inventoryCheckList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-nav-container{
  296. height: 30px!important;
  297. }
  298. .inventoryCheckList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab-active{
  299. height: 30px!important;
  300. }
  301. .inventoryCheckList-tabs.ant-tabs.ant-tabs-card .ant-tabs-card-bar .ant-tabs-tab{
  302. line-height: 26px!important;
  303. height: 30px!important;
  304. }
  305. }
  306. </style>