Browse Source

上传图片

fenbao
wangyx 1 month ago
parent
commit
f898c4a046
  1. 158
      pagesA/checkout/detail/detail.vue
  2. 123
      pagesA/force/index/index.vue
  3. 113
      pagesA/release/detail/detail.vue
  4. 441
      pagesA/xjPage/xj.vue

158
pagesA/checkout/detail/detail.vue

@ -18,7 +18,8 @@
>{{ info.gender == 1 ? "男" : "女" }}</view
>
<view class="info-row"
><text class="label">联系电话</text>{{ maskPhoneNumber(info.telephone) }}</view
><text class="label">联系电话</text
>{{ maskPhoneNumber(info.telephone) }}</view
>
<view class="info-row"
><text class="label">居住日期</text>{{ info.checkInDate }}{{
@ -91,18 +92,36 @@
<view class="section-card">
<view class="section-title">图片/视频</view>
<u-upload
<<<<<<< Updated upstream
<<<<<<< Updated upstream
<<<<<<< Updated upstream
accept="media"
=======
=======
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
:max-count="10"
:multiple="true"
:preview-full-image="true"
:deletable="true"
:show-upload-list="true"
<<<<<<< Updated upstream
<<<<<<< Updated upstream
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
:fileList="fileList"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="10"
uploadIconColor="#12c3c3"
:previewImage="true"
:auto-upload="false"
accept="all"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn">
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="icon-box">
<image
class="camera-icon"
@ -110,8 +129,7 @@
mode="aspectFill"
></image>
</view>
<view class="upload-tips">最多10个</view>
<view class="upload-tips">点击上传</view>
</view>
</u-upload>
</view>
@ -174,11 +192,11 @@ export default {
this.getFacilities(options.houseId);
},
methods: {
maskPhoneNumber (phoneNumber) {
maskPhoneNumber(phoneNumber) {
if (!phoneNumber || phoneNumber.length !== 11) {
return phoneNumber;
}
return phoneNumber.substr(0, 3) + '****' + phoneNumber.substr(7);
return phoneNumber.substr(0, 3) + "****" + phoneNumber.substr(7);
},
getFacilities(id) {
getRoomFacilities({ houseId: id }).then((res) => {
@ -193,66 +211,55 @@ export default {
beforeRead(event) {
console.log("event", event);
},
chooseImage() {
uni.chooseImage({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
status: "success",
});
}
this.img1 = this.fileList.map((v) => v.url);
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
uni.hideLoading();
}
},
fail: () => {
uni.hideLoading();
},
});
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
//
async afterRead(event) {
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: "uploading",
message: "上传中",
});
});
for (let i = 0; i < lists.length; i++) {
try {
const result = await uploadImage(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
url: result.url,
})
);
fileListLen++;
} catch (err) {
//
let msg = (err && err.msg) || (err && err.message) || "上传失败";
console.log('344',err);
uni.showToast({
title: msg,
icon: "none",
duration: 3000
});
//
this[`fileList${event.name}`].splice(fileListLen, 1);
return; //
}
}
var arry = [];
this.fileList.filter((v, i) => {
arry.push(v.url);
});
this.img1 = arry;
},
//
deletePic(event) {
onDelete(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];
this.fileList.filter((v, i) => {
arry.push(v.url);
arry.push({
name: v.name || "",
format: v.type,
url: v.url,
});
});
this.img1 = arry;
this.form.imageList = arry;
},
//
handleTempSave(formData) {
@ -270,33 +277,36 @@ export default {
onSubmit() {
//
const uncheckedDevices = this.deviceList.filter((item, index) => {
return this.checkStatus[index] === undefined || this.checkStatus[index] === '';
return (
this.checkStatus[index] === undefined ||
this.checkStatus[index] === ""
);
});
if (uncheckedDevices.length > 0) {
uni.showToast({
title: '请完成所有设备检查',
icon: 'none',
duration: 2000
title: "请完成所有设备检查",
icon: "none",
duration: 2000,
});
return;
}
//
if (!this.waterMeterValue || this.waterMeterValue.trim() === '') {
if (!this.waterMeterValue || this.waterMeterValue.trim() === "") {
uni.showToast({
title: '请输入水表数',
icon: 'none',
duration: 2000
title: "请输入水表数",
icon: "none",
duration: 2000,
});
return;
}
if (!this.energyMeterValue || this.energyMeterValue.trim() === '') {
if (!this.energyMeterValue || this.energyMeterValue.trim() === "") {
uni.showToast({
title: '请输入电表数',
icon: 'none',
duration: 2000
title: "请输入电表数",
icon: "none",
duration: 2000,
});
return;
}

123
pagesA/force/index/index.vue

@ -61,7 +61,7 @@
@click="showDate = false"
>
<text style="text-align: right">{{ baseInfo.checkOutTime }}</text> -->
<!-- <u--input
<!-- <u--input
v-model="baseInfo.checkOutTime"
placeholder="请选择退房日期"
border="none"
@ -97,27 +97,27 @@
></u-textarea>
<view class="label-des">上传图片/视频</view>
<u-upload
accept="all"
:max-count="10"
:multiple="true"
:preview-full-image="true"
:deletable="true"
:show-upload-list="true"
:fileList="fileList"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="10"
uploadIconColor="#12c3c3"
:previewImage="true"
:auto-upload="false"
accept="all"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
@delete="onDelete"
:disabled="true"
>
<view class="custom-upload-btn">
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="icon-box">
<image
class="camera-icon"
src="/static/img/camera-icon.png"
mode="aspectFill"
>
</image>
></image>
</view>
<view class="upload-tips">点击上传</view>
</view>
</u-upload>
@ -212,12 +212,12 @@ export default {
this.showInfo = true;
}
this.baseInfo.roomId = res.data.roomId;
} else {
uni.showToast({
title: res.msg || "查询失败",
icon: "none",
});
}
} else {
uni.showToast({
title: res.msg || "查询失败",
icon: "none",
});
}
});
},
handleClear() {
@ -230,64 +230,45 @@ export default {
(this.baseInfo.unitName = ""),
(this.baseInfo.roomTypeName = "");
},
chooseImage() {
uni.chooseImage({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
status: "success",
});
}
this.img1 = this.fileList.map((v) => v.url);
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
uni.hideLoading();
}
},
fail: () => {
uni.hideLoading();
},
});
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
//
beforeRead(event) {
//
const { file } = event;
if (file.size > 10 * 1024 * 1024) {
// 10MB
uni.showToast({
title: "文件过大",
icon: "none",
});
return false;
}
return true;
},
//
async afterRead(event) {
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: "uploading",
message: "上传中",
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadImage(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
url: result.url,
})
);
fileListLen++;
}
var arry = [];
this.fileList.filter((v, i) => {
arry.push({
name: v.name || "",
format: v.type,
url: v.url,
});
});
// this.img1 = arry;
},
//
deletePic(event) {
onDelete(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];
this.fileList.filter((v, i) => {
@ -297,7 +278,7 @@ export default {
url: v.url,
});
});
// this.img1 = arry;
this.form.imageList = arry;
},
onProblemTypeConfirm(e) {
const selectedItem = e.value[0];

113
pagesA/release/detail/detail.vue

@ -72,36 +72,21 @@
<!-- 图片/视频上传区域 -->
<view class="section-card">
<view class="section-title">图片/视频</view>
<!-- #ifdef MP-WEIXIN -->
<u-upload
:max-count="10"
:multiple="true"
:preview-full-image="true"
:deletable="true"
:show-upload-list="true"
:fileList="fileList"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="10"
uploadIconColor="#12c3c3"
uploadText="点击上传"
:previewImage="true"
:auto-upload="false"
accept="all"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
@delete="onDelete"
:disabled="true"
>
</u-upload>
<!-- #endif -->
<!-- #ifdef H5 -->
<u-upload
:fileList="fileList"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="10"
uploadIconColor="#12c3c3"
:previewImage="true"
accept="image/*,video/*"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
>
<view class="custom-upload-btn">
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="icon-box">
<image
class="camera-icon"
@ -109,11 +94,9 @@
mode="aspectFill"
></image>
</view>
<view class="upload-tips">点击上传</view>
</view>
</u-upload>
<!-- #endif -->
</view>
<!-- 提交按钮 -->
<view class="submit-btn-wrap">
@ -185,53 +168,55 @@ export default {
}
},
methods: {
//
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];
this.fileList.filter((v, i) => {
arry.push(v.url);
chooseImage() {
uni.chooseImage({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
const uploadRes = await uploadImage(filePath);
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path,
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
status: "success",
});
}
this.img1 = this.fileList.map((v) => v.url);
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
uni.hideLoading();
}
},
fail: () => {
uni.hideLoading();
},
});
this.fileList = arry;
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
//
async afterRead(event) {
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: "uploading",
message: "上传中",
//
onDelete(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];
this.fileList.filter((v, i) => {
arry.push({
name: v.name || "",
format: v.type,
url: v.url,
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadImage(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
url: result.url,
})
);
fileListLen++;
}
console.log(this.fileList);
this.fileList = this.fileList.map((v) => ({
url: v.url,
name: v.name,
type: v.type,
}));
this.form.imageList = arry;
},
//
async getRoomDetail() {

441
pagesA/xjPage/xj.vue

@ -6,44 +6,99 @@
<view class="xjTips">请您填写相关问题</view>
<view class="conItem">
<u-form labelPosition="left">
<u-form-item labelAlign="right" labelWidth="100px" label="乐业社区" prop="sex" borderBottom
@click="lysqShow = true" required>
<u--input v-model="form.apartmentName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="乐业社区"
prop="sex"
borderBottom
@click="lysqShow = true"
required
>
<u--input
v-model="form.apartmentName"
disabled
disabledColor="#ffffff"
placeholder="请选择"
border="none"
></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item labelAlign="right" labelWidth="100px" label="巡检问题类型" borderBottom
@click="wtlxShow = true" required>
<u--input v-model="form.questionName" disabled disabledColor="#ffffff" placeholder="请选择" border="none"></u--input>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="巡检问题类型"
borderBottom
@click="wtlxShow = true"
required
>
<u--input
v-model="form.questionName"
disabled
disabledColor="#ffffff"
placeholder="请选择"
border="none"
></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item labelAlign="right" labelWidth="100px" label="标题内容" borderBottom required>
<u--textarea v-model="form.title" placeholder="请输入内容" count maxlength="500"></u--textarea>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="标题内容"
borderBottom
required
>
<u--textarea
v-model="form.title"
placeholder="请输入内容"
count
maxlength="500"
></u--textarea>
</u-form-item>
<u-form-item labelAlign="right" labelWidth="100px" label="问题描述" borderBottom required>
<u--textarea v-model="form.content" placeholder="请输入内容" count maxlength="500"></u--textarea>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="问题描述"
borderBottom
required
>
<u--textarea
v-model="form.content"
placeholder="请输入内容"
count
maxlength="500"
></u--textarea>
</u-form-item>
<u-form-item labelAlign="right" labelWidth="120px" label="上传图片/视频" borderBottom>
<u-form-item
labelAlign="right"
labelWidth="120px"
label="上传图片/视频"
borderBottom
>
<u-upload
v-model="fileList"
:max-count="10"
:multiple="true"
:preview-full-image="true"
:deletable="true"
:show-upload-list="true"
:fileList="fileList"
:auto-upload="false"
accept="all"
@afterRead="afterRead"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
@delete="onDelete"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
:disabled="true"
>
<view class="custom-upload-btn">
<view class="custom-upload-btn" @click.stop="chooseImage">
<view class="icon-box">
<image class="camera-icon" src="/static/img/camera-icon.png" mode="aspectFill"></image>
<image
class="camera-icon"
src="/static/img/camera-icon.png"
mode="aspectFill"
></image>
</view>
<view class="upload-tips">点击上传</view>
</view>
@ -52,12 +107,24 @@
</u-form>
</view>
<view class="conItem" style="margin-top: 40rpx;">
<view class="conItem" style="margin-top: 40rpx">
<u--form labelPosition="left">
<u-form-item labelAlign="right" labelWidth="100px" label="巡检人姓名" borderBottom required>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="巡检人姓名"
borderBottom
required
>
<u--input v-model="form.inspector" border="none"></u--input>
</u-form-item>
<u-form-item labelAlign="right" labelWidth="100px" label="巡检人电话" borderBottom required>
<u-form-item
labelAlign="right"
labelWidth="100px"
label="巡检人电话"
borderBottom
required
>
<u--input v-model="form.inspectorPhone" border="none"></u--input>
</u-form-item>
</u--form>
@ -65,117 +132,130 @@
<view class="btn" @click="handleBtn">提交</view>
<u-action-sheet :show="lysqShow" :actions="apartmentList" title="请选择乐业社区" @close="lysqShow = false" @select="handleTreeSelect">
<u-action-sheet
:show="lysqShow"
:actions="apartmentList"
title="请选择乐业社区"
@close="lysqShow = false"
@select="handleTreeSelect"
>
</u-action-sheet>
<u-action-sheet :show="wtlxShow" :actions="questionTypeList" title="请选择问题类型" @close="wtlxShow = false" @select="handleQuestionSelect">
<u-action-sheet
:show="wtlxShow"
:actions="questionTypeList"
title="请选择问题类型"
@close="wtlxShow = false"
@select="handleQuestionSelect"
>
</u-action-sheet>
</scroll-view>
</template>
<script>
import {
queryDeptDropdownList,
} from "@/common/rec";
import { getdeptList,addInspection } from '@/common/api';
import { uploadImage } from '@/pages/api.js';
import { queryDeptDropdownList } from "@/common/rec";
import { getdeptList, addInspection } from "@/common/api";
import { uploadImage } from "@/pages/api";
import { getDicts } from "@/common/system/dict/data";
export default {
data () {
data() {
return {
wtlxShow: false,
lysqShow: false,
deptOptions: [],
questionTypeList: [],
form: {
apartmentId: '',
apartmentName:'',
questionType: '',
questionName: '',
title: '',
content: '',
inspector: '',
inspectorPhone: '',
inspectionTime: '',
imageList: []
apartmentId: "",
apartmentName: "",
questionType: "",
questionName: "",
title: "",
content: "",
inspector: "",
inspectorPhone: "",
inspectionTime: "",
imageList: [],
},
rules:{
sex:[
{ required: true, message: '请输入', trigger: 'blur' }
]
rules: {
sex: [{ required: true, message: "请输入", trigger: "blur" }],
},
radio: '',
radio: "",
switchVal: false,
fileList: [],
apartmentList:[]
}
apartmentList: [],
};
},
onLoad () {
this.getTree()
this.getDictType()
onLoad() {
this.getTree();
this.getDictType();
},
methods: {
async afterRead(event) {
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: "uploading",
message: "上传中",
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadImage(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
url: result.url,
})
);
fileListLen++;
}
var arry = [];
this.fileList.filter((v, i) => {
arry.push({
name: v.name || '',
format: v.type,
url:v.url
});
chooseImage() {
uni.chooseImage({
count: 10 - this.fileList.length,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: async (res) => {
uni.showLoading({ title: "上传中...", mask: true });
try {
// H5
const files =
res.tempFiles || res.tempFilePaths.map((path) => ({ path }));
for (let i = 0; i < files.length; i++) {
const filePath = files[i].path;
//
const uploadRes = await uploadImage(filePath);
//
this.fileList.push({
url: uploadRes.data?.url || uploadRes.url || uploadRes.path, //
name: uploadRes.data?.name || uploadRes.name || "",
type: uploadRes.data?.type || uploadRes.type || "image",
status: "success",
});
}
// form.imageList
this.form.imageList = this.fileList.map((v) => ({
name: v.name || "",
format: v.type,
url: v.url,
}));
} catch (e) {
uni.showToast({ title: "上传失败", icon: "none" });
} finally {
uni.hideLoading();
}
},
fail: () => {
uni.hideLoading();
},
});
this.form.imageList = arry
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
onDelete(event) {
this[`fileList${event.name}`].splice(event.index, 1);
var arry = [];
this.fileList.filter((v, i) => {
arry.push({
name: v.name || '',
name: v.name || "",
format: v.type,
url:v.url
url: v.url,
});
});
this.form.imageList = arry
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
this.form.imageList = arry;
},
getDictType(){
getDicts('inspection_question_type').then((res) => {
this.questionTypeList = res.data.map(item=>{
item.name = item.dictLabel
return item
})
getDictType() {
getDicts("inspection_question_type").then((res) => {
this.questionTypeList = res.data.map((item) => {
item.name = item.dictLabel;
return item;
});
});
},
getTree(){
getTree() {
getdeptList().then(async (res) => {
this.deptOptions = this.handleTree(
res.data,
@ -184,13 +264,13 @@ export default {
"children",
2
);
console.log(this.deptOptions,'this.deptOptions');
console.log(this.deptOptions, "this.deptOptions");
const deptInfo = this.deptOptions[0].children[0]
const newArr = this.deptOptions.map(item => ({
const deptInfo = this.deptOptions[0].children[0];
const newArr = this.deptOptions.map((item) => ({
name: item.deptName,
}))
this.apartmentList = newArr
}));
this.apartmentList = newArr;
// this.deptOptions = await this.getListByParentId("1", deptInfo.deptId);
// console.log(this.deptOptions);
});
@ -203,97 +283,98 @@ export default {
});
});
},
handleBtn () {
handleBtn() {
console.log(this.form);
if(!this.form.apartmentId){
if (!this.form.apartmentId) {
uni.showToast({
icon: 'none',
title: '请选择乐业社区'
})
return
} else if(!this.form.questionType){
icon: "none",
title: "请选择乐业社区",
});
return;
} else if (!this.form.questionType) {
uni.showToast({
icon: 'none',
title: '巡检问题类型'
})
return
} else if(!this.form.title){
icon: "none",
title: "巡检问题类型",
});
return;
} else if (!this.form.title) {
uni.showToast({
icon: 'none',
title: '请输入标题内容'
})
return
} else if(!this.form.content){
icon: "none",
title: "请输入标题内容",
});
return;
} else if (!this.form.content) {
uni.showToast({
icon: 'none',
title: '请输入问题描述'
})
return
} else if(!this.form.inspector){
icon: "none",
title: "请输入问题描述",
});
return;
} else if (!this.form.inspector) {
uni.showToast({
icon: 'none',
title: '请输入巡检人姓名'
})
return
} else if(!this.form.inspectorPhone){
icon: "none",
title: "请输入巡检人姓名",
});
return;
} else if (!this.form.inspectorPhone) {
uni.showToast({
icon: 'none',
title: '请输入巡检人电话'
})
return
icon: "none",
title: "请输入巡检人电话",
});
return;
}
// console.log(this.form);
let parmas = JSON.parse(JSON.stringify(this.form))
delete parmas.apartmentName
delete parmas.questionName
addInspection(parmas).then(res=>{
if(res.code == 200){
let parmas = JSON.parse(JSON.stringify(this.form));
delete parmas.apartmentName;
delete parmas.questionName;
addInspection(parmas).then((res) => {
if (res.code == 200) {
uni.showToast({
icon: 'success',
title: '提交成功!',
success:()=>{
this.fileList = []
icon: "success",
title: "提交成功!",
success: () => {
this.fileList = [];
this.form = {
apartmentId: '',
apartmentName:'',
questionType: '',
questionName: '',
title: '',
content: '',
inspector: '',
inspectorPhone: '',
inspectionTime: '',
imageList: []
}
apartmentId: "",
apartmentName: "",
questionType: "",
questionName: "",
title: "",
content: "",
inspector: "",
inspectorPhone: "",
inspectionTime: "",
imageList: [],
};
setTimeout(() => {
uni.switchTab({
url: '/pages/tabBar/work/index'
});
},2000)
uni.switchTab({
url: "/pages/tabBar/work/index",
});
}, 2000);
},
})
}else{
});
} else {
uni.showToast({
title: res.msg || "提交失败",
icon: "none",
});
title: res.msg || "提交失败",
icon: "none",
});
}
})
});
},
handleTreeSelect(e) {
console.log(e);
console.log(this.deptOptions);
this.form.apartmentName = e.name
this.form.apartmentId = this.deptOptions.find(item=>item.deptName === e.name).deptId
this.form.apartmentName = e.name;
this.form.apartmentId = this.deptOptions.find(
(item) => item.deptName === e.name
).deptId;
},
handleQuestionSelect(e){
this.form.questionName = e.dictLabel
this.form.questionType = e.dictValue
}
}
}
handleQuestionSelect(e) {
this.form.questionName = e.dictLabel;
this.form.questionType = e.dictValue;
},
},
};
</script>
<style lang="scss" scoped>
@ -346,7 +427,12 @@ export default {
height: 70rpx;
line-height: 70rpx;
border-radius: 600rpx;
background: linear-gradient(86.25deg, rgba(13, 198, 198, 1) 3.03%, rgba(19, 194, 194, 1) 3.03%, rgba(70, 219, 213, 1) 96.43%);
background: linear-gradient(
86.25deg,
rgba(13, 198, 198, 1) 3.03%,
rgba(19, 194, 194, 1) 3.03%,
rgba(70, 219, 213, 1) 96.43%
);
color: rgba(255, 255, 255, 1);
font-size: 34rpx;
text-align: center;
@ -366,7 +452,7 @@ export default {
justify-content: center;
margin: 20rpx 16rpx 0 0;
}
.icon-box{
.icon-box {
width: 60rpx;
height: 60rpx;
background: #ceeced;
@ -375,7 +461,7 @@ export default {
align-items: center;
justify-content: center;
}
.camera-icon{
.camera-icon {
width: 36rpx;
height: 36rpx;
}
@ -399,10 +485,9 @@ export default {
</style>
<style lang="scss">
.xj-page{
.u-form-item__body__left__content__required{
.xj-page {
.u-form-item__body__left__content__required {
font-size: 24rpx !important;
}
}
</style>

Loading…
Cancel
Save