list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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-warning"
  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-info"
  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 { STable, VSelect } from '@/components'
  134. import rangeDate from '@/views/common/rangeDate.vue'
  135. import basicInfoModal from './basicInfoModal.vue'
  136. import getDate from '@/libs/getDate.js'
  137. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  138. export default {
  139. components: { STable, VSelect, basicInfoModal, rangeDate },
  140. data () {
  141. return {
  142. spinning: false,
  143. tableHeight: 0,
  144. advanced: true, // 高级搜索 展开/关闭
  145. time: [
  146. getDate.getCurrMonthDays().starttime,
  147. getDate.getCurrMonthDays().endtime
  148. ],
  149. queryParam: { // 查询条件
  150. beginDate: getDate.getCurrMonthDays().starttime,
  151. endDate: getDate.getCurrMonthDays().endtime,
  152. putTenantSn: undefined, // 调往对象
  153. allocationType: undefined, // 调出产品类型
  154. state: undefined, // 业务状态
  155. settleState: undefined
  156. },
  157. disabled: false, // 查询、重置按钮是否可操作
  158. columns: [
  159. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  160. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: '16%', align: 'center' },
  162. { title: '调往对象', dataIndex: 'putTenantName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  163. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  164. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  165. { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  166. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  167. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  168. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  169. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '操作', scopedSlots: { customRender: 'action' }, width: '13%', align: 'center' }
  171. ],
  172. // 加载数据方法 必须为 Promise 对象
  173. loadData: parameter => {
  174. this.disabled = true
  175. this.spinning = true
  176. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  177. let data
  178. if (res.status == 200) {
  179. data = res.data
  180. const no = (data.pageNo - 1) * data.pageSize
  181. for (var i = 0; i < data.list.length; i++) {
  182. data.list[i].no = no + i + 1
  183. }
  184. this.disabled = false
  185. }
  186. this.spinning = 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.resetData()
  204. this.$refs.table.refresh(true)
  205. },
  206. // 重置数据
  207. resetData () {
  208. this.$refs.rangeDate.resetDate(this.time)
  209. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  210. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  211. this.queryParam.putTenantSn = undefined
  212. this.queryParam.allocationType = undefined
  213. this.queryParam.state = undefined
  214. this.queryParam.settleState = undefined
  215. },
  216. // 基本信息 保存
  217. handleOk (data) {
  218. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  219. },
  220. // 删除
  221. handleDel (row) {
  222. const _this = this
  223. this.$confirm({
  224. title: '提示',
  225. content: '删除后不可恢复,确定要进行删除吗?',
  226. centered: true,
  227. onOk () {
  228. _this.spinning = true
  229. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  230. if (res.status == 200) {
  231. _this.$message.success(res.message)
  232. _this.$refs.table.refresh()
  233. _this.spinning = false
  234. } else {
  235. _this.spinning = false
  236. }
  237. })
  238. }
  239. })
  240. },
  241. // 出库
  242. handleOut (row) {
  243. const _this = this
  244. this.$confirm({
  245. title: '提示',
  246. content: '确认要出库吗?',
  247. centered: true,
  248. onOk () {
  249. _this.spinning = true
  250. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  251. if (res.status == 200) {
  252. _this.$message.success(res.message)
  253. _this.$refs.table.refresh()
  254. _this.spinning = false
  255. } else {
  256. _this.spinning = false
  257. }
  258. })
  259. }
  260. })
  261. },
  262. // 审核
  263. handleExamine (row) {
  264. const _this = this
  265. this.$confirm({
  266. title: '提示',
  267. content: '确认要审核通过吗?',
  268. centered: true,
  269. onOk () {
  270. _this.spinning = true
  271. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  272. if (res.status == 200) {
  273. _this.$message.success(res.message)
  274. _this.$refs.table.refresh()
  275. _this.spinning = false
  276. } else {
  277. _this.spinning = false
  278. }
  279. })
  280. }
  281. })
  282. },
  283. // 详情
  284. handleDetail (row) {
  285. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  286. },
  287. // 新增/编辑
  288. handleEdit (row) {
  289. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  290. },
  291. // 调往对象
  292. getPutTenantList () {
  293. getTenantList({}).then(res => {
  294. if (res.status == 200) {
  295. this.putTenantSnData = res.data
  296. } else {
  297. this.putTenantSnData = []
  298. }
  299. })
  300. },
  301. filterOption (input, option) {
  302. return (
  303. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  304. )
  305. },
  306. pageInit () {
  307. const _this = this
  308. this.$nextTick(() => { // 页面渲染完成后的回调
  309. _this.setTableH()
  310. })
  311. this.openModal = false
  312. this.getPutTenantList()
  313. },
  314. setTableH () {
  315. const tableSearchH = this.$refs.tableSearch.offsetHeight
  316. this.tableHeight = window.innerHeight - tableSearchH - 235
  317. }
  318. },
  319. watch: {
  320. advanced (newValue, oldValue) {
  321. const _this = this
  322. this.$nextTick(() => { // 页面渲染完成后的回调
  323. _this.setTableH()
  324. })
  325. },
  326. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  327. this.setTableH()
  328. }
  329. },
  330. mounted () {
  331. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  332. this.pageInit()
  333. this.resetSearchForm()
  334. }
  335. },
  336. activated () {
  337. // 如果是新页签打开,则重置当前页面
  338. if (this.$store.state.app.isNewTab) {
  339. this.resetData()
  340. if (this.$route.query.pageParams) {
  341. this.queryParam.state = this.$route.query.pageParams.state
  342. }
  343. this.pageInit()
  344. this.$refs.table.refresh(true)
  345. }
  346. // 仅刷新列表,不重置页面
  347. if (this.$store.state.app.updateList) {
  348. this.pageInit()
  349. this.$refs.table.refresh()
  350. }
  351. },
  352. beforeRouteEnter (to, from, next) {
  353. next(vm => {})
  354. }
  355. }
  356. </script>