|
|
@@ -5,16 +5,16 @@
|
|
|
<Breadcrumb></Breadcrumb>
|
|
|
<div class="Theorder-searchs">
|
|
|
<div class="Theorder-searchs1">
|
|
|
- <el-input v-model="input" placeholder-style="color:red" style="width: 200px;" placeholder="请输入内容"></el-input>
|
|
|
- <el-date-picker v-model="value1" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期">
|
|
|
+ <el-input v-model="initParam.t_orderid" clearable placeholder-style="color:red" style="width: 200px;" placeholder="订单号"></el-input>
|
|
|
+ <el-date-picker v-model="daterange" type="daterange" range-separator="至"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ start-placeholder="开始日期" end-placeholder="结束日期">
|
|
|
</el-date-picker>
|
|
|
- <el-select v-model="value" placeholder="请选择">
|
|
|
- <el-option v-for="item in options" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
+ <el-select v-model="initParam.t_sn" clearable placeholder="请选择设备编号">
|
|
|
+ <el-option v-for="item in options" :key="item.value" :label="item.T_devName" :value="item.T_sn">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="searchs()"></el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="_searchs()"></el-button>
|
|
|
</div>
|
|
|
<div class="Theorder-tit-mai1-btn">
|
|
|
<!-- @click="clickNew()" -->
|
|
|
@@ -30,101 +30,142 @@
|
|
|
</div>
|
|
|
<div class="Theorder-B">
|
|
|
<div class="Theorder2">
|
|
|
- <el-button v-permission="'GoodsOrder:Add'" @click="clickNew()" icon="el-icon-plus"
|
|
|
- style="margin-bottom: 20px;">新增订单</el-button>
|
|
|
+ <div style="margin-bottom: 20px; display: flex; gap:20px">
|
|
|
+ <el-button v-permission="'GoodsOrder:Add'" @click="_clickNew('新增订单')" icon="el-icon-plus">新增订单</el-button>
|
|
|
+ <Address/>
|
|
|
+ </div>
|
|
|
<el-table :data="tableData" border style="width: 100%" size="small">
|
|
|
<template slot="empty">
|
|
|
<noData></noData>
|
|
|
</template>
|
|
|
- <el-table-column prop="id" label="货单ID" :show-overflow-tooltip="true" width="100">
|
|
|
+
|
|
|
+ <el-table-column prop="T_name" label="设备名称" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="sn" label="货单查询号码" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column prop="DeviceType" label="设备类型" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="sn" label="货单号码" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column prop="T_orderid" label="订单号码" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="sn" label="箱号" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column prop="WaybillNo" label="运单号码" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="sn" label="收货单位" :show-overflow-tooltip="true">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="sn" label="建单人" :show-overflow-tooltip="true">
|
|
|
- <!-- <template slot-scope="scope">
|
|
|
- {{ scope.row.T_end_Ut | Time(scope.row.T_end_Ut) }}
|
|
|
- </template> -->
|
|
|
+ <el-table-column label="是否外派">
|
|
|
+ <template slot-scope="scope" show-overflow-tooltip>
|
|
|
+ <el-tag :type="
|
|
|
+ scope.row.IsExpatriate==1?'':'warning'">{{scope.row.IsExpatriate==1?'否':'是'}}</el-tag>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="time" label="建单时间" :show-overflow-tooltip="true">
|
|
|
+
|
|
|
+ <el-table-column prop="T_receiving" label="收货单位" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="time" label="启运时间" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column prop="T_start_Ut" label="开始时间" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="time" label="抵达时间" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column prop="T_end_Ut" label="抵达时间" :show-overflow-tooltip="true">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="time" label="状态" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column label="状态">
|
|
|
+ <template slot-scope="scope" show-overflow-tooltip>
|
|
|
+ <el-tag :type="
|
|
|
+ scope.row.T_State==1?'':
|
|
|
+ scope.row.T_State==2?'warning':
|
|
|
+ 'success'">{{deviceStatus[scope.row.T_State-1]}}</el-tag>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="address" label="操作" fixed="right">
|
|
|
+
|
|
|
+ <el-table-column prop="address" label="操作" fixed="right" width="220">
|
|
|
<template slot-scope="scope">
|
|
|
- <!-- <el-button v-permission="'GoodsOrder:Pdf'" size="small"
|
|
|
- @click="allpir('a', scope.row)">PDF下载</el-button> -->
|
|
|
- <el-button v-permission="'GoodsOrder:Edit'" size="small"
|
|
|
- @click="allpir('b', scope.row)">编辑</el-button>
|
|
|
- <el-button v-permission="'GoodsOrder:Del'" size="small"
|
|
|
- @click="allpir('c', scope.row)">删除</el-button>
|
|
|
+ <div style="display:flex;gap:10px">
|
|
|
+ <preview :row="scope.row"/>
|
|
|
+ <el-button type="primary" plain v-permission="'GoodsOrder:Edit'" size="small"
|
|
|
+ @click="_clickNew('编辑订单',scope.row)" >编辑</el-button>
|
|
|
+ <el-button type="danger" style="margin-left:0" plain v-permission="'GoodsOrder:Del'" size="small"
|
|
|
+ @click="_setdelApi(scope.row.Id)">删除</el-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="Theorder-pagination">
|
|
|
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" background
|
|
|
- :current-page="pages.page" :page-size="pages.page_z" layout="total, prev, pager, next, jumper"
|
|
|
+ <el-pagination
|
|
|
+ :hide-on-single-page="true"
|
|
|
+ @size-change="handleSizeChange" @current-change="handleCurrentChange" background
|
|
|
+ :current-page="initParam.page" :page-size="initParam.page_z" layout="total, prev, pager, next, jumper"
|
|
|
:total="total">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog :title="titles" :visible.sync="dialogVisible" width="50%" :append-to-body="true">
|
|
|
- <div class="NewUser">
|
|
|
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-dialog :title="titles"
|
|
|
+ :close-on-click-modal="false" custom-class="y-dialog"
|
|
|
+ @closed="_beforeclose"
|
|
|
+ :visible.sync="dialogVisible" width="1000px" :append-to-body="true">
|
|
|
+ <div class="NewUser" v-loading="loading">
|
|
|
+ <el-form :model="ruleForm" :inline="true" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
<el-form-item label="订单号">
|
|
|
- <el-input v-model="ruleForm.T_orderid" disabled placeholder="订单号"></el-input>
|
|
|
+ <el-input v-model="ruleForm.T_orderid" disabled placeholder="订单号" class="conter_width"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="出库订单号" prop="T_outorderid">
|
|
|
- <el-input v-model="ruleForm.T_outorderid" placeholder="出库订单号"></el-input>
|
|
|
+ <el-form-item label="运单号">
|
|
|
+ <el-input v-model="ruleForm.WaybillNo" placeholder="出库订单号" class="conter_width"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设备编号" prop="T_sn">
|
|
|
- <el-select v-model="ruleForm.T_sn" placeholder="请选择设备编号">
|
|
|
- <el-option v-for="item in options" :key="item.value" :label="item.T_devName"
|
|
|
- :value="item.T_sn">
|
|
|
+ <el-select v-model="ruleForm.T_sn" placeholder="设备编号" class="conter_width">
|
|
|
+ <el-option v-for="item in options" :key="item.value" :label="item.T_devName" :value="item.T_sn">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="收货单位" prop="T_receiving">
|
|
|
- <el-input v-model="ruleForm.T_receiving" placeholder="请输入收货单位"></el-input>
|
|
|
+ <el-form-item label="设备类型" prop="DeviceType">
|
|
|
+ <el-select v-model="ruleForm.DeviceType" placeholder="设备类型" class="conter_width">
|
|
|
+ <el-option v-for="item in deviceType" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否外派" prop="IsExpatriate">
|
|
|
+ <el-radio-group v-model="ruleForm.IsExpatriate" @change="_inputGroup" class="conter_width">
|
|
|
+ <el-radio :label="1">否</el-radio>
|
|
|
+ <el-radio :label="2">是</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号码" prop="Phone" v-if="ruleForm.IsExpatriate==2">
|
|
|
+ <el-input v-model="ruleForm.Phone" maxlength="11" placeholder="手机号码" class="conter_width"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="收货单位" prop="ChildPid">
|
|
|
+ <el-cascader v-model="ruleForm.ChildPid" :options="optionsTree"
|
|
|
+ filterable :show-all-levels="false" class="conter_width"
|
|
|
+ @change="handleChange"
|
|
|
+ :props="{ children: 'Children', checkStrictly: true, label: 'T_name', value: 'Id', emitPath: false,}"
|
|
|
+ ></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="发货单位" prop="ShippingUnit">
|
|
|
+ <el-input v-model="ruleForm.ShippingUnit" placeholder="发货单位" class="conter_width"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="配送计划" prop="T_time">
|
|
|
- <el-date-picker v-model="ruleForm.T_time" type="datetimerange"
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期"
|
|
|
+ <el-date-picker v-model="ruleForm.T_time" type="daterange" class="conter_width"
|
|
|
+ value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="随货同行单">
|
|
|
<el-upload
|
|
|
+ class="conter_width"
|
|
|
ref="uploadRef"
|
|
|
action=""
|
|
|
:multiple="false"
|
|
|
:limit="1"
|
|
|
:auto-upload="false"
|
|
|
:on-change="changeFile"
|
|
|
+ :before-remove="()=>ruleForm.PeerList = ''"
|
|
|
accept="image/*,application/pdf,application/octet-stream,application/zip,application/x-tar,application/msword"
|
|
|
>
|
|
|
<el-button size="small" @click="_onclickupload" icon="el-icon-link">上传附件</el-button>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="详情" prop="T_text">
|
|
|
- <el-input type="textarea" v-model="ruleForm.T_text"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="danger" @click="submitForm('ruleForm')">立即提交</el-button>
|
|
|
- <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
+ <el-form-item label="详情">
|
|
|
+ <el-input type="textarea" v-model="ruleForm.T_text" class="conter_width"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <el-divider></el-divider>
|
|
|
+ <div class="_footer">
|
|
|
+ <el-button type="primary" :disabled="disabled" @click="submitForm('ruleForm')">立即提交</el-button>
|
|
|
+ <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
@@ -133,101 +174,86 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- GoodsOrderList,
|
|
|
- GoodsOrderAdd,
|
|
|
+ OrderList,
|
|
|
+ OrderAdd,
|
|
|
DeviceList,
|
|
|
- GoodsOrderDel,
|
|
|
- GoodsOrderEdit,
|
|
|
- GoodsOrderPDF
|
|
|
+ getNumber,
|
|
|
+ getCompany,
|
|
|
+ getcompanyTree,
|
|
|
+ OrderDel,OrderEdit,AddressList
|
|
|
} from '../../api/instrument/Theorder.js'
|
|
|
|
|
|
import { getQiniuToken } from "@/api/pdfToken.js";
|
|
|
-import { formatDate } from '../../utils/Times.js'
|
|
|
import { _sendUpFun } from './js/qiliuyun.js';
|
|
|
+import {rules} from "./js/rules.js";
|
|
|
+import {initParam,ruleForm,initForm} from './js/initParam.js'
|
|
|
+import { deviceType,deviceStatus } from "./js/goods.js";
|
|
|
import * as qiniu from 'qiniu-js';
|
|
|
-import Axios from 'axios'
|
|
|
+import Address from './address.vue'
|
|
|
+import preview from './preview.vue'
|
|
|
+
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ Address,preview
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
uploadData: {},
|
|
|
uploadInstance: new _sendUpFun(),
|
|
|
-
|
|
|
+ initParam,//列表请求参数
|
|
|
+ deviceType,//设备类型下拉数据
|
|
|
+ deviceStatus,//设备状态下拉数据
|
|
|
+ ruleForm,//新增编辑请求参数
|
|
|
+ daterange: '',
|
|
|
total: 0,
|
|
|
- pages: {
|
|
|
- T_name: '',
|
|
|
- page: 1,
|
|
|
- page_z: 10
|
|
|
- },
|
|
|
+ rules,
|
|
|
titles: '',
|
|
|
- ruleForm: {
|
|
|
- T_orderid: '', //订单号
|
|
|
- T_outorderid: '', //出库订单号
|
|
|
- T_sn: '', //设备sn
|
|
|
- T_receiving: '', //收货单位
|
|
|
- T_time: [], //运输时间
|
|
|
- T_text: '' //详情
|
|
|
- },
|
|
|
- rules: {
|
|
|
- T_orderid: [{
|
|
|
- required: true,
|
|
|
- message: '请输入订单号',
|
|
|
- trigger: 'blur'
|
|
|
- },],
|
|
|
- T_outorderid: [{
|
|
|
- required: true,
|
|
|
- message: '请输入出库订单号',
|
|
|
- trigger: 'blur'
|
|
|
- }],
|
|
|
- T_sn: [{
|
|
|
- required: true,
|
|
|
- message: '请选择设备编号',
|
|
|
- trigger: 'change'
|
|
|
- }],
|
|
|
- T_receiving: [{
|
|
|
- required: true,
|
|
|
- message: '请输入收货单位',
|
|
|
- trigger: 'blur'
|
|
|
- }],
|
|
|
- T_time: [{
|
|
|
- required: true,
|
|
|
- message: '请选择运输时间',
|
|
|
- trigger: 'change'
|
|
|
- }],
|
|
|
- T_text: [{
|
|
|
- required: true,
|
|
|
- message: '请填写订单详情',
|
|
|
- trigger: 'blur'
|
|
|
- }]
|
|
|
- },
|
|
|
+ loading: false,
|
|
|
+ optionsTree: [],//公司下拉数据
|
|
|
+ disabled:false,//禁止新增编辑的提交按钮
|
|
|
options: [],
|
|
|
dialogVisible: false,
|
|
|
- Page4: 5, //当前页
|
|
|
- loading: false,
|
|
|
- formInline: {
|
|
|
- user: '',
|
|
|
- region: ''
|
|
|
- },
|
|
|
- sta: null,
|
|
|
- tableData: [
|
|
|
- {id:Math.floor(100000 + Math.random() * 900000),sn:Math.floor(100000 + Math.random() * 900000000000),time:'2025-01-01',name:'测试数据'},
|
|
|
- {id:Math.floor(100000 + Math.random() * 900000),sn:Math.floor(100000 + Math.random() * 900000000000),time:'2025-01-01',name:'测试数据'},
|
|
|
- {id:Math.floor(100000 + Math.random() * 900000),sn:Math.floor(100000 + Math.random() * 900000000000),time:'2025-01-01',name:'测试数据'},
|
|
|
- {id:Math.floor(100000 + Math.random() * 900000),sn:Math.floor(100000 + Math.random() * 900000000000),time:'2025-01-01',name:'测试数据'},
|
|
|
- ]
|
|
|
-
|
|
|
+ tableData: [],
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.GetTheorderApi()
|
|
|
- this.GetDeviceListApi()
|
|
|
- // 创建 _sendUpFun 类的实例
|
|
|
+ this._getTheorderApi()
|
|
|
+ this._getDeviceListApi()
|
|
|
},
|
|
|
methods: {
|
|
|
+ _inputGroup(e){
|
|
|
+ console.log('切换',e)
|
|
|
+ this.ruleForm.ChildPid = ''//清空收货单位
|
|
|
+ this.ruleForm.Phone = ''//清空手机号码
|
|
|
+ if(e==1){
|
|
|
+ this._getTree()
|
|
|
+ }else{
|
|
|
+ this._getAddressListApi()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 地址管理列表
|
|
|
+ */
|
|
|
+ _getAddressListApi() {
|
|
|
+ AddressList({page: 1,page_z:9999}).then(res => {
|
|
|
+ let {data:result} = res
|
|
|
+ if (result.Code == 200) {
|
|
|
+ this.optionsTree = result.Data.Data || []
|
|
|
+ console.log(this.optionsTree)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async _getTree(){
|
|
|
+ const {data:res} = await getcompanyTree({page_z: 999999})//获取公司树
|
|
|
+ this.optionsTree = this.removeEmptyChildren(res.Data.Data)
|
|
|
+ },
|
|
|
_onclickupload() {
|
|
|
this.$refs.uploadRef.clearFiles();
|
|
|
},
|
|
|
async changeFile(e){
|
|
|
- console.log('changeFile',e);
|
|
|
+ this.loading = true
|
|
|
let file = e.raw;
|
|
|
console.log(file);
|
|
|
var strtype = file.name.substring(file.name.lastIndexOf('.') + 1); //获取后缀 png jpg
|
|
|
@@ -254,12 +280,17 @@ export default {
|
|
|
};
|
|
|
var observable = qiniu.upload(file, file.name, token, putExtra, config);
|
|
|
// 设置实例的监听对象
|
|
|
+
|
|
|
var observer = {
|
|
|
next(res) {
|
|
|
console.log('上传进度', parseInt(res.total.percent))
|
|
|
+ if (parseInt(res.total.percent)==100) {
|
|
|
+ _this.loading = false
|
|
|
+ }
|
|
|
},
|
|
|
// 接收上传错误信息
|
|
|
error(err) {
|
|
|
+ _this.loading = false
|
|
|
switch (err.code) {
|
|
|
case 413:
|
|
|
_this.$message.error('错了哦,图片可能太大了哦');
|
|
|
@@ -273,166 +304,226 @@ export default {
|
|
|
},
|
|
|
// 接收上传完成后的信息
|
|
|
complete(com) {
|
|
|
- console.log('七牛云返回',com)
|
|
|
+ _this.ruleForm.PeerList = com.key
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
observable.subscribe(observer);
|
|
|
},
|
|
|
-
|
|
|
- GetTheorderApi() {
|
|
|
- GoodsOrderList(this.pages).then(res => {
|
|
|
+ /**
|
|
|
+ * 列表数据
|
|
|
+ */
|
|
|
+ _getTheorderApi() {
|
|
|
+ if(this.daterange.length>0){
|
|
|
+ this.initParam.startTime = this.daterange[0]
|
|
|
+ this.initParam.endTime = this.daterange[1]
|
|
|
+ }
|
|
|
+ OrderList(this.initParam).then(res => {
|
|
|
if (res.data.Code === 200 && res.data.Msg === 'ok!') {
|
|
|
- ////console.log('liebiao',res.data.Data.Data)
|
|
|
- this.total = res.data.Data.Num
|
|
|
- this.tableData = res.data.Data.Data
|
|
|
+ this.total = res.data.Data.Num || 0
|
|
|
+ this.tableData = res.data.Data.Data || []
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- GetDeviceListApi() { //设备编号select框
|
|
|
- var that = this
|
|
|
- DeviceList({
|
|
|
- page: 1,
|
|
|
- page_z: 9999999
|
|
|
- }).then(res => {
|
|
|
- if (res.data.Code === 200 && res.data.Msg === "ok!") {
|
|
|
- that.options = res.data.Data.Device_lite
|
|
|
- }
|
|
|
+
|
|
|
+ _searchs(){
|
|
|
+ this.initParam.page = 1
|
|
|
+ this._getTheorderApi()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 清空上传随货同行单文件
|
|
|
+ */
|
|
|
+ _beforeclose(){
|
|
|
+ if (this.$refs.uploadRef.uploadFiles.length>0) {
|
|
|
+ this.$refs.uploadRef.uploadFiles = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 新增、编辑订单
|
|
|
+ */
|
|
|
+ async _clickNew(title,item=null) {
|
|
|
+ this.titles = title
|
|
|
+ this.disabled = false
|
|
|
+ console.log('新增',item)
|
|
|
+
|
|
|
+ this.dialogVisible = true
|
|
|
+
|
|
|
+ if (this.$refs.ruleForm) {//为了验证第一次触发表单验证,第二次打开还是触发
|
|
|
+ this.$refs.ruleForm.resetFields();
|
|
|
+ }
|
|
|
+ Object.keys(this.ruleForm).forEach(key => {
|
|
|
+ if (key == 'IsExpatriate'){this.ruleForm[key] = 1}else{this.ruleForm[key] = ''}
|
|
|
})
|
|
|
+
|
|
|
+ if (title == '新增订单') {
|
|
|
+ const {data:result} = await getNumber({})
|
|
|
+ this.ruleForm.T_orderid = result.Data
|
|
|
+ const {data:result1} = await getCompany({})//获取公司名称
|
|
|
+ this.ruleForm.ShippingUnit = result1.Data.Data.T_name
|
|
|
+ this._getTree()
|
|
|
+ }else{//编辑订单
|
|
|
+ if(item.IsExpatriate==1){
|
|
|
+ this._getTree()
|
|
|
+ }else{
|
|
|
+ this._getAddressListApi()
|
|
|
+ }
|
|
|
+ Object.keys(this.ruleForm).forEach(key => {
|
|
|
+ this.ruleForm[key] = item[key]
|
|
|
+ })
|
|
|
+ this.ruleForm.T_time = [this.ruleForm.EstimateStartTime.split(' ')[0],this.ruleForm.EstimateEndTime.split(' ')[0]]
|
|
|
+ this.ruleForm.ChildPid = Number(this.ruleForm.ChildPid)
|
|
|
+ this.ruleForm.T_id = item.Id
|
|
|
+ }
|
|
|
},
|
|
|
- inputValue(e) {
|
|
|
- this.pages.T_name = e
|
|
|
- this.pages.page = 1
|
|
|
- this.GetTheorderApi()
|
|
|
+ /**
|
|
|
+ * 去除空Children
|
|
|
+ */
|
|
|
+ removeEmptyChildren(arr) {
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const item = arr[i];
|
|
|
+ if (item.Children && item.Children.length === 0) {
|
|
|
+ delete item.Children;
|
|
|
+ } else if (item.Children) {
|
|
|
+ this.removeEmptyChildren(item.Children);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 提交新增、编辑
|
|
|
+ * @param formName 表单名
|
|
|
+ */
|
|
|
submitForm(formName) {
|
|
|
+ var self = this
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- var obj = { ...this.ruleForm }
|
|
|
- obj.T_time = obj.T_time[0] + '|' + obj.T_time[1]
|
|
|
- ////console.log('提交', obj,this.sta)
|
|
|
- var that = this
|
|
|
- if (that.sta == 'a') {
|
|
|
- ////console.log('新增提交')
|
|
|
- that.SetAdd(obj)
|
|
|
- } else {
|
|
|
- ////console.log('编辑提交')
|
|
|
- that.SetEdit(obj)
|
|
|
+ self.disabled = true
|
|
|
+ var obj = { ...self.ruleForm }
|
|
|
+ obj.EstimateStartTime = obj.T_time[0]
|
|
|
+ obj.EstimateEndTime = obj.T_time[1]
|
|
|
+ delete obj.T_time
|
|
|
+ if (obj.IsExpatriate == 1) obj.Phone = ''
|
|
|
+ if (self.titles == '新增订单') {
|
|
|
+ self._setAdd(obj)
|
|
|
+ } else {//编辑订单
|
|
|
+ self._setEdit(obj)
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$message.error('请完善必填信息在提交')
|
|
|
- return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- SetEdit(e) {
|
|
|
- var that = this
|
|
|
- GoodsOrderEdit(e).then(res => {
|
|
|
- ////console.log('res',res)
|
|
|
+ /**
|
|
|
+ * 新增Api
|
|
|
+ */
|
|
|
+ _setAdd(obj) {
|
|
|
+ var self = this
|
|
|
+ OrderAdd(obj).then(res => {
|
|
|
+ console.log('添加',res)
|
|
|
if (res.data.Code === 200 && res.data.Msg === "ok!") {
|
|
|
- that.pages.page = 1
|
|
|
- that.GetTheorderApi()
|
|
|
- that.$message.success('编辑订单成功!')
|
|
|
- that.dialogVisible = false
|
|
|
+ self.initParam.page = 1
|
|
|
+ self._getTheorderApi()
|
|
|
+ self.$message.success('新增成功!')
|
|
|
+ self.dialogVisible = false
|
|
|
}
|
|
|
+ self.disabled = false
|
|
|
})
|
|
|
},
|
|
|
- SetAdd(obj) {
|
|
|
- var that = this
|
|
|
- GoodsOrderAdd(obj).then(res => {
|
|
|
- ////console.log('添加',res)
|
|
|
+ /**
|
|
|
+ * 编辑api
|
|
|
+ * @param e
|
|
|
+ */
|
|
|
+ _setEdit(e) {
|
|
|
+ var self = this
|
|
|
+ OrderEdit(e).then(res => {
|
|
|
if (res.data.Code === 200 && res.data.Msg === "ok!") {
|
|
|
- that.pages.page = 1
|
|
|
- that.GetTheorderApi()
|
|
|
- that.$message.success('新增订单成功!')
|
|
|
- that.dialogVisible = false
|
|
|
+ self.initParam.page = 1
|
|
|
+ self._getTheorderApi()
|
|
|
+ self.$message.success('编辑成功!')
|
|
|
+ self.dialogVisible = false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- clickNew() {
|
|
|
- this.dialogVisible = true
|
|
|
- this.sta = 'a'
|
|
|
- this.titles = '新增订单'
|
|
|
- if (this.$refs.ruleForm) {//为了验证第一次触发表单验证,第二次打开还是触发
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
- }
|
|
|
- },
|
|
|
- handleSizeChange(e) { //每页多少条
|
|
|
- this.pages.page_z = e
|
|
|
- this.GetTheorderApi()
|
|
|
+ /**
|
|
|
+ * 删除api
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ _setdelApi(id) {
|
|
|
+ let _this = this
|
|
|
+ this.$confirm('删除操作,是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ console.log('删除',id)
|
|
|
+ OrderDel({ T_id: id }).then(res => {
|
|
|
+ console.log('删除成功',res)
|
|
|
+ if (res.data.Code === 200 && res.data.Msg == "ok!") {
|
|
|
+ _this.initParam.page = 1
|
|
|
+ _this._getTheorderApi()
|
|
|
+ _this.$message.success('删除成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {});
|
|
|
},
|
|
|
- handleCurrentChange(e) { //跳转页
|
|
|
- this.pages.page = e
|
|
|
- this.GetTheorderApi()
|
|
|
+ /**
|
|
|
+ * 筛选出选中收货单位id对应的公司名称
|
|
|
+ * @param value
|
|
|
+ */
|
|
|
+ handleChange(value) {
|
|
|
+ this.ruleForm.T_receiving = this._findTNameById(value, this.optionsTree);
|
|
|
+ if(this.ruleForm.IsExpatriate==2){
|
|
|
+ const result = this.optionsTree.find(item=>item.Id==value)
|
|
|
+ this.ruleForm.Phone = result.Phone
|
|
|
+ }
|
|
|
},
|
|
|
- allpir(i, item) {
|
|
|
- var that = this
|
|
|
- if (i === 'a') { //
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: '正在整理数据,请稍后...',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
- GoodsOrderPDF({ T_id: item.Id }).then(res => {
|
|
|
- loading.close()
|
|
|
- Axios({
|
|
|
- method: 'get',
|
|
|
- url: res.data.Data,
|
|
|
- responseType: 'blob'
|
|
|
- }).then(resBlob => {
|
|
|
- const FileSaver = require('file-saver')
|
|
|
- const blob = new Blob([resBlob.data], { type: 'application/pdf;charset=utf-8' }) // 此处type根据你想要的
|
|
|
- FileSaver.saveAs(blob, new Date().getTime()) // 下载的name文件名
|
|
|
- this.$message.success('PDF文件下载成功');
|
|
|
- });
|
|
|
- })
|
|
|
- } else if (i === "b") { //编辑
|
|
|
- if (this.$refs.ruleForm) {//为了验证第一次触发表单验证,第二次打开还是触发
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
+ /**
|
|
|
+ * 根据公司id筛选出对应的公司名称
|
|
|
+ * @param id 公司id
|
|
|
+ * @param arr 公司数组
|
|
|
+ */
|
|
|
+ _findTNameById(id, arr) {
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const currentObj = arr[i];
|
|
|
+ if (currentObj.Id === id) {
|
|
|
+ return currentObj.T_name;
|
|
|
+ }
|
|
|
+ if (currentObj.Children && currentObj.Children.length > 0) {
|
|
|
+ const result = this._findTNameById(id, currentObj.Children);
|
|
|
+ if (result) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
- this.dialogVisible = true
|
|
|
- this.sta = 'b'
|
|
|
- this.titles = '编辑订单'
|
|
|
- this.ruleForm.T_time[0] = formatDate(item.T_start_Ut)
|
|
|
- this.ruleForm.T_time[1] = formatDate(item.T_end_Ut)
|
|
|
- this.ruleForm.T_text = item.T_text
|
|
|
- this.ruleForm.T_id = item.Id
|
|
|
- this.ruleForm.T_sn = item.T_sn
|
|
|
- this.ruleForm.T_receiving = item.T_receiving
|
|
|
- this.ruleForm.T_outorderid = item.T_outorderid
|
|
|
- this.ruleForm.T_orderid = item.T_orderid
|
|
|
-
|
|
|
- } else if (i === "c") { //同步大屏
|
|
|
- this.$confirm('删除操作,是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- center: true
|
|
|
- }).then(() => {
|
|
|
- that.SetdelApi(item.Id)
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '删除取消'
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
+ return null;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 每页多少条
|
|
|
+ */
|
|
|
+ handleSizeChange(e) {
|
|
|
+ this.initParam.page_z = e
|
|
|
+ this._getTheorderApi()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 跳转页
|
|
|
+ */
|
|
|
+ handleCurrentChange(e) {
|
|
|
+ this.initParam.page = e
|
|
|
+ this._getTheorderApi()
|
|
|
},
|
|
|
- SetdelApi(id) {
|
|
|
+ /**
|
|
|
+ * 设备编号select框
|
|
|
+ */
|
|
|
+ _getDeviceListApi() {
|
|
|
var that = this
|
|
|
- GoodsOrderDel({ T_id: id }).then(res => {
|
|
|
- ////console.log('删除',res)
|
|
|
- if (res.data.Code === 200 && res.data.Msg == "ok!") {
|
|
|
- that.GetTheorderApi()
|
|
|
- that.$message.success('删除成功')
|
|
|
+ DeviceList({
|
|
|
+ page: 1,
|
|
|
+ page_z: 9999999
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.Code === 200 && res.data.Msg === "ok!") {
|
|
|
+ that.options = res.data.Data.Device_lite
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onSubmit() {
|
|
|
- ////console.log('submit!');
|
|
|
- }
|
|
|
},
|
|
|
filters: {
|
|
|
Time: function (time) { //时间戳转换
|
|
|
@@ -454,9 +545,14 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+.conter_width{
|
|
|
+ width:350px;
|
|
|
+}
|
|
|
+._footer{
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
.Theorder {
|
|
|
- user-select: none;
|
|
|
-
|
|
|
.Theorder-T {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -465,7 +561,6 @@ export default {
|
|
|
height: 70px;
|
|
|
padding: 15px 10px;
|
|
|
box-shadow: 5px 5px 10px -10px #000;
|
|
|
-
|
|
|
.Theorder-TL {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -476,7 +571,6 @@ export default {
|
|
|
justify-content: center;
|
|
|
margin-left: 20px;
|
|
|
|
|
|
- .Theorder-tit-mai1-btn {}
|
|
|
|
|
|
.Theorder-searchs1 {
|
|
|
display: flex;
|
|
|
@@ -491,8 +585,6 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
cursor: pointer;
|
|
|
-
|
|
|
- .Theorder-searchsMai1 {}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -501,49 +593,16 @@ export default {
|
|
|
}
|
|
|
|
|
|
.Theorder2 {
|
|
|
-
|
|
|
- // border-radius: 10px;
|
|
|
overflow: hidden;
|
|
|
margin: 10px;
|
|
|
padding: 20px;
|
|
|
}
|
|
|
|
|
|
.Theorder-pagination {
|
|
|
- // background: rgba(#31353e,1);
|
|
|
padding: 50px 20px;
|
|
|
margin: 10px;
|
|
|
border-radius: 2px;
|
|
|
display: flex;
|
|
|
- // .el-pagination.is-background .btn-next,
|
|
|
- // .btn-prev,
|
|
|
- // .el-pagination.is-background .el-pager li {
|
|
|
- // //未选中
|
|
|
- // margin: 0 5px;
|
|
|
- // background-color: #222;
|
|
|
- // color: #fff;
|
|
|
- // min-width: 30px;
|
|
|
- // border-radius: 2px;
|
|
|
- // }
|
|
|
-
|
|
|
- // .el-pagination.is-background .el-pager li:not(.disabled).active {
|
|
|
- // //选中
|
|
|
- // background-color: #fff;
|
|
|
- // color: #222;
|
|
|
- // }
|
|
|
-
|
|
|
- // .el-pagination__total {
|
|
|
- // //总total
|
|
|
- // margin-right: 10px;
|
|
|
- // font-weight: 400;
|
|
|
- // // color: #fff;
|
|
|
- // }
|
|
|
-
|
|
|
- // .el-pagination__jump {
|
|
|
- // //跳转页
|
|
|
- // margin-left: 24px;
|
|
|
- // font-weight: 400;
|
|
|
- // // color: #fff;
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
</style>
|