oYeOutbound.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="oYeOutbound">
  3. <div class="search">
  4. <el-form :inline="true">
  5. <el-form-item v-if="Object.keys(queryMap).length > 0">
  6. <span style="color: #409EFF;font-size: 18px;font-weight: 700;"
  7. >出库明细</span
  8. >
  9. </el-form-item>
  10. <el-form-item>
  11. <el-date-picker
  12. v-model="startTime"
  13. type="datetime"
  14. placeholder="出库时间"
  15. style="width: 180px;"
  16. value-format="timestamp"
  17. >
  18. </el-date-picker>
  19. <span>至</span>
  20. <el-date-picker
  21. v-model="endTime"
  22. type="datetime"
  23. placeholder="出库时间"
  24. style="width: 180px;"
  25. value-format="timestamp"
  26. >
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-select
  31. v-model="screen"
  32. placeholder="选择条件"
  33. style="width:180px"
  34. clearable
  35. >
  36. <el-option
  37. v-for="(item, index) in selectOptions"
  38. :label="item.label"
  39. :key="index"
  40. :value="item.value"
  41. ></el-option>
  42. </el-select>
  43. <el-input v-model="con" style="width:200px" clearable> </el-input>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-select
  47. v-model="screen1"
  48. placeholder="选择条件"
  49. style="width:180px"
  50. clearable
  51. >
  52. <el-option
  53. v-for="(item, index) in selectOptions"
  54. :label="item.label"
  55. :key="index"
  56. :value="item.value"
  57. ></el-option>
  58. </el-select>
  59. <el-input v-model="con1" style="width:200px" clearable></el-input>
  60. </el-form-item>
  61. <el-button type="primary" @click="search">查询</el-button>
  62. <el-button type="primary" @click="exportExcel">导出</el-button>
  63. <el-button
  64. type="primary"
  65. @click="back"
  66. v-if="Object.keys(queryMap).length > 0"
  67. >返回</el-button
  68. >
  69. <el-form-item></el-form-item>
  70. </el-form>
  71. </div>
  72. <div class="table">
  73. <dilTable
  74. v-bind.sync="options"
  75. :showSummaryList="showSummaryList"
  76. :isshowSummary="true"
  77. :showIndex="false"
  78. :row-style="{ height: '35px' }"
  79. :cell-style="returnClassName"
  80. @func="func"
  81. ></dilTable>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import { getCookie, formatDate } from '@/utils/util.js'
  87. export default {
  88. data() {
  89. const generateStartDate = _ => {
  90. let startDate = new Date()
  91. let startDateStr = formatDate(startDate, 'yyyy-MM-dd')
  92. let startTimeStr = startDateStr + ' 00:00:00'
  93. let startTime = new Date(startTimeStr)
  94. return startTime.getTime()
  95. }
  96. const generateEndDate = _ => {
  97. let endDate = new Date()
  98. let endDateStr = formatDate(endDate, 'yyyy-MM-dd')
  99. let endTimeStr = endDateStr + ' 23:59:59'
  100. let endTime = new Date(endTimeStr)
  101. return endTime.getTime()
  102. }
  103. return {
  104. options: {
  105. requestUrl: '',
  106. requestQuery: {}
  107. },
  108. selectOptions: [
  109. {
  110. value: 'consigneeName',
  111. label: '客户'
  112. },
  113. {
  114. value: 'saleArea',
  115. label: '片区'
  116. },
  117. {
  118. value: 'inboundArea',
  119. label: '仓库大类'
  120. },
  121. {
  122. value: 'inboundWarehouse',
  123. label: '具体仓库'
  124. },
  125. {
  126. value: 'materialName',
  127. label: '物资名称'
  128. },
  129. {
  130. value: 'materialSpe',
  131. label: '规格'
  132. }
  133. ],
  134. con: '',
  135. con1: '',
  136. screen: '',
  137. screen1: '',
  138. startTime: generateStartDate(),
  139. endTime: generateEndDate(),
  140. apiId: '530',
  141. orgCode: null,
  142. loginName: null,
  143. showSummaryList: ['materialNumber', 'netWeight', 'theoryWeight'],
  144. queryMap: {},
  145. tableData: [],
  146. tableTop: []
  147. }
  148. },
  149. created() {
  150. if (Object.keys(this.$route.query).length > 0) {
  151. this.queryMap = this.$route.query
  152. this.startTime = this.queryMap.startTime
  153. this.endTime = this.queryMap.endTime
  154. }
  155. this.getInfo()
  156. this.getRequestUrl()
  157. },
  158. methods: {
  159. func(res) {
  160. console.log(res, 'res')
  161. this.tableTop = res.columnData
  162. },
  163. exportExcel() {
  164. //创建工作簿对象
  165. let wb = XLSX.utils.book_new()
  166. let data = []
  167. let queryMap = {}
  168. queryMap[this.screen] = this.con
  169. queryMap[this.screen1] = this.con1
  170. if (this.loginName != null) {
  171. queryMap['consigneeName'] = this.loginName
  172. }
  173. if (this.orgCode == 'xiaoshouyewuyuan') {
  174. queryMap['saler'] = getCookie('loginName')
  175. }
  176. queryMap.isExcel = 1
  177. queryMap.inboundAreaSide = '厂外库'
  178. this.axios
  179. .post(
  180. '/api/v1/wms/getOyeOutboundResult' +
  181. '?startTime=' +
  182. this.startTime +
  183. '&endTime=' +
  184. this.endTime,
  185. queryMap
  186. )
  187. .then(res => {
  188. this.tableData = res.data.data
  189. this.tableData.forEach((item, index) => {
  190. let temp = {}
  191. this.tableTop.forEach(col => {
  192. temp[col.label] = item[col.prop]
  193. })
  194. data.push(temp)
  195. })
  196. //将json数组转换成sheet
  197. let table_sheet = XLSX.utils.json_to_sheet(data)
  198. //为工作簿添加sheet
  199. XLSX.utils.book_append_sheet(wb, table_sheet, '厂外库出库实绩')
  200. //导出
  201. XLSX.writeFile(wb, '厂外库出库实绩' + '.xlsx')
  202. })
  203. },
  204. back() {
  205. this.$router.go(-1)
  206. },
  207. returnClassName({ row, column, rowIndex, columnIndex }) {
  208. return {
  209. fontWeight: '500 !important',
  210. fontSize: '14px !important'
  211. // backgroundColor: '#FFFF01'
  212. }
  213. },
  214. getInfo() {
  215. this.orgCode = getCookie('orgCode')
  216. if (this.orgCode == 'shouhuokehu' || this.orgCode == 'chengyunshang') {
  217. this.apiId = 536
  218. this.loginName = getCookie('loginName')
  219. } else if (this.orgCode == 'ouyechangwaiku') {
  220. this.apiId = 530
  221. this.loginName = null
  222. this.inboundWarehouse = getCookie('loginName')
  223. } else {
  224. this.apiId = 530
  225. this.loginName = null
  226. }
  227. },
  228. getRequestUrl() {
  229. this.options.requestUrl =
  230. '/api/v1/wms/getOyeOutboundResult?apiId=' +
  231. this.apiId +
  232. '&con=' +
  233. this.con +
  234. '&i=' +
  235. new Date() +
  236. '&startTime=' +
  237. this.startTime +
  238. '&endTime=' +
  239. this.endTime
  240. let queryMap = {}
  241. queryMap[this.screen] = this.con
  242. queryMap[this.screen1] = this.con1
  243. if (this.loginName != null) {
  244. queryMap['consigneeName'] = this.loginName
  245. }
  246. if (this.orgCode == 'xiaoshouyewuyuan') {
  247. queryMap['saler'] = getCookie('loginName')
  248. }
  249. if (Object.keys(this.queryMap).length > 0) {
  250. queryMap = { ...queryMap, ...this.queryMap }
  251. }
  252. if (this.orgCode == 'ouyechangwaiku') {
  253. queryMap['inboundWarehouse'] = this.inboundWarehouse
  254. }
  255. queryMap.inboundAreaSide = '厂外库'
  256. this.options.requestQuery = JSON.parse(JSON.stringify(queryMap))
  257. },
  258. search() {
  259. this.getRequestUrl()
  260. }
  261. }
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. .oYeOutbound {
  266. .search {
  267. margin-left: 10px;
  268. margin-top: 10px;
  269. }
  270. .table {
  271. margin-left: 10px;
  272. margin-top: 10px;
  273. }
  274. /deep/ .el-table__footer-wrapper {
  275. font-weight: 700 !important;
  276. font-size: 16px !important;
  277. }
  278. }
  279. </style>