list.vue 12 KB

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