list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferOutList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="chainTransferOutList-createDate"
  12. :disabledDate="disabledDate"
  13. v-model="createDate"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="调往对象">
  21. <a-select
  22. placeholder="请选择调往对象"
  23. allowClear
  24. id="chainTransferOutList-putTenantSn"
  25. v-model="queryParam.putTenantSn"
  26. :showSearch="true"
  27. option-filter-prop="children"
  28. :filter-option="filterOption">
  29. <a-select-option v-for="item in putTenantSnData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
  30. </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="调出产品类型">
  35. <v-select
  36. v-model="queryParam.allocationType"
  37. ref="allocationType"
  38. id="chainTransferOutList-allocationType"
  39. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  40. placeholder="请选择调出产品类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <template v-if="advanced">
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="业务状态">
  47. <v-select
  48. v-model="queryParam.state"
  49. ref="state"
  50. id="chainTransferOutList-state"
  51. code="ALLOCATION_LINKAGE_OUT_STATUS"
  52. placeholder="请选择业务状态"
  53. allowClear></v-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-item label="财务状态">
  58. <v-select
  59. v-model="queryParam.settleState"
  60. ref="settleState"
  61. id="chainTransferOutList-settleState"
  62. code="FINANCIAL_RECEIVE_STATUS"
  63. placeholder="请选择财务状态"
  64. allowClear></v-select>
  65. </a-form-item>
  66. </a-col>
  67. </template>
  68. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  69. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
  70. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
  71. <a @click="advanced=!advanced" style="margin-left: 8px">
  72. {{ advanced ? '收起' : '展开' }}
  73. <a-icon :type="advanced ? 'up' : 'down'"/>
  74. </a>
  75. </a-col>
  76. </a-row>
  77. </a-form>
  78. </div>
  79. <!-- 操作按钮 -->
  80. <div class="table-operator">
  81. <a-button id="chainTransferOutList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  82. </div>
  83. <!-- 列表 -->
  84. <s-table
  85. class="sTable"
  86. ref="table"
  87. size="default"
  88. :rowKey="(record) => record.id"
  89. :columns="columns"
  90. :data="loadData"
  91. :scroll="{ x: 1680, y: tableHeight }"
  92. bordered>
  93. <!-- 连锁调出单号 -->
  94. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  95. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  96. </template>
  97. <!-- 财务状态 -->
  98. <template slot="settleState" slot-scope="text, record">
  99. <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
  100. </template>
  101. <!-- 操作 -->
  102. <template slot="action" slot-scope="text, record">
  103. <a-button
  104. size="small"
  105. type="link"
  106. v-if="record.state == 'WAIT_AUDIT'"
  107. class="button-warning"
  108. @click="handleExamine(record)"
  109. id="chainTransferOutList-examine-btn">审核</a-button>
  110. <a-button
  111. size="small"
  112. type="link"
  113. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  114. class="button-info"
  115. @click="handleEdit(record)"
  116. id="chainTransferOutList-edit-btn">编辑</a-button>
  117. <a-button
  118. size="small"
  119. type="link"
  120. v-if="record.state == 'WAIT_OUT_WAREHOUSE'"
  121. class="button-primary"
  122. @click="handleOut(record)"
  123. id="chainTransferOutList-out-btn">出库</a-button>
  124. <a-button
  125. size="small"
  126. type="link"
  127. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE'"
  128. class="button-error"
  129. @click="handleDel(record)"
  130. id="chainTransferOutList-del-btn">删除</a-button>
  131. <span v-if="record.state != 'WAIT_SUBMIT' && record.state != 'WAIT_AUDIT' && record.state != 'WAIT_OUT_WAREHOUSE'">--</span>
  132. </template>
  133. </s-table>
  134. <!-- 新增/编辑 -->
  135. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  136. </a-card>
  137. </template>
  138. <script>
  139. import moment from 'moment'
  140. import getDate from '@/libs/getDate.js'
  141. import { STable, VSelect } from '@/components'
  142. import basicInfoModal from './basicInfoModal.vue'
  143. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  144. export default {
  145. components: { STable, VSelect, basicInfoModal },
  146. data () {
  147. return {
  148. tableHeight: 0,
  149. advanced: false, // 高级搜索 展开/关闭
  150. createDate: [
  151. moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
  152. moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
  153. ], // 创建时间
  154. queryParam: { // 查询条件
  155. putTenantSn: undefined, // 调往对象
  156. allocationType: undefined, // 调出产品类型
  157. state: undefined, // 业务状态
  158. settleState: undefined
  159. },
  160. disabled: false, // 查询、重置按钮是否可操作
  161. dateFormat: 'YYYY-MM-DD',
  162. columns: [
  163. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  164. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  165. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, align: 'center' },
  166. { title: '调往对象', dataIndex: 'putTenantName', width: 180, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  167. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  168. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  170. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  171. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  173. { title: '财务状态', scopedSlots: { customRender: 'settleState' }, width: 100, align: 'center' },
  174. { title: '操作', scopedSlots: { customRender: 'action' }, width: 210, align: 'center', fixed: 'right' }
  175. ],
  176. // 加载数据方法 必须为 Promise 对象
  177. loadData: parameter => {
  178. this.disabled = true
  179. if (this.tableHeight == 0) {
  180. this.tableHeight = window.innerHeight - 275
  181. }
  182. // 创建时间
  183. if (this.createDate && this.createDate.length > 0) {
  184. this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
  185. this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
  186. } else {
  187. this.queryParam.beginDate = undefined
  188. this.queryParam.endDate = undefined
  189. }
  190. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  191. const data = res.data
  192. const no = (data.pageNo - 1) * data.pageSize
  193. for (var i = 0; i < data.list.length; i++) {
  194. data.list[i].no = no + i + 1
  195. }
  196. this.disabled = false
  197. return data
  198. })
  199. },
  200. putTenantSnData: [],
  201. openModal: false, // 新增编辑 弹框
  202. itemId: '' // 当前品牌id
  203. }
  204. },
  205. methods: {
  206. // 不可选日期
  207. disabledDate (date, dateStrings) {
  208. return date && date.valueOf() > Date.now()
  209. },
  210. // 重置
  211. resetSearchForm () {
  212. this.queryParam.putTenantSn = undefined
  213. this.queryParam.allocationType = undefined
  214. this.queryParam.state = undefined
  215. this.queryParam.settleState = undefined
  216. this.createDate = [
  217. moment(getDate.getCurrMonthDays().starttime, this.dateFormat),
  218. moment(getDate.getCurrMonthDays().endtime, this.dateFormat)
  219. ]
  220. this.$refs.table.refresh(true)
  221. },
  222. // 基本信息 保存
  223. handleOk (data) {
  224. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  225. },
  226. // 删除
  227. handleDel (row) {
  228. const _this = this
  229. this.$confirm({
  230. title: '提示',
  231. content: '删除后不可恢复,确定要进行删除吗?',
  232. centered: true,
  233. onOk () {
  234. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  235. if (res.status == 200) {
  236. _this.$message.success(res.message)
  237. _this.$refs.table.refresh()
  238. }
  239. })
  240. }
  241. })
  242. },
  243. // 出库
  244. handleOut (row) {
  245. const _this = this
  246. this.$confirm({
  247. title: '提示',
  248. content: '确认要出库吗?',
  249. centered: true,
  250. onOk () {
  251. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  252. if (res.status == 200) {
  253. _this.$message.success(res.message)
  254. _this.$refs.table.refresh()
  255. }
  256. })
  257. }
  258. })
  259. },
  260. // 审核
  261. handleExamine (row) {
  262. const _this = this
  263. this.$confirm({
  264. title: '提示',
  265. content: '确认要审核通过吗?',
  266. centered: true,
  267. onOk () {
  268. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  269. if (res.status == 200) {
  270. _this.$message.success(res.message)
  271. _this.$refs.table.refresh()
  272. }
  273. })
  274. }
  275. })
  276. },
  277. // 详情
  278. handleDetail (row) {
  279. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  280. },
  281. // 新增/编辑
  282. handleEdit (row) {
  283. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  284. },
  285. // 调往对象
  286. getPutTenantList () {
  287. getTenantList({}).then(res => {
  288. if (res.status == 200) {
  289. this.putTenantSnData = res.data
  290. } else {
  291. this.putTenantSnData = []
  292. }
  293. })
  294. },
  295. filterOption (input, option) {
  296. return (
  297. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  298. )
  299. }
  300. },
  301. beforeRouteEnter (to, from, next) {
  302. next(vm => {
  303. vm.openModal = false
  304. vm.getPutTenantList()
  305. })
  306. }
  307. }
  308. </script>