list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="allocateBillList-wrap" style="margin-bottom:6px;">
  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="allocateBillList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调往对象"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="收货客户名称">
  20. <dealerSearchList ref="receiverSn" @change="custChange" />
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  25. <a-form-item label="调出仓库">
  26. <warehouse
  27. v-model="queryParam.warehouseSn"
  28. isPermission
  29. id="allocateBillList-warehouseSn"
  30. placeholder="请选择调出仓库"
  31. />
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="业务状态">
  36. <v-select
  37. v-model="queryParam.state"
  38. ref="state"
  39. id="allocateBillList-state"
  40. code="ALLOCATE_STATUS"
  41. placeholder="请选择业务状态"
  42. allowClear
  43. ></v-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-item label="调拨单号">
  48. <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="对单状态">
  53. <v-select
  54. v-model="queryParam.checkStatus"
  55. ref="checkStatus"
  56. id="allocateBillList-checkStatus"
  57. code="CHECK_STATUS"
  58. placeholder="请选择对单状态"
  59. allowClear
  60. ></v-select>
  61. </a-form-item>
  62. </a-col>
  63. </template>
  64. <a-col :md="6" :sm="24">
  65. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
  66. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
  67. <a @click="advanced=!advanced" style="margin-left: 5px">
  68. {{ advanced ? '收起' : '展开' }}
  69. <a-icon :type="advanced ? 'up' : 'down'"/>
  70. </a>
  71. </a-col>
  72. </a-row>
  73. </a-form>
  74. </div>
  75. </a-card>
  76. <a-card size="small" :bordered="false">
  77. <a-spin :spinning="spinning" tip="Loading...">
  78. <!-- 列表 -->
  79. <s-table
  80. class="sTable fixPagination"
  81. ref="table"
  82. :style="{ height: tableHeight+84.5+'px' }"
  83. size="small"
  84. :rowKey="(record) => record.id"
  85. :columns="columns"
  86. :data="loadData"
  87. :defaultLoadData="false"
  88. :scroll="{ y: tableHeight }"
  89. bordered>
  90. <!-- 单号 -->
  91. <template slot="allocateNo" slot-scope="text, record">
  92. <span v-if="$hasPermissions('M_transferOut_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
  93. <span v-else>{{ record.allocateNo }}</span>
  94. </template>
  95. <!-- 操作 -->
  96. <template slot="action" slot-scope="text, record">
  97. <a-button
  98. size="small"
  99. type="link"
  100. v-if="record.checkStatus == 'WAIT'&&$hasPermissions('B_YxAudit')"
  101. class="button-warning"
  102. @click="handleYxAudit(record)"
  103. id="allocateBillList-checkStatus">对单通过</a-button>
  104. <span v-else>--</span>
  105. </template>
  106. </s-table>
  107. </a-spin>
  108. <!-- 查看详情 -->
  109. <commonModal
  110. modalTit="调拨单详情"
  111. bodyPadding="10px"
  112. width="70%"
  113. :showFooter="false"
  114. :openModal="showDetailModal"
  115. @cancel="cancelDetail">
  116. <allocationDetailModal v-if="showDetailModal" :outBizSn="bizSn" />
  117. </commonModal>
  118. </a-card>
  119. </div>
  120. </template>
  121. <script>
  122. import { commonMixin } from '@/utils/mixin'
  123. import moment from 'moment'
  124. import getDate from '@/libs/getDate.js'
  125. import { STable, VSelect } from '@/components'
  126. import rangeDate from '@/views/common/rangeDate.vue'
  127. import commonModal from '@/views/common/commonModal.vue'
  128. import dealerSearchList from '@/views/common/dealerSearchList.vue'
  129. import allocationDetailModal from '@/views/allocationManagement/transferOut/detail.vue'
  130. import warehouse from '@/views/common/chooseWarehouse.js'
  131. import { allocateBillList, allocateBillCheck } from '@/api/allocateBill'
  132. export default {
  133. name: 'MatchSendOutOrderAllocationList',
  134. mixins: [commonMixin],
  135. components: { STable, VSelect, rangeDate, dealerSearchList, commonModal, allocationDetailModal, warehouse },
  136. data () {
  137. return {
  138. spinning: false,
  139. advanced: true, // 高级搜索 展开/关闭
  140. tableHeight: 0,
  141. time: [
  142. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  143. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  144. ],
  145. queryParam: { // 查询条件
  146. beginDate: getDate.getThreeMonthDays().starttime,
  147. endDate: getDate.getCurrMonthDays().endtime,
  148. targetName: '', // 调往对象
  149. state: undefined, // 业务状态
  150. allocateNo: '', // 调拨单号
  151. warehouseSn: undefined,
  152. receiverSn: undefined,
  153. checkStatus: undefined,
  154. printState: undefined
  155. },
  156. showDetailModal: false,
  157. disabled: false, // 查询、重置按钮是否可操作
  158. exportLoading: false,
  159. // 加载数据方法 必须为 Promise 对象
  160. loadData: parameter => {
  161. this.disabled = true
  162. this.spinning = true
  163. return allocateBillList(Object.assign(parameter, this.queryParam, { authWarehouseFlag: 1 })).then(res => {
  164. let data
  165. if (res.status == 200) {
  166. 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. }
  173. this.spinning = false
  174. return data
  175. })
  176. },
  177. visibleAudit: false,
  178. auditInfo: null,
  179. bizSn: '',
  180. spinningAudit: false,
  181. openModal: false // 新增编辑 弹框
  182. }
  183. },
  184. computed: {
  185. columns () {
  186. const arr = [
  187. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  188. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  189. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '9%' },
  190. { title: '调往对象', dataIndex: 'targetName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  191. { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  192. { title: '发货说明', dataIndex: 'explainInfo', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  193. { title: '收货客户名称', dataIndex: 'receiverName', width: '9%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  194. { title: '总数量', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  195. // { title: '调出仓库', dataIndex: 'warehouseName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  196. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  197. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  198. { title: '对单人员', dataIndex: 'checkPersonName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  199. { title: '对单时间', dataIndex: 'checkDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  200. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  201. ]
  202. if (this.isShowWarehouse) {
  203. arr.splice(4, 0, { title: '调出仓库', dataIndex: 'warehouseName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
  204. }
  205. return arr
  206. }
  207. },
  208. methods: {
  209. custChange (val) {
  210. if (val.row) {
  211. this.queryParam.receiverSn = val.row.dealerSn
  212. this.queryParam.receiverName = undefined
  213. } else {
  214. this.queryParam.receiverSn = undefined
  215. this.queryParam.receiverName = val.key
  216. }
  217. },
  218. // 创建时间 change
  219. dateChange (date) {
  220. this.queryParam.beginDate = date[0]
  221. this.queryParam.endDate = date[1]
  222. },
  223. // 重置
  224. resetSearchForm () {
  225. this.$refs.rangeDate.resetDate(this.time)
  226. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  227. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  228. this.queryParam.targetName = ''
  229. this.queryParam.state = undefined
  230. this.queryParam.allocateNo = ''
  231. this.queryParam.receiverSn = ''
  232. this.queryParam.receiverName = ''
  233. this.queryParam.warehouseSn = undefined
  234. this.queryParam.checkStatus = undefined
  235. this.$refs.table.refresh(true)
  236. this.$refs.receiverSn.resetForm()
  237. },
  238. // 允许打印
  239. handleYxAudit (row) {
  240. const _this = this
  241. this.$confirm({
  242. title: '提示',
  243. content: '确认对单通过吗?',
  244. centered: true,
  245. onOk () {
  246. _this.spinning = true
  247. allocateBillCheck({ sn: row.allocateSn }).then(res => {
  248. if (res.status == 200) {
  249. _this.$message.success(res.message)
  250. _this.$refs.table.refresh()
  251. _this.spinning = false
  252. } else {
  253. _this.spinning = false
  254. }
  255. })
  256. }
  257. })
  258. },
  259. // 详情
  260. handleDetail (row) {
  261. this.$store.state.app.curActionPermission = 'M_transferOut_detail'
  262. this.bizSn = row.allocateSn
  263. this.showDetailModal = true
  264. },
  265. cancelDetail () {
  266. this.$store.state.app.curActionPermission = ''
  267. this.showDetailModal = false
  268. this.bizSn = null
  269. },
  270. pageInit () {
  271. const _this = this
  272. this.$nextTick(() => { // 页面渲染完成后的回调
  273. _this.setTableH()
  274. })
  275. this.openModal = false
  276. },
  277. setTableH () {
  278. const tableSearchH = this.$refs.tableSearch.offsetHeight
  279. this.tableHeight = window.innerHeight - tableSearchH - 226
  280. }
  281. },
  282. watch: {
  283. advanced (newValue, oldValue) {
  284. const _this = this
  285. this.$nextTick(() => { // 页面渲染完成后的回调
  286. _this.setTableH()
  287. })
  288. },
  289. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  290. this.setTableH()
  291. }
  292. },
  293. mounted () {
  294. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  295. this.pageInit()
  296. this.resetSearchForm()
  297. }
  298. },
  299. activated () {
  300. // 如果是新页签打开,则重置当前页面
  301. if (this.$store.state.app.isNewTab) {
  302. this.pageInit()
  303. this.resetSearchForm()
  304. }
  305. // 仅刷新列表,不重置页面
  306. if (this.$store.state.app.updateList) {
  307. this.pageInit()
  308. this.$refs.table.refresh()
  309. }
  310. },
  311. beforeRouteEnter (to, from, next) {
  312. next(vm => {})
  313. }
  314. }
  315. </script>
  316. <style lang="less">
  317. .active{
  318. color: #ed1c24;
  319. cursor: pointer;
  320. }
  321. .common{
  322. color: rgba(0, 0, 0);
  323. }
  324. </style>