list.vue 12 KB

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