list.vue 9.0 KB

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