list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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_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-info"
  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-warning"
  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 moment from 'moment'
  97. import getDate from '@/libs/getDate'
  98. import { STable, VSelect } from '@/components'
  99. import rangeDate from '@/views/common/rangeDate.vue'
  100. import { receivingList, receivingStockInAudit, receivingCount } from '@/api/receiving'
  101. export default {
  102. components: { STable, VSelect, rangeDate },
  103. data () {
  104. return {
  105. spinning: false,
  106. advanced: true, // 高级搜索 展开/关闭
  107. disabled: false, // 查询、重置按钮是否可操作
  108. auditTime: [
  109. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  110. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  111. ], // 入库时间
  112. tableHeight: 0,
  113. // 查询参数
  114. queryParam: {
  115. beginDate: getDate.getThreeMonthDays().starttime,
  116. endDate: getDate.getCurrMonthDays().endtime,
  117. purchaseBillNo: '',
  118. receivingBillNo: '',
  119. auditState: undefined
  120. },
  121. // 表头
  122. columns: [
  123. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  124. { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  125. { title: '采购入库单号', scopedSlots: { customRender: 'receivingBillNo' }, width: '15%', align: 'center' },
  126. { title: '总款数', dataIndex: 'totalPutCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  127. { title: '入库总数量', dataIndex: 'totalPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  128. { title: '入库总成本', dataIndex: 'totalPutAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  129. { title: '签收入库时间', dataIndex: 'stockPutTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '财务入库审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '财务审核状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  133. ],
  134. // 加载数据方法 必须为 Promise 对象
  135. loadData: parameter => {
  136. this.disabled = true
  137. this.spinning = true
  138. const params = Object.assign(parameter, this.queryParam)
  139. return receivingList(params).then(res => {
  140. let data
  141. if (res.status == 200) {
  142. data = res.data
  143. this.getTotal(params)
  144. const no = (data.pageNo - 1) * data.pageSize
  145. for (var i = 0; i < data.list.length; i++) {
  146. data.list[i].no = no + i + 1
  147. }
  148. this.disabled = false
  149. }
  150. this.spinning = false
  151. return data
  152. })
  153. },
  154. productTotal: null
  155. }
  156. },
  157. methods: {
  158. // 时间 change
  159. dateChange (date) {
  160. this.queryParam.beginDate = date[0]
  161. this.queryParam.endDate = date[1]
  162. },
  163. // 合计
  164. getTotal (param) {
  165. receivingCount(param).then(res => {
  166. if (res.status == 200 && res.data) {
  167. this.productTotal = res.data
  168. } else {
  169. this.productTotal = null
  170. }
  171. })
  172. },
  173. // 详情
  174. handleDetail (row) {
  175. if (this.$hasPermissions('M_warehousingAudit_detail')) {
  176. this.$router.push({ path: `/financialManagement/warehousingAudit/detail/${row.receivingBillSn}` })
  177. }
  178. },
  179. // 审核
  180. handleExamine (row, type) {
  181. const _this = this
  182. this.$confirm({
  183. title: '提示',
  184. content: '确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  185. centered: true,
  186. onOk () {
  187. _this.spinning = true
  188. receivingStockInAudit({ id: row.id, auditState: type == 1 ? 'FINISH' : 'PUT_WAREHOUSE_AUDIT_REJECT' }).then(res => {
  189. if (res.status == 200) {
  190. _this.$message.success(res.message)
  191. _this.$refs.table.refresh()
  192. _this.spinning = false
  193. } else {
  194. _this.spinning = false
  195. }
  196. })
  197. }
  198. })
  199. },
  200. // 重置
  201. resetSearchForm () {
  202. this.resetData()
  203. this.$refs.table.refresh(true)
  204. },
  205. // 重置数据
  206. resetData () {
  207. this.$refs.rangeDate.resetDate(this.auditTime)
  208. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  209. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  210. this.queryParam.purchaseBillNo = ''
  211. this.queryParam.receivingBillNo = ''
  212. this.queryParam.auditState = undefined
  213. },
  214. pageInit () {
  215. const _this = this
  216. this.$nextTick(() => { // 页面渲染完成后的回调
  217. _this.setTableH()
  218. })
  219. },
  220. setTableH () {
  221. const tableSearchH = this.$refs.tableSearch.offsetHeight
  222. this.tableHeight = window.innerHeight - tableSearchH - 238
  223. }
  224. },
  225. watch: {
  226. advanced (newValue, oldValue) {
  227. const _this = this
  228. setTimeout(() => {
  229. _this.setTableH()
  230. }, 400)
  231. },
  232. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  233. this.setTableH()
  234. }
  235. },
  236. mounted () {
  237. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  238. this.pageInit()
  239. this.resetSearchForm()
  240. }
  241. },
  242. activated () {
  243. // 如果是新页签打开,则重置当前页面
  244. if (this.$store.state.app.isNewTab) {
  245. this.resetData()
  246. if (this.$route.query.pageParams) {
  247. this.queryParam.auditState = this.$route.query.pageParams.auditState
  248. }
  249. this.pageInit()
  250. this.$refs.table.refresh(true)
  251. }
  252. },
  253. beforeRouteEnter (to, from, next) {
  254. next(vm => {})
  255. }
  256. }
  257. </script>
  258. <style lang="less">
  259. .warehousingAuditList-wrap{
  260. .active{
  261. color: #ed1c24;
  262. cursor: pointer;
  263. }
  264. .common{
  265. color: rgba(0, 0, 0, 0.65);
  266. }
  267. }
  268. </style>