list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <a-card size="small" :bordered="false" class="warehousingAuditList-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="warehousingAuditList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="发货单号">
  15. <a-input id="warehousingAuditList-receivingBillNo" v-model.trim="queryParam.receivingBillNo" allowClear placeholder="请输入发货单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="入库时间">
  20. <rangeDate ref="rangeDate" :value="auditTime" @change="dateChange" />
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="入库审核状态">
  26. <v-select
  27. v-model="queryParam.auditState"
  28. ref="auditState"
  29. id="warehousingAuditList-auditState"
  30. code="RECEIVING_BILL_AUDIT_STATUS"
  31. placeholder="请选择入库审核状态"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. </template>
  36. <a-col :md="6" :sm="24">
  37. <span class="table-page-search-submitButtons">
  38. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehousingAuditList-refresh">查询</a-button>
  39. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="warehousingAuditList-reset">重置</a-button>
  40. <a @click="advanced=!advanced" style="margin-left: 8px">
  41. {{ advanced ? '收起' : '展开' }}
  42. <a-icon :type="advanced ? 'up' : 'down'"/>
  43. </a>
  44. </span>
  45. </a-col>
  46. </a-row>
  47. </a-form>
  48. </div>
  49. <!-- alert -->
  50. <a-alert type="info" style="margin-bottom:10px">
  51. <div slot="message">
  52. 共 <strong>{{ (productTotal&&(productTotal.totalRecord || productTotal.totalRecord==0)) ? productTotal.totalRecord : '--' }}</strong> 条记录,
  53. 其中待审核 <strong>{{ (productTotal&&(productTotal.waitAuditRecord || productTotal.waitAuditRecord==0)) ? productTotal.waitAuditRecord : '--' }}</strong> 条
  54. </div>
  55. </a-alert>
  56. <!-- 列表 -->
  57. <s-table
  58. class="sTable fixPagination"
  59. ref="table"
  60. :style="{ height: tableHeight+84.5+'px' }"
  61. size="small"
  62. :rowKey="(record) => record.id"
  63. :columns="columns"
  64. :data="loadData"
  65. :scroll="{ y: tableHeight }"
  66. :defaultLoadData="false"
  67. bordered>
  68. <!-- 发货单号 -->
  69. <template slot="receivingBillNo" slot-scope="text, record">
  70. <span v-if="record.receivingBillNo" :class="$hasPermissions('M_warehousingAudit_detail')?'active':'common'" @click="handleDetail(record)">{{ record.receivingBillNo }}</span>
  71. <span v-else>--</span>
  72. </template>
  73. <!-- 操作 -->
  74. <template slot="action" slot-scope="text, record">
  75. <a-button
  76. size="small"
  77. v-if="record.auditState=='WAIT_PUT_WAREHOUSE_AUDIT' && $hasPermissions('B_receivingAudit')"
  78. type="link"
  79. class="button-primary"
  80. @click="handleExamine(record, 1)"
  81. id="warehousingAudit-adopt-btn">通过</a-button>
  82. <a-button
  83. size="small"
  84. v-if="record.auditState=='WAIT_PUT_WAREHOUSE_AUDIT'&& $hasPermissions('B_receivingAudit')"
  85. type="link"
  86. class="button-error"
  87. @click="handleExamine(record, 2)"
  88. id="warehousingAudit-unadopt-btn">不通过</a-button>
  89. <span v-if="record.auditState!='WAIT_PUT_WAREHOUSE_AUDIT'|| !$hasPermissions('B_receivingAudit')">--</span>
  90. </template>
  91. </s-table>
  92. </a-spin>
  93. </a-card>
  94. </template>
  95. <script>
  96. import { commonMixin } from '@/utils/mixin'
  97. import moment from 'moment'
  98. import getDate from '@/libs/getDate'
  99. import { STable, VSelect } from '@/components'
  100. import rangeDate from '@/views/common/rangeDate.vue'
  101. import { receivingAuditList, receivingStockInAudit, receivingCount } from '@/api/receiving'
  102. export default {
  103. name: 'WarehousingAuditList',
  104. components: { STable, VSelect, rangeDate },
  105. mixins: [commonMixin],
  106. data () {
  107. return {
  108. spinning: false,
  109. advanced: true, // 高级搜索 展开/关闭
  110. disabled: false, // 查询、重置按钮是否可操作
  111. auditTime: [
  112. moment(getDate.getThreeMonthDays().starttime + ' 00:00:00', 'YYYY-MM-DD'),
  113. moment(getDate.getCurrMonthDays().endtime + ' 23:59:59', 'YYYY-MM-DD')
  114. ], // 入库时间
  115. tableHeight: 0,
  116. // 查询参数
  117. queryParam: {
  118. beginDate: getDate.getThreeMonthDays().starttime + ' 00:00:00',
  119. endDate: getDate.getCurrMonthDays().endtime + ' 23:59:59',
  120. purchaseBillNo: '',
  121. receivingBillNo: '',
  122. auditState: 'WAIT_PUT_WAREHOUSE_AUDIT'
  123. },
  124. // 表头
  125. columns: [
  126. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  127. { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '发货单号', scopedSlots: { customRender: 'receivingBillNo' }, width: '15%', align: 'center' },
  129. { title: '总款数', dataIndex: 'totalPutCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  130. { title: '入库总数量', dataIndex: 'totalPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  131. { title: '入库总成本', dataIndex: 'totalPutAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  132. { title: '签收入库时间', dataIndex: 'stockPutTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '财务入库审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  134. { title: '财务审核状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  136. ],
  137. // 加载数据方法 必须为 Promise 对象
  138. loadData: parameter => {
  139. this.disabled = true
  140. this.spinning = true
  141. const params = Object.assign(parameter, this.queryParam)
  142. return receivingAuditList(params).then(res => {
  143. let data
  144. if (res.status == 200) {
  145. data = res.data
  146. this.getTotal(params)
  147. const no = (data.pageNo - 1) * data.pageSize
  148. for (var i = 0; i < data.list.length; i++) {
  149. data.list[i].no = no + i + 1
  150. if (data.list[i].auditState == 'WAIT_PUT_WAREHOUSE_AUDIT') {
  151. data.list[i].auditStateDictValue = '待审核'
  152. } else if (data.list[i].auditState == 'FINISH') {
  153. data.list[i].auditStateDictValue = '已审核'
  154. } else if (data.list[i].auditState == 'PUT_WAREHOUSE_AUDIT_REJECT') {
  155. data.list[i].auditStateDictValue = '审核不通过'
  156. }
  157. }
  158. this.disabled = false
  159. }
  160. this.spinning = false
  161. return data
  162. })
  163. },
  164. productTotal: null
  165. }
  166. },
  167. methods: {
  168. // 时间 change
  169. dateChange (date) {
  170. this.queryParam.beginDate = date[0] ? date[0] + ' 00:00:00' : ''
  171. this.queryParam.endDate = date[1] ? date[1] + ' 23:59:59' : ''
  172. },
  173. // 合计
  174. getTotal (param) {
  175. receivingCount(param).then(res => {
  176. if (res.status == 200 && res.data) {
  177. this.productTotal = res.data
  178. } else {
  179. this.productTotal = null
  180. }
  181. })
  182. },
  183. // 详情
  184. handleDetail (row) {
  185. if (this.$hasPermissions('M_warehousingAudit_detail')) {
  186. this.$router.push({ path: `/financialManagement/warehousingAudit/detail/${row.receivingBillSn}` })
  187. }
  188. },
  189. // 审核
  190. handleExamine (row, type) {
  191. const _this = this
  192. this.$confirm({
  193. title: '提示',
  194. content: '确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  195. centered: true,
  196. onOk () {
  197. _this.spinning = true
  198. receivingStockInAudit({ id: row.id, auditState: type == 1 ? 'FINISH' : 'PUT_WAREHOUSE_AUDIT_REJECT' }).then(res => {
  199. if (res.status == 200) {
  200. _this.$message.success(res.message)
  201. _this.$refs.table.refresh()
  202. _this.spinning = false
  203. } else {
  204. _this.spinning = false
  205. }
  206. })
  207. }
  208. })
  209. },
  210. // 重置
  211. resetSearchForm () {
  212. this.resetData()
  213. this.$refs.table.refresh(true)
  214. },
  215. // 重置数据
  216. resetData () {
  217. this.$refs.rangeDate.resetDate(this.auditTime)
  218. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime + ' 00:00:00'
  219. this.queryParam.endDate = getDate.getCurrMonthDays().endtime + ' 23:59:59'
  220. this.queryParam.purchaseBillNo = ''
  221. this.queryParam.receivingBillNo = ''
  222. this.queryParam.auditState = 'WAIT_PUT_WAREHOUSE_AUDIT'
  223. },
  224. pageInit () {
  225. const _this = this
  226. this.$nextTick(() => { // 页面渲染完成后的回调
  227. _this.setTableH()
  228. })
  229. },
  230. setTableH () {
  231. const tableSearchH = this.$refs.tableSearch.offsetHeight
  232. this.tableHeight = window.innerHeight - tableSearchH - 238
  233. }
  234. },
  235. watch: {
  236. advanced (newValue, oldValue) {
  237. const _this = this
  238. this.$nextTick(() => { // 页面渲染完成后的回调
  239. _this.setTableH()
  240. })
  241. },
  242. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  243. this.setTableH()
  244. }
  245. },
  246. mounted () {
  247. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  248. this.pageInit()
  249. this.resetSearchForm()
  250. }
  251. },
  252. activated () {
  253. // 如果是新页签打开,则重置当前页面
  254. if (this.$store.state.app.isNewTab) {
  255. this.resetData()
  256. if (this.$route.query.pageParams) {
  257. this.queryParam.auditState = this.$route.query.pageParams.auditState
  258. }
  259. this.pageInit()
  260. this.$refs.table.refresh(true)
  261. }
  262. },
  263. beforeRouteEnter (to, from, next) {
  264. next(vm => {})
  265. }
  266. }
  267. </script>
  268. <style lang="less">
  269. .warehousingAuditList-wrap{
  270. .active{
  271. color: #ed1c24;
  272. cursor: pointer;
  273. }
  274. .common{
  275. color: rgba(0, 0, 0);
  276. }
  277. }
  278. </style>