list.vue 16 KB

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