list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. <rangeDate ref="auditRangeDate" v-model="auditTime" @change="auditDateChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="出库时间">
  20. <rangeDate ref="outWareRangeDate" v-model="outWareTime" @change="outWareDateChange" />
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="调往对象">
  26. <getTenantList id="chainTransferOutList-putTenantSn" type="out" placeholder="请选择调往对象" v-model="queryParam.putTenantSn"></getTenantList>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="调出产品类型">
  31. <v-select
  32. v-model="queryParam.allocationType"
  33. ref="allocationType"
  34. id="chainTransferOutList-allocationType"
  35. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  36. placeholder="请选择调出产品类型"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="业务状态">
  42. <v-select
  43. v-model="queryParam.state"
  44. ref="state"
  45. id="chainTransferOutList-state"
  46. code="ALLOCATION_LINKAGE_OUT_STATUS"
  47. placeholder="请选择业务状态"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="财务状态">
  53. <v-select
  54. v-model="queryParam.settleState"
  55. ref="settleState"
  56. id="chainTransferOutList-settleState"
  57. code="FINANCIAL_STATUS"
  58. placeholder="请选择财务状态"
  59. allowClear></v-select>
  60. </a-form-item>
  61. </a-col>
  62. </template>
  63. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  64. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
  65. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
  66. <a @click="advanced=!advanced" style="margin-left: 8px">
  67. {{ advanced ? '收起' : '展开' }}
  68. <a-icon :type="advanced ? 'up' : 'down'"/>
  69. </a>
  70. </a-col>
  71. </a-row>
  72. </a-form>
  73. </div>
  74. <!-- 操作按钮 -->
  75. <div class="table-operator">
  76. <a-button id="chainTransferOutList-add" v-if="$hasPermissions('B_allocLinkageOutNew')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  77. </div>
  78. <!-- 统计 -->
  79. <a-alert type="info" style="margin-bottom:10px">
  80. <div slot="message">
  81. 总款数: <strong>{{ countData&&(countData.productTotalCategory || countData.productTotalCategory==0) ? countData.productTotalCategory : '--' }}</strong> ,
  82. 总数量: <strong>{{ countData&&(countData.productTotalQty || countData.productTotalQty==0) ? countData.productTotalQty : '--' }}</strong>
  83. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  84. ,总成本: <strong>{{ countData&&(countData.productTotalCost || countData.productTotalCost==0) ? toThousands(countData.productTotalCost,2) : '--' }}</strong>
  85. </div>
  86. </div>
  87. </a-alert>
  88. <!-- 列表 -->
  89. <s-table
  90. class="sTable fixPagination"
  91. ref="table"
  92. :style="{ height: tableHeight+84.5+'px' }"
  93. size="small"
  94. :rowKey="(record) => record.id"
  95. :columns="columns"
  96. :data="loadData"
  97. :scroll="{ y: tableHeight }"
  98. :defaultLoadData="false"
  99. bordered>
  100. <!-- 连锁调出单号 -->
  101. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  102. <span class="table-td-link" v-if="$hasPermissions('B_allocLinkageOutDetail')" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  103. <span v-else>{{ record.allocationLinkageOutNo }}</span>
  104. </template>
  105. <!-- 审核 -->
  106. <template slot="audit" slot-scope="text, record">
  107. <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'||record.state == 'WAIT_OUT_WAREHOUSE'?'1':'2'"></stateIcon>
  108. </template>
  109. <!-- 结算 -->
  110. <template slot="financial" slot-scope="text, record">
  111. <stateIcon :title="record.settleStateDictValue" :state="record.settleState == 'FINISH'?'1':'2'"></stateIcon>
  112. </template>
  113. <!-- 出库 -->
  114. <template slot="waitOut" slot-scope="text, record">
  115. <stateIcon :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  116. </template>
  117. <!-- 操作 -->
  118. <template slot="action" slot-scope="text, record">
  119. <a-button
  120. size="small"
  121. type="link"
  122. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')"
  123. class="button-primary"
  124. @click="handleExamine(record)"
  125. id="chainTransferOutList-examine-btn">审核</a-button>
  126. <a-button
  127. size="small"
  128. type="link"
  129. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')"
  130. class="button-primary"
  131. @click="handleEdit(record)"
  132. id="chainTransferOutList-edit-btn">编辑</a-button>
  133. <a-button
  134. size="small"
  135. type="link"
  136. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')"
  137. class="button-primary"
  138. @click="handleOut(record)"
  139. id="chainTransferOutList-out-btn">出库</a-button>
  140. <a-button
  141. size="small"
  142. type="link"
  143. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE') &&$hasPermissions('B_allocLinkageOutDel')"
  144. class="button-error"
  145. @click="handleDel(record)"
  146. id="chainTransferOutList-del-btn">删除</a-button>
  147. <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>
  148. </template>
  149. </s-table>
  150. </a-spin>
  151. <!-- 新增/编辑 -->
  152. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  153. </a-card>
  154. </template>
  155. <script>
  156. import { commonMixin } from '@/utils/mixin'
  157. import { STable, VSelect } from '@/components'
  158. import rangeDate from '@/views/common/rangeDate.vue'
  159. import basicInfoModal from './basicInfoModal.vue'
  160. import stateIcon from '@/views/common/stateIcon'
  161. import getDate from '@/libs/getDate.js'
  162. import getTenantList from '@/views/common/getTenantList.js'
  163. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, allocLinkageOutQueryCount } from '@/api/allocLinkageOut'
  164. export default {
  165. name: 'AllocLinkageOutList',
  166. components: { STable, VSelect, basicInfoModal, rangeDate, stateIcon, getTenantList },
  167. mixins: [commonMixin],
  168. data () {
  169. return {
  170. spinning: false,
  171. tableHeight: 0,
  172. advanced: true, // 高级搜索 展开/关闭
  173. time: [
  174. getDate.getCurrMonthDays().starttime,
  175. getDate.getCurrMonthDays().endtime
  176. ],
  177. auditTime: [],
  178. outWareTime: [],
  179. queryParam: { // 查询条件
  180. beginDate: getDate.getCurrMonthDays().starttime,
  181. endDate: getDate.getCurrMonthDays().endtime,
  182. auditBeginDate: '',
  183. auditEndDate: '',
  184. outWarehouseBeginDate: '',
  185. outWarehouseEndDate: '',
  186. putTenantSn: undefined, // 调往对象
  187. allocationType: undefined, // 调出产品类型
  188. state: undefined, // 业务状态
  189. settleState: undefined
  190. },
  191. disabled: false, // 查询、重置按钮是否可操作
  192. // 加载数据方法 必须为 Promise 对象
  193. loadData: parameter => {
  194. this.disabled = true
  195. this.spinning = true
  196. const params = Object.assign(parameter, this.queryParam)
  197. return allocLinkageOutList(params).then(res => {
  198. let data
  199. if (res.status == 200) {
  200. data = res.data
  201. this.getCount(params)
  202. const no = (data.pageNo - 1) * data.pageSize
  203. for (var i = 0; i < data.list.length; i++) {
  204. data.list[i].no = no + i + 1
  205. }
  206. this.disabled = false
  207. }
  208. this.spinning = false
  209. return data
  210. })
  211. },
  212. openModal: false, // 新增编辑 弹框
  213. itemId: '', // 当前品牌id
  214. countData: null // 统计
  215. }
  216. },
  217. computed: {
  218. columns () {
  219. const _this = this
  220. const arr = [
  221. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  222. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  223. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: '16%', align: 'center' },
  224. { title: '调往对象', dataIndex: 'putTenantName', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  225. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  226. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  227. // { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  228. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  229. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  230. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  231. // { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  232. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  233. { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
  234. { title: '收款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
  235. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  236. ]
  237. if (this.$hasPermissions('M_ShowAllCost')) {
  238. arr.splice(6, 0, { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  239. }
  240. return arr
  241. }
  242. },
  243. methods: {
  244. // 统计
  245. getCount (params) {
  246. allocLinkageOutQueryCount(params).then(res => {
  247. if (res.status == 200) {
  248. this.countData = res.data
  249. } else {
  250. this.countData = null
  251. }
  252. })
  253. },
  254. // 时间 change
  255. dateChange (date) {
  256. this.queryParam.beginDate = date[0]
  257. this.queryParam.endDate = date[1]
  258. },
  259. auditDateChange (date) {
  260. this.queryParam.auditBeginDate = date[0]
  261. this.queryParam.auditEndDate = date[1]
  262. },
  263. outWareDateChange (date) {
  264. this.queryParam.outWarehouseBeginDate = date[0]
  265. this.queryParam.outWarehouseEndDate = date[1]
  266. },
  267. // 重置
  268. resetSearchForm () {
  269. this.resetData()
  270. this.$refs.table.refresh(true)
  271. },
  272. // 重置数据
  273. resetData (flag) {
  274. this.$refs.rangeDate.resetDate(flag ? '' : this.time)
  275. this.queryParam.beginDate = flag ? '' : getDate.getCurrMonthDays().starttime
  276. this.queryParam.endDate = flag ? '' : getDate.getCurrMonthDays().endtime
  277. this.$refs.auditRangeDate.resetDate('')
  278. this.queryParam.auditBeginDate = ''
  279. this.queryParam.auditEndDate = ''
  280. this.$refs.outWareRangeDate.resetDate('')
  281. this.queryParam.outWarehouseBeginDate = ''
  282. this.queryParam.outWarehouseEndDate = ''
  283. this.queryParam.putTenantSn = undefined
  284. this.queryParam.allocationType = undefined
  285. this.queryParam.state = undefined
  286. this.queryParam.settleState = undefined
  287. if (!flag) {
  288. this.setIsHomeNav(this.$route.name, null)
  289. }
  290. },
  291. // 基本信息 保存
  292. handleOk (data) {
  293. this.resetData()
  294. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  295. },
  296. // 删除
  297. handleDel (row) {
  298. const _this = this
  299. this.$confirm({
  300. title: '提示',
  301. content: '删除后不可恢复,确定要进行删除吗?',
  302. centered: true,
  303. onOk () {
  304. _this.spinning = true
  305. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  306. if (res.status == 200) {
  307. _this.$message.success(res.message)
  308. _this.$refs.table.refresh()
  309. _this.spinning = false
  310. } else {
  311. _this.spinning = false
  312. }
  313. })
  314. }
  315. })
  316. },
  317. // 出库
  318. handleOut (row) {
  319. const _this = this
  320. this.$confirm({
  321. title: '提示',
  322. content: '确认要出库吗?',
  323. centered: true,
  324. onOk () {
  325. _this.spinning = true
  326. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  327. if (res.status == 200) {
  328. _this.$message.success(res.message)
  329. _this.$refs.table.refresh()
  330. _this.spinning = false
  331. } else {
  332. _this.spinning = false
  333. }
  334. })
  335. }
  336. })
  337. },
  338. // 审核
  339. handleExamine (row) {
  340. const _this = this
  341. this.$confirm({
  342. title: '提示',
  343. content: '确认要审核通过吗?',
  344. centered: true,
  345. onOk () {
  346. _this.spinning = true
  347. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  348. if (res.status == 200) {
  349. _this.$message.success(res.message)
  350. _this.$refs.table.refresh()
  351. _this.spinning = false
  352. } else {
  353. _this.spinning = false
  354. }
  355. })
  356. }
  357. })
  358. },
  359. // 详情
  360. handleDetail (row) {
  361. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  362. },
  363. // 新增/编辑
  364. handleEdit (row) {
  365. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  366. },
  367. pageInit () {
  368. const _this = this
  369. this.$nextTick(() => { // 页面渲染完成后的回调
  370. _this.setTableH()
  371. })
  372. this.openModal = false
  373. // 是否打开的页签
  374. const a = this.$store.state.app.isNewTab
  375. // 是否要刷新列表
  376. const b = this.$store.state.app.updateList
  377. // 是否从首页点击进入
  378. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  379. console.log(a, b, this.getIsHomeNav(), isHomeNav, this.$route.name)
  380. // 从首页进入,判断式新建还式待办查询
  381. if (isHomeNav) {
  382. // 新增
  383. if (isHomeNav.type == 'new') {
  384. this.resetSearchForm()
  385. this.openModal = true
  386. }
  387. // 待办
  388. if (isHomeNav.type == 'todo') {
  389. this.resetData(true)
  390. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  391. this.$refs.rangeDate.resetDate([this.queryParam.beginDate, this.queryParam.endDate])
  392. this.$refs.table.refresh(true)
  393. }
  394. } else {
  395. // 如果是新页签打开,则重置当前页面
  396. if (a && !b) {
  397. this.resetSearchForm()
  398. }
  399. }
  400. // 仅刷新列表,不重置页面
  401. if (b || a == b) {
  402. this.$refs.table.refresh()
  403. }
  404. },
  405. setTableH () {
  406. const tableSearchH = this.$refs.tableSearch.offsetHeight
  407. this.tableHeight = window.innerHeight - tableSearchH - 235
  408. }
  409. },
  410. watch: {
  411. advanced (newValue, oldValue) {
  412. const _this = this
  413. this.$nextTick(() => { // 页面渲染完成后的回调
  414. _this.setTableH()
  415. })
  416. },
  417. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  418. this.setTableH()
  419. }
  420. },
  421. mounted () {},
  422. activated () {
  423. this.pageInit()
  424. },
  425. beforeRouteEnter (to, from, next) {
  426. next(vm => {})
  427. }
  428. }
  429. </script>