list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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 { STable, VSelect } from '@/components'
  121. import rangeDate from '@/views/common/rangeDate.vue'
  122. import { allocLinkagePutList, allocLinkagePutAudit } from '@/api/allocLinkagePut'
  123. import { getTenantList } from '@/api/allocLinkageOut'
  124. export default {
  125. components: { STable, VSelect, rangeDate },
  126. data () {
  127. return {
  128. spinning: false,
  129. advanced: true, // 高级搜索 展开/关闭
  130. tableHeight: 0,
  131. queryParam: { // 查询条件
  132. beginDate: '',
  133. endDate: '',
  134. outTenantSn: undefined, // 调出对象
  135. allocationType: undefined, // 调拨产品类型
  136. state: undefined, // 业务状态
  137. settleState: undefined
  138. },
  139. disabled: false, // 查询、重置按钮是否可操作
  140. columns: [
  141. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  142. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: '16%', align: 'center' },
  144. { title: '调出对象', dataIndex: 'outTenantName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  145. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  147. { title: '总成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  148. { title: '入库时间', dataIndex: 'putWarehouseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  153. ],
  154. // 加载数据方法 必须为 Promise 对象
  155. loadData: parameter => {
  156. this.disabled = true
  157. this.spinning = true
  158. return allocLinkagePutList(Object.assign(parameter, this.queryParam)).then(res => {
  159. let data
  160. if (res.status == 200) {
  161. data = res.data
  162. const no = (data.pageNo - 1) * data.pageSize
  163. for (var i = 0; i < data.list.length; i++) {
  164. data.list[i].no = no + i + 1
  165. }
  166. this.disabled = false
  167. }
  168. this.spinning = false
  169. return data
  170. })
  171. },
  172. outTenantSnData: []
  173. }
  174. },
  175. methods: {
  176. // 时间 change
  177. dateChange (date) {
  178. this.queryParam.beginDate = date[0]
  179. this.queryParam.endDate = date[1]
  180. },
  181. // 重置
  182. resetSearchForm () {
  183. this.$refs.rangeDate.resetDate()
  184. this.queryParam.beginDate = ''
  185. this.queryParam.endDate = ''
  186. this.queryParam.outTenantSn = undefined
  187. this.queryParam.allocationType = undefined
  188. this.queryParam.state = undefined
  189. this.queryParam.settleState = undefined
  190. this.$refs.table.refresh(true)
  191. },
  192. // 详情
  193. handleDetail (row) {
  194. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  195. },
  196. // 入库/编辑
  197. handleEdit (row) {
  198. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  199. },
  200. // 审核
  201. handleExamine (row) {
  202. const _this = this
  203. this.$confirm({
  204. title: '提示',
  205. content: '确认要审核通过吗?',
  206. centered: true,
  207. onOk () {
  208. _this.spinning = true
  209. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  210. if (res.status == 200) {
  211. _this.$message.success(res.message)
  212. _this.$refs.table.refresh()
  213. _this.spinning = false
  214. } else {
  215. _this.spinning = false
  216. }
  217. })
  218. }
  219. })
  220. },
  221. // 调出对象
  222. getPutTenantList () {
  223. getTenantList({}).then(res => {
  224. if (res.status == 200) {
  225. this.outTenantSnData = res.data
  226. } else {
  227. this.outTenantSnData = []
  228. }
  229. })
  230. },
  231. filterOption (input, option) {
  232. return (
  233. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  234. )
  235. },
  236. pageInit () {
  237. const _this = this
  238. this.$nextTick(() => { // 页面渲染完成后的回调
  239. _this.setTableH()
  240. })
  241. this.getPutTenantList()
  242. },
  243. setTableH () {
  244. const tableSearchH = this.$refs.tableSearch.offsetHeight
  245. this.tableHeight = window.innerHeight - tableSearchH - 197
  246. }
  247. },
  248. watch: {
  249. advanced (newValue, oldValue) {
  250. const _this = this
  251. setTimeout(() => {
  252. _this.setTableH()
  253. }, 400)
  254. },
  255. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  256. this.setTableH()
  257. }
  258. },
  259. mounted () {
  260. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  261. this.pageInit()
  262. this.resetSearchForm()
  263. }
  264. },
  265. activated () {
  266. // 如果是新页签打开,则重置当前页面
  267. if (this.$store.state.app.isNewTab) {
  268. this.pageInit()
  269. this.resetSearchForm()
  270. }
  271. // 仅刷新列表,不重置页面
  272. if (this.$store.state.app.updateList) {
  273. this.pageInit()
  274. this.$refs.table.refresh()
  275. }
  276. },
  277. beforeRouteEnter (to, from, next) {
  278. next(vm => {})
  279. }
  280. }
  281. </script>