list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <a-card size="small" :bordered="false" class="inventoryCheckingList-wrap">
  3. <!-- 搜索条件 -->
  4. <div ref="tableSearch" class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="盘点单号">
  9. <a-input id="inventoryCheckingList-checkWarehouseNo" v-model.trim="queryParam.checkWarehouseNo" allowClear placeholder="请输入盘点单号"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="盘点类型">
  14. <v-select code="CHECK_WAREHOUSE_TYPE" id="inventoryCheckingList-checkType" v-model="queryParam.checkType" allowClear placeholder="请选择盘点类型"></v-select>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="是否区分仓库">
  19. <v-select code="FLAG" id="inventoryCheckingList-warehouseFlag" v-model="queryParam.warehouseFlag" allowClear placeholder="请选择"></v-select>
  20. </a-form-item>
  21. </a-col>
  22. <template v-if="advanced">
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="盘点状态">
  25. <v-select code="CHECK_WAREHOUSE_STATE" id="inventoryCheckingList-state" v-model="queryParam.state" allowClear placeholder="请选择盘点状态"></v-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="创建时间">
  30. <rangeDate ref="rangeDate" :value="[queryParam.beginDate, queryParam.endDate]" @change="dateChange" />
  31. </a-form-item>
  32. </a-col>
  33. </template>
  34. <a-col :md="6" :sm="24">
  35. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckingList-refresh">查询</a-button>
  36. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckingList-reset">重置</a-button>
  37. <a @click="advanced=!advanced" style="margin-left: 5px">
  38. {{ advanced ? '收起' : '展开' }}
  39. <a-icon :type="advanced ? 'up' : 'down'"/>
  40. </a>
  41. </a-col>
  42. </a-row>
  43. </a-form>
  44. </div>
  45. <!-- 操作按钮 -->
  46. <div class="table-operator">
  47. <a-button id="inventoryCheckingList-add" v-if="$hasPermissions('B_inventoryCheckingAdd')" type="primary" class="button-error" @click="handleAdd">新增</a-button>
  48. </div>
  49. <!-- 列表 -->
  50. <s-table
  51. class="sTable fixPagination"
  52. ref="table"
  53. :style="{ height: tableHeight+84.5+'px' }"
  54. size="small"
  55. :rowKey="(record) => record.id"
  56. :columns="columns"
  57. :data="loadData"
  58. :scroll="{ y: tableHeight }"
  59. :defaultLoadData="false"
  60. bordered>
  61. <!-- 单号 -->
  62. <template slot="checkWarehouseNo" slot-scope="text, record">
  63. <span class="table-td-link" v-if="$hasPermissions('B_inventoryCheckingDetail')" @click="handleDetail(record)">{{ record.checkWarehouseNo }}</span>
  64. <span v-else>{{ record.checkWarehouseNo }}</span>
  65. </template>
  66. <!-- 监盘人审核 -->
  67. <template slot="dpaudit" slot-scope="text, record">
  68. <stateIcon v-if="record.state!='AUDIT_REJECT'" :state="record.state !== 'WAIT_SUBMIT'&&record.state !== 'WAIT_AUDIT'?'1':'2'"></stateIcon>
  69. <stateIcon :title="record.stateDictValue" v-else :state="0"></stateIcon>
  70. </template>
  71. <!-- 财务人审核 -->
  72. <template slot="cwaudit" slot-scope="text, record">
  73. <stateIcon :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  74. </template>
  75. <!-- 操作 -->
  76. <template slot="action" slot-scope="text, record">
  77. <a-button
  78. size="small"
  79. type="link"
  80. v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'AUDIT_REJECT') && $hasPermissions('B_inventoryCheckingEdit')"
  81. class="button-primary"
  82. @click="handleEdit(record)"
  83. >编辑</a-button>
  84. <a-button
  85. size="small"
  86. type="link"
  87. v-if="record.state == 'WAIT_AUDIT' && $hasPermissions('B_inventoryCheckingAudit')"
  88. class="button-primary"
  89. @click="handleEexamine(record)"
  90. >审核</a-button>
  91. <a-button
  92. size="small"
  93. type="link"
  94. v-if="record.state == 'WAIT_CHECK_WAREHOUSE' && $hasPermissions('B_inventoryCheckingInventory')"
  95. class="button-primary"
  96. @click="handleWarehouse(record)"
  97. >盘点</a-button>
  98. <a-button
  99. size="small"
  100. type="link"
  101. v-if="record.state == 'WAIT_CHECK_WAREHOUSE' && $hasPermissions('B_inventoryCheckingAgain')"
  102. class="button-primary"
  103. @click="handleAgain(record)"
  104. >重盘</a-button>
  105. <a-button
  106. size="small"
  107. type="link"
  108. v-if="(record.state == 'WAIT_SUBMIT') || (record.state == 'AUDIT_REJECT') && $hasPermissions('B_inventoryCheckingDel')"
  109. class="button-error"
  110. @click="handleDel(record)"
  111. >删除</a-button>
  112. <span
  113. v-if="!((record.state == 'WAIT_SUBMIT') || (record.state == 'AUDIT_REJECT') && ($hasPermissions('B_inventoryCheckingEdit') || $hasPermissions('B_inventoryCheckingDel')))
  114. && !(record.state == 'WAIT_AUDIT' && $hasPermissions('B_inventoryCheckingAudit'))
  115. && !(record.state == 'WAIT_CHECK_WAREHOUSE' && ($hasPermissions('B_inventoryCheckingInventory') || $hasPermissions('B_inventoryCheckingAgain')))">--</span>
  116. </template>
  117. </s-table>
  118. <!-- 基础信息 -->
  119. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  120. <!-- 审核 -->
  121. <auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder(true)" @fail="auditOrder(false)" />
  122. <!-- 详情 -->
  123. <inventoryChecking-detail-modal :openModal="openDetailModal" :itemSn="itemSn" @close="handleDetailClose" />
  124. </a-card>
  125. </template>
  126. <script>
  127. import { commonMixin } from '@/utils/mixin'
  128. import { STable, VSelect } from '@/components'
  129. import rangeDate from '@/views/common/rangeDate.vue'
  130. import auditModal from '@/views/common/auditModal.vue'
  131. import basicInfoModal from './basicInfoModal.vue'
  132. import inventoryCheckingDetailModal from './detailModal.vue'
  133. import stateIcon from '@/views/common/stateIcon'
  134. import { checkWarehouseList, checkWarehouseDel, checkWarehouseAudit, checkWarehouseValidate, checkWarehouseReInventory } from '@/api/checkWarehouse'
  135. export default {
  136. name: 'InventoryCheckingList',
  137. components: { STable, VSelect, rangeDate, auditModal, basicInfoModal, inventoryCheckingDetailModal, stateIcon },
  138. mixins: [commonMixin],
  139. data () {
  140. return {
  141. queryParam: { // 查询条件
  142. checkWarehouseNo: '',
  143. checkType: undefined,
  144. warehouseFlag: undefined,
  145. state: undefined,
  146. beginDate: '', // 创建时间 开始时间
  147. endDate: '' // 创建时间 结束时间
  148. },
  149. tableHeight: 0,
  150. advanced: true,
  151. disabled: false, // 查询、重置按钮是否可操作
  152. // 加载数据方法 必须为 Promise 对象
  153. loadData: parameter => {
  154. this.disabled = true
  155. this.spinning = true
  156. return checkWarehouseList(Object.assign(parameter, this.queryParam)).then(res => {
  157. let data
  158. if (res.status == 200) {
  159. data = res.data
  160. const no = (data.pageNo - 1) * data.pageSize
  161. for (var i = 0; i < data.list.length; i++) {
  162. data.list[i].no = no + i + 1
  163. }
  164. this.disabled = false
  165. }
  166. this.spinning = false
  167. return data
  168. })
  169. },
  170. openModal: false, // 新增编辑 弹框
  171. itemId: '', // 当前id
  172. nowData: null, // 当前记录数据
  173. visibleAudit: false,
  174. auditInfo: null,
  175. spinningAudit: false,
  176. openDetailModal: false,
  177. itemSn: null
  178. }
  179. },
  180. computed: {
  181. columns () {
  182. const _this = this
  183. const arr = [
  184. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  185. { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '12%', align: 'center' },
  186. { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  187. { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  188. // { title: '总成本', dataIndex: 'totalStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  189. { title: '盘点类型', dataIndex: 'checkTypeDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '是否区分仓库', dataIndex: 'warehouseFlagDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  191. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  192. { title: '审核时间', dataIndex: 'checkSuperviseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  193. { title: '盘点状态', dataIndex: 'stateDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  194. { title: '监盘人审核', scopedSlots: { customRender: 'dpaudit' }, width: '3%', align: 'center' },
  195. { title: '财务人审核', scopedSlots: { customRender: 'cwaudit' }, width: '3%', align: 'center' },
  196. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  197. ]
  198. if (this.$hasPermissions('M_ShowAllCost')) {
  199. arr.splice(4, 0, { title: '总成本', dataIndex: 'totalStockCost', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  200. }
  201. return arr
  202. }
  203. },
  204. methods: {
  205. // 时间 change
  206. dateChange (date) {
  207. this.queryParam.beginDate = date[0]
  208. this.queryParam.endDate = date[1]
  209. },
  210. // 重置
  211. resetSearchForm () {
  212. this.queryParam.checkWarehouseNo = ''
  213. this.queryParam.checkType = undefined
  214. this.queryParam.warehouseFlag = undefined
  215. this.queryParam.state = undefined
  216. this.queryParam.beginDate = ''
  217. this.queryParam.endDate = ''
  218. this.$refs.rangeDate.resetDate()
  219. this.$refs.table.refresh(true)
  220. },
  221. // 新增
  222. handleAdd () {
  223. const _this = this
  224. this.$confirm({
  225. title: '提示',
  226. content: '如果开始盘点,不能再进行其他与产品出入库相关的操作。确认开始盘点吗?',
  227. centered: true,
  228. onOk () {
  229. // checkWarehouseValidate({}).then(res => {
  230. // if (res.status == 200) {
  231. // if (res.data) {
  232. _this.openModal = true
  233. // } else {
  234. // _this.$message.info('存在未完结的盘点单,不能新增,请先完成盘点后再新增')
  235. // }
  236. // }
  237. // })
  238. }
  239. })
  240. },
  241. // 编辑
  242. handleEdit (row) {
  243. if (row.checkType == 'ALL') { // 全盘
  244. this.$router.push({ path: `/inventoryManagement/inventoryChecking/overall/${row.id}/${row.checkWarehouseSn}` })
  245. } else if (row.checkType == 'SELECT') { // 自选盘点
  246. this.$router.push({ path: `/inventoryManagement/inventoryChecking/selfDisk/${row.id}/${row.checkWarehouseSn}` })
  247. }
  248. },
  249. // 详情
  250. handleDetail (row) {
  251. this.itemSn = row.checkWarehouseSn
  252. this.openDetailModal = true
  253. },
  254. // 盘点
  255. handleWarehouse (row) {
  256. this.$router.push({ path: `/inventoryManagement/inventoryChecking/makeInventory/${row.id}/${row.checkWarehouseSn}` })
  257. },
  258. // 重盘
  259. handleAgain (row) {
  260. const _this = this
  261. this.$confirm({
  262. title: '提示',
  263. content: '重新盘点后,盘点单状态回退到待提交。确认重新盘点吗?',
  264. centered: true,
  265. onOk () {
  266. checkWarehouseReInventory({ id: row.id }).then(res => {
  267. if (res.status == 200) {
  268. _this.$message.success(res.message)
  269. _this.$refs.table.refresh()
  270. }
  271. })
  272. }
  273. })
  274. },
  275. // 基本信息 保存
  276. handleOk (data) {
  277. this.handleEdit(data)
  278. },
  279. // 删除
  280. handleDel (row) {
  281. const _this = this
  282. this.$confirm({
  283. title: '提示',
  284. content: '删除后不可恢复,确定要进行删除吗?',
  285. centered: true,
  286. onOk () {
  287. checkWarehouseDel({ id: row.id }).then(res => {
  288. if (res.status == 200) {
  289. _this.$message.success(res.message)
  290. _this.$refs.table.refresh()
  291. }
  292. })
  293. }
  294. })
  295. },
  296. // 审核
  297. handleEexamine (row) {
  298. this.auditInfo = row
  299. this.visibleAudit = true
  300. },
  301. auditOrder (billStatus) {
  302. this.spinningAudit = true
  303. checkWarehouseAudit({
  304. id: this.auditInfo.id,
  305. auditFlag: billStatus
  306. }).then(res => {
  307. if (res.status == 200) {
  308. this.visibleAudit = false
  309. this.$message.success(res.message)
  310. this.$refs.table.refresh()
  311. this.spinningAudit = false
  312. } else {
  313. this.visibleAudit = false
  314. this.spinningAudit = false
  315. }
  316. })
  317. },
  318. handleDetailClose () {
  319. this.itemSn = null
  320. this.openDetailModal = false
  321. },
  322. pageInit () {
  323. const _this = this
  324. this.$nextTick(() => { // 页面渲染完成后的回调
  325. _this.setTableH()
  326. })
  327. },
  328. setTableH () {
  329. const tableSearchH = this.$refs.tableSearch.offsetHeight
  330. this.tableHeight = window.innerHeight - tableSearchH - 235
  331. }
  332. },
  333. watch: {
  334. advanced (newValue, oldValue) {
  335. const _this = this
  336. this.$nextTick(() => { // 页面渲染完成后的回调
  337. _this.setTableH()
  338. })
  339. },
  340. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  341. this.setTableH()
  342. }
  343. },
  344. mounted () {
  345. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  346. this.pageInit()
  347. this.resetSearchForm()
  348. }
  349. },
  350. activated () {
  351. // 如果是新页签打开,则重置当前页面
  352. if (this.$store.state.app.isNewTab) {
  353. this.pageInit()
  354. this.resetSearchForm()
  355. }
  356. // 仅刷新列表,不重置页面
  357. if (this.$store.state.app.updateList) {
  358. this.pageInit()
  359. this.$refs.table.refresh()
  360. }
  361. },
  362. beforeRouteEnter (to, from, next) {
  363. next(vm => {})
  364. }
  365. }
  366. </script>