山东众工仓库管理系统前台vue代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

changerecord.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div style="height:100%;">
  3. <div class="searchForm-header">
  4. <el-row>
  5. <el-form :model="query" label-width="100px" inline="">
  6. <el-row>
  7. <el-form-item label="库房名称" style="margin-left: -15px">
  8. <el-select v-model="query.wareName" size="small" clearable style="width:120px;margin-left: -8px" @change="changeWare">
  9. <el-option v-for="item in optionsWare" :key="item.id" :label="item.name" :value="item.name">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="垛位名称" style="margin-left: -35px">
  14. <el-input v-model="query.stackName" size="small" style="width:120px;margin-left: -8px"></el-input>
  15. </el-form-item>
  16. <el-form-item label="物料名称" style="margin-left: -35px">
  17. <el-input v-model="query.materialName" size="small" style="width:120px;margin-left: -8px">
  18. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  19. </el-input>
  20. </el-form-item>
  21. <el-form-item label="钢种" style="margin-left: -35px">
  22. <el-input v-model="query.standard" size="small" style="width:120px;margin-left: -8px">
  23. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  24. </el-input>
  25. </el-form-item>
  26. <el-form-item label="客户名称" style="margin-left: -35px">
  27. <el-input v-model="query.customerName" size="small" style="width:170px;margin-left: -8px">
  28. <el-button slot="append" icon="el-icon-search" @click="showCustomer"></el-button>
  29. </el-input>
  30. </el-form-item>
  31. </el-row>
  32. <el-row>
  33. <el-form-item label="规格型号" style="margin-left: -15px;margin-top: -15px">
  34. <el-input v-model="query.model" size="small" style="width:120px;margin-left: -8px">
  35. </el-input>
  36. </el-form-item>
  37. <el-form-item label="钢板号" style="margin-left: -35px;margin-top: -15px">
  38. <el-input v-model="query.plateNo" size="small" style="width:120px;margin-left: -8px">
  39. </el-input>
  40. </el-form-item>
  41. <el-form-item label="转移时间" style="margin-left: -35px;margin-top: -15px">
  42. <el-date-picker v-model="query.RecordDate" size="small" style="width:330px;margin-left: -8px" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  43. </el-date-picker>
  44. </el-form-item>
  45. <el-form-item label=" " style="margin-top: -15px">
  46. <el-button @click="handleSearch" type="primary" size="small" >查询</el-button>
  47. <el-button type="success" @click="handleExport" style="margin-left: 2px" size="small">导出记录</el-button>
  48. </el-form-item>
  49. </el-row>
  50. </el-form>
  51. </el-row>
  52. <total-block ref="totalBlock" style="margin-top: -25px;margin-left: -35px" v-bind:childParam="childParam" v-bind:childUrl = 'childUrl'></total-block>
  53. </div>
  54. <div class="tabledata-grid">
  55. <el-table v-loading="loading" :data="tableData" height="100%" stripe border style="width: 97%;;font-size: 13px;margin-top: -50px;" :header-cell-style="{'text-align':'center'}">
  56. <el-table-column prop="id" label="编号" min-width="10%" v-if="false">
  57. </el-table-column>
  58. <el-table-column prop="wareName" label="仓库名称" width="100px" show-overflow-tooltip header-align="center">
  59. </el-table-column>
  60. <el-table-column prop="stackName" label="垛位" width="60px" show-overflow-tooltip header-align="center" align="center">
  61. </el-table-column>
  62. <el-table-column prop="layer" label="层号" show-overflow-tooltip width="60px" header-align="center" align="center">
  63. </el-table-column>
  64. <el-table-column prop="materialName" label="品名" show-overflow-tooltip width="60px" header-align="center" align="center">
  65. </el-table-column>
  66. <el-table-column prop="model" label="规格型号" show-overflow-tooltip width="180px" align="center">
  67. </el-table-column>
  68. <el-table-column prop="standard" label="钢种" show-overflow-tooltip width="80px" align="center">
  69. </el-table-column>
  70. <el-table-column prop="count" label="数量" width="80px" show-overflow-tooltip align="right">
  71. </el-table-column>
  72. <el-table-column prop="weight" label="重量" width="80px" show-overflow-tooltip align="right">
  73. </el-table-column>
  74. <el-table-column prop="plateNo" label="钢板号" width="200px" show-overflow-tooltip align="center">
  75. </el-table-column>
  76. <el-table-column prop="fkCustomerNameOld" label="原货权单位" show-overflow-tooltip width="300px">
  77. </el-table-column>
  78. <el-table-column prop="customerNameOld" label="原客户名称" show-overflow-tooltip width="300px">
  79. </el-table-column>
  80. <el-table-column prop="fkCustomerNameNew" label="新货权单位" show-overflow-tooltip width="300px">
  81. </el-table-column>
  82. <el-table-column prop="customerNameNew" label="新客户名称" show-overflow-tooltip width="300px">
  83. </el-table-column>
  84. <el-table-column prop="receiveAddressOld" label="原收货地址" width="300" show-overflow-tooltip align="left">
  85. </el-table-column>
  86. <el-table-column prop="receiveAddressNew" label="新收货地址" width="300" show-overflow-tooltip align="left">
  87. </el-table-column>
  88. <el-table-column prop="addTime" label="操作时间" width="200px" show-overflow-tooltip align="left">
  89. </el-table-column>
  90. <el-table-column prop="addUser.userDesc" label="操作人" width="100px" show-overflow-tooltip align="left">
  91. </el-table-column>
  92. <el-table-column prop="wgtDcnMtcCd" label="计量方式" width="100" show-overflow-tooltip header-align="center">
  93. </el-table-column>
  94. <el-table-column prop="edgeTy" label="切边类型" width="100" show-overflow-tooltip header-align="center">
  95. </el-table-column>
  96. <el-table-column prop="productionPlace" label="产地" width="250" show-overflow-tooltip header-align="center">
  97. </el-table-column>
  98. <el-table-column prop="remark" label="备注" width="100px" show-overflow-tooltip align="left">
  99. </el-table-column>
  100. </el-table>
  101. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  102. :page-sizes="pageSizes" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalRows">
  103. </el-pagination>
  104. </div>
  105. <popup-material ref="PopupMaterial" @receviceFromChild="receviceFromMaterial"></popup-material>
  106. <popup-customer ref="PopupCustomer" @receviceFromChild="receviceFromCustomer"></popup-customer>
  107. </div>
  108. </template>
  109. <script>
  110. import axios from '@/axios'
  111. import PopupStack from '@/components/PopupStack.vue'
  112. import PopupMaterial from '@/components/PopupMaterial.vue'
  113. import PopupCustomer from '@/components/PopupCustomer.vue'
  114. import TotalBlock from '@/components/TotalBlock.vue'
  115. import Export2Excel from '../../excel/Export2Excel.js'
  116. import {
  117. mapState
  118. } from 'vuex'
  119. export default {
  120. computed: {
  121. ...mapState({
  122. serverName: state => state.app.serverName
  123. })
  124. },
  125. components: {
  126. PopupStack,
  127. PopupMaterial,
  128. PopupCustomer,
  129. TotalBlock
  130. },
  131. data() {
  132. return {
  133. query: {
  134. wareName: '',
  135. stackName: '',
  136. model: '',
  137. materialName: '',
  138. standard: '',
  139. customerName: '',
  140. plateNo: '',
  141. RecordDate:[],
  142. },
  143. tableData: [],
  144. optionsWare: [],
  145. dialogVisible: false,
  146. labelPosition: 'right',
  147. //分页参数
  148. currentPage: 1,
  149. totalRows: 0,
  150. pageSizes: [50, 100, 200,500],
  151. pageSize: 50,
  152. childParam:{
  153. wareName: '',
  154. stackName: '',
  155. model: '',
  156. materialName: '',
  157. standard: '',
  158. customerName: '',
  159. plateNo: '',
  160. RecordDate:[],
  161. },
  162. childUrl:'WareChangeRecord/queryTotal.do',
  163. loading: false,
  164. };
  165. },
  166. //页面加载完成渲染
  167. mounted() {
  168. this.getWare()
  169. this.getTableData()
  170. },
  171. methods: {
  172. typeFormatter: function(row, column) {
  173. switch (row.recordType) {
  174. case "0":
  175. return "入库取消";
  176. break;
  177. default:
  178. return "入库";
  179. break;
  180. }
  181. },
  182. showMaterial() {
  183. this.$refs.PopupMaterial.show()
  184. },
  185. receviceFromMaterial(material) {
  186. //console.log("receviceFromStack")
  187. this.query.materialName = material.name
  188. this.query.standard = material.standard
  189. },
  190. showCustomer() {
  191. this.$refs.PopupCustomer.show()
  192. },
  193. receviceFromCustomer(customer) {
  194. //console.log("receviceFromStack")
  195. this.query.customerName = customer.name
  196. },
  197. handleSizeChange(val) {
  198. console.log(`每页 ${val} 条`);
  199. this.pageSize = val
  200. this.getTableData()
  201. },
  202. // 修改当前页事件
  203. handleCurrentChange(val) {
  204. console.log(`当前页: ${val}`);
  205. this.currentPage = val
  206. this.getTableData()
  207. },
  208. handleSearch() {
  209. this.currentPage = 1
  210. this.getTableData()
  211. },
  212. getWare() {
  213. var url = 'MaintWare/queryByUserId.do'
  214. var param = {}
  215. axios.get(url, param).then(response => {
  216. console.log(response)
  217. this.optionsWare = response.data.data
  218. if (response.data.data.length == 1) {
  219. this.wareName = response.data.data[0].name
  220. // this.getStack()
  221. }
  222. });
  223. },
  224. getTableData() {
  225. var url = 'WareChangeRecord/query.do'
  226. if(this.query.RecordDate == null){
  227. this.query.RecordDate = [false,false];
  228. }
  229. this.loading = true
  230. var param = {
  231. page: this.currentPage,
  232. rows: this.pageSize,
  233. wareName: this.query.wareName,
  234. stackName: this.query.stackName,
  235. model: this.query.model,
  236. materialName: this.query.materialName,
  237. standard: this.query.standard,
  238. customerName: this.query.customerName,
  239. plateNo: this.query.plateNo,
  240. pFromDate:(!this.query.RecordDate[0]) ? "1970-01-01 00:00:00" : this.query.RecordDate[0].Format("yyyy-MM-dd HH:mm:ss"), //date类型
  241. pToDate :(!this.query.RecordDate[1]) ? new Date().Format("yyyy-MM-dd HH:mm:ss") :this.query.RecordDate[1].Format("yyyy-MM-dd HH:mm:ss"),
  242. }
  243. this.childParam = param;
  244. axios.get(url, param).then(response => {
  245. if (response.data.code == 0) {
  246. this.tableData = response.data.data.list;
  247. this.totalRows = response.data.data.total;
  248. this.$refs.totalBlock.getTotalData();
  249. } else {
  250. this.$message({
  251. type: 'error',
  252. message: '操作失败;' + response.data.msg,
  253. });
  254. }
  255. this.loading = false;
  256. });
  257. },
  258. changeWare(){
  259. },
  260. handleExport() {
  261. var imptData = [];
  262. var url = 'WareChangeRecord/query.do'
  263. if(this.query.RecordDate == null){
  264. this.query.RecordDate = [false,false];
  265. }
  266. var param = {
  267. page: -1,
  268. rows: -1,
  269. wareName: this.query.wareName,
  270. stackName: this.query.stackName,
  271. model: this.query.model,
  272. materialName: this.query.materialName,
  273. standard: this.query.standard,
  274. customerName: this.query.customerName,
  275. plateNo: this.query.plateNo,
  276. pFromDate:(!this.query.RecordDate[0]) ? "1970-01-01 00:00:00" : this.query.RecordDate[0].Format("yyyy-MM-dd HH:mm:ss"), //date类型
  277. pToDate :(!this.query.RecordDate[1]) ? new Date().Format("yyyy-MM-dd HH:mm:ss") :this.query.RecordDate[1].Format("yyyy-MM-dd HH:mm:ss"),
  278. }
  279. // alert(JSON.stringify(param))
  280. axios.get(url, param).then(response => {
  281. // alert(JSON.stringify(response))
  282. if (response.data.code == 0) {
  283. var imptData = response.data.data;
  284. if (imptData.length == 0) {
  285. this.$alert('无法导出,选择时间段无记录', '提示', {
  286. confirmButtonText: '确定',
  287. callback: action => {}
  288. });
  289. } else {
  290. this.exportExcel(imptData)
  291. }
  292. } else {
  293. this.$message({
  294. type: 'error',
  295. message: '操作失败;' + response.data.msg,
  296. });
  297. }
  298. });
  299. },
  300. exportExcel(imptData) {
  301. console.log(imptData)
  302. const header = ["仓库名称",
  303. "垛位",
  304. "层号",
  305. "品名",
  306. "规格型号",
  307. "钢种",
  308. "数量",
  309. "重量",
  310. "钢板号",
  311. "原货权单位",
  312. "原客户名称",
  313. "新货权单位",
  314. "新客户名称",
  315. "原收货地址",
  316. "新收货地址",
  317. "操作时间",
  318. "操作人",
  319. "计量方式",
  320. "切边类型",
  321. "产地",
  322. "备注"
  323. ] // 导出的表头名
  324. const filterVal = [
  325. "wareName",
  326. "stackName",
  327. "layer",
  328. "materialName",
  329. "model",
  330. "standard",
  331. "count",
  332. "weight",
  333. "plateNo",
  334. "fkCustomerNameOld",
  335. "customerNameOld",
  336. "fkCustomerNameNew",
  337. "customerNameNew",
  338. "receiveAddressOld",
  339. "receiveAddressNew",
  340. "addTime",
  341. "addUserUserDesc",
  342. "wgtDcnMtcCd",
  343. "edgeTy",
  344. "productionPlace",
  345. "remark"
  346. ]
  347. for(var i=0;i<imptData.length;i++){
  348. imptData[i]["addUserUserDesc"] = imptData[i].addUser.userDesc;
  349. }
  350. const list = imptData
  351. const data = this.formatJson(filterVal, list)
  352. const filename = '货权转移记录' + (new Date()).toLocaleDateString();
  353. Export2Excel.export_json_to_excel({
  354. header,
  355. data,
  356. filename
  357. })
  358. },
  359. formatJson(filterVal, jsonData) {
  360. return jsonData.map(v => filterVal.map(j => {
  361. return v[j]
  362. }))
  363. },
  364. },
  365. }
  366. </script>
  367. <style>
  368. .searchForm-header{
  369. /*background-color: red;*/
  370. height: auto;
  371. /*;*/
  372. margin-left: 10px;
  373. }
  374. .tabledata-grid{
  375. /*margin-left: 100px;*/
  376. font-size: 20px;
  377. height: calc(100% - 170px);
  378. margin-left: 15px;
  379. /*background-color: #000;*/
  380. }
  381. </style>