list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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="{ x: 1310, 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: 70, align: 'center' },
  142. { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: 180, align: 'center' },
  144. { title: '调出对象', dataIndex: 'outTenantName', align: 'center', customRender: function (text) { return text || '--' } },
  145. { title: '总款数', dataIndex: 'productTotalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '总数量', dataIndex: 'productTotalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  147. { title: '总成本', dataIndex: 'productTotalCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  148. { title: '入库时间', dataIndex: 'putWarehouseTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '业务状态', dataIndex: 'stateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  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. 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. this.spinning = false
  166. return data
  167. })
  168. },
  169. outTenantSnData: []
  170. }
  171. },
  172. methods: {
  173. // 时间 change
  174. dateChange (date) {
  175. this.queryParam.beginDate = date[0]
  176. this.queryParam.endDate = date[1]
  177. },
  178. // 重置
  179. resetSearchForm () {
  180. this.$refs.rangeDate.resetDate()
  181. this.queryParam.beginDate = ''
  182. this.queryParam.endDate = ''
  183. this.queryParam.outTenantSn = undefined
  184. this.queryParam.allocationType = undefined
  185. this.queryParam.state = undefined
  186. this.queryParam.settleState = undefined
  187. this.$refs.table.refresh(true)
  188. },
  189. // 详情
  190. handleDetail (row) {
  191. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  192. },
  193. // 入库/编辑
  194. handleEdit (row) {
  195. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  196. },
  197. // 审核
  198. handleExamine (row) {
  199. const _this = this
  200. this.$confirm({
  201. title: '提示',
  202. content: '确认要审核通过吗?',
  203. centered: true,
  204. onOk () {
  205. _this.spinning = true
  206. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  207. if (res.status == 200) {
  208. _this.$message.success(res.message)
  209. _this.$refs.table.refresh()
  210. _this.spinning = false
  211. } else {
  212. _this.spinning = false
  213. }
  214. })
  215. }
  216. })
  217. },
  218. // 调出对象
  219. getPutTenantList () {
  220. getTenantList({}).then(res => {
  221. if (res.status == 200) {
  222. this.outTenantSnData = res.data
  223. } else {
  224. this.outTenantSnData = []
  225. }
  226. })
  227. },
  228. filterOption (input, option) {
  229. return (
  230. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  231. )
  232. },
  233. pageInit () {
  234. const _this = this
  235. this.$nextTick(() => { // 页面渲染完成后的回调
  236. _this.setTableH()
  237. })
  238. this.getPutTenantList()
  239. },
  240. setTableH () {
  241. const tableSearchH = this.$refs.tableSearch.offsetHeight
  242. this.tableHeight = window.innerHeight - tableSearchH - 197
  243. }
  244. },
  245. watch: {
  246. advanced (newValue, oldValue) {
  247. const _this = this
  248. setTimeout(() => {
  249. _this.setTableH()
  250. }, 400)
  251. }
  252. },
  253. mounted () {
  254. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  255. this.pageInit()
  256. this.resetSearchForm()
  257. }
  258. },
  259. activated () {
  260. // 如果是新页签打开,则重置当前页面
  261. if (this.$store.state.app.isNewTab) {
  262. this.pageInit()
  263. this.resetSearchForm()
  264. }
  265. },
  266. beforeRouteEnter (to, from, next) {
  267. next(vm => {})
  268. }
  269. }
  270. </script>