list.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <a-card size="small" :bordered="false" class="warehousingAuditList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div 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" showIcon 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"
  59. ref="table"
  60. size="small"
  61. :rowKey="(record) => record.id"
  62. :columns="columns"
  63. :data="loadData"
  64. :scroll="{ x: 1420, y: tableHeight }"
  65. bordered>
  66. <!-- 采购入库单号 -->
  67. <template slot="receivingBillNo" slot-scope="text, record">
  68. <span v-if="record.receivingBillNo" :class="$hasPermissions('M_warehousingAudit_detail')?'active':'common'" @click="handleDetail(record)">{{ record.receivingBillNo }}</span>
  69. <span v-else>--</span>
  70. </template>
  71. <!-- 操作 -->
  72. <template slot="action" slot-scope="text, record">
  73. <a-button
  74. size="small"
  75. v-if="record.auditState=='WAIT_PUT_WAREHOUSE_AUDIT' && $hasPermissions('B_receivingAudit')"
  76. type="link"
  77. class="button-info"
  78. @click="handleExamine(record, 1)"
  79. id="warehousingAudit-adopt-btn">通过</a-button>
  80. <a-button
  81. size="small"
  82. v-if="record.auditState=='WAIT_PUT_WAREHOUSE_AUDIT'&& $hasPermissions('B_receivingAudit')"
  83. type="link"
  84. class="button-warning"
  85. @click="handleExamine(record, 2)"
  86. id="warehousingAudit-unadopt-btn">不通过</a-button>
  87. <span v-if="record.auditState!='WAIT_PUT_WAREHOUSE_AUDIT'|| !$hasPermissions('B_receivingAudit')">--</span>
  88. </template>
  89. </s-table>
  90. </a-spin>
  91. </a-card>
  92. </template>
  93. <script>
  94. import moment from 'moment'
  95. import getDate from '@/libs/getDate'
  96. import { STable, VSelect } from '@/components'
  97. import rangeDate from '@/views/common/rangeDate.vue'
  98. import { receivingList, receivingStockInAudit, receivingCount } from '@/api/receiving'
  99. export default {
  100. components: { STable, VSelect, rangeDate },
  101. data () {
  102. return {
  103. spinning: false,
  104. advanced: false, // 高级搜索 展开/关闭
  105. disabled: false, // 查询、重置按钮是否可操作
  106. auditTime: [
  107. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  108. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  109. ], // 入库时间
  110. tableHeight: 0,
  111. // 查询参数
  112. queryParam: {
  113. beginDate: getDate.getThreeMonthDays().starttime,
  114. endDate: getDate.getCurrMonthDays().endtime,
  115. purchaseBillNo: '',
  116. receivingBillNo: '',
  117. auditState: undefined
  118. },
  119. // 表头
  120. columns: [
  121. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  122. { title: '采购单号', dataIndex: 'purchaseBillNo', align: 'center', customRender: function (text) { return text || '--' } },
  123. { title: '采购入库单号', scopedSlots: { customRender: 'receivingBillNo' }, width: 220, align: 'center' },
  124. { title: '总款数', dataIndex: 'totalPutCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  125. { title: '入库总数量', dataIndex: 'totalPutQty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  126. { title: '入库总成本', dataIndex: 'totalPutAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  127. { title: '签收入库时间', dataIndex: 'stockPutTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '财务入库审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '财务审核状态', dataIndex: 'auditStateDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '操作', scopedSlots: { customRender: 'action' }, width: 140, align: 'center', fixed: 'right' }
  131. ],
  132. // 加载数据方法 必须为 Promise 对象
  133. loadData: parameter => {
  134. this.disabled = true
  135. if (this.tableHeight == 0) {
  136. this.tableHeight = window.innerHeight - 370
  137. }
  138. const params = Object.assign(parameter, this.queryParam)
  139. return receivingList(params).then(res => {
  140. const data = res.data
  141. const no = (data.pageNo - 1) * data.pageSize
  142. for (var i = 0; i < data.list.length; i++) {
  143. data.list[i].no = no + i + 1
  144. }
  145. this.disabled = false
  146. this.getTotal(params)
  147. return data
  148. })
  149. },
  150. productTotal: null
  151. }
  152. },
  153. methods: {
  154. // 时间 change
  155. dateChange (date) {
  156. this.queryParam.beginDate = date[0]
  157. this.queryParam.endDate = date[1]
  158. },
  159. // 合计
  160. getTotal (param) {
  161. receivingCount(param).then(res => {
  162. if (res.status == 200 && res.data) {
  163. this.productTotal = res.data
  164. } else {
  165. this.productTotal = null
  166. }
  167. })
  168. },
  169. // 详情
  170. handleDetail (row) {
  171. if (this.$hasPermissions('M_warehousingAudit_detail')) {
  172. this.$router.push({ path: `/financialManagement/warehousingAudit/detail/${row.receivingBillSn}` })
  173. }
  174. },
  175. // 审核
  176. handleExamine (row, type) {
  177. const _this = this
  178. this.$confirm({
  179. title: '提示',
  180. content: '确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  181. centered: true,
  182. onOk () {
  183. _this.spinning = true
  184. receivingStockInAudit({ id: row.id, auditState: type == 1 ? 'FINISH' : 'PUT_WAREHOUSE_AUDIT_REJECT' }).then(res => {
  185. if (res.status == 200) {
  186. _this.$message.success(res.message)
  187. _this.$refs.table.refresh()
  188. _this.spinning = false
  189. } else {
  190. _this.spinning = false
  191. }
  192. })
  193. }
  194. })
  195. },
  196. // 重置
  197. resetSearchForm () {
  198. this.$refs.rangeDate.resetDate(this.auditTime)
  199. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  200. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  201. this.queryParam.purchaseBillNo = ''
  202. this.queryParam.receivingBillNo = ''
  203. this.queryParam.auditState = undefined
  204. this.$refs.table.refresh(true)
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="less">
  210. .warehousingAuditList-wrap{
  211. .sTable{
  212. margin-top: 15px;
  213. }
  214. .active{
  215. color: #ed1c24;
  216. cursor: pointer;
  217. }
  218. .common{
  219. color: rgba(0, 0, 0, 0.65);
  220. }
  221. }
  222. </style>