list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <a-card size="small" :bordered="false" class="storeTransferOutList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="storeTransferOutList-createDate"
  12. :disabledDate="disabledDate"
  13. v-model="createDate"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="调往对象名称">
  21. <a-input id="storeTransferOutList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象名称"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="调拨类型">
  26. <a-select id="storeTransferOutList-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
  27. <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
  28. </a-select>
  29. </a-form-item>
  30. </a-col>
  31. <template v-if="advanced">
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="业务状态">
  34. <v-select
  35. v-model="queryParam.state"
  36. ref="state"
  37. id="storeTransferOutList-state"
  38. code="STORE_CALL_OUT_STATE"
  39. placeholder="请选择业务状态"
  40. allowClear
  41. ></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="财务状态">
  46. <v-select
  47. v-model="queryParam.settleState"
  48. ref="settleState"
  49. id="storeTransferOutList-settleState"
  50. code="FINANCIAL_STATUS"
  51. placeholder="请选择财务状态"
  52. allowClear
  53. ></v-select>
  54. </a-form-item>
  55. </a-col>
  56. </template>
  57. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  58. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
  59. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
  60. <a @click="advanced=!advanced" style="margin-left: 8px">
  61. {{ advanced ? '收起' : '展开' }}
  62. <a-icon :type="advanced ? 'up' : 'down'"/>
  63. </a>
  64. </a-col>
  65. </a-row>
  66. </a-form>
  67. </div>
  68. <!-- 操作按钮 -->
  69. <div class="table-operator">
  70. <a-button id="storeTransferOutList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  71. </div>
  72. <!-- 列表 -->
  73. <s-table
  74. class="sTable"
  75. ref="table"
  76. size="default"
  77. :rowKey="(record) => record.id"
  78. :columns="columns"
  79. :data="loadData"
  80. :scroll="{ x: 1500 }"
  81. bordered>
  82. <!-- 店内调出单号 -->
  83. <template slot="storeCallOutNo" slot-scope="text, record">
  84. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
  85. </template>
  86. <!-- 操作 -->
  87. <template slot="action" slot-scope="text, record">
  88. <a-button
  89. size="small"
  90. type="primary"
  91. v-if="record.state == 'WAIT_AUDIT'"
  92. class="button-success"
  93. @click="handleExamine(record)"
  94. id="storeTransferOutList-examine-btn">审核</a-button>
  95. <a-button
  96. size="small"
  97. type="primary"
  98. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  99. class="button-info"
  100. @click="handleEdit(record)"
  101. id="storeTransferOutList-edit-btn">编辑</a-button>
  102. <a-button
  103. size="small"
  104. type="primary"
  105. v-if="record.state == 'WAIT_OUT_WAREHOUSE'"
  106. class="button-warning"
  107. @click="handleOut(record)"
  108. id="storeTransferOutList-out-btn">出库</a-button>
  109. <a-button
  110. size="small"
  111. type="primary"
  112. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  113. class="button-error"
  114. @click="handleDel(record)"
  115. id="storeTransferOutList-del-btn">删除</a-button>
  116. </template>
  117. </s-table>
  118. <!-- 新增/编辑 -->
  119. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  120. </a-card>
  121. </template>
  122. <script>
  123. import moment from 'moment'
  124. import { STable, VSelect } from '@/components'
  125. import basicInfoModal from './basicInfoModal.vue'
  126. import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut } from '@/api/storeCallOut'
  127. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  128. export default {
  129. components: { STable, VSelect, basicInfoModal },
  130. data () {
  131. return {
  132. advanced: false, // 高级搜索 展开/关闭
  133. createDate: [], // 创建时间
  134. queryParam: { // 查询条件
  135. putPersonName: undefined, // 调往对象
  136. callOutType: undefined, // 调拨类型
  137. state: undefined, // 业务状态
  138. settleState: undefined // 财务状态
  139. },
  140. disabled: false, // 查询、重置按钮是否可操作
  141. dateFormat: 'YYYY-MM-DD',
  142. columns: [
  143. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  144. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  145. { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: 200, align: 'center' },
  146. { title: '调往对象名称', dataIndex: 'putPersonName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  147. { title: '调拨类型', dataIndex: 'callOutTypeName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  148. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  149. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  150. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
  153. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 110, align: 'center' },
  154. { title: '操作', scopedSlots: { customRender: 'action' }, width: 250, align: 'center', fixed: 'right' }
  155. ],
  156. // 加载数据方法 必须为 Promise 对象
  157. loadData: parameter => {
  158. this.disabled = true
  159. // 创建时间
  160. if (this.createDate && this.createDate.length > 0) {
  161. this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
  162. this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
  163. } else {
  164. this.queryParam.beginDate = undefined
  165. this.queryParam.endDate = undefined
  166. }
  167. return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
  168. const data = res.data
  169. const no = (data.pageNo - 1) * data.pageSize
  170. for (var i = 0; i < data.list.length; i++) {
  171. data.list[i].no = no + i + 1
  172. }
  173. this.disabled = false
  174. return data
  175. })
  176. },
  177. storeCallOutTypeList: [], // 调拨类型
  178. openModal: false, // 新增编辑 弹框
  179. itemId: '' // 当前品牌id
  180. }
  181. },
  182. methods: {
  183. // 不可选日期
  184. disabledDate (date, dateStrings) {
  185. return date && date.valueOf() > Date.now()
  186. },
  187. // 重置
  188. resetSearchForm () {
  189. this.queryParam.putPersonName = undefined
  190. this.queryParam.callOutType = undefined
  191. this.queryParam.state = undefined
  192. this.createDate = undefined
  193. this.$refs.table.refresh(true)
  194. },
  195. // 基本信息 保存
  196. handleOk (data) {
  197. this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
  198. },
  199. // 删除
  200. handleDel (row) {
  201. const _this = this
  202. this.$confirm({
  203. title: '提示',
  204. content: '删除后不可恢复,确定要进行删除吗?',
  205. centered: true,
  206. onOk () {
  207. storeCallOutDel({ id: row.id }).then(res => {
  208. if (res.status == 200) {
  209. _this.$message.success(res.message)
  210. _this.$refs.table.refresh()
  211. }
  212. })
  213. }
  214. })
  215. },
  216. // 出库
  217. handleOut (row) {
  218. const _this = this
  219. this.$confirm({
  220. title: '提示',
  221. content: '确认要进行出库操作吗?',
  222. centered: true,
  223. onOk () {
  224. storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
  225. if (res.status == 200) {
  226. _this.$message.success(res.message)
  227. _this.$refs.table.refresh()
  228. }
  229. })
  230. }
  231. })
  232. },
  233. // 审核
  234. handleExamine (row) {
  235. const _this = this
  236. this.$confirm({
  237. title: '提示',
  238. content: '确认要审核通过吗?',
  239. centered: true,
  240. onOk () {
  241. storeCallOutAudit({ id: row.id }).then(res => {
  242. if (res.status == 200) {
  243. _this.$message.success(res.message)
  244. _this.$refs.table.refresh()
  245. }
  246. })
  247. }
  248. })
  249. },
  250. // 详情
  251. handleDetail (row) {
  252. this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
  253. },
  254. // 新增/编辑
  255. handleEdit (row) {
  256. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
  257. },
  258. // 调拨类型
  259. getStoreCallOutTypeAllList () {
  260. storeCallOutTypeAllList().then(res => {
  261. if (res.status == 200) {
  262. this.storeCallOutTypeList = res.data
  263. } else {
  264. this.storeCallOutTypeList = []
  265. }
  266. })
  267. }
  268. },
  269. beforeRouteEnter (to, from, next) {
  270. next(vm => {
  271. vm.openModal = false
  272. vm.getStoreCallOutTypeAllList()
  273. })
  274. }
  275. }
  276. </script>