list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="调往对象">
  15. <a-select
  16. placeholder="请选择调往对象"
  17. allowClear
  18. id="chainTransferOutList-putTenantSn"
  19. v-model="queryParam.putTenantSn"
  20. :showSearch="true"
  21. option-filter-prop="children"
  22. :filter-option="filterOption">
  23. <a-select-option v-for="item in putTenantSnData" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
  24. </a-select>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="调出产品类型">
  29. <v-select
  30. v-model="queryParam.allocationType"
  31. ref="allocationType"
  32. id="chainTransferOutList-allocationType"
  33. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  34. placeholder="请选择调出产品类型"
  35. allowClear></v-select>
  36. </a-form-item>
  37. </a-col>
  38. <template v-if="advanced">
  39. <a-col :md="6" :sm="24">
  40. <a-form-item label="业务状态">
  41. <v-select
  42. v-model="queryParam.state"
  43. ref="state"
  44. id="chainTransferOutList-state"
  45. code="ALLOCATION_LINKAGE_OUT_STATUS"
  46. placeholder="请选择业务状态"
  47. allowClear></v-select>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="24">
  51. <a-form-item label="财务状态">
  52. <v-select
  53. v-model="queryParam.settleState"
  54. ref="settleState"
  55. id="chainTransferOutList-settleState"
  56. code="FINANCIAL_STATUS"
  57. placeholder="请选择财务状态"
  58. allowClear></v-select>
  59. </a-form-item>
  60. </a-col>
  61. </template>
  62. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  63. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
  64. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
  65. <a @click="advanced=!advanced" style="margin-left: 8px">
  66. {{ advanced ? '收起' : '展开' }}
  67. <a-icon :type="advanced ? 'up' : 'down'"/>
  68. </a>
  69. </a-col>
  70. </a-row>
  71. </a-form>
  72. </div>
  73. <!-- 操作按钮 -->
  74. <div class="table-operator">
  75. <a-button id="chainTransferOutList-add" v-if="$hasPermissions('B_allocLinkageOutNew')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  76. </div>
  77. <!-- 列表 -->
  78. <s-table
  79. class="sTable fixPagination"
  80. ref="table"
  81. :style="{ height: tableHeight+84.5+'px' }"
  82. size="small"
  83. :rowKey="(record) => record.id"
  84. :columns="columns"
  85. :data="loadData"
  86. :scroll="{ x: 1380, y: tableHeight }"
  87. :defaultLoadData="false"
  88. bordered>
  89. <!-- 连锁调出单号 -->
  90. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  91. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_allocLinkageOutDetail')" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  92. <span v-else>{{ record.allocationLinkageOutNo }}</span>
  93. </template>
  94. <!-- 操作 -->
  95. <template slot="action" slot-scope="text, record">
  96. <a-button
  97. size="small"
  98. type="link"
  99. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')"
  100. class="button-warning"
  101. @click="handleExamine(record)"
  102. id="chainTransferOutList-examine-btn">审核</a-button>
  103. <a-button
  104. size="small"
  105. type="link"
  106. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')"
  107. class="button-info"
  108. @click="handleEdit(record)"
  109. id="chainTransferOutList-edit-btn">编辑</a-button>
  110. <a-button
  111. size="small"
  112. type="link"
  113. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')"
  114. class="button-primary"
  115. @click="handleOut(record)"
  116. id="chainTransferOutList-out-btn">出库</a-button>
  117. <a-button
  118. size="small"
  119. type="link"
  120. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE') &&$hasPermissions('B_allocLinkageOutDel')"
  121. class="button-error"
  122. @click="handleDel(record)"
  123. id="chainTransferOutList-del-btn">删除</a-button>
  124. <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>
  125. </template>
  126. </s-table>
  127. </a-spin>
  128. <!-- 新增/编辑 -->
  129. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  130. </a-card>
  131. </template>
  132. <script>
  133. import { STable, VSelect } from '@/components'
  134. import rangeDate from '@/views/common/rangeDate.vue'
  135. import basicInfoModal from './basicInfoModal.vue'
  136. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, getTenantList } from '@/api/allocLinkageOut'
  137. export default {
  138. components: { STable, VSelect, basicInfoModal, rangeDate },
  139. data () {
  140. return {
  141. spinning: false,
  142. tableHeight: 0,
  143. advanced: true, // 高级搜索 展开/关闭
  144. queryParam: { // 查询条件
  145. beginDate: '',
  146. endDate: '',
  147. putTenantSn: undefined, // 调往对象
  148. allocationType: undefined, // 调出产品类型
  149. state: undefined, // 业务状态
  150. settleState: undefined
  151. },
  152. disabled: false, // 查询、重置按钮是否可操作
  153. columns: [
  154. { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
  155. { title: '创建时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: 180, align: 'center' },
  157. { title: '调往对象', dataIndex: 'putTenantName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  158. { title: '总款数', dataIndex: 'productTotalCategory', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  159. { title: '总数量', dataIndex: 'productTotalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  160. { title: '总成本', dataIndex: 'productTotalCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  161. { title: '审核时间', dataIndex: 'auditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '业务状态', dataIndex: 'stateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  165. { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
  166. ],
  167. // 加载数据方法 必须为 Promise 对象
  168. loadData: parameter => {
  169. this.disabled = true
  170. this.spinning = true
  171. return allocLinkageOutList(Object.assign(parameter, this.queryParam)).then(res => {
  172. const data = res.data
  173. const no = (data.pageNo - 1) * data.pageSize
  174. for (var i = 0; i < data.list.length; i++) {
  175. data.list[i].no = no + i + 1
  176. }
  177. this.disabled = false
  178. this.spinning = false
  179. return data
  180. })
  181. },
  182. putTenantSnData: [],
  183. openModal: false, // 新增编辑 弹框
  184. itemId: '' // 当前品牌id
  185. }
  186. },
  187. methods: {
  188. // 时间 change
  189. dateChange (date) {
  190. this.queryParam.beginDate = date[0]
  191. this.queryParam.endDate = date[1]
  192. },
  193. // 重置
  194. resetSearchForm () {
  195. this.$refs.rangeDate.resetDate()
  196. this.queryParam.beginDate = ''
  197. this.queryParam.endDate = ''
  198. this.queryParam.putTenantSn = undefined
  199. this.queryParam.allocationType = undefined
  200. this.queryParam.state = undefined
  201. this.queryParam.settleState = undefined
  202. this.$refs.table.refresh(true)
  203. },
  204. // 基本信息 保存
  205. handleOk (data) {
  206. this.$router.push({ path: `/allocationManagement/chainTransferOut/add/${data.id}/${data.allocationLinkageOutSn}` })
  207. },
  208. // 删除
  209. handleDel (row) {
  210. const _this = this
  211. this.$confirm({
  212. title: '提示',
  213. content: '删除后不可恢复,确定要进行删除吗?',
  214. centered: true,
  215. onOk () {
  216. _this.spinning = true
  217. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  218. if (res.status == 200) {
  219. _this.$message.success(res.message)
  220. _this.$refs.table.refresh()
  221. _this.spinning = false
  222. } else {
  223. _this.spinning = false
  224. }
  225. })
  226. }
  227. })
  228. },
  229. // 出库
  230. handleOut (row) {
  231. const _this = this
  232. this.$confirm({
  233. title: '提示',
  234. content: '确认要出库吗?',
  235. centered: true,
  236. onOk () {
  237. _this.spinning = true
  238. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  239. if (res.status == 200) {
  240. _this.$message.success(res.message)
  241. _this.$refs.table.refresh()
  242. _this.spinning = false
  243. } else {
  244. _this.spinning = false
  245. }
  246. })
  247. }
  248. })
  249. },
  250. // 审核
  251. handleExamine (row) {
  252. const _this = this
  253. this.$confirm({
  254. title: '提示',
  255. content: '确认要审核通过吗?',
  256. centered: true,
  257. onOk () {
  258. _this.spinning = true
  259. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  260. if (res.status == 200) {
  261. _this.$message.success(res.message)
  262. _this.$refs.table.refresh()
  263. _this.spinning = false
  264. } else {
  265. _this.spinning = false
  266. }
  267. })
  268. }
  269. })
  270. },
  271. // 详情
  272. handleDetail (row) {
  273. this.$router.push({ path: `/allocationManagement/chainTransferOut/detail/${row.allocationLinkageOutSn}` })
  274. },
  275. // 新增/编辑
  276. handleEdit (row) {
  277. this.$router.push({ path: `/allocationManagement/chainTransferOut/edit/${row.id}/${row.allocationLinkageOutSn}` })
  278. },
  279. // 调往对象
  280. getPutTenantList () {
  281. getTenantList({}).then(res => {
  282. if (res.status == 200) {
  283. this.putTenantSnData = res.data
  284. } else {
  285. this.putTenantSnData = []
  286. }
  287. })
  288. },
  289. filterOption (input, option) {
  290. return (
  291. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  292. )
  293. },
  294. pageInit () {
  295. const _this = this
  296. this.$nextTick(() => { // 页面渲染完成后的回调
  297. _this.setTableH()
  298. })
  299. this.openModal = false
  300. this.getPutTenantList()
  301. },
  302. setTableH () {
  303. const tableSearchH = this.$refs.tableSearch.offsetHeight
  304. this.tableHeight = window.innerHeight - tableSearchH - 235
  305. }
  306. },
  307. watch: {
  308. advanced (newValue, oldValue) {
  309. const _this = this
  310. setTimeout(() => {
  311. _this.setTableH()
  312. }, 400)
  313. }
  314. },
  315. mounted () {
  316. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  317. this.pageInit()
  318. this.resetSearchForm()
  319. }
  320. },
  321. activated () {
  322. // 如果是新页签打开,则重置当前页面
  323. if (this.$store.state.app.isNewTab) {
  324. this.pageInit()
  325. this.resetSearchForm()
  326. }
  327. },
  328. beforeRouteEnter (to, from, next) {
  329. next(vm => {})
  330. }
  331. }
  332. </script>