Commit f03c4ad3 by 张杰

增加工单功能

1 parent 6c3b4b59
<template>
<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">
<slot />
</div>
......@@ -13,7 +16,7 @@
<script>
export default {
name: 'GlsxDialog',
name: "GlsxDialog",
props: {
show: {
type: Boolean,
......@@ -21,11 +24,11 @@ export default {
},
title: {
type: String,
default: '提示',
default: "提示",
},
width: {
type: String,
default: '46%',
default: "46%",
},
cancel: {
required: false,
......@@ -45,15 +48,28 @@ export default {
type: Boolean,
default: false,
},
value: {
type: Boolean,
default: false,
},
showClose: {
required: false,
type: Boolean,
default: true,
},
},
data() {
return {
hasFooter: false,
}
hasTitle: false,
slotInfo: {},
};
},
created() {
let o = this.$slots
this.hasFooter = o.footer
let o = this.$slots;
this.hasFooter = o.footer;
this.hasTitle = o.title;
this.slotInfo = o;
},
mounted: function () {},
methods: {
......@@ -62,16 +78,20 @@ export default {
*/
onCancel: function () {
// 兼容以前的页面
this.$emit('closed')
this.$emit('close')
// this.$emit("closed");
// this.$emit("close");
this.$emit("input", false);
},
/**
* 确定
*/
onConfirm: function () {},
//
onDialogOpened() {},
},
}
};
</script>
<style lang="scss">
......
......@@ -26,6 +26,15 @@
<script>
export default {
name: "PlateNumberInput",
props: {
value: {
type: String,
default: "",
},
},
model: {
prop: "",
},
data() {
return {
provinceArr: [
......@@ -95,6 +104,27 @@ export default {
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: {
// 选择省份
selectProvince(e) {
......@@ -115,9 +145,10 @@ export default {
// 传递参数给父组件
toParent() {
let plate = `${this.plateProvince||''}${this.plateLetter||''}${this.plateNo||''}`;
console.log(plate)
this.$emit("change", plate);
let plate = `${this.plateProvince || ""}${this.plateLetter || ""}${
this.plateNo || ""
}`;
this.$emit("input", plate);
},
},
};
......
......@@ -37,3 +37,9 @@ export const ACTIVATE_WORKORDER_INFO = (params) => {
export const GET_VEHICLE_SELECTEDTYPETREE = (params) => {
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
......@@ -8,7 +8,7 @@ const getters = {
}
return arr;
}
},
}
......
export default {
//更新全局baseURL
updateBaseURL(state, newBaseURL) {
state.baseURL = newBaseURL;
},
//更新全局baseURL
updateBaseURL(state, newBaseURL) {
state.baseURL = newBaseURL;
},
// 更新车型数据
updateVehicleTree(state, list) {
state.vehicleTree = list;
}
}
// 更新车型数据
updateVehicleTree(state, list) {
state.vehicleTree = list;
},
// 更新定制后的车型数据
updateVehicleCustomTree(state, list) {
state.vehicleCustomTree = list;
},
// 更新设备组合数据
updateDeviceAssembly(state, list) {
state.deviceAssembly = list;
},
};
......@@ -13,6 +13,8 @@ const state = {
position: ''
},
vehicleTree:[], // 车形数据
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合
}
try {
......
......@@ -80,3 +80,37 @@
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 @@
<!-- 按钮区域 开始 -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" :title="current.id?'编辑车辆':'新增车辆'" @close="closeDialog()">
<template>
<keep-alive>
<add-car ref="addCarCom" :info="current" @change="onChange"></add-car>
</keep-alive>
</template>
<glsx-dialog v-model="showDialog" :title="current.id?'编辑车辆':'新增车辆'">
<div>
<add-car ref="addCarCom" :info="current" @change="onChange"></add-car>
</div>
<template slot="footer">
<el-button type="primary" size="small" @click="saveCar()">保存</el-button>
<el-button type="default" size="small" @click="closeDialog()">取消</el-button>
......@@ -192,13 +190,14 @@ export default {
// 打开弹框
openDialog() {
this.showDialog = true;
console.log(new Date());
},
// 关闭弹框
closeDialog() {
this.showDialog = false;
this.current = {};
this.$refs.addCarCom.rest();
//this.$refs.addCarCom.rest();
},
// 监听新增车辆组件变化
......@@ -208,9 +207,10 @@ export default {
return false;
}
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) {
list[idx] = e;
this.$set(this.tableData, idx, e);
} else {
list.push(e);
}
......@@ -314,19 +314,24 @@ export default {
oParams.serviceType = "IS";
oParams.vehicles = m;
oParams.shopAddress = '店面默认地址'
return oParams;
},
// 返回上一页
goBack() {
this.addForm = {};
this.tableData = []
this.$refs.addForm.clearValidate();
this.$router.go(-1);
},
// 编辑车辆信息
editCar(row) {
this.openDialog();
this.current = row;
this.current = deepClone(row);
this.showDialog = true;
console.log(new Date());
},
},
};
......
......@@ -13,7 +13,7 @@
</el-select>
</el-form-item>
<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 label="承租人电话号码" prop="lesseePhone">
<el-input v-model="addForm.lesseePhone" maxlength="11" placeholder="请输入"></el-input>
......@@ -71,8 +71,8 @@ export default {
},
],
},
deviceList: [],
carBrands: [],
deviceList: this.$store.state.deviceAssembly,
carBrands: this.$store.state.vehicleCustomTree,
cascaderProps: {
label: "name",
value: "id",
......@@ -80,26 +80,42 @@ export default {
},
};
},
activated() {
console.log('666666666666666666');
this.addForm = this.info;
watch: {
info: {
handler: function (n, o) {
console.log(n);
this.addForm = n;
},
immediate: true,
},
},
mounted() {
this.getDevice();
this.getCarBrand();
created() {
let o = this.$store.state;
if (!o.vehicleCustomTree || o.vehicleCustomTree.length <= 0) {
this.getCarBrand();
}
if (!o.deviceList || o.deviceList.length <= 0) {
this.getDevice();
}
},
mounted() {},
methods: {
// 获取设备组合
getDevice() {
GET_DEVICE_COMPOSE().then((res) => {
this.deviceList = res.data || [];
let list = res.data || [];
this.deviceList = list;
this.$store.commit("updateDeviceAssembly", list);
});
},
// 获取车型
getCarBrand() {
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 {
// 找第四级
let f = (s.childs || []).find((k) => k.id == e[3]);
this.$set(this.addForm, "brandId", e[0]);
this.$set(this.addForm, "subBrandId", e[1]);
this.$set(this.addForm, "seriesId", e[2]);
this.$set(this.addForm, "typeId", e[3]);
this.$set(this.addForm, "brandName", m.name);
this.$set(this.addForm, "subBrandName", n.name);
this.$set(this.addForm, "seriesName", s.name);
this.$set(this.addForm, "typeName", f.name);
let o = {};
o.brandId = e[0];
o.subBrandId = e[1];
o.seriesId = e[2];
o.typeId = e[3];
o.brandName = m.name;
o.subBrandName = n.name;
o.seriesName = s.name;
o.typeName = f.name;
this.addForm = Object.assign(this.addForm, o);
},
// 保存数据
......
......@@ -64,7 +64,7 @@
<div class="links_group">
<span class="name">工单管理</span>
<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-plus" size="small" @click="addOrder">工单新增</el-button>
<el-button type="primary" icon="el-icon-download" size="small" :loading="dloading" @click="downloadExcel()">导出excel</el-button>
......@@ -74,7 +74,7 @@
<!-- 表格区域 开始 -->
<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 label="序号" type="index"></el-table-column>
<el-table-column label="系统工单号" prop="orderNo"></el-table-column>
......@@ -91,9 +91,9 @@
<el-table-column label="创建人" prop="createdBy"></el-table-column>
<el-table-column label="创建时间" prop="createdDate"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="180px">
<template>
<el-link class="el_link" type="primary">查看</el-link>
<el-link class="el_link" type="primary">编辑</el-link>
<template slot-scope="{row}">
<el-link class="el_link" type="primary" @click="lookDetail(row,1)">查看</el-link>
<el-link class="el_link" type="primary" @click="lookDetail(row,2)">编辑</el-link>
<el-link class="el_link" type="primary">激活</el-link>
</template>
</el-table-column>
......@@ -105,11 +105,11 @@
<!-- 表格区域 end -->
<!-- 弹框 开始 -->
<glsx-dialog :show="showDialog" title="批量操作" width="560px" @close="closeDialog()">
<glsx-dialog v-model="showDialog" title="批量操作" width="560px">
<template>
<div class="upload_box" v-if="!showResult">
<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-button size="small" type="primary">选择文件</el-button>
</el-upload>
......@@ -130,30 +130,56 @@
<template slot="footer">
<div class="dialog_links">
<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>
</div>
<div class="">
<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>
</template>
</glsx-dialog>
<!-- 弹框 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>
</template>
<script>
import GlsxDialog from "@/components/dialog";
import { GET_WORKORDER_SEARCH, GET_WORKORDER_EXPORT } from "@/services/order";
import { deepClone, showToast } from "@/utils/util";
import {
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 GlsxOrganization from "@/components/glsx-organization";
import EditOrder from "./edit.vue";
import moment from "moment";
export default {
components: {
GlsxDialog,
GlsxOrganization,
EditOrder,
},
data() {
return {
......@@ -170,17 +196,30 @@ export default {
dloading: false,
tabLoading: 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() {
this.getList();
},
methods: {
// 重置
rest(){
this.searchForm = {timeType:'1'};
this.getList()
rest() {
this.searchForm = { timeType: "1" };
this.getList();
},
// 获取查询参数
......@@ -192,7 +231,6 @@ export default {
oParams.eDate = m[1];
}
oParams.pageNumber = this.currentPage;
oParams.pageSize = this.pageSize;
delete oParams.dateRange;
......@@ -201,8 +239,9 @@ export default {
},
// 获取数据列表
getList() {
getList(current) {
let oParams = this.getParams();
oParams.pageNumber = current || this.currentPage;
this.tabLoading = true;
GET_WORKORDER_SEARCH(oParams).then((res) => {
this.tabLoading = false;
......@@ -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
downloadExcel() {
let _this = this;
......@@ -287,6 +360,48 @@ export default {
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>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!