123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <template>
- <div>
- <el-dialog title="配车" :visible.sync="dialogVisible" width="1000px" height="400px" @close="close">
-
- <el-form :model="distribution" label-width="100px" inline="">
- <el-form-item label="车号">
- <el-select v-model="truckNo" clearable allow-create filterable default-first-option @change="change" style="width: 200px;">
- <el-option v-for="item in trucks" :key="item.id" :label="item.truckNo" :value="item.truckNo">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="司机姓名">
- <el-input v-model="distribution.driverName" placeholder="司机姓名" style="width: 200px;"></el-input>
- </el-form-item>
- <el-form-item label="联系方式">
- <el-input v-model="distribution.driverPhone" placeholder="联系方式" style="width: 200px;"></el-input>
- </el-form-item>
- <el-form-item label="总重量">
- <el-input v-model="sumWeight" placeholder="总重量" style="width: 200px;"></el-input>
- </el-form-item>
- <el-form-item label="总数量">
- <el-input v-model="sumCount" placeholder="总数量" style="width: 200px;"></el-input>
- </el-form-item>
- <el-form-item label="过磅重量" v-if="false">
- <el-input v-model="distribution.suttle" placeholder="过磅重量" style="width: 200px;"></el-input>
- </el-form-item>
- <el-form-item label="提货单位" >
- <el-input v-model="distribution.deliveryCompany" placeholder="提货单位" style="width: 200px;"></el-input>
- </el-form-item>
-
- <el-form-item label=" ">
- <el-button size="medium" type="success" @click="handleSave">确定</el-button>
- <el-button size="medium" type="success" @click="handleCancel">取消</el-button>
- <el-button size="medium" type="primary" @click="handlePrint">打印配车单</el-button>
- </el-form-item>
- </el-form>
-
-
- <el-table :data="tableData" border style="width: 99%;" ref="multipleTable" :row-class-name="tableRowClassName"
- @select="handleTableSelect" @select-all = "selectAll">
- <el-table-column type="selection" width="40" header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="layer" label="层数" width="60" show-overflow-tooltip header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="stack.name" label="垛位" width="60" show-overflow-tooltip header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="material.name" label="物料" width="100" show-overflow-tooltip header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="material.standard" label="钢种" width="100" show-overflow-tooltip header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="plateNo" label="钢板号" width="200" show-overflow-tooltip header-align="center">
- </el-table-column>
- <el-table-column prop="model" label="规格型号" width="120" show-overflow-tooltip header-align="center" align="center">
- </el-table-column>
- <el-table-column prop="count" label="数量" width="120" show-overflow-tooltip align="right" header-align="center">
- </el-table-column>
- <el-table-column prop="weight" label="重量" width="120" show-overflow-tooltip align="right" header-align="center">
- </el-table-column>
- <el-table-column prop="customer.name" label="客户" width="300" show-overflow-tooltip header-align="center">
- </el-table-column>
- <el-table-column prop="receiveAddress" label="收货地址" width="300" show-overflow-tooltip header-align="center">
- </el-table-column>
- <el-table-column prop="wgtDcnMtcCd" label="计量方式" width="100" show-overflow-tooltip header-align="center">
- </el-table-column>
- <el-table-column prop="edgeTy" label="切边类型" width="100" show-overflow-tooltip header-align="center">
- </el-table-column>
- <el-table-column prop="productionPlace" label="产地" width="250" show-overflow-tooltip header-align="center">
- </el-table-column>
- </el-table>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import axios from '@/axios';
- import {
- mapState
- } from 'vuex'
- export default {
- computed: {
- sumWeight: function() {
- let result = 0
- for (let i = 0; i < this.tableData.length; i++) {
- //console.log(this.distribution.listDetail[i].weight)
- result = Number(result) + Number(this.tableData[i].weight)
- }
- return result.toFixed(3)
- },
- sumCount: function() {
- let result = 0
- for (let i = 0; i < this.tableData.length; i++) {
- //console.log(this.distribution.listDetail[i].count)
- result = Number(result) + Number(this.tableData[i].count)
- }
- return result.toFixed(0)
- },
- ...mapState({
- serverName: state => state.app.serverName
- })
- },
- props: {
- selectRows: {
- type: Array
- },
- },
- data() {
- return {
- trucks: [],
- truckNo: '',
- tableData: [],
- currentPage: 1,
- totalRows: 0,
- pageSizes: [10, 20, 30, 40],
- pageSize: 10,
- query: '',
- isShow: false,
- dialogVisible: false,
- distribution: {
- truckNo: '',
- driverName: '',
- driverPhone: '',
- sumWeight: '',
- sumCount: '',
- suttle: 0,
- deliveryCompany:'',
- listDetail: []
- },
- selection: []
- };
- },
- methods: {
- getTableData() {
- var url = 'MaintCustomer/query.do'
- var param = {
- page: this.currentPage,
- rows: this.pageSize,
- query: this.query
- }
- axios.get(url, param).then(response => {
- if (response.data.code == 0) {
- this.tableData = response.data.data.list
- this.totalRows = response.data.data.total
- } else {
- this.$message({
- type: 'error',
- message: '失败!' + response.data.msg,
- });
- }
- });
- },
- getTrucks() {
- var url = 'WareDistribution/queryWaitTrucks.do'
- var param = {}
- axios.get(url, param).then(response => {
- if (response.data.code == 0) {
- for (let i = 0; i < response.data.data.length; i++) {
- if (response.data.data.listDetail) {
- response.data.data.listDetail = []
- }
- }
- this.trucks = response.data.data
- // console.log(JSON.stringify(this.trucks))
-
- } else {
- this.$message({
- type: 'error',
- message: '失败!' + response.data.msg,
- });
- }
- });
- },
- // 修改每页行数
- handleSizeChange(val) {
- this.pageSize = val
- this.getTableData()
- },
- // 修改当前页事件
- handleCurrentChange(val) {
- this.currentPage = val
- this.getTableData()
- },
- sendToParent: function(row) {
- this.$emit('receviceFromChild', row);
- this.dialogVisible = false
- },
- show() {
- this.tableData = []
- this.distribution = {}
- this.dialogVisible = true
- //this.getTableData()
- this.getTrucks()
- //console.log(JSON.stringify(this.selectRows))
- for (let i = 0; i < this.selectRows.length; i++) {
- this.selectRows[i].lockFlag = '0'
- this.tableData.push(this.selectRows[i])
- }
- //this.tableData = this.tableData.concat()
- //console.log(JSON.stringify(this.selectRows))
- },
- search() {
- this.currentPage = 1
- this.getTableData()
-
- },
- clear() {
- this.distribution = {
- truckNo: '',
- driverName: '',
- driverPhone: '',
- sumWeight: this.sumWeight,
- sumCount: this.sumCount,
- suttle: 0,
- listDetail: []
- }
- this.tableData = []
- },
-
- change(val) {
-
- if (val == '') {
- } else {
- for (let i = 0; i < this.trucks.length; i++) {
- if (this.trucks[i].truckNo == val) {
- this.distribution = this.trucks[i]
- }
- }
- this.tableData = []
- var tempPltNo = [];
- // console.log("iiiiiiiiii"+JSON.stringify(this.distribution))
- // if(typeof(this.distribution.listDetail) != "undefined"){
- // alert("kk")
-
- // }
-
- for (let i = 0; i < this.selectRows.length; i++) {
- this.tableData.push(this.selectRows[i])
- console.log(JSON.stringify(this.selectRows[i]))
- tempPltNo.push(this.selectRows[i].plateNo);
- }
- for (let i = 0; i < this.distribution.listDetail.length; i++) {
- // alert(JSON.stringify(this.distribution.listDetail[i].store))
- if(tempPltNo.indexOf(this.distribution.listDetail[i].store.plateNo) === -1){
- this.tableData.push(this.distribution.listDetail[i].store)
- }
- }
-
-
- this.distribution.sumWeight = this.sumWeight
- this.distribution.sumCount = this.sumCount
- this.truckNo = this.distribution.truckNo
- }
- },
- handleSave() {
- //console.log(JSON.stringify(this.distribution))
- this.distribution.sumWeight = this.sumWeight
- this.distribution.sumCount = this.sumCount
- this.distribution.truckNo = this.truckNo
- if(this.truckNo.length == 0){
- this.$message({
- type: 'error',
- message: '请选择车辆!'
- });
- return;
- }
- var url = 'WareDistribution/save.do'
- var param = {
- json: JSON.stringify(this.distribution),
- jsonList: JSON.stringify(this.selectRows)
- }
- this.dialogVisible = false
- axios.post(url, param).then(response => {
- if (response.data.code == 0) {
-
- //this.dialogVisible = false
- this.selectRows = []
- } else {
- this.$message({
- type: 'error',
- message: '失败!' + response.data.msg,
- });
- }
- });
- },
- close() {
- this.distribution = {
- truckNo: '',
- driverName: '',
- driverPhone: '',
- sumWeight: 0,
- sumCount: 0,
- suttle: 0,
- listDetail: []
- }
- this.tableData = []
- this.truckNo = ''
- this.$emit('receviceFromChild')
-
- },
-
- handlePrint() {
- if (this.distribution.truckNo == null || this.distribution.truckNo == '') {
- this.$message({
- type: 'error',
- message: '请选择车辆!'
- });
- return
- }
- // window.open(this.serverName + 'ureport/preview?_u=file:distribution.ureport.xml&id=' + this.distribution.id)
- window.open(this.serverName + 'ureport/preview?_u=file:distribution.ureport.xml&id=' + this.distribution.id)
- },
-
- handleTableSelect(selection, row) {
- if (row.lockFlag == '0') {
- this.$message({
- type: 'error',
- message: '该行未配货',
- });
- this.$refs.multipleTable.toggleRowSelection(row, false);
- } else {
- this.selection = selection
- }
- },
- selectAll(selection){
- for(var i = 0 ; i < selection.length;i++){
- if (selection[i].lockFlag == '0') {
-
- this.$message({
- type: 'error',
- message: '存在未配货记录',
- });
- return;
- }
-
- }
-
- this.selection = selection;
- },
- handleCancel() {
- var url = 'WareDistribution/cancel.do'
- if(this.selection.length == 0){
- this.$message({
- type: 'error',
- message: '请选择记录',
- });
- return;
- }
- var param = {
- json: JSON.stringify(this.distribution),
- jsonList: JSON.stringify(this.selection)
- }
- axios.post(url, param).then(response => {
- if (response.data.code == 0) {
- this.dialogVisible = false
- } else {
- this.$message({
- type: 'error',
- message: '失败!' + response.data.msg,
- });
- }
- });
- },
-
-
- tableRowClassName({
- row,
- rowIndex
- })
- {
- if (row.lockFlag == '1') {
- return 'success-row';
- }
- return '';
- }
-
- },
-
- }
- </script>
- <style>
- .el-table .success-row {
- background: #f0f9eb;
- }
- </style>
|