山东众工仓库管理系统前台vue代码
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

PopupDistribution.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div>
  3. <el-dialog title="配车" :visible.sync="dialogVisible" width="1000px" height="400px" @close="close">
  4. <el-form :model="distribution" label-width="100px" inline="">
  5. <el-form-item label="车号">
  6. <el-select v-model="truckNo" clearable allow-create filterable default-first-option @change="change" style="width: 200px;">
  7. <el-option v-for="item in trucks" :key="item.id" :label="item.truckNo" :value="item.truckNo">
  8. </el-option>
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="司机姓名">
  12. <el-input v-model="distribution.driverName" placeholder="司机姓名" style="width: 200px;"></el-input>
  13. </el-form-item>
  14. <el-form-item label="联系方式">
  15. <el-input v-model="distribution.driverPhone" placeholder="联系方式" style="width: 200px;"></el-input>
  16. </el-form-item>
  17. <el-form-item label="总重量">
  18. <el-input v-model="sumWeight" placeholder="总重量" style="width: 200px;"></el-input>
  19. </el-form-item>
  20. <el-form-item label="总数量">
  21. <el-input v-model="sumCount" placeholder="总数量" style="width: 200px;"></el-input>
  22. </el-form-item>
  23. <el-form-item label="过磅重量" v-if="false">
  24. <el-input v-model="distribution.suttle" placeholder="过磅重量" style="width: 200px;"></el-input>
  25. </el-form-item>
  26. <el-form-item label="提货单位" >
  27. <el-input v-model="distribution.deliveryCompany" placeholder="提货单位" style="width: 200px;"></el-input>
  28. </el-form-item>
  29. <el-form-item label=" ">
  30. <el-button size="medium" type="success" @click="handleSave">确定</el-button>
  31. <el-button size="medium" type="success" @click="handleCancel">取消</el-button>
  32. <el-button size="medium" type="primary" @click="handlePrint">打印配车单</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-table :data="tableData" border style="width: 99%;" ref="multipleTable" :row-class-name="tableRowClassName"
  36. @select="handleTableSelect" @select-all = "selectAll">
  37. <el-table-column type="selection" width="40" header-align="center" align="center">
  38. </el-table-column>
  39. <el-table-column prop="layer" label="层数" width="60" show-overflow-tooltip header-align="center" align="center">
  40. </el-table-column>
  41. <el-table-column prop="stack.name" label="垛位" width="60" show-overflow-tooltip header-align="center" align="center">
  42. </el-table-column>
  43. <el-table-column prop="material.name" label="物料" width="100" show-overflow-tooltip header-align="center" align="center">
  44. </el-table-column>
  45. <el-table-column prop="material.standard" label="钢种" width="100" show-overflow-tooltip header-align="center" align="center">
  46. </el-table-column>
  47. <el-table-column prop="plateNo" label="钢板号" width="200" show-overflow-tooltip header-align="center">
  48. </el-table-column>
  49. <el-table-column prop="model" label="规格型号" width="120" show-overflow-tooltip header-align="center" align="center">
  50. </el-table-column>
  51. <el-table-column prop="count" label="数量" width="120" show-overflow-tooltip align="right" header-align="center">
  52. </el-table-column>
  53. <el-table-column prop="weight" label="重量" width="120" show-overflow-tooltip align="right" header-align="center">
  54. </el-table-column>
  55. <el-table-column prop="customer.name" label="客户" width="300" show-overflow-tooltip header-align="center">
  56. </el-table-column>
  57. <el-table-column prop="receiveAddress" label="收货地址" width="300" show-overflow-tooltip header-align="center">
  58. </el-table-column>
  59. <el-table-column prop="wgtDcnMtcCd" label="计量方式" width="100" show-overflow-tooltip header-align="center">
  60. </el-table-column>
  61. <el-table-column prop="edgeTy" label="切边类型" width="100" show-overflow-tooltip header-align="center">
  62. </el-table-column>
  63. <el-table-column prop="productionPlace" label="产地" width="250" show-overflow-tooltip header-align="center">
  64. </el-table-column>
  65. </el-table>
  66. </el-dialog>
  67. </div>
  68. </template>
  69. <script>
  70. import axios from '@/axios';
  71. import {
  72. mapState
  73. } from 'vuex'
  74. export default {
  75. computed: {
  76. sumWeight: function() {
  77. let result = 0
  78. for (let i = 0; i < this.tableData.length; i++) {
  79. //console.log(this.distribution.listDetail[i].weight)
  80. result = Number(result) + Number(this.tableData[i].weight)
  81. }
  82. return result.toFixed(3)
  83. },
  84. sumCount: function() {
  85. let result = 0
  86. for (let i = 0; i < this.tableData.length; i++) {
  87. //console.log(this.distribution.listDetail[i].count)
  88. result = Number(result) + Number(this.tableData[i].count)
  89. }
  90. return result.toFixed(0)
  91. },
  92. ...mapState({
  93. serverName: state => state.app.serverName
  94. })
  95. },
  96. props: {
  97. selectRows: {
  98. type: Array
  99. },
  100. },
  101. data() {
  102. return {
  103. trucks: [],
  104. truckNo: '',
  105. tableData: [],
  106. currentPage: 1,
  107. totalRows: 0,
  108. pageSizes: [10, 20, 30, 40],
  109. pageSize: 10,
  110. query: '',
  111. isShow: false,
  112. dialogVisible: false,
  113. distribution: {
  114. truckNo: '',
  115. driverName: '',
  116. driverPhone: '',
  117. sumWeight: '',
  118. sumCount: '',
  119. suttle: 0,
  120. deliveryCompany:'',
  121. listDetail: []
  122. },
  123. selection: []
  124. };
  125. },
  126. methods: {
  127. getTableData() {
  128. var url = 'MaintCustomer/query.do'
  129. var param = {
  130. page: this.currentPage,
  131. rows: this.pageSize,
  132. query: this.query
  133. }
  134. axios.get(url, param).then(response => {
  135. if (response.data.code == 0) {
  136. this.tableData = response.data.data.list
  137. this.totalRows = response.data.data.total
  138. } else {
  139. this.$message({
  140. type: 'error',
  141. message: '失败!' + response.data.msg,
  142. });
  143. }
  144. });
  145. },
  146. getTrucks() {
  147. var url = 'WareDistribution/queryWaitTrucks.do'
  148. var param = {}
  149. axios.get(url, param).then(response => {
  150. if (response.data.code == 0) {
  151. for (let i = 0; i < response.data.data.length; i++) {
  152. if (response.data.data.listDetail) {
  153. response.data.data.listDetail = []
  154. }
  155. }
  156. this.trucks = response.data.data
  157. // console.log(JSON.stringify(this.trucks))
  158. } else {
  159. this.$message({
  160. type: 'error',
  161. message: '失败!' + response.data.msg,
  162. });
  163. }
  164. });
  165. },
  166. // 修改每页行数
  167. handleSizeChange(val) {
  168. this.pageSize = val
  169. this.getTableData()
  170. },
  171. // 修改当前页事件
  172. handleCurrentChange(val) {
  173. this.currentPage = val
  174. this.getTableData()
  175. },
  176. sendToParent: function(row) {
  177. this.$emit('receviceFromChild', row);
  178. this.dialogVisible = false
  179. },
  180. show() {
  181. this.tableData = []
  182. this.distribution = {}
  183. this.dialogVisible = true
  184. //this.getTableData()
  185. this.getTrucks()
  186. //console.log(JSON.stringify(this.selectRows))
  187. for (let i = 0; i < this.selectRows.length; i++) {
  188. this.selectRows[i].lockFlag = '0'
  189. this.tableData.push(this.selectRows[i])
  190. }
  191. //this.tableData = this.tableData.concat()
  192. //console.log(JSON.stringify(this.selectRows))
  193. },
  194. search() {
  195. this.currentPage = 1
  196. this.getTableData()
  197. },
  198. clear() {
  199. this.distribution = {
  200. truckNo: '',
  201. driverName: '',
  202. driverPhone: '',
  203. sumWeight: this.sumWeight,
  204. sumCount: this.sumCount,
  205. suttle: 0,
  206. listDetail: []
  207. }
  208. this.tableData = []
  209. },
  210. change(val) {
  211. if (val == '') {
  212. } else {
  213. for (let i = 0; i < this.trucks.length; i++) {
  214. if (this.trucks[i].truckNo == val) {
  215. this.distribution = this.trucks[i]
  216. }
  217. }
  218. this.tableData = []
  219. var tempPltNo = [];
  220. // console.log("iiiiiiiiii"+JSON.stringify(this.distribution))
  221. // if(typeof(this.distribution.listDetail) != "undefined"){
  222. // alert("kk")
  223. // }
  224. for (let i = 0; i < this.selectRows.length; i++) {
  225. this.tableData.push(this.selectRows[i])
  226. console.log(JSON.stringify(this.selectRows[i]))
  227. tempPltNo.push(this.selectRows[i].plateNo);
  228. }
  229. for (let i = 0; i < this.distribution.listDetail.length; i++) {
  230. // alert(JSON.stringify(this.distribution.listDetail[i].store))
  231. if(tempPltNo.indexOf(this.distribution.listDetail[i].store.plateNo) === -1){
  232. this.tableData.push(this.distribution.listDetail[i].store)
  233. }
  234. }
  235. this.distribution.sumWeight = this.sumWeight
  236. this.distribution.sumCount = this.sumCount
  237. this.truckNo = this.distribution.truckNo
  238. }
  239. },
  240. handleSave() {
  241. //console.log(JSON.stringify(this.distribution))
  242. this.distribution.sumWeight = this.sumWeight
  243. this.distribution.sumCount = this.sumCount
  244. this.distribution.truckNo = this.truckNo
  245. if(this.truckNo.length == 0){
  246. this.$message({
  247. type: 'error',
  248. message: '请选择车辆!'
  249. });
  250. return;
  251. }
  252. var url = 'WareDistribution/save.do'
  253. var param = {
  254. json: JSON.stringify(this.distribution),
  255. jsonList: JSON.stringify(this.selectRows)
  256. }
  257. this.dialogVisible = false
  258. axios.post(url, param).then(response => {
  259. if (response.data.code == 0) {
  260. //this.dialogVisible = false
  261. this.selectRows = []
  262. } else {
  263. this.$message({
  264. type: 'error',
  265. message: '失败!' + response.data.msg,
  266. });
  267. }
  268. });
  269. },
  270. close() {
  271. this.distribution = {
  272. truckNo: '',
  273. driverName: '',
  274. driverPhone: '',
  275. sumWeight: 0,
  276. sumCount: 0,
  277. suttle: 0,
  278. listDetail: []
  279. }
  280. this.tableData = []
  281. this.truckNo = ''
  282. this.$emit('receviceFromChild')
  283. },
  284. handlePrint() {
  285. if (this.distribution.truckNo == null || this.distribution.truckNo == '') {
  286. this.$message({
  287. type: 'error',
  288. message: '请选择车辆!'
  289. });
  290. return
  291. }
  292. // window.open(this.serverName + 'ureport/preview?_u=file:distribution.ureport.xml&id=' + this.distribution.id)
  293. window.open(this.serverName + 'ureport/preview?_u=file:distribution.ureport.xml&id=' + this.distribution.id)
  294. },
  295. handleTableSelect(selection, row) {
  296. if (row.lockFlag == '0') {
  297. this.$message({
  298. type: 'error',
  299. message: '该行未配货',
  300. });
  301. this.$refs.multipleTable.toggleRowSelection(row, false);
  302. } else {
  303. this.selection = selection
  304. }
  305. },
  306. selectAll(selection){
  307. for(var i = 0 ; i < selection.length;i++){
  308. if (selection[i].lockFlag == '0') {
  309. this.$message({
  310. type: 'error',
  311. message: '存在未配货记录',
  312. });
  313. return;
  314. }
  315. }
  316. this.selection = selection;
  317. },
  318. handleCancel() {
  319. var url = 'WareDistribution/cancel.do'
  320. if(this.selection.length == 0){
  321. this.$message({
  322. type: 'error',
  323. message: '请选择记录',
  324. });
  325. return;
  326. }
  327. var param = {
  328. json: JSON.stringify(this.distribution),
  329. jsonList: JSON.stringify(this.selection)
  330. }
  331. axios.post(url, param).then(response => {
  332. if (response.data.code == 0) {
  333. this.dialogVisible = false
  334. } else {
  335. this.$message({
  336. type: 'error',
  337. message: '失败!' + response.data.msg,
  338. });
  339. }
  340. });
  341. },
  342. tableRowClassName({
  343. row,
  344. rowIndex
  345. })
  346. {
  347. if (row.lockFlag == '1') {
  348. return 'success-row';
  349. }
  350. return '';
  351. }
  352. },
  353. }
  354. </script>
  355. <style>
  356. .el-table .success-row {
  357. background: #f0f9eb;
  358. }
  359. </style>