Commit f03c4ad3 by 张杰

增加工单功能

1 parent 6c3b4b59
<template> <template>
<div class="dialog_page"> <div class="dialog_page">
<el-dialog :title="title" :visible.sync="show" :width="width" :append-to-body="appendtobody" custom-class="glsx_dialog" :close-on-press-escape="false" :close-on-click-modal="false" @close="onCancel"> <el-dialog :title="title" :visible="value" :width="width" :append-to-body="appendtobody" :show-close="showClose" custom-class="glsx_dialog" :close-on-press-escape="false" :close-on-click-modal="false" @close="onCancel" @opened="onDialogOpened">
<div slot="title" class="test" v-if="slotInfo.title">
<slot name="title" />
</div>
<div class="dialog_content"> <div class="dialog_content">
<slot /> <slot />
</div> </div>
...@@ -13,7 +16,7 @@ ...@@ -13,7 +16,7 @@
<script> <script>
export default { export default {
name: 'GlsxDialog', name: "GlsxDialog",
props: { props: {
show: { show: {
type: Boolean, type: Boolean,
...@@ -21,11 +24,11 @@ export default { ...@@ -21,11 +24,11 @@ export default {
}, },
title: { title: {
type: String, type: String,
default: '提示', default: "提示",
}, },
width: { width: {
type: String, type: String,
default: '46%', default: "46%",
}, },
cancel: { cancel: {
required: false, required: false,
...@@ -45,15 +48,28 @@ export default { ...@@ -45,15 +48,28 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
value: {
type: Boolean,
default: false,
},
showClose: {
required: false,
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
hasFooter: false, hasFooter: false,
} hasTitle: false,
slotInfo: {},
};
}, },
created() { created() {
let o = this.$slots let o = this.$slots;
this.hasFooter = o.footer this.hasFooter = o.footer;
this.hasTitle = o.title;
this.slotInfo = o;
}, },
mounted: function () {}, mounted: function () {},
methods: { methods: {
...@@ -62,16 +78,20 @@ export default { ...@@ -62,16 +78,20 @@ export default {
*/ */
onCancel: function () { onCancel: function () {
// 兼容以前的页面 // 兼容以前的页面
this.$emit('closed') // this.$emit("closed");
this.$emit('close') // this.$emit("close");
this.$emit("input", false);
}, },
/** /**
* 确定 * 确定
*/ */
onConfirm: function () {}, onConfirm: function () {},
//
onDialogOpened() {},
}, },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
......
...@@ -26,6 +26,15 @@ ...@@ -26,6 +26,15 @@
<script> <script>
export default { export default {
name: "PlateNumberInput", name: "PlateNumberInput",
props: {
value: {
type: String,
default: "",
},
},
model: {
prop: "",
},
data() { data() {
return { return {
provinceArr: [ provinceArr: [
...@@ -95,6 +104,27 @@ export default { ...@@ -95,6 +104,27 @@ export default {
plateLetter: "B", plateLetter: "B",
}; };
}, },
watch: {
value: {
handler: function (n, o) {
console.log(n)
this.value = n;
if(!n){
this.plateNo = ''
}
if(n){
this.plateProvince = n.substr(0,1)
this.plateLetter = n.substr(1,1)
this.plateNo = n.substr(2,n.length-2)
}
},
},
},
created() {
console.log(this.value)
},
methods: { methods: {
// 选择省份 // 选择省份
selectProvince(e) { selectProvince(e) {
...@@ -115,9 +145,10 @@ export default { ...@@ -115,9 +145,10 @@ export default {
// 传递参数给父组件 // 传递参数给父组件
toParent() { toParent() {
let plate = `${this.plateProvince||''}${this.plateLetter||''}${this.plateNo||''}`; let plate = `${this.plateProvince || ""}${this.plateLetter || ""}${
console.log(plate) this.plateNo || ""
this.$emit("change", plate); }`;
this.$emit("input", plate);
}, },
}, },
}; };
......
...@@ -37,3 +37,9 @@ export const ACTIVATE_WORKORDER_INFO = (params) => { ...@@ -37,3 +37,9 @@ export const ACTIVATE_WORKORDER_INFO = (params) => {
export const GET_VEHICLE_SELECTEDTYPETREE = (params) => { export const GET_VEHICLE_SELECTEDTYPETREE = (params) => {
return request(params, "/trialdrive/vehicle/getSelectedTypeTree"); return request(params, "/trialdrive/vehicle/getSelectedTypeTree");
}; };
// 工单管理-工单列表-图片打包下载
export const GET_WORKORDER_BATCHEXPORTPICS = "/trialdrive/workorder/batchExportPics";
// 工单管理-工单列表-导入工单-模板下载
export const GET_WORKORDER_TEMPLATEFILE = 'https://img01.glsx.com.cn/weapp/resource/e-shield/新E盾工单导入模板.xlsx'
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ const getters = { ...@@ -8,7 +8,7 @@ const getters = {
} }
return arr; return arr;
} },
} }
......
...@@ -7,5 +7,15 @@ export default { ...@@ -7,5 +7,15 @@ export default {
// 更新车型数据 // 更新车型数据
updateVehicleTree(state, list) { updateVehicleTree(state, list) {
state.vehicleTree = list; state.vehicleTree = list;
} },
}
// 更新定制后的车型数据
updateVehicleCustomTree(state, list) {
state.vehicleCustomTree = list;
},
// 更新设备组合数据
updateDeviceAssembly(state, list) {
state.deviceAssembly = list;
},
};
...@@ -13,6 +13,8 @@ const state = { ...@@ -13,6 +13,8 @@ const state = {
position: '' position: ''
}, },
vehicleTree:[], // 车形数据 vehicleTree:[], // 车形数据
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合
} }
try { try {
......
...@@ -80,3 +80,37 @@ ...@@ -80,3 +80,37 @@
margin-right: 4px; margin-right: 4px;
} }
} }
// 自定义弹框标题
.custom_title {
display: flex;
align-items: center;
justify-content: space-between;
.name {
font-size: 16px;
}
.dialog_menu {
display: flex;
align-items: center;
padding-right: 10px;
a {
padding: 10px;
margin:0 0 0 10px;
}
.active {
position: relative;
color: #409eff;
}
.active:after {
display: block;
content: "";
height: 2px;
background: #409eff;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 80%;
}
}
}
...@@ -89,12 +89,10 @@ ...@@ -89,12 +89,10 @@
<!-- 按钮区域 开始 --> <!-- 按钮区域 开始 -->
<!-- 弹框 开始 --> <!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" :title="current.id?'编辑车辆':'新增车辆'" @close="closeDialog()"> <glsx-dialog v-model="showDialog" :title="current.id?'编辑车辆':'新增车辆'">
<template> <div>
<keep-alive>
<add-car ref="addCarCom" :info="current" @change="onChange"></add-car> <add-car ref="addCarCom" :info="current" @change="onChange"></add-car>
</keep-alive> </div>
</template>
<template slot="footer"> <template slot="footer">
<el-button type="primary" size="small" @click="saveCar()">保存</el-button> <el-button type="primary" size="small" @click="saveCar()">保存</el-button>
<el-button type="default" size="small" @click="closeDialog()">取消</el-button> <el-button type="default" size="small" @click="closeDialog()">取消</el-button>
...@@ -192,13 +190,14 @@ export default { ...@@ -192,13 +190,14 @@ export default {
// 打开弹框 // 打开弹框
openDialog() { openDialog() {
this.showDialog = true; this.showDialog = true;
console.log(new Date());
}, },
// 关闭弹框 // 关闭弹框
closeDialog() { closeDialog() {
this.showDialog = false; this.showDialog = false;
this.current = {}; this.current = {};
this.$refs.addCarCom.rest(); //this.$refs.addCarCom.rest();
}, },
// 监听新增车辆组件变化 // 监听新增车辆组件变化
...@@ -208,9 +207,10 @@ export default { ...@@ -208,9 +207,10 @@ export default {
return false; return false;
} }
let list = this.tableData; let list = this.tableData;
let idx = list.find((k) => k.id == e.id); let idx = list.findIndex((k) => k.id == e.id);
console.log(idx);
if (idx >= 0) { if (idx >= 0) {
list[idx] = e; this.$set(this.tableData, idx, e);
} else { } else {
list.push(e); list.push(e);
} }
...@@ -314,19 +314,24 @@ export default { ...@@ -314,19 +314,24 @@ export default {
oParams.serviceType = "IS"; oParams.serviceType = "IS";
oParams.vehicles = m; oParams.vehicles = m;
oParams.shopAddress = '店面默认地址'
return oParams; return oParams;
}, },
// 返回上一页 // 返回上一页
goBack() { goBack() {
this.addForm = {};
this.tableData = []
this.$refs.addForm.clearValidate();
this.$router.go(-1); this.$router.go(-1);
}, },
// 编辑车辆信息 // 编辑车辆信息
editCar(row) { editCar(row) {
this.openDialog(); this.current = deepClone(row);
this.current = row; this.showDialog = true;
console.log(new Date());
}, },
}, },
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="车牌号码"> <el-form-item label="车牌号码">
<plate-number-input @change="onPlateChange"></plate-number-input> <plate-number-input v-model="addForm.plateNo"></plate-number-input>
</el-form-item> </el-form-item>
<el-form-item label="承租人电话号码" prop="lesseePhone"> <el-form-item label="承租人电话号码" prop="lesseePhone">
<el-input v-model="addForm.lesseePhone" maxlength="11" placeholder="请输入"></el-input> <el-input v-model="addForm.lesseePhone" maxlength="11" placeholder="请输入"></el-input>
...@@ -71,8 +71,8 @@ export default { ...@@ -71,8 +71,8 @@ export default {
}, },
], ],
}, },
deviceList: [], deviceList: this.$store.state.deviceAssembly,
carBrands: [], carBrands: this.$store.state.vehicleCustomTree,
cascaderProps: { cascaderProps: {
label: "name", label: "name",
value: "id", value: "id",
...@@ -80,26 +80,42 @@ export default { ...@@ -80,26 +80,42 @@ export default {
}, },
}; };
}, },
activated() { watch: {
console.log('666666666666666666'); info: {
this.addForm = this.info; handler: function (n, o) {
console.log(n);
this.addForm = n;
}, },
mounted() { immediate: true,
this.getDevice(); },
},
created() {
let o = this.$store.state;
if (!o.vehicleCustomTree || o.vehicleCustomTree.length <= 0) {
this.getCarBrand(); this.getCarBrand();
}
if (!o.deviceList || o.deviceList.length <= 0) {
this.getDevice();
}
}, },
mounted() {},
methods: { methods: {
// 获取设备组合 // 获取设备组合
getDevice() { getDevice() {
GET_DEVICE_COMPOSE().then((res) => { GET_DEVICE_COMPOSE().then((res) => {
this.deviceList = res.data || []; let list = res.data || [];
this.deviceList = list;
this.$store.commit("updateDeviceAssembly", list);
}); });
}, },
// 获取车型 // 获取车型
getCarBrand() { getCarBrand() {
GET_VEHICLE_SELECTEDTYPETREE().then((res) => { GET_VEHICLE_SELECTEDTYPETREE().then((res) => {
this.carBrands = res.data || []; let list = res.data || [];
this.carBrands = list;
this.$store.commit("updateVehicleCustomTree", list);
}); });
}, },
...@@ -122,14 +138,16 @@ export default { ...@@ -122,14 +138,16 @@ export default {
// 找第四级 // 找第四级
let f = (s.childs || []).find((k) => k.id == e[3]); let f = (s.childs || []).find((k) => k.id == e[3]);
this.$set(this.addForm, "brandId", e[0]); let o = {};
this.$set(this.addForm, "subBrandId", e[1]); o.brandId = e[0];
this.$set(this.addForm, "seriesId", e[2]); o.subBrandId = e[1];
this.$set(this.addForm, "typeId", e[3]); o.seriesId = e[2];
this.$set(this.addForm, "brandName", m.name); o.typeId = e[3];
this.$set(this.addForm, "subBrandName", n.name); o.brandName = m.name;
this.$set(this.addForm, "seriesName", s.name); o.subBrandName = n.name;
this.$set(this.addForm, "typeName", f.name); o.seriesName = s.name;
o.typeName = f.name;
this.addForm = Object.assign(this.addForm, o);
}, },
// 保存数据 // 保存数据
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div class="links_group"> <div class="links_group">
<span class="name">工单管理</span> <span class="name">工单管理</span>
<div> <div>
<el-button type="primary" icon="el-icon-download" size="small">图片导出</el-button> <el-button type="primary" icon="el-icon-download" size="small" :loading="iloading" @click="dowloadZipFiles()">图片导出</el-button>
<el-button type="primary" icon="el-icon-upload2" size="small" @click="openDialog()">批量导入</el-button> <el-button type="primary" icon="el-icon-upload2" size="small" @click="openDialog()">批量导入</el-button>
<el-button type="primary" icon="el-icon-plus" size="small" @click="addOrder">工单新增</el-button> <el-button type="primary" icon="el-icon-plus" size="small" @click="addOrder">工单新增</el-button>
<el-button type="primary" icon="el-icon-download" size="small" :loading="dloading" @click="downloadExcel()">导出excel</el-button> <el-button type="primary" icon="el-icon-download" size="small" :loading="dloading" @click="downloadExcel()">导出excel</el-button>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<div class="table_box"> <div class="table_box">
<el-table class="el_table" :data="tableData" border size="small" v-loading="tabLoading"> <el-table class="el_table" :data="tableData" border size="small" v-loading="tabLoading" @selection-change="onSelectionChange">
<el-table-column type="selection" width="50" /> <el-table-column type="selection" width="50" />
<el-table-column label="序号" type="index"></el-table-column> <el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="系统工单号" prop="orderNo"></el-table-column> <el-table-column label="系统工单号" prop="orderNo"></el-table-column>
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
<el-table-column label="创建人" prop="createdBy"></el-table-column> <el-table-column label="创建人" prop="createdBy"></el-table-column>
<el-table-column label="创建时间" prop="createdDate"></el-table-column> <el-table-column label="创建时间" prop="createdDate"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="180px"> <el-table-column label="操作" fixed="right" align="center" width="180px">
<template> <template slot-scope="{row}">
<el-link class="el_link" type="primary">查看</el-link> <el-link class="el_link" type="primary" @click="lookDetail(row,1)">查看</el-link>
<el-link class="el_link" type="primary">编辑</el-link> <el-link class="el_link" type="primary" @click="lookDetail(row,2)">编辑</el-link>
<el-link class="el_link" type="primary">激活</el-link> <el-link class="el_link" type="primary">激活</el-link>
</template> </template>
</el-table-column> </el-table-column>
...@@ -105,11 +105,11 @@ ...@@ -105,11 +105,11 @@
<!-- 表格区域 end --> <!-- 表格区域 end -->
<!-- 弹框 开始 --> <!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" title="批量操作" width="560px" @close="closeDialog()"> <glsx-dialog v-model="showDialog" title="批量操作" width="560px">
<template> <template>
<div class="upload_box" v-if="!showResult"> <div class="upload_box" v-if="!showResult">
<div class="input_box"> <div class="input_box">
<el-input v-model="uploadFile.name" class="a_input" size="small" readonly></el-input> <el-input v-model="uploadFile.name" placeholder="请选择需要导入的工单表格" class="a_input" size="small" readonly></el-input>
<el-upload ref="elUpload" action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false" :auto-upload="false" :on-change="onFileChange" :on-success="onSuccess"> <el-upload ref="elUpload" action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false" :auto-upload="false" :on-change="onFileChange" :on-success="onSuccess">
<el-button size="small" type="primary">选择文件</el-button> <el-button size="small" type="primary">选择文件</el-button>
</el-upload> </el-upload>
...@@ -130,30 +130,56 @@ ...@@ -130,30 +130,56 @@
<template slot="footer"> <template slot="footer">
<div class="dialog_links"> <div class="dialog_links">
<div> <div>
<el-button type="primary" size="small" v-if="!showResult">下载模板</el-button> <el-button type="primary" size="small" v-if="!showResult" @click="downloadTemplate()">下载模板</el-button>
<el-button type="primary" size="small" v-if="showResult">导出失败记录</el-button> <el-button type="primary" size="small" v-if="showResult">导出失败记录</el-button>
</div> </div>
<div class=""> <div class="">
<el-button type="primary" size="small" :loading="loading" @click="saveFile()">确认</el-button> <el-button type="primary" size="small" :loading="loading" @click="saveFile()">确认</el-button>
<el-button type="default" size="small" @click="closeDialog()">取消</el-button> <el-button type="default" size="small" @click="closeDialog()">关闭</el-button>
</div> </div>
</div> </div>
</template> </template>
</glsx-dialog> </glsx-dialog>
<!-- 弹框 end --> <!-- 弹框 end -->
<!-- 查看工单 开始 -->
<glsx-dialog v-model="showWorkDialog" :show-close="false">
<div class="custom_title" slot="title">
<span class="name">{{orderType == 1?'查看工单':'编辑工单'}}</span>
<div class="dialog_menu">
<a href="javascript:void(0)" :class="activeId == item.id?'active':''" v-for="(item,index) in menus" :key="index" @click="linkEvent(item)">{{item.name}}</a>
</div>
</div>
<template>
<edit-order ref="editOrderCom" :id="orderId" :type="orderType" @change="onEditChange"></edit-order>
</template>
<template slot="footer">
<el-button type="primary" size="small" :loading="aloading" v-if="orderType == 2" @click="saveInfo()">提交</el-button>
<el-button type="default" size="small" @click="closeDetailDialog()">关闭</el-button>
</template>
</glsx-dialog>
<!-- 查看工单 end -->
</div> </div>
</template> </template>
<script> <script>
import GlsxDialog from "@/components/dialog"; import GlsxDialog from "@/components/dialog";
import { GET_WORKORDER_SEARCH, GET_WORKORDER_EXPORT } from "@/services/order"; import {
import { deepClone, showToast } from "@/utils/util"; GET_WORKORDER_SEARCH,
GET_WORKORDER_EXPORT,
GET_WORKORDER_BATCHEXPORTPICS,
GET_WORKORDER_TEMPLATEFILE,
} from "@/services/order";
import { deepClone, showToast, showModal } from "@/utils/util";
import store from "@/store"; import store from "@/store";
import GlsxOrganization from "@/components/glsx-organization"; import GlsxOrganization from "@/components/glsx-organization";
import EditOrder from "./edit.vue";
import moment from "moment";
export default { export default {
components: { components: {
GlsxDialog, GlsxDialog,
GlsxOrganization, GlsxOrganization,
EditOrder,
}, },
data() { data() {
return { return {
...@@ -170,17 +196,30 @@ export default { ...@@ -170,17 +196,30 @@ export default {
dloading: false, dloading: false,
tabLoading: false, tabLoading: false,
filterVisible: false, filterVisible: false,
showWorkDialog: false,
orderId: "",
menus: [
{ id: "orderInfo", name: "工单信息" },
{ id: "deviceInfo", name: "设备信息" },
{ id: "lesseeInfo", name: "承租人信息" },
{ id: "carInfo", name: "车辆信息" },
{ id: "logInfo", name: "操作日志" },
],
activeId: "orderInfo",
checkList: [],
iloading: false,
orderType: 1,
aloading: false,
}; };
}, },
mounted() { mounted() {
this.getList(); this.getList();
}, },
methods: { methods: {
// 重置 // 重置
rest(){ rest() {
this.searchForm = {timeType:'1'}; this.searchForm = { timeType: "1" };
this.getList() this.getList();
}, },
// 获取查询参数 // 获取查询参数
...@@ -192,7 +231,6 @@ export default { ...@@ -192,7 +231,6 @@ export default {
oParams.eDate = m[1]; oParams.eDate = m[1];
} }
oParams.pageNumber = this.currentPage;
oParams.pageSize = this.pageSize; oParams.pageSize = this.pageSize;
delete oParams.dateRange; delete oParams.dateRange;
...@@ -201,8 +239,9 @@ export default { ...@@ -201,8 +239,9 @@ export default {
}, },
// 获取数据列表 // 获取数据列表
getList() { getList(current) {
let oParams = this.getParams(); let oParams = this.getParams();
oParams.pageNumber = current || this.currentPage;
this.tabLoading = true; this.tabLoading = true;
GET_WORKORDER_SEARCH(oParams).then((res) => { GET_WORKORDER_SEARCH(oParams).then((res) => {
this.tabLoading = false; this.tabLoading = false;
...@@ -257,6 +296,40 @@ export default { ...@@ -257,6 +296,40 @@ export default {
}); });
}, },
// 图片批量导出
dowloadZipFiles() {
let _this = this;
let oParams = {};
let arr = [];
let list = this.checkList;
if (!list || list.length <= 0) {
showToast({
message: "请选择要导出的工单图片",
});
return false;
}
list.map((k) => {
arr.push(k.id);
});
oParams.orderIds = arr.toString();
_this.iloading = true;
_this.$Common.exportExcel({
url: `${store.state.baseURL}${GET_WORKORDER_BATCHEXPORTPICS}`,
method: "GET",
data: oParams,
fileName: `图片${moment().format("YYYY-MM-DD")}.zip`,
success: () => {
_this.iloading = false;
},
fail: () => {
_this.iloading = false;
},
});
},
// 导出excel // 导出excel
downloadExcel() { downloadExcel() {
let _this = this; let _this = this;
...@@ -287,6 +360,48 @@ export default { ...@@ -287,6 +360,48 @@ export default {
this.searchForm.orgName = e.origin.orgName; this.searchForm.orgName = e.origin.orgName;
} }
}, },
// 查看、编辑工单
lookDetail(row, type) {
this.showWorkDialog = true;
this.orderId = row.id;
this.orderType = type;
},
// 菜单切换
linkEvent(row) {
this.activeId = row.id;
this.$refs.editOrderCom.scrollTo(row.id);
},
// 监听表格选择
onSelectionChange(e) {
this.checkList = e;
},
// 关闭查看工单详情弹框
closeDetailDialog() {
this.showWorkDialog = false;
},
// 下载模板
downloadTemplate() {
window.open(GET_WORKORDER_TEMPLATEFILE);
},
// 编辑工单
saveInfo() {
this.aloading = true;
this.$refs.editOrderCom.saveInfo();
},
// 监听编辑工单组件
onEditChange(e) {
this.aloading = false;
if (e) {
this.getList();
}
},
}, },
}; };
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!