list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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')?'table-td-link':'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. // 加载数据方法 必须为 Promise 对象
  131. loadData: parameter => {
  132. this.disabled = true
  133. this.spinning = true
  134. const params = Object.assign(parameter, this.queryParam)
  135. return receivingAuditList(params).then(res => {
  136. let data
  137. if (res.status == 200) {
  138. data = res.data
  139. this.getTotal(params)
  140. const no = (data.pageNo - 1) * data.pageSize
  141. for (var i = 0; i < data.list.length; i++) {
  142. data.list[i].no = no + i + 1
  143. if (data.list[i].auditState == 'WAIT_PUT_WAREHOUSE_AUDIT') {
  144. data.list[i].auditStateDictValue = '待审核'
  145. } else if (data.list[i].auditState == 'FINISH') {
  146. data.list[i].auditStateDictValue = '已审核'
  147. } else if (data.list[i].auditState == 'PUT_WAREHOUSE_AUDIT_REJECT') {
  148. data.list[i].auditStateDictValue = '审核不通过'
  149. }
  150. }
  151. this.disabled = false
  152. }
  153. this.spinning = false
  154. return data
  155. })
  156. },
  157. productTotal: null
  158. }
  159. },
  160. computed: {
  161. columns () {
  162. const _this = this
  163. const arr = [
  164. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  165. { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '发货单号', scopedSlots: { customRender: 'receivingBillNo' }, width: '15%', align: 'center' },
  167. { title: '总款数', dataIndex: 'totalPutCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  168. { title: '入库总数量', dataIndex: 'totalRealPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. // { title: '入库总成本', dataIndex: 'totalRealPutAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  170. { title: '签收入库时间', dataIndex: 'stockPutTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  171. { title: '财务入库审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  173. // { title: '财务审核状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  174. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  175. ]
  176. if (this.$hasPermissions('M_ShowAllCost')) {
  177. arr.splice(5, 0, { title: '入库总成本', dataIndex: 'totalRealPutAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  178. }
  179. return arr
  180. }
  181. },
  182. methods: {
  183. // 时间 change
  184. dateChange (date) {
  185. this.queryParam.beginDate = date[0] ? date[0] : ''
  186. this.queryParam.endDate = date[1] ? date[1] : ''
  187. },
  188. // 合计
  189. getTotal (param) {
  190. receivingCount(param).then(res => {
  191. if (res.status == 200 && res.data) {
  192. this.productTotal = res.data
  193. } else {
  194. this.productTotal = null
  195. }
  196. })
  197. },
  198. // 详情
  199. handleDetail (row) {
  200. if (this.$hasPermissions('M_warehousingAudit_detail')) {
  201. this.$router.push({ path: `/financialManagement/warehousingAudit/detail/${row.receivingBillSn}` })
  202. }
  203. },
  204. // 审核
  205. handleExamine (row, type) {
  206. const _this = this
  207. this.$confirm({
  208. title: '提示',
  209. content: '确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  210. centered: true,
  211. onOk () {
  212. _this.spinning = true
  213. receivingStockInAudit({ id: row.id, auditState: type == 1 ? 'FINISH' : 'PUT_WAREHOUSE_AUDIT_REJECT' }).then(res => {
  214. if (res.status == 200) {
  215. _this.$message.success(res.message)
  216. _this.$refs.table.refresh()
  217. _this.spinning = false
  218. } else {
  219. _this.spinning = false
  220. }
  221. })
  222. }
  223. })
  224. },
  225. // 重置
  226. resetSearchForm () {
  227. this.resetData()
  228. this.$refs.table.refresh(true)
  229. },
  230. // 重置数据
  231. resetData (flag) {
  232. this.$refs.rangeDate.resetDate(flag ? '' : this.auditTime)
  233. this.queryParam.beginDate = flag ? '' : (getDate.getThreeMonthDays().starttime)
  234. this.queryParam.endDate = flag ? '' : (getDate.getCurrMonthDays().endtime)
  235. this.queryParam.purchaseBillNo = ''
  236. this.queryParam.receivingBillNo = ''
  237. this.queryParam.auditState = flag ? '' : 'WAIT_PUT_WAREHOUSE_AUDIT'
  238. },
  239. pageInit () {
  240. const _this = this
  241. this.$nextTick(() => { // 页面渲染完成后的回调
  242. _this.setTableH()
  243. })
  244. },
  245. setTableH () {
  246. const tableSearchH = this.$refs.tableSearch.offsetHeight
  247. this.tableHeight = window.innerHeight - tableSearchH - 238
  248. }
  249. },
  250. watch: {
  251. advanced (newValue, oldValue) {
  252. const _this = this
  253. this.$nextTick(() => { // 页面渲染完成后的回调
  254. _this.setTableH()
  255. })
  256. },
  257. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  258. this.setTableH()
  259. }
  260. },
  261. mounted () {
  262. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  263. this.pageInit()
  264. this.resetSearchForm()
  265. }
  266. },
  267. activated () {
  268. // 是否从首页点击进入
  269. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  270. console.log(this.getIsHomeNav(), isHomeNav, this.$route.name)
  271. this.pageInit()
  272. // 待办查询
  273. if (isHomeNav && isHomeNav.type == 'todo') {
  274. this.resetData(true)
  275. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  276. this.$refs.rangeDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
  277. this.$refs.table.refresh(true)
  278. } else {
  279. // 如果是新页签打开
  280. if (this.$store.state.app.isNewTab) {
  281. this.resetSearchForm()
  282. }
  283. }
  284. },
  285. beforeRouteEnter (to, from, next) {
  286. next(vm => {})
  287. }
  288. }
  289. </script>
  290. <style lang="less">
  291. .warehousingAuditList-wrap{
  292. .active{
  293. color: #ed1c24;
  294. cursor: pointer;
  295. }
  296. .common{
  297. color: rgba(0, 0, 0);
  298. }
  299. }
  300. </style>