list.vue 13 KB

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