list.vue 17 KB

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