list.vue 17 KB

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