list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferInList-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 ref="rangeDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="调出对象">
  15. <getTenantList id="chainTransferInList-outTenantSn" v-model="queryParam.outTenantSn"></getTenantList>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="调拨产品类型">
  20. <v-select
  21. v-model="queryParam.allocationType"
  22. ref="allocationType"
  23. id="chainTransferInList-allocationType"
  24. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  25. placeholder="请选择调拨产品类型"
  26. allowClear></v-select>
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="advanced">
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="业务状态">
  32. <v-select
  33. v-model="queryParam.state"
  34. ref="state"
  35. id="chainTransferInList-state"
  36. code="ALLOCATION_LINKAGE_PUT_STATUS"
  37. placeholder="请选择业务状态"
  38. allowClear></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-item label="财务状态">
  43. <v-select
  44. v-model="queryParam.settleState"
  45. ref="settleState"
  46. id="chainTransferInList-settleState"
  47. code="FINANCIAL_PAY_STATUS"
  48. placeholder="请选择财务状态"
  49. allowClear></v-select>
  50. </a-form-item>
  51. </a-col>
  52. </template>
  53. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  54. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferInList-refresh">查询</a-button>
  55. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInList-reset">重置</a-button>
  56. <a @click="advanced=!advanced" style="margin-left: 5px">
  57. {{ advanced ? '收起' : '展开' }}
  58. <a-icon :type="advanced ? 'up' : 'down'"/>
  59. </a>
  60. </a-col>
  61. </a-row>
  62. </a-form>
  63. </div>
  64. <!-- 统计 -->
  65. <a-alert type="info" style="margin-bottom:10px">
  66. <div slot="message">
  67. 总款数: <strong>{{ countData&&(countData.productTotalCategory || countData.productTotalCategory==0) ? countData.productTotalCategory : '--' }}</strong> ,
  68. 总数量: <strong>{{ countData&&(countData.productTotalQty || countData.productTotalQty==0) ? countData.productTotalQty : '--' }}</strong>
  69. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  70. ,总成本: <strong>{{ countData&&(countData.productTotalCost || countData.productTotalCost==0) ? toThousands(countData.productTotalCost,2) : '--' }}</strong>
  71. </div>
  72. </div>
  73. </a-alert>
  74. <!-- 列表 -->
  75. <s-table
  76. class="sTable fixPagination"
  77. ref="table"
  78. :style="{ height: tableHeight+84.5+'px' }"
  79. size="small"
  80. :rowKey="(record) => record.id"
  81. :columns="columns"
  82. :data="loadData"
  83. :scroll="{ y: tableHeight }"
  84. :defaultLoadData="false"
  85. bordered>
  86. <!-- 连锁调入单号 -->
  87. <template slot="allocationLinkagePutNo" slot-scope="text, record">
  88. <span class="table-td-link" v-if="$hasPermissions('B_allocLinkagePutDetail')" @click="handleDetail(record)">{{ record.allocationLinkagePutNo }}</span>
  89. <span v-else>{{ record.allocationLinkagePutNo }}</span>
  90. </template>
  91. <!-- 审核 -->
  92. <template slot="audit" slot-scope="text, record">
  93. <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  94. </template>
  95. <!-- 付款 -->
  96. <template slot="financial" slot-scope="text, record">
  97. <stateIcon :title="record.settleStateDictValue" :state="record.settleState == 'FINISH'?'1':'2'"></stateIcon>
  98. </template>
  99. <!-- 入库 -->
  100. <template slot="waitOut" slot-scope="text, record">
  101. <stateIcon :state="record.state != 'WAIT_SUBMIT'?'1':'2'"></stateIcon>
  102. </template>
  103. <!-- 操作 -->
  104. <template slot="action" slot-scope="text, record">
  105. <a-button
  106. size="small"
  107. type="link"
  108. v-if="record.state == 'WAIT_SUBMIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  109. class="button-primary"
  110. @click="handleEdit(record)"
  111. id="chainTransferInList-warehousing-btn">入库</a-button>
  112. <a-button
  113. size="small"
  114. type="link"
  115. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutAudit')"
  116. class="button-primary"
  117. @click="handleExamine(record)"
  118. id="chainTransferInList-examine-btn">审核</a-button>
  119. <a-button
  120. size="small"
  121. type="link"
  122. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  123. class="button-primary"
  124. @click="handleEdit(record)"
  125. id="chainTransferInList-edit-btn">编辑</a-button>
  126. <span v-if="((record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT')) || (!(record.state == 'WAIT_SUBMIT'&&$hasPermissions('B_allocLinkagePutEdit'))&&!(record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutAudit'))&&!(record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutEdit')))">--</span>
  127. </template>
  128. </s-table>
  129. </a-spin>
  130. </a-card>
  131. </template>
  132. <script>
  133. import { commonMixin } from '@/utils/mixin'
  134. import { STable, VSelect } from '@/components'
  135. import { formatDecimal } from '@/libs/tools'
  136. import rangeDate from '@/views/common/rangeDate.vue'
  137. import { allocLinkagePutList, allocLinkagePutAudit, allocLinkagePutQueryCount } from '@/api/allocLinkagePut'
  138. import getTenantList from '@/views/common/getTenantList.js'
  139. import stateIcon from '@/views/common/stateIcon'
  140. export default {
  141. name: 'AllocLinkagePutList',
  142. components: { STable, VSelect, rangeDate, stateIcon, getTenantList },
  143. mixins: [commonMixin],
  144. data () {
  145. return {
  146. spinning: false,
  147. advanced: true, // 高级搜索 展开/关闭
  148. tableHeight: 0,
  149. queryParam: { // 查询条件
  150. beginDate: '',
  151. endDate: '',
  152. outTenantSn: undefined, // 调出对象
  153. allocationType: undefined, // 调拨产品类型
  154. state: undefined, // 业务状态
  155. settleState: undefined
  156. },
  157. disabled: false, // 查询、重置按钮是否可操作
  158. countData: null, // 统计
  159. // 加载数据方法 必须为 Promise 对象
  160. loadData: parameter => {
  161. this.disabled = true
  162. this.spinning = true
  163. const params = Object.assign(parameter, this.queryParam)
  164. return allocLinkagePutList(params).then(res => {
  165. let data
  166. if (res.status == 200) {
  167. data = res.data
  168. this.getCount(params)
  169. const no = (data.pageNo - 1) * data.pageSize
  170. for (var i = 0; i < data.list.length; i++) {
  171. data.list[i].no = no + i + 1
  172. data.list[i].productTotalCost = formatDecimal(data.list[i].productTotalCost, 2)
  173. }
  174. this.disabled = false
  175. }
  176. this.spinning = false
  177. return data
  178. })
  179. }
  180. }
  181. },
  182. computed: {
  183. columns () {
  184. const _this = this
  185. const arr = [
  186. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  187. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  188. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: '16%', align: 'center' },
  189. { title: '调出对象', dataIndex: 'outTenantName', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  191. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  192. // { title: '总成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  193. { title: '入库时间', dataIndex: 'putWarehouseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  194. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  195. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  196. // { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  197. { title: '入库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
  198. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  199. { title: '付款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
  200. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  201. ]
  202. if (this.$hasPermissions('M_ShowAllCost')) {
  203. arr.splice(6, 0, { title: '总成本', dataIndex: 'productTotalCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  204. }
  205. return arr
  206. }
  207. },
  208. methods: {
  209. // 统计
  210. getCount (params) {
  211. allocLinkagePutQueryCount(params).then(res => {
  212. if (res.status == 200) {
  213. this.countData = res.data
  214. } else {
  215. this.countData = null
  216. }
  217. })
  218. },
  219. // 时间 change
  220. dateChange (date) {
  221. this.queryParam.beginDate = date[0]
  222. this.queryParam.endDate = date[1]
  223. },
  224. // 重置
  225. resetSearchForm () {
  226. this.$refs.rangeDate.resetDate()
  227. this.queryParam.beginDate = ''
  228. this.queryParam.endDate = ''
  229. this.queryParam.outTenantSn = undefined
  230. this.queryParam.allocationType = undefined
  231. this.queryParam.state = undefined
  232. this.queryParam.settleState = undefined
  233. this.$refs.table.refresh(true)
  234. },
  235. // 详情
  236. handleDetail (row) {
  237. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  238. },
  239. // 入库/编辑
  240. handleEdit (row) {
  241. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  242. },
  243. // 审核
  244. handleExamine (row) {
  245. const _this = this
  246. this.$confirm({
  247. title: '提示',
  248. content: '确认要审核通过吗?',
  249. centered: true,
  250. onOk () {
  251. _this.spinning = true
  252. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  253. if (res.status == 200) {
  254. _this.$message.success(res.message)
  255. _this.$refs.table.refresh()
  256. _this.spinning = false
  257. } else {
  258. _this.spinning = false
  259. }
  260. })
  261. }
  262. })
  263. },
  264. pageInit () {
  265. const _this = this
  266. this.$nextTick(() => { // 页面渲染完成后的回调
  267. _this.setTableH()
  268. })
  269. },
  270. setTableH () {
  271. const tableSearchH = this.$refs.tableSearch.offsetHeight
  272. this.tableHeight = window.innerHeight - tableSearchH - 232
  273. }
  274. },
  275. watch: {
  276. advanced (newValue, oldValue) {
  277. const _this = this
  278. this.$nextTick(() => { // 页面渲染完成后的回调
  279. _this.setTableH()
  280. })
  281. },
  282. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  283. this.setTableH()
  284. }
  285. },
  286. mounted () {
  287. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  288. this.pageInit()
  289. this.resetSearchForm()
  290. }
  291. },
  292. activated () {
  293. // 如果是新页签打开,则重置当前页面
  294. if (this.$store.state.app.isNewTab) {
  295. this.pageInit()
  296. this.resetSearchForm()
  297. }
  298. // 仅刷新列表,不重置页面
  299. if (this.$store.state.app.updateList) {
  300. this.pageInit()
  301. this.$refs.table.refresh()
  302. }
  303. },
  304. beforeRouteEnter (to, from, next) {
  305. next(vm => {})
  306. }
  307. }
  308. </script>