list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferOutList-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="chainTransferOutList-putTenantSn"
  19. v-model="queryParam.putTenantSn"
  20. :showSearch="true"
  21. option-filter-prop="children"
  22. :filter-option="filterOption">
  23. <a-select-option v-for="item in putTenantSnData" :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="chainTransferOutList-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="chainTransferOutList-state"
  45. code="ALLOCATION_LINKAGE_OUT_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="chainTransferOutList-settleState"
  56. code="FINANCIAL_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="chainTransferOutList-refresh">查询</a-button>
  64. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-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. <div class="table-operator">
  75. <a-button id="chainTransferOutList-add" v-if="$hasPermissions('B_allocLinkageOutNew')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  76. </div>
  77. <!-- 列表 -->
  78. <s-table
  79. class="sTable fixPagination"
  80. ref="table"
  81. :style="{ height: tableHeight+84.5+'px' }"
  82. size="small"
  83. :rowKey="(record) => record.id"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ x: 1380, y: tableHeight }"
  87. bordered>
  88. <!-- 连锁调出单号 -->
  89. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  90. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_allocLinkageOutDetail')" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  91. <span v-else>{{ record.allocationLinkageOutNo }}</span>
  92. </template>
  93. <!-- 操作 -->
  94. <template slot="action" slot-scope="text, record">
  95. <a-button
  96. size="small"
  97. type="link"
  98. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')"
  99. class="button-warning"
  100. @click="handleExamine(record)"
  101. id="chainTransferOutList-examine-btn">审核</a-button>
  102. <a-button
  103. size="small"
  104. type="link"
  105. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')"
  106. class="button-info"
  107. @click="handleEdit(record)"
  108. id="chainTransferOutList-edit-btn">编辑</a-button>
  109. <a-button
  110. size="small"
  111. type="link"
  112. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')"
  113. class="button-primary"
  114. @click="handleOut(record)"
  115. id="chainTransferOutList-out-btn">出库</a-button>
  116. <a-button
  117. size="small"
  118. type="link"
  119. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE') &&$hasPermissions('B_allocLinkageOutDel')"
  120. class="button-error"
  121. @click="handleDel(record)"
  122. id="chainTransferOutList-del-btn">删除</a-button>
  123. <span v-if="(record.state != 'WAIT_SUBMIT' && record.state != 'WAIT_AUDIT' && record.state != 'WAIT_OUT_WAREHOUSE')|| (!(record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')) && !((record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')) && !(record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')))">--</span>
  124. </template>
  125. </s-table>
  126. </a-spin>
  127. <!-- 新增/编辑 -->
  128. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  129. </a-card>
  130. </template>
  131. <script>
  132. import { STable, VSelect } from '@/components'
  133. import rangeDate from '@/views/common/rangeDate.vue'
  134. import basicInfoModal from './basicInfoModal.vue'
  135. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  136. export default {
  137. components: { STable, VSelect, basicInfoModal, rangeDate },
  138. data () {
  139. return {
  140. spinning: false,
  141. tableHeight: 0,
  142. advanced: true, // 高级搜索 展开/关闭
  143. queryParam: { // 查询条件
  144. beginDate: '',
  145. endDate: '',
  146. putTenantSn: undefined, // 调往对象
  147. allocationType: undefined, // 调出产品类型
  148. state: undefined, // 业务状态
  149. settleState: undefined
  150. },
  151. disabled: false, // 查询、重置按钮是否可操作
  152. columns: [
  153. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  154. { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: 180, align: 'center' },
  156. { title: '调往对象', dataIndex: 'putTenantName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  157. { title: '总款数', dataIndex: 'productTotalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  158. { title: '总数量', dataIndex: 'productTotalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  159. { title: '总成本', dataIndex: 'productTotalCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  160. { title: '审核时间', dataIndex: 'auditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '业务状态', dataIndex: 'stateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
  165. ],
  166. // 加载数据方法 必须为 Promise 对象
  167. loadData: parameter => {
  168. this.disabled = true
  169. this.spinning = true
  170. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  171. const data = res.data
  172. const no = (data.pageNo - 1) * data.pageSize
  173. for (var i = 0; i < data.list.length; i++) {
  174. data.list[i].no = no + i + 1
  175. }
  176. this.disabled = false
  177. this.spinning = false
  178. return data
  179. })
  180. },
  181. putTenantSnData: [],
  182. openModal: false, // 新增编辑 弹框
  183. itemId: '' // 当前品牌id
  184. }
  185. },
  186. methods: {
  187. // 时间 change
  188. dateChange (date) {
  189. this.queryParam.beginDate = date[0]
  190. this.queryParam.endDate = date[1]
  191. },
  192. // 重置
  193. resetSearchForm () {
  194. this.$refs.rangeDate.resetDate()
  195. this.queryParam.beginDate = ''
  196. this.queryParam.endDate = ''
  197. this.queryParam.putTenantSn = undefined
  198. this.queryParam.allocationType = undefined
  199. this.queryParam.state = undefined
  200. this.queryParam.settleState = undefined
  201. this.$refs.table.refresh(true)
  202. },
  203. // 基本信息 保存
  204. handleOk (data) {
  205. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  206. },
  207. // 删除
  208. handleDel (row) {
  209. const _this = this
  210. this.$confirm({
  211. title: '提示',
  212. content: '删除后不可恢复,确定要进行删除吗?',
  213. centered: true,
  214. onOk () {
  215. _this.spinning = true
  216. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  217. if (res.status == 200) {
  218. _this.$message.success(res.message)
  219. _this.$refs.table.refresh()
  220. _this.spinning = false
  221. } else {
  222. _this.spinning = false
  223. }
  224. })
  225. }
  226. })
  227. },
  228. // 出库
  229. handleOut (row) {
  230. const _this = this
  231. this.$confirm({
  232. title: '提示',
  233. content: '确认要出库吗?',
  234. centered: true,
  235. onOk () {
  236. _this.spinning = true
  237. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  238. if (res.status == 200) {
  239. _this.$message.success(res.message)
  240. _this.$refs.table.refresh()
  241. _this.spinning = false
  242. } else {
  243. _this.spinning = false
  244. }
  245. })
  246. }
  247. })
  248. },
  249. // 审核
  250. handleExamine (row) {
  251. const _this = this
  252. this.$confirm({
  253. title: '提示',
  254. content: '确认要审核通过吗?',
  255. centered: true,
  256. onOk () {
  257. _this.spinning = true
  258. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  259. if (res.status == 200) {
  260. _this.$message.success(res.message)
  261. _this.$refs.table.refresh()
  262. _this.spinning = false
  263. } else {
  264. _this.spinning = false
  265. }
  266. })
  267. }
  268. })
  269. },
  270. // 详情
  271. handleDetail (row) {
  272. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  273. },
  274. // 新增/编辑
  275. handleEdit (row) {
  276. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  277. },
  278. // 调往对象
  279. getPutTenantList () {
  280. getTenantList({}).then(res => {
  281. if (res.status == 200) {
  282. this.putTenantSnData = res.data
  283. } else {
  284. this.putTenantSnData = []
  285. }
  286. })
  287. },
  288. filterOption (input, option) {
  289. return (
  290. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  291. )
  292. },
  293. setTableH () {
  294. const tableSearchH = this.$refs.tableSearch.offsetHeight
  295. this.tableHeight = window.innerHeight - tableSearchH - 235
  296. }
  297. },
  298. mounted () {
  299. const _this = this
  300. this.$nextTick(() => { // 页面渲染完成后的回调
  301. _this.setTableH()
  302. })
  303. },
  304. watch: {
  305. advanced (newValue, oldValue) {
  306. const _this = this
  307. setTimeout(() => {
  308. _this.setTableH()
  309. }, 400)
  310. }
  311. },
  312. beforeRouteEnter (to, from, next) {
  313. next(vm => {
  314. vm.openModal = false
  315. vm.getPutTenantList()
  316. vm.$refs.table.refresh()
  317. })
  318. }
  319. }
  320. </script>