list.vue 14 KB

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