list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <a-card size="small" :bordered="false" class="storeTransferOutList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div 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" @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: 24px;">
  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"
  69. ref="table"
  70. size="default"
  71. :rowKey="(record) => record.id"
  72. :columns="columns"
  73. :data="loadData"
  74. :scroll="{ x: 1500, y: tableHeight }"
  75. bordered>
  76. <!-- 店内调出单号 -->
  77. <template slot="storeCallOutNo" slot-scope="text, record">
  78. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_storeCallOutDetail')" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
  79. <span v-else>{{ record.storeCallOutNo }}</span>
  80. </template>
  81. <!-- 财务状态 -->
  82. <template slot="settleState" slot-scope="text, record">
  83. <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
  84. </template>
  85. <!-- 操作 -->
  86. <template slot="action" slot-scope="text, record">
  87. <a-button
  88. size="small"
  89. type="link"
  90. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_storeCallOutAudit')"
  91. class="button-warning"
  92. @click="handleExamine(record)"
  93. id="storeTransferOutList-examine-btn">审核</a-button>
  94. <a-button
  95. size="small"
  96. type="link"
  97. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')) &&$hasPermissions('B_storeCallOutEdit')"
  98. class="button-info"
  99. @click="handleEdit(record)"
  100. id="storeTransferOutList-edit-btn">编辑</a-button>
  101. <a-button
  102. size="small"
  103. type="link"
  104. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_storeCallStockOut')"
  105. class="button-primary"
  106. @click="handleOut(record)"
  107. id="storeTransferOutList-out-btn">出库</a-button>
  108. <a-button
  109. size="small"
  110. type="link"
  111. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'WAIT_OUT_WAREHOUSE'))&&$hasPermissions('B_storeCallOutDel')"
  112. class="button-error"
  113. @click="handleDel(record)"
  114. id="storeTransferOutList-del-btn">删除</a-button>
  115. <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>
  116. </template>
  117. </s-table>
  118. </a-spin>
  119. <!-- 新增/编辑 -->
  120. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  121. </a-card>
  122. </template>
  123. <script>
  124. import { STable, VSelect } from '@/components'
  125. import rangeDate from '@/views/common/rangeDate.vue'
  126. import basicInfoModal from './basicInfoModal.vue'
  127. import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut } from '@/api/storeCallOut'
  128. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  129. export default {
  130. components: { STable, VSelect, basicInfoModal, rangeDate },
  131. data () {
  132. return {
  133. spinning: false,
  134. advanced: false, // 高级搜索 展开/关闭
  135. tableHeight: 0,
  136. queryParam: { // 查询条件
  137. beginDate: '',
  138. endDate: '',
  139. putPersonName: undefined, // 调往对象
  140. callOutType: undefined, // 调拨类型
  141. state: undefined, // 业务状态
  142. settleState: undefined // 财务状态
  143. },
  144. disabled: false, // 查询、重置按钮是否可操作
  145. columns: [
  146. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  147. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: 220, align: 'center' },
  149. { title: '调往对象名称', dataIndex: 'putPersonName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  150. { title: '调拨类型', dataIndex: 'callOutTypeName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  153. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  154. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '财务状态', dataIndex: 'settleState', scopedSlots: { customRender: 'settleState' }, width: 110, align: 'center' },
  157. { title: '操作', scopedSlots: { customRender: 'action' }, width: 250, align: 'center', fixed: 'right' }
  158. ],
  159. // 加载数据方法 必须为 Promise 对象
  160. loadData: parameter => {
  161. this.disabled = true
  162. if (this.tableHeight == 0) {
  163. this.tableHeight = window.innerHeight - 380
  164. }
  165. return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
  166. const data = res.data
  167. const no = (data.pageNo - 1) * data.pageSize
  168. for (var i = 0; i < data.list.length; i++) {
  169. data.list[i].no = no + i + 1
  170. }
  171. this.disabled = false
  172. return data
  173. })
  174. },
  175. storeCallOutTypeList: [], // 调拨类型
  176. openModal: false, // 新增编辑 弹框
  177. itemId: '' // 当前品牌id
  178. }
  179. },
  180. methods: {
  181. // 时间 change
  182. dateChange (date) {
  183. this.queryParam.beginDate = date[0]
  184. this.queryParam.endDate = date[1]
  185. },
  186. // 重置
  187. resetSearchForm () {
  188. this.$refs.rangeDate.resetDate()
  189. this.queryParam.beginDate = ''
  190. this.queryParam.endDate = ''
  191. this.queryParam.putPersonName = undefined
  192. this.queryParam.callOutType = undefined
  193. this.queryParam.state = undefined
  194. this.queryParam.settleState = undefined
  195. this.$refs.table.refresh(true)
  196. },
  197. // 基本信息 保存
  198. handleOk (data) {
  199. this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
  200. },
  201. // 删除
  202. handleDel (row) {
  203. const _this = this
  204. this.$confirm({
  205. title: '提示',
  206. content: '删除后不可恢复,确定要进行删除吗?',
  207. centered: true,
  208. onOk () {
  209. _this.spinning = true
  210. storeCallOutDel({ id: row.id }).then(res => {
  211. if (res.status == 200) {
  212. _this.$message.success(res.message)
  213. _this.$refs.table.refresh()
  214. _this.spinning = false
  215. } else {
  216. _this.spinning = false
  217. }
  218. })
  219. }
  220. })
  221. },
  222. // 出库
  223. handleOut (row) {
  224. const _this = this
  225. this.$confirm({
  226. title: '提示',
  227. content: '确认要出库吗?',
  228. centered: true,
  229. onOk () {
  230. _this.spinning = true
  231. storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
  232. if (res.status == 200) {
  233. _this.$message.success(res.message)
  234. _this.$refs.table.refresh()
  235. _this.spinning = false
  236. } else {
  237. _this.spinning = false
  238. }
  239. })
  240. }
  241. })
  242. },
  243. // 审核
  244. handleExamine (row) {
  245. const _this = this
  246. this.$confirm({
  247. title: '提示',
  248. content: '确认要审核通过吗?',
  249. centered: true,
  250. onOk () {
  251. _this.spinning = true
  252. storeCallOutAudit({ id: row.id }).then(res => {
  253. if (res.status == 200) {
  254. _this.$message.success(res.message)
  255. _this.$refs.table.refresh()
  256. _this.spinning = false
  257. } else {
  258. _this.spinning = false
  259. }
  260. })
  261. }
  262. })
  263. },
  264. // 详情
  265. handleDetail (row) {
  266. this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
  267. },
  268. // 新增/编辑
  269. handleEdit (row) {
  270. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
  271. },
  272. // 调拨类型
  273. getStoreCallOutTypeAllList () {
  274. storeCallOutTypeAllList().then(res => {
  275. if (res.status == 200) {
  276. this.storeCallOutTypeList = res.data
  277. } else {
  278. this.storeCallOutTypeList = []
  279. }
  280. })
  281. }
  282. },
  283. beforeRouteEnter (to, from, next) {
  284. next(vm => {
  285. vm.openModal = false
  286. vm.getStoreCallOutTypeAllList()
  287. })
  288. }
  289. }
  290. </script>