list.vue 12 KB

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