list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferOutList-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="chainTransferOutList-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-select
  22. placeholder="请选择调往对象"
  23. allowClear
  24. id="chainTransferOutList-putTenantSn"
  25. v-model="queryParam.putTenantSn"
  26. :showSearch="true"
  27. option-filter-prop="children"
  28. :filter-option="filterOption">
  29. <a-select-option v-for="item in putTenantSnData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
  30. </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="调出产品类型">
  35. <v-select
  36. v-model="queryParam.allocationType"
  37. ref="allocationType"
  38. id="chainTransferOutList-allocationType"
  39. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  40. placeholder="请选择调出产品类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <template v-if="advanced">
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="业务状态">
  47. <v-select
  48. v-model="queryParam.state"
  49. ref="state"
  50. id="chainTransferOutList-state"
  51. code="ALLOCATION_LINKAGE_OUT_STATUS"
  52. placeholder="请选择业务状态"
  53. allowClear></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="chainTransferOutList-refresh">查询</a-button>
  59. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-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="chainTransferOutList-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: 1680 }"
  81. bordered>
  82. <!-- 连锁调出单号 -->
  83. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  84. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  85. </template>
  86. <!-- 财务状态 -->
  87. <template slot="settleState" slot-scope="text, record">
  88. <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.settleStateDictValue" />
  89. </template>
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <a-button
  93. size="small"
  94. type="link"
  95. v-if="record.state == 'WAIT_AUDIT'"
  96. class="button-warning"
  97. @click="handleExamine(record)"
  98. id="chainTransferOutList-examine-btn">审核</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  103. class="button-info"
  104. @click="handleEdit(record)"
  105. id="chainTransferOutList-edit-btn">编辑</a-button>
  106. <a-button
  107. size="small"
  108. type="link"
  109. v-if="record.state == 'WAIT_OUT_WAREHOUSE'"
  110. class="button-primary"
  111. @click="handleOut(record)"
  112. id="chainTransferOutList-out-btn">出库</a-button>
  113. <a-button
  114. size="small"
  115. type="link"
  116. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE'"
  117. class="button-error"
  118. @click="handleDel(record)"
  119. id="chainTransferOutList-del-btn">删除</a-button>
  120. <span v-if="record.state != 'WAIT_SUBMIT' && record.state != 'WAIT_AUDIT' && record.state != 'WAIT_OUT_WAREHOUSE'">--</span>
  121. </template>
  122. </s-table>
  123. <!-- 新增/编辑 -->
  124. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  125. </a-card>
  126. </template>
  127. <script>
  128. import moment from 'moment'
  129. import { STable, VSelect } from '@/components'
  130. import basicInfoModal from './basicInfoModal.vue'
  131. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  132. export default {
  133. components: { STable, VSelect, basicInfoModal },
  134. data () {
  135. return {
  136. advanced: false, // 高级搜索 展开/关闭
  137. createDate: undefined, // 创建时间
  138. queryParam: { // 查询条件
  139. putTenantSn: undefined, // 调往对象
  140. allocationType: undefined, // 调出产品类型
  141. state: undefined // 业务状态
  142. },
  143. disabled: false, // 查询、重置按钮是否可操作
  144. dateFormat: 'YYYY-MM-DD',
  145. columns: [
  146. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  147. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  148. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, align: 'center' },
  149. { title: '调往对象', dataIndex: 'putTenantName', width: 180, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  150. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  153. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  155. { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '财务状态', scopedSlots: { customRender: 'settleState' }, width: 100, align: 'center' },
  157. { title: '操作', scopedSlots: { customRender: 'action' }, width: 210, align: 'center', fixed: 'right' }
  158. ],
  159. // 加载数据方法 必须为 Promise 对象
  160. loadData: parameter => {
  161. this.disabled = true
  162. // 创建时间
  163. if (this.createDate && this.createDate.length > 0) {
  164. this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
  165. this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
  166. } else {
  167. this.queryParam.beginDate = undefined
  168. this.queryParam.endDate = undefined
  169. }
  170. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  171. const 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. return data
  178. })
  179. },
  180. putTenantSnData: [],
  181. openModal: false, // 新增编辑 弹框
  182. itemId: '' // 当前品牌id
  183. }
  184. },
  185. methods: {
  186. // 不可选日期
  187. disabledDate (date, dateStrings) {
  188. return date && date.valueOf() > Date.now()
  189. },
  190. // 重置
  191. resetSearchForm () {
  192. this.queryParam.putTenantSn = undefined
  193. this.queryParam.allocationType = undefined
  194. this.queryParam.state = undefined
  195. this.createDate = undefined
  196. this.$refs.table.refresh(true)
  197. },
  198. // 基本信息 保存
  199. handleOk (data) {
  200. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  201. },
  202. // 删除
  203. handleDel (row) {
  204. console.log(row, '-----------------------row', row.allocationLinkageOutSn)
  205. const _this = this
  206. this.$confirm({
  207. title: '提示',
  208. content: '删除后不可恢复,确定要进行删除吗?',
  209. centered: true,
  210. onOk () {
  211. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  212. if (res.status == 200) {
  213. _this.$message.success(res.message)
  214. _this.$refs.table.refresh()
  215. }
  216. })
  217. }
  218. })
  219. },
  220. // 出库
  221. handleOut (row) {
  222. const _this = this
  223. this.$confirm({
  224. title: '提示',
  225. content: '确认要出库吗?',
  226. centered: true,
  227. onOk () {
  228. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  229. if (res.status == 200) {
  230. _this.$message.success(res.message)
  231. _this.$refs.table.refresh()
  232. }
  233. })
  234. }
  235. })
  236. },
  237. // 审核
  238. handleExamine (row) {
  239. const _this = this
  240. this.$confirm({
  241. title: '提示',
  242. content: '确认要审核通过吗?',
  243. centered: true,
  244. onOk () {
  245. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  246. if (res.status == 200) {
  247. _this.$message.success(res.message)
  248. _this.$refs.table.refresh()
  249. }
  250. })
  251. }
  252. })
  253. },
  254. // 详情
  255. handleDetail (row) {
  256. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  257. },
  258. // 新增/编辑
  259. handleEdit (row) {
  260. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  261. },
  262. // 调往对象
  263. getPutTenantList () {
  264. getTenantList({}).then(res => {
  265. if (res.status == 200) {
  266. this.putTenantSnData = res.data
  267. } else {
  268. this.putTenantSnData = []
  269. }
  270. })
  271. },
  272. filterOption (input, option) {
  273. return (
  274. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  275. )
  276. }
  277. },
  278. beforeRouteEnter (to, from, next) {
  279. next(vm => {
  280. vm.openModal = false
  281. vm.getPutTenantList()
  282. })
  283. }
  284. }
  285. </script>