list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. <rangeDate id="warehousingAuditList-auditTime" ref="rangeDate" :value="auditTime" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="4" :sm="24">
  14. <a-form-item label="采购单号">
  15. <a-input id="warehousingAuditList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="4" :sm="24">
  19. <a-form-item label="发货单号">
  20. <a-input id="warehousingAuditList-receivingBillNo" v-model.trim="queryParam.receivingBillNo" allowClear placeholder="请输入发货单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="5" :sm="24">
  24. <a-form-item label="入库审核状态">
  25. <v-select
  26. v-model="queryParam.auditState"
  27. ref="auditState"
  28. @change="setIsHomeNav($route.name, null)"
  29. id="warehousingAuditList-auditState"
  30. code="RECEIVING_BILL_AUDIT_STATUS"
  31. placeholder="请选择入库审核状态"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="5" :sm="24">
  36. <span class="table-page-search-submitButtons">
  37. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehousingAuditList-refresh">查询</a-button>
  38. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="warehousingAuditList-reset">重置</a-button>
  39. </span>
  40. </a-col>
  41. </a-row>
  42. </a-form>
  43. </div>
  44. <!-- alert -->
  45. <a-alert type="info" style="margin-bottom:10px">
  46. <div slot="message">
  47. 共 <strong>{{ (productTotal&&(productTotal.totalRecord || productTotal.totalRecord==0)) ? productTotal.totalRecord : '--' }}</strong> 条记录,
  48. 其中待审核 <strong>{{ (productTotal&&(productTotal.waitAuditRecord || productTotal.waitAuditRecord==0)) ? productTotal.waitAuditRecord : '--' }}</strong> 条
  49. </div>
  50. </a-alert>
  51. <!-- 列表 -->
  52. <s-table
  53. class="sTable fixPagination"
  54. ref="table"
  55. :style="{ height: tableHeight+84.5+'px' }"
  56. size="small"
  57. :rowKey="(record) => record.id"
  58. :columns="columns"
  59. :data="loadData"
  60. :scroll="{ y: tableHeight }"
  61. :defaultLoadData="false"
  62. bordered>
  63. <!-- 发货单号 -->
  64. <template slot="receivingBillNo" slot-scope="text, record">
  65. <span v-if="record.receivingBillNo" :class="$hasPermissions('M_warehousingAudit_detail')?'table-td-link':'common'" @click="handleDetail(record)">{{ record.receivingBillNo }}</span>
  66. <span v-else>--</span>
  67. </template>
  68. <!-- 审核 -->
  69. <template slot="audit" slot-scope="text, record">
  70. <stateIcon :title="record.auditStateDictValue" v-if="record.auditState!='PUT_WAREHOUSE_AUDIT_REJECT'" :state="record.auditState == 'FINISH'?'1':'2'"></stateIcon>
  71. <stateIcon :title="record.auditStateDictValue" v-else :state="0"></stateIcon>
  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-primary"
  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-error"
  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 { commonMixin } from '@/utils/mixin'
  97. import getDate from '@/libs/getDate'
  98. import { STable, VSelect } from '@/components'
  99. import rangeDate from '@/views/common/rangeDate.vue'
  100. import stateIcon from '@/views/common/stateIcon'
  101. import { receivingAuditList, receivingStockInAudit, receivingCount } from '@/api/receiving'
  102. export default {
  103. name: 'WarehousingAuditList',
  104. components: { STable, VSelect, rangeDate, stateIcon },
  105. mixins: [commonMixin],
  106. data () {
  107. return {
  108. spinning: false,
  109. advanced: true, // 高级搜索 展开/关闭
  110. disabled: false, // 查询、重置按钮是否可操作
  111. auditTime: [ // 审核时间默认值
  112. getDate.getThreeMonthDays().starttime,
  113. getDate.getCurrMonthDays().endtime
  114. ], // 入库时间
  115. tableHeight: 0, // 表格高度
  116. // 查询参数
  117. queryParam: {
  118. beginDate: getDate.getThreeMonthDays().starttime, // 开始时间
  119. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  120. purchaseBillNo: '', // 采购单号
  121. receivingBillNo: '', // 发货单号
  122. auditState: 'WAIT_PUT_WAREHOUSE_AUDIT'// 审核状态
  123. },
  124. // 加载数据方法 必须为 Promise 对象
  125. loadData: parameter => {
  126. this.disabled = true
  127. this.spinning = true
  128. const params = Object.assign(parameter, this.queryParam)
  129. return receivingAuditList(params).then(res => {
  130. let data
  131. if (res.status == 200) {
  132. data = res.data
  133. this.getTotal(params)
  134. const no = (data.pageNo - 1) * data.pageSize
  135. for (var i = 0; i < data.list.length; i++) {
  136. data.list[i].no = no + i + 1
  137. if (data.list[i].auditState == 'WAIT_PUT_WAREHOUSE_AUDIT') {
  138. data.list[i].auditStateDictValue = '待审核'
  139. } else if (data.list[i].auditState == 'FINISH') {
  140. data.list[i].auditStateDictValue = '已审核'
  141. } else if (data.list[i].auditState == 'PUT_WAREHOUSE_AUDIT_REJECT') {
  142. data.list[i].auditStateDictValue = '审核不通过'
  143. }
  144. }
  145. this.disabled = false
  146. }
  147. this.spinning = false
  148. return data
  149. })
  150. },
  151. productTotal: null // 统计
  152. }
  153. },
  154. computed: {
  155. columns () {
  156. const _this = this
  157. const arr = [
  158. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  159. { title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '发货单号', scopedSlots: { customRender: 'receivingBillNo' }, width: '15%', align: 'center' },
  161. { title: '总款数', dataIndex: 'totalPutCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  162. { title: '入库总数量', dataIndex: 'totalRealPutQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  163. // { title: '入库总成本', dataIndex: 'totalRealPutAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  164. { title: '签收入库时间', dataIndex: 'stockPutTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  165. { title: '财务入库审核时间', dataIndex: 'auditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  167. // { title: '财务审核状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  168. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  169. ]
  170. // 成本价权限
  171. if (this.$hasPermissions('M_ShowAllCost')) {
  172. arr.splice(5, 0, { title: '入库总成本', dataIndex: 'totalRealPutAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  173. }
  174. return arr
  175. }
  176. },
  177. methods: {
  178. // 时间 change
  179. dateChange (date) {
  180. this.queryParam.beginDate = date[0] ? date[0] : ''
  181. this.queryParam.endDate = date[1] ? date[1] : ''
  182. },
  183. // 合计
  184. getTotal (param) {
  185. receivingCount(param).then(res => {
  186. if (res.status == 200 && res.data) {
  187. this.productTotal = res.data
  188. } else {
  189. this.productTotal = null
  190. }
  191. })
  192. },
  193. // 详情
  194. handleDetail (row) {
  195. if (this.$hasPermissions('M_warehousingAudit_detail')) {
  196. this.$router.push({ path: `/financialManagement/warehousingAudit/detail/${row.receivingBillSn}` })
  197. }
  198. },
  199. // 审核
  200. handleExamine (row, type) {
  201. const _this = this
  202. this.$confirm({
  203. title: '提示',
  204. content: '确定要进行' + (type == 1 ? ' 通过 ' : ' 不通过 ') + '操作吗?',
  205. centered: true,
  206. onOk () {
  207. _this.spinning = true
  208. receivingStockInAudit({ id: row.id, auditState: type == 1 ? 'FINISH' : 'PUT_WAREHOUSE_AUDIT_REJECT' }).then(res => {
  209. if (res.status == 200) {
  210. _this.$message.success(res.message)
  211. _this.$refs.table.refresh()
  212. _this.spinning = false
  213. } else {
  214. _this.spinning = false
  215. }
  216. })
  217. }
  218. })
  219. },
  220. // 重置
  221. resetSearchForm () {
  222. this.resetData()
  223. this.$refs.table.refresh(true)
  224. },
  225. // 重置数据
  226. resetData (flag) {
  227. this.$refs.rangeDate.resetDate(flag ? '' : this.auditTime)
  228. this.queryParam.beginDate = flag ? '' : (getDate.getThreeMonthDays().starttime)
  229. this.queryParam.endDate = flag ? '' : (getDate.getCurrMonthDays().endtime)
  230. this.queryParam.purchaseBillNo = ''
  231. this.queryParam.receivingBillNo = ''
  232. this.queryParam.auditState = flag ? '' : 'WAIT_PUT_WAREHOUSE_AUDIT'
  233. },
  234. // 页面初始化
  235. pageInit () {
  236. const _this = this
  237. this.$nextTick(() => { // 页面渲染完成后的回调
  238. _this.setTableH()
  239. })
  240. },
  241. // 表格高度计算
  242. setTableH () {
  243. const tableSearchH = this.$refs.tableSearch.offsetHeight
  244. this.tableHeight = window.innerHeight - tableSearchH - 238
  245. }
  246. },
  247. watch: {
  248. advanced (newValue, oldValue) {
  249. const _this = this
  250. this.$nextTick(() => { // 页面渲染完成后的回调
  251. _this.setTableH()
  252. })
  253. },
  254. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  255. this.setTableH()
  256. }
  257. },
  258. mounted () {
  259. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  260. this.pageInit()
  261. this.resetSearchForm()
  262. }
  263. },
  264. activated () {
  265. // 是否从首页点击进入
  266. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  267. console.log(this.getIsHomeNav(), isHomeNav, this.$route.name)
  268. this.pageInit()
  269. // 待办查询
  270. if (isHomeNav && isHomeNav.type == 'todo') {
  271. this.resetData(true)
  272. this.$refs.rangeDate.resetDate([isHomeNav.pageParams.beginDate, isHomeNav.pageParams.endDate])
  273. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  274. this.$refs.table.refresh(true)
  275. } else {
  276. // 如果是新页签打开
  277. if (this.$store.state.app.isNewTab) {
  278. this.resetSearchForm()
  279. }
  280. }
  281. },
  282. beforeRouteEnter (to, from, next) {
  283. next(vm => {})
  284. }
  285. }
  286. </script>
  287. <style lang="less">
  288. .warehousingAuditList-wrap{
  289. .active{
  290. color: #ed1c24;
  291. cursor: pointer;
  292. }
  293. .common{
  294. color: rgba(0, 0, 0);
  295. }
  296. }
  297. </style>