list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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="audit" slot-scope="text, record">
  92. <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  93. </template>
  94. <!-- 付款 -->
  95. <template slot="financial" slot-scope="text, record">
  96. <stateIcon :title="record.settleStateDictValue" :state="record.settleState == 'FINISH'?'1':'2'"></stateIcon>
  97. </template>
  98. <!-- 入库 -->
  99. <template slot="waitOut" slot-scope="text, record">
  100. <stateIcon :state="record.state != 'WAIT_SUBMIT'?'1':'2'"></stateIcon>
  101. </template>
  102. <!-- 操作 -->
  103. <template slot="action" slot-scope="text, record">
  104. <a-button
  105. size="small"
  106. type="link"
  107. v-if="record.state == 'WAIT_SUBMIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  108. class="button-primary"
  109. @click="handleEdit(record)"
  110. id="chainTransferInList-warehousing-btn">入库</a-button>
  111. <a-button
  112. size="small"
  113. type="link"
  114. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutAudit')"
  115. class="button-primary"
  116. @click="handleExamine(record)"
  117. id="chainTransferInList-examine-btn">审核</a-button>
  118. <a-button
  119. size="small"
  120. type="link"
  121. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkagePutEdit')"
  122. class="button-primary"
  123. @click="handleEdit(record)"
  124. id="chainTransferInList-edit-btn">编辑</a-button>
  125. <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>
  126. </template>
  127. </s-table>
  128. </a-spin>
  129. </a-card>
  130. </template>
  131. <script>
  132. import { commonMixin } from '@/utils/mixin'
  133. import { STable, VSelect } from '@/components'
  134. import { formatDecimal } from '@/libs/tools'
  135. import rangeDate from '@/views/common/rangeDate.vue'
  136. import { allocLinkagePutList, allocLinkagePutAudit } from '@/api/allocLinkagePut'
  137. import { getTenantList } from '@/api/allocLinkageOut'
  138. import stateIcon from '@/views/common/stateIcon'
  139. export default {
  140. name: 'AllocLinkagePutList',
  141. components: { STable, VSelect, rangeDate, stateIcon },
  142. mixins: [commonMixin],
  143. data () {
  144. return {
  145. spinning: false,
  146. advanced: true, // 高级搜索 展开/关闭
  147. tableHeight: 0,
  148. queryParam: { // 查询条件
  149. beginDate: '',
  150. endDate: '',
  151. outTenantSn: undefined, // 调出对象
  152. allocationType: undefined, // 调拨产品类型
  153. state: undefined, // 业务状态
  154. settleState: undefined
  155. },
  156. disabled: false, // 查询、重置按钮是否可操作
  157. // 加载数据方法 必须为 Promise 对象
  158. loadData: parameter => {
  159. this.disabled = true
  160. this.spinning = true
  161. return allocLinkagePutList(Object.assign(parameter, this.queryParam)).then(res => {
  162. let data
  163. if (res.status == 200) {
  164. data = res.data
  165. const no = (data.pageNo - 1) * data.pageSize
  166. for (var i = 0; i < data.list.length; i++) {
  167. data.list[i].no = no + i + 1
  168. data.list[i].productTotalCost = formatDecimal(data.list[i].productTotalCost, 2)
  169. }
  170. this.disabled = false
  171. }
  172. this.spinning = false
  173. return data
  174. })
  175. },
  176. outTenantSnData: []
  177. }
  178. },
  179. computed: {
  180. columns () {
  181. const arr = [
  182. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  183. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  184. { title: '连锁调入单号', scopedSlots: { customRender: 'allocationLinkagePutNo' }, width: '16%', align: 'center' },
  185. { title: '调出对象', dataIndex: 'outTenantName', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  186. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  187. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  188. // { title: '总成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  189. { title: '入库时间', dataIndex: 'putWarehouseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  190. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  191. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  192. // { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  193. { title: '入库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
  194. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  195. { title: '付款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
  196. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  197. ]
  198. if (this.$hasPermissions('M_ShowAllCost')) {
  199. arr.splice(6, 0, { title: '总成本', dataIndex: 'productTotalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  200. }
  201. return arr
  202. }
  203. },
  204. methods: {
  205. // 时间 change
  206. dateChange (date) {
  207. this.queryParam.beginDate = date[0]
  208. this.queryParam.endDate = date[1]
  209. },
  210. // 重置
  211. resetSearchForm () {
  212. this.$refs.rangeDate.resetDate()
  213. this.queryParam.beginDate = ''
  214. this.queryParam.endDate = ''
  215. this.queryParam.outTenantSn = undefined
  216. this.queryParam.allocationType = undefined
  217. this.queryParam.state = undefined
  218. this.queryParam.settleState = undefined
  219. this.$refs.table.refresh(true)
  220. },
  221. // 详情
  222. handleDetail (row) {
  223. this.$router.push({ path: `/allocationManagement/chainTransferIn/detail/${row.allocationLinkagePutSn}` })
  224. },
  225. // 入库/编辑
  226. handleEdit (row) {
  227. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${row.id}/${row.allocationLinkagePutSn}` })
  228. },
  229. // 审核
  230. handleExamine (row) {
  231. const _this = this
  232. this.$confirm({
  233. title: '提示',
  234. content: '确认要审核通过吗?',
  235. centered: true,
  236. onOk () {
  237. _this.spinning = true
  238. allocLinkagePutAudit({ sn: row.allocationLinkagePutSn }).then(res => {
  239. if (res.status == 200) {
  240. _this.$message.success(res.message)
  241. _this.$refs.table.refresh()
  242. _this.spinning = false
  243. } else {
  244. _this.spinning = false
  245. }
  246. })
  247. }
  248. })
  249. },
  250. // 调出对象
  251. getPutTenantList () {
  252. getTenantList({}).then(res => {
  253. if (res.status == 200) {
  254. this.outTenantSnData = res.data
  255. } else {
  256. this.outTenantSnData = []
  257. }
  258. })
  259. },
  260. filterOption (input, option) {
  261. return (
  262. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  263. )
  264. },
  265. pageInit () {
  266. const _this = this
  267. this.$nextTick(() => { // 页面渲染完成后的回调
  268. _this.setTableH()
  269. })
  270. this.getPutTenantList()
  271. },
  272. setTableH () {
  273. const tableSearchH = this.$refs.tableSearch.offsetHeight
  274. this.tableHeight = window.innerHeight - tableSearchH - 197
  275. }
  276. },
  277. watch: {
  278. advanced (newValue, oldValue) {
  279. const _this = this
  280. this.$nextTick(() => { // 页面渲染完成后的回调
  281. _this.setTableH()
  282. })
  283. },
  284. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  285. this.setTableH()
  286. }
  287. },
  288. mounted () {
  289. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  290. this.pageInit()
  291. this.resetSearchForm()
  292. }
  293. },
  294. activated () {
  295. // 如果是新页签打开,则重置当前页面
  296. if (this.$store.state.app.isNewTab) {
  297. this.pageInit()
  298. this.resetSearchForm()
  299. }
  300. // 仅刷新列表,不重置页面
  301. if (this.$store.state.app.updateList) {
  302. this.pageInit()
  303. this.$refs.table.refresh()
  304. }
  305. },
  306. beforeRouteEnter (to, from, next) {
  307. next(vm => {})
  308. }
  309. }
  310. </script>