list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferInList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div 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: 24px;">
  63. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferInList-refresh">查询</a-button>
  64. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInList-reset">重置</a-button>
  65. <a @click="advanced=!advanced" style="margin-left: 8px">
  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"
  76. ref="table"
  77. size="small"
  78. :rowKey="(record) => record.id"
  79. :columns="columns"
  80. :data="loadData"
  81. :scroll="{ x: 1650, y: tableHeight }"
  82. bordered>
  83. <!-- 连锁调入单号 -->
  84. <template slot="allocationLinkagePutNo" slot-scope="text, record">
  85. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_allocLinkagePutDetail')" @click="handleDetail(record)">{{ record.allocationLinkagePutNo }}</span>
  86. <span v-else>{{ record.allocationLinkagePutNo }}</span>
  87. </template>
  88. <!-- 操作 -->
  89. <template slot="action" slot-scope="text, record">
  90. <a-button
  91. size="small"
  92. type="link"
  93. v-if="record.state == 'WAIT_SUBMIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  94. class="button-primary"
  95. @click="handleEdit(record)"
  96. id="chainTransferInList-warehousing-btn">入库</a-button>
  97. <a-button
  98. size="small"
  99. type="link"
  100. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutAudit')"
  101. class="button-warning"
  102. @click="handleExamine(record)"
  103. id="chainTransferInList-examine-btn">审核</a-button>
  104. <a-button
  105. size="small"
  106. type="link"
  107. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  108. class="button-info"
  109. @click="handleEdit(record)"
  110. id="chainTransferInList-edit-btn">编辑</a-button>
  111. <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>
  112. </template>
  113. </s-table>
  114. </a-spin>
  115. </a-card>
  116. </template>
  117. <script>
  118. import { STable, VSelect } from '@/components'
  119. import rangeDate from '@/views/common/rangeDate.vue'
  120. import { allocLinkagePutList, allocLinkagePutAudit } from '@/api/allocLinkagePut'
  121. import { getTenantList } from '@/api/allocLinkageOut'
  122. export default {
  123. components: { STable, VSelect, rangeDate },
  124. data () {
  125. return {
  126. spinning: false,
  127. tableHeight: 0,
  128. advanced: false, // 高级搜索 展开/关闭
  129. queryParam: { // 查询条件
  130. beginDate: '',
  131. endDate: '',
  132. outTenantSn: undefined, // 调出对象
  133. allocationType: undefined, // 调拨产品类型
  134. state: undefined, // 业务状态
  135. settleState: undefined
  136. },
  137. disabled: false, // 查询、重置按钮是否可操作
  138. columns: [
  139. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  140. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  141. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: 220, align: 'center' },
  142. { title: '调出对象', dataIndex: 'outTenantName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  143. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  144. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  145. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '入库时间', dataIndex: 'putWarehouseTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  147. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
  151. ],
  152. // 加载数据方法 必须为 Promise 对象
  153. loadData: parameter => {
  154. this.disabled = true
  155. if (this.tableHeight == 0) {
  156. this.tableHeight = window.innerHeight - 80
  157. }
  158. return allocLinkagePutList(Object.assign(parameter, this.queryParam)).then(res => {
  159. const data = res.data
  160. const no = (data.pageNo - 1) * data.pageSize
  161. for (var i = 0; i < data.list.length; i++) {
  162. data.list[i].no = no + i + 1
  163. }
  164. this.disabled = false
  165. return data
  166. })
  167. },
  168. outTenantSnData: []
  169. }
  170. },
  171. methods: {
  172. // 时间 change
  173. dateChange (date) {
  174. this.queryParam.beginDate = date[0]
  175. this.queryParam.endDate = date[1]
  176. },
  177. // 重置
  178. resetSearchForm () {
  179. this.$refs.rangeDate.resetDate()
  180. this.queryParam.beginDate = ''
  181. this.queryParam.endDate = ''
  182. this.queryParam.outTenantSn = undefined
  183. this.queryParam.allocationType = undefined
  184. this.queryParam.state = undefined
  185. this.queryParam.settleState = undefined
  186. this.$refs.table.refresh(true)
  187. },
  188. // 详情
  189. handleDetail (row) {
  190. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  191. },
  192. // 入库/编辑
  193. handleEdit (row) {
  194. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  195. },
  196. // 审核
  197. handleExamine (row) {
  198. const _this = this
  199. this.$confirm({
  200. title: '提示',
  201. content: '确认要审核通过吗?',
  202. centered: true,
  203. onOk () {
  204. _this.spinning = true
  205. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  206. if (res.status == 200) {
  207. _this.$message.success(res.message)
  208. _this.$refs.table.refresh()
  209. _this.spinning = false
  210. } else {
  211. _this.spinning = false
  212. }
  213. })
  214. }
  215. })
  216. },
  217. // 调出对象
  218. getPutTenantList () {
  219. getTenantList({}).then(res => {
  220. if (res.status == 200) {
  221. this.outTenantSnData = res.data
  222. } else {
  223. this.outTenantSnData = []
  224. }
  225. })
  226. },
  227. filterOption (input, option) {
  228. return (
  229. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  230. )
  231. }
  232. },
  233. beforeRouteEnter (to, from, next) {
  234. next(vm => {
  235. vm.getPutTenantList()
  236. })
  237. }
  238. }
  239. </script>