list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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" :value="time" @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="{ y: tableHeight }"
  87. :defaultLoadData="false"
  88. bordered>
  89. <!-- 连锁调出单号 -->
  90. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  91. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_allocLinkageOutDetail')" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  92. <span v-else>{{ record.allocationLinkageOutNo }}</span>
  93. </template>
  94. <!-- 操作 -->
  95. <template slot="action" slot-scope="text, record">
  96. <a-button
  97. size="small"
  98. type="link"
  99. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')"
  100. class="button-primary"
  101. @click="handleExamine(record)"
  102. id="chainTransferOutList-examine-btn">审核</a-button>
  103. <a-button
  104. size="small"
  105. type="link"
  106. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')"
  107. class="button-primary"
  108. @click="handleEdit(record)"
  109. id="chainTransferOutList-edit-btn">编辑</a-button>
  110. <a-button
  111. size="small"
  112. type="link"
  113. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')"
  114. class="button-primary"
  115. @click="handleOut(record)"
  116. id="chainTransferOutList-out-btn">出库</a-button>
  117. <a-button
  118. size="small"
  119. type="link"
  120. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE') &&$hasPermissions('B_allocLinkageOutDel')"
  121. class="button-error"
  122. @click="handleDel(record)"
  123. id="chainTransferOutList-del-btn">删除</a-button>
  124. <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>
  125. </template>
  126. </s-table>
  127. </a-spin>
  128. <!-- 新增/编辑 -->
  129. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  130. </a-card>
  131. </template>
  132. <script>
  133. import { commonMixin } from '@/utils/mixin'
  134. import { STable, VSelect } from '@/components'
  135. import rangeDate from '@/views/common/rangeDate.vue'
  136. import basicInfoModal from './basicInfoModal.vue'
  137. import getDate from '@/libs/getDate.js'
  138. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  139. export default {
  140. name: 'AllocLinkageOutList',
  141. components: { STable, VSelect, basicInfoModal, rangeDate },
  142. mixins: [commonMixin],
  143. data () {
  144. return {
  145. spinning: false,
  146. tableHeight: 0,
  147. advanced: true, // 高级搜索 展开/关闭
  148. time: [
  149. getDate.getCurrMonthDays().starttime,
  150. getDate.getCurrMonthDays().endtime
  151. ],
  152. queryParam: { // 查询条件
  153. beginDate: getDate.getCurrMonthDays().starttime,
  154. endDate: getDate.getCurrMonthDays().endtime,
  155. putTenantSn: undefined, // 调往对象
  156. allocationType: undefined, // 调出产品类型
  157. state: undefined, // 业务状态
  158. settleState: undefined
  159. },
  160. disabled: false, // 查询、重置按钮是否可操作
  161. columns: [
  162. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  163. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: '16%', align: 'center' },
  165. { title: '调往对象', dataIndex: 'putTenantName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  166. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  167. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  168. { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  171. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  173. { title: '操作', scopedSlots: { customRender: 'action' }, width: '13%', align: 'center' }
  174. ],
  175. // 加载数据方法 必须为 Promise 对象
  176. loadData: parameter => {
  177. this.disabled = true
  178. this.spinning = true
  179. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  180. let data
  181. if (res.status == 200) {
  182. data = res.data
  183. const no = (data.pageNo - 1) * data.pageSize
  184. for (var i = 0; i < data.list.length; i++) {
  185. data.list[i].no = no + i + 1
  186. }
  187. this.disabled = false
  188. }
  189. this.spinning = false
  190. return data
  191. })
  192. },
  193. putTenantSnData: [],
  194. openModal: false, // 新增编辑 弹框
  195. itemId: '' // 当前品牌id
  196. }
  197. },
  198. methods: {
  199. // 时间 change
  200. dateChange (date) {
  201. this.queryParam.beginDate = date[0]
  202. this.queryParam.endDate = date[1]
  203. },
  204. // 重置
  205. resetSearchForm () {
  206. this.resetData()
  207. this.$refs.table.refresh(true)
  208. },
  209. // 重置数据
  210. resetData () {
  211. this.$refs.rangeDate.resetDate(this.time)
  212. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  213. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  214. this.queryParam.putTenantSn = undefined
  215. this.queryParam.allocationType = undefined
  216. this.queryParam.state = undefined
  217. this.queryParam.settleState = undefined
  218. },
  219. // 基本信息 保存
  220. handleOk (data) {
  221. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  222. },
  223. // 删除
  224. handleDel (row) {
  225. const _this = this
  226. this.$confirm({
  227. title: '提示',
  228. content: '删除后不可恢复,确定要进行删除吗?',
  229. centered: true,
  230. onOk () {
  231. _this.spinning = true
  232. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  233. if (res.status == 200) {
  234. _this.$message.success(res.message)
  235. _this.$refs.table.refresh()
  236. _this.spinning = false
  237. } else {
  238. _this.spinning = false
  239. }
  240. })
  241. }
  242. })
  243. },
  244. // 出库
  245. handleOut (row) {
  246. const _this = this
  247. this.$confirm({
  248. title: '提示',
  249. content: '确认要出库吗?',
  250. centered: true,
  251. onOk () {
  252. _this.spinning = true
  253. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  254. if (res.status == 200) {
  255. _this.$message.success(res.message)
  256. _this.$refs.table.refresh()
  257. _this.spinning = false
  258. } else {
  259. _this.spinning = false
  260. }
  261. })
  262. }
  263. })
  264. },
  265. // 审核
  266. handleExamine (row) {
  267. const _this = this
  268. this.$confirm({
  269. title: '提示',
  270. content: '确认要审核通过吗?',
  271. centered: true,
  272. onOk () {
  273. _this.spinning = true
  274. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  275. if (res.status == 200) {
  276. _this.$message.success(res.message)
  277. _this.$refs.table.refresh()
  278. _this.spinning = false
  279. } else {
  280. _this.spinning = false
  281. }
  282. })
  283. }
  284. })
  285. },
  286. // 详情
  287. handleDetail (row) {
  288. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  289. },
  290. // 新增/编辑
  291. handleEdit (row) {
  292. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  293. },
  294. // 调往对象
  295. getPutTenantList () {
  296. getTenantList({}).then(res => {
  297. if (res.status == 200) {
  298. this.putTenantSnData = res.data
  299. } else {
  300. this.putTenantSnData = []
  301. }
  302. })
  303. },
  304. filterOption (input, option) {
  305. return (
  306. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  307. )
  308. },
  309. pageInit () {
  310. const _this = this
  311. this.$nextTick(() => { // 页面渲染完成后的回调
  312. _this.setTableH()
  313. })
  314. this.openModal = false
  315. this.getPutTenantList()
  316. },
  317. setTableH () {
  318. const tableSearchH = this.$refs.tableSearch.offsetHeight
  319. this.tableHeight = window.innerHeight - tableSearchH - 235
  320. }
  321. },
  322. watch: {
  323. advanced (newValue, oldValue) {
  324. const _this = this
  325. this.$nextTick(() => { // 页面渲染完成后的回调
  326. _this.setTableH()
  327. })
  328. },
  329. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  330. this.setTableH()
  331. }
  332. },
  333. mounted () {
  334. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  335. this.pageInit()
  336. this.resetSearchForm()
  337. }
  338. },
  339. activated () {
  340. // 如果是新页签打开,则重置当前页面
  341. if (this.$store.state.app.isNewTab) {
  342. this.resetData()
  343. if (this.$route.query.pageParams) {
  344. this.queryParam.state = this.$route.query.pageParams.state
  345. }
  346. this.pageInit()
  347. this.$refs.table.refresh(true)
  348. }
  349. // 仅刷新列表,不重置页面
  350. if (this.$store.state.app.updateList) {
  351. this.pageInit()
  352. this.$refs.table.refresh()
  353. }
  354. },
  355. beforeRouteEnter (to, from, next) {
  356. next(vm => {})
  357. }
  358. }
  359. </script>