list.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferInList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="入库时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="chainTransferInList-time"
  12. :disabledDate="disabledDate"
  13. v-model="time"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="调出对象">
  20. <a-select
  21. placeholder="请选择调出对象"
  22. allowClear
  23. id="chainTransferInList-outTenantSn"
  24. v-model="queryParam.outTenantSn"
  25. :showSearch="true"
  26. option-filter-prop="children"
  27. :filter-option="filterOption">
  28. <a-select-option v-for="item in outTenantSnData" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
  29. </a-select>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="调拨产品类型">
  34. <v-select
  35. v-model="queryParam.allocationType"
  36. ref="allocationType"
  37. id="chainTransferInList-allocationType"
  38. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  39. placeholder="请选择调拨产品类型"
  40. allowClear></v-select>
  41. </a-form-item>
  42. </a-col>
  43. <template v-if="advanced">
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="业务状态">
  46. <v-select
  47. v-model="queryParam.state"
  48. ref="state"
  49. id="chainTransferInList-state"
  50. code="ALLOCATION_LINKAGE_PUT_STATUS"
  51. placeholder="请选择业务状态"
  52. allowClear></v-select>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="6" :sm="24">
  56. <a-form-item label="财务状态">
  57. <v-select
  58. v-model="queryParam.settleState"
  59. ref="settleState"
  60. id="chainTransferInList-settleState"
  61. code="FINANCIAL_PAY_STATUS"
  62. placeholder="请选择财务状态"
  63. allowClear></v-select>
  64. </a-form-item>
  65. </a-col>
  66. </template>
  67. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  68. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferInList-refresh">查询</a-button>
  69. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInList-reset">重置</a-button>
  70. <a @click="advanced=!advanced" style="margin-left: 8px">
  71. {{ advanced ? '收起' : '展开' }}
  72. <a-icon :type="advanced ? 'up' : 'down'"/>
  73. </a>
  74. </a-col>
  75. </a-row>
  76. </a-form>
  77. </div>
  78. <!-- 列表 -->
  79. <s-table
  80. class="sTable"
  81. ref="table"
  82. size="default"
  83. :rowKey="(record) => record.id"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ x: 1650, y: tableHeight }"
  87. bordered>
  88. <!-- 连锁调入单号 -->
  89. <template slot="allocationLinkagePutNo" slot-scope="text, record">
  90. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.allocationLinkagePutNo }}</span>
  91. </template>
  92. <!-- 财务状态 -->
  93. <template slot="settleState" slot-scope="text, record">
  94. <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
  95. </template>
  96. <!-- 操作 -->
  97. <template slot="action" slot-scope="text, record">
  98. <a-button
  99. size="small"
  100. type="link"
  101. v-if="record.state == 'WAIT_SUBMIT'"
  102. class="button-primary"
  103. @click="handleEdit(record)"
  104. id="chainTransferInList-warehousing-btn">入库</a-button>
  105. <a-button
  106. size="small"
  107. type="link"
  108. v-if="record.state == 'WAIT_AUDIT'"
  109. class="button-warning"
  110. @click="handleExamine(record)"
  111. id="chainTransferInList-examine-btn">审核</a-button>
  112. <a-button
  113. size="small"
  114. type="link"
  115. v-if="record.state == 'WAIT_AUDIT'"
  116. class="button-info"
  117. @click="handleEdit(record)"
  118. id="chainTransferInList-edit-btn">编辑</a-button>
  119. <span v-if="(record.state != 'WAIT_SUBMIT') && (record.state != 'WAIT_AUDIT')">--</span>
  120. </template>
  121. </s-table>
  122. </a-card>
  123. </template>
  124. <script>
  125. import moment from 'moment'
  126. import { STable, VSelect } from '@/components'
  127. import { allocLinkagePutList, allocLinkagePutAudit } from '@/api/allocLinkagePut'
  128. import { getTenantList } from '@/api/allocLinkageOut'
  129. export default {
  130. components: { STable, VSelect },
  131. data () {
  132. return {
  133. tableHeight: 0,
  134. advanced: false, // 高级搜索 展开/关闭
  135. time: [], // 入库时间
  136. queryParam: { // 查询条件
  137. outTenantSn: undefined, // 调出对象
  138. allocationType: undefined, // 调拨产品类型
  139. state: undefined, // 业务状态
  140. settleState: undefined
  141. },
  142. disabled: false, // 查询、重置按钮是否可操作
  143. dateFormat: 'YYYY-MM-DD',
  144. columns: [
  145. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  146. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  147. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: 220, align: 'center' },
  148. { title: '调出对象', dataIndex: 'outTenantName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  149. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  150. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. { title: '入库时间', dataIndex: 'putWarehouseTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center' },
  155. { title: '财务状态', scopedSlots: { customRender: 'settleState' }, width: 100, align: 'center' },
  156. { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
  157. ],
  158. // 加载数据方法 必须为 Promise 对象
  159. loadData: parameter => {
  160. this.disabled = true
  161. if (this.tableHeight == 0) {
  162. this.tableHeight = window.innerHeight - 80
  163. }
  164. // 入库时间
  165. if (this.time && this.time.length > 0) {
  166. this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
  167. this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
  168. } else {
  169. this.queryParam.beginDate = undefined
  170. this.queryParam.endDate = undefined
  171. }
  172. return allocLinkagePutList(Object.assign(parameter, this.queryParam)).then(res => {
  173. const data = res.data
  174. const no = (data.pageNo - 1) * data.pageSize
  175. for (var i = 0; i < data.list.length; i++) {
  176. data.list[i].no = no + i + 1
  177. }
  178. this.disabled = false
  179. return data
  180. })
  181. },
  182. outTenantSnData: []
  183. }
  184. },
  185. methods: {
  186. // 不可选日期
  187. disabledDate (date, dateStrings) {
  188. return date && date.valueOf() > Date.now()
  189. },
  190. // 重置
  191. resetSearchForm () {
  192. this.queryParam.outTenantSn = undefined
  193. this.queryParam.allocationType = undefined
  194. this.queryParam.state = undefined
  195. this.queryParam.settleState = undefined
  196. this.time = []
  197. this.$refs.table.refresh(true)
  198. },
  199. // 详情
  200. handleDetail (row) {
  201. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  202. },
  203. // 入库/编辑
  204. handleEdit (row) {
  205. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  206. },
  207. // 审核
  208. handleExamine (row) {
  209. const _this = this
  210. this.$confirm({
  211. title: '提示',
  212. content: '确认要审核通过吗?',
  213. centered: true,
  214. onOk () {
  215. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  216. if (res.status == 200) {
  217. _this.$message.success(res.message)
  218. _this.$refs.table.refresh()
  219. }
  220. })
  221. }
  222. })
  223. },
  224. // 调出对象
  225. getPutTenantList () {
  226. getTenantList({}).then(res => {
  227. if (res.status == 200) {
  228. this.outTenantSnData = res.data
  229. } else {
  230. this.outTenantSnData = []
  231. }
  232. })
  233. },
  234. filterOption (input, option) {
  235. return (
  236. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  237. )
  238. }
  239. },
  240. beforeRouteEnter (to, from, next) {
  241. next(vm => {
  242. vm.getPutTenantList()
  243. })
  244. }
  245. }
  246. </script>