内容修改

This commit is contained in:
tx 2024-10-18 15:47:20 +08:00
parent 051a0caaaf
commit 3bd5c70108
4 changed files with 222 additions and 47 deletions

25
src/api/common/common.js Normal file
View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
// 查询生成表数据
export function getQiniuToken() {
return request({
url: '/common/qiniu/uploadInfo',
method: 'get',
})
}
// 获取省市区
export function getDistrictList() {
return request({
url: '/app/getDistrictList',
method: 'get',
})
}
// 转二维码
export function getQrCodeText(data) {
let url = `https://dianche.chuantewulian.cn?sn=`+data.sn;
return url;
}

View File

@ -12,7 +12,7 @@
ref="imageUpload"
:on-remove="handleDelete"
:show-file-list="true"
:headers="headers"
:data='uploadData'
:file-list="fileList"
:on-preview="handlePictureCardPreview"
:class="{hide: this.fileList.length >= this.limit}"
@ -43,7 +43,7 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import {getQiniuToken} from "@/api/common/common";
export default {
props: {
@ -77,13 +77,25 @@ export default {
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
uploadData: {token:''},
domain:"",
uploadImgUrl:"https://up-z2.qiniup.com", //
// headers: {
// Authorization: "Bearer " + getToken(),
// },
fileList: []
};
},
mounted(){
getQiniuToken().then(res => {
// debugger
// console.log("token"+JSON.stringify(res));
if (res.code === 200) {
this.uploadData.token = res.token;
this.domain = res.domain;
}
})
},
watch: {
value: {
handler(val) {
@ -93,11 +105,7 @@ export default {
//
this.fileList = list.map(item => {
if (typeof item === "string") {
if (item.indexOf(this.baseUrl) === -1) {
item = { name: this.baseUrl + item, url: this.baseUrl + item };
} else {
item = { name: item, url: item };
}
item = { name: item, url: item };
}
return item;
});
@ -154,21 +162,23 @@ export default {
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName });
this.uploadedSuccessfully();
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.imageUpload.handleRemove(file);
this.uploadedSuccessfully();
}
console.log("上传成功回调token"+JSON.stringify(res));
console.log("上传成功回调file"+JSON.stringify(file));
// if (res.code === 200) {
this.uploadList.push({ name: res.hash, url: this.domain+"/"+res.hash });
this.uploadedSuccessfully();
// } else {
// this.number--;
// this.$modal.closeLoading();
// this.$modal.msgError(res.msg);
// this.$refs.imageUpload.handleRemove(file);
// this.uploadedSuccessfully();
// }
},
//
handleDelete(file) {
const findex = this.fileList.map(f => f.name).indexOf(file.name);
if (findex > -1) {
if(findex > -1) {
this.fileList.splice(findex, 1);
this.$emit("input", this.listToString(this.fileList));
}
@ -180,7 +190,9 @@ export default {
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
console.log("this.number"+this.number);
console.log("this.uploadList.length"+this.uploadList.length);
if (this.number > 0) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
@ -190,6 +202,7 @@ export default {
},
//
handlePictureCardPreview(file) {
// console.log(""+JSON.stringify(file));
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},

View File

@ -290,16 +290,32 @@
</el-col>
<el-col :span="8">
<el-form-item label="车辆型号" prop="modelId" >
<el-select v-model="form.modelId" clearable placeholder="请选择车辆型号">
<!-- <el-select v-model="form.modelId" clearable placeholder="请选择车辆型号">
<el-option
v-for="item in modelOptions"
:key="item.modelId"
:label="item.model"
:value="item.modelId"
></el-option>
</el-select> -->
<el-select v-model="form.modelId" filterable placeholder="请选择" >
<el-option v-for="item in modelList" :key="item.modelId" :label="item.model" :value="item.modelId">
</el-option>
</el-select>
<el-select v-model="form.modelId" filterable placeholder="请选择" :multiple="true">
<el-option v-for="item in modelList" :key="item.value" :label="item.label" :value="item.value">
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="所属店铺" prop="modelId" >
<!-- <el-select v-model="form.modelId" clearable placeholder="请选择车辆型号">
<el-option
v-for="item in modelOptions"
:key="item.modelId"
:label="item.model"
:value="item.modelId"
></el-option>
</el-select> -->
<el-select v-model="form.storeId" filterable placeholder="请选择" >
<el-option v-for="item in storeList" :key="item.storeId" :label="item.name+ ''+item.contactName " :value="item.storeId">
</el-option>
</el-select>
</el-form-item>
@ -443,6 +459,7 @@ import { parseTime } from '../../../utils/ruoyi';
import { getHardwareVersion, listHardwareVersion } from '@/api/system/hardwareVersion'
import Treeselect from '@riophae/vue-treeselect'
import { listModel, getModel, delModel, addModel, updateModel } from "@/api/rl/model";
import { listStore, getStore, delStore, addStore, updateStore } from "@/api/rl/store";
// import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
@ -534,6 +551,7 @@ export default {
selected: null,
//
form: {},
storeList:[],
//
rules: {
sn: [
@ -552,7 +570,7 @@ export default {
window.removeEventListener('scroll', this.handleScroll, true)
},
created() {
this.getlistModel()
listHardwareVersion(this.queryParams).then(response => {
this.hardwareVersionOptions = response.rows;
this.loading2 = false;
@ -582,6 +600,8 @@ export default {
});
this.userName = this.$store.state.user.name;
this.getList();
this.getlistModel()
this.getlistStore()
},
watch: {
},
@ -595,13 +615,30 @@ export default {
pageSize: 20,
}
listModel(this.addDateRange(data)).then(response => {
console.log(response,'responseresponseresponse');
// this.modelList = response.rows
this.modelList = response.rows.map(item => ({
value: item.modelId,
label: item.model
}));
listModel(data).then(response => {
// console.log(response,'responseresponseresponse');
this.modelList = response.rows
// this.modelList = response.rows.map(item => ({
// value: item.modelId,
// label: item.model
// }));
console.log( this.options,' this.options this.options');
});
},
getlistStore() {
let data = {
pageNum: 1,
pageSize: 20,
}
listStore(data).then(response => {
console.log(response,'店铺');
this.storeList = response.rows
// this.modelList = response.rows.map(item => ({
// value: item.modelId,
// label: item.model
// }));
console.log( this.options,' this.options this.options');
});

View File

@ -114,34 +114,58 @@
<!-- 添加或修改车辆型号对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="代理商" prop="agentId">
<el-input v-model="form.agentId" placeholder="请输入代理商" />
<el-form-item label="代理商" prop="agentId " label-width="100px">
<!-- <el-input v-model="form.agentId" placeholder="请输入代理商" /> -->
<el-select v-model="form.agentId" filterable placeholder="请选择">
<el-option v-for="item in agentList" :key="item.agentId" :label="item.name+' ' +item.contact" :value="item.agentId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="车型" prop="model">
<el-form-item label="套餐" prop="agentId " label-width="100px">
<!-- <el-input v-model="form.agentId" placeholder="请输入代理商" /> -->
<el-select v-model="form.feeRulesIds" filterable placeholder="请选择" :multiple="true">
<el-option v-for="item in ruleList" :key="item.ruleId" :label="item.price+'元/' + timeReturn( item.rentalUnit)" :value="item.ruleId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="车辆配件" prop="agentId " label-width="100px">
<!-- <el-input v-model="form.agentId" placeholder="请输入代理商" /> -->
<el-select v-model="form.accessoryIds" filterable placeholder="请选择" :multiple="true">
<el-option v-for="item in AccessoryList" :key="item.accessoryId" :label="item.name" :value="item.accessoryId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="车型名称" prop="model" label-width="100px">
<el-input v-model="form.model" placeholder="请输入车型" />
</el-form-item>
<el-form-item label="满电电压" prop="fullVoltage">
<el-form-item label="满电电压(v)" prop="fullVoltage" label-width="100px">
<el-input v-model="form.fullVoltage" placeholder="请输入满电电压(v)" />
</el-form-item>
<el-form-item label="亏电电压" prop="lowVoltage">
<el-form-item label="亏电电压(v)" prop="lowVoltage" label-width="100px">
<el-input v-model="form.lowVoltage" placeholder="请输入亏电电压(v)" />
</el-form-item>
<el-form-item label="满电续航" prop="fullEndurance">
<el-form-item label="满电续航" prop="fullEndurance" label-width="100px">
<el-input v-model="form.fullEndurance" placeholder="请输入满电续航" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-form-item label="备注" prop="remark" label-width="100px">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="简介" prop="intro">
<el-form-item label="简介" prop="intro" label-width="100px">
<el-input v-model="form.intro" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="押金" prop="deposit">
<el-form-item label="押金" prop="deposit" label-width="100px">
<el-input v-model="form.deposit" placeholder="请输入押金" />
</el-form-item>
<el-form-item label="图片" prop="picture">
<el-table-column label="商户图片" align="center" prop="picture" width="100" label-width="100px">
<form-col label="店铺图片" prop="picture" :span="span * 2">
<image-upload v-model="form.picture" :limit="1" />
</form-col>
</el-table-column>
<!-- <el-form-item label="图片" prop="picture">
<el-input v-model="form.picture" placeholder="请输入图片" />
</el-form-item>
<el-form-item label="描述" prop="description">
</el-form-item> -->
<el-form-item label="描述" prop="description" label-width="100px">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
@ -155,7 +179,12 @@
<script>
import { listModel, getModel, delModel, addModel, updateModel } from "@/api/rl/model";
import { listAgent, getAgent, delAgent, addAgent, updateAgent } from "@/api/rl/agent";
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/rl/rule";
import {
listAccessory,
} from "@/api/rl/accessory";
export default {
name: "Model",
data() {
@ -194,6 +223,9 @@ export default {
},
//
form: {},
agentList:[],
ruleList:[],
AccessoryList:[],
//
rules: {
}
@ -201,8 +233,76 @@ export default {
},
created() {
this.getList();
this.getAgentList()
this.getlistRule()
this.getAccessoryList()
},
methods: {
//
timeReturn(time){
if (time == 'hour') {
return '小时'
} else if (time == 'day') {
return '天'
} else if (time == 'week') {
return '周'
} else if (time == 'month') {
return '月'
} else if (time == 'quarter') {
return '季度'
} else if (time == 'year') {
return '年'
}
},
getAgentList() {
let data = {
pageNum: 1,
pageSize: 30,
}
listAgent(this.addDateRange(data)).then(response => {
console.log(response,'responseresponseresponse');
this.agentList=response.rows
// this.options = response.rows.map(item => ({
// value: item.userId,
// label: item.realName+' ' +item.phonenumber
// }));
console.log( this.options,' this.options this.options');
});
},
getAccessoryList() {
let data = {
pageNum: 1,
pageSize: 30,
}
listAccessory(this.addDateRange(data)).then(response => {
console.log(response,'responseresponseresponse');
this.AccessoryList=response.rows
// this.options = response.rows.map(item => ({
// value: item.userId,
// label: item.realName+' ' +item.phonenumber
// }));
console.log( this.options,' this.options this.options');
});
},
getlistRule() {
let data = {
pageNum: 1,
pageSize: 30,
}
listRule(this.addDateRange(data)).then(response => {
console.log(response,'responseresponseresponse');
this.ruleList=response.rows
console.log( this.options,' this.options this.options');
});
},
/** 查询车辆型号列表 */
getList() {
this.loading = true;