|
|
|
@ -10,28 +10,29 @@ |
|
|
|
|
style="width: 96%; padding: 0"> |
|
|
|
|
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'"> |
|
|
|
|
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center"> |
|
|
|
|
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" |
|
|
|
|
type="number"> |
|
|
|
|
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" |
|
|
|
|
inputAlign="right" type="number"> |
|
|
|
|
<u-text :text="item.unit" slot="suffix" margin="0 3px 0 0" type="tips"></u-text> |
|
|
|
|
</u-input> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
|
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'"> |
|
|
|
|
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center"> |
|
|
|
|
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" /> |
|
|
|
|
<u-input :disabled="type=='view'" placeholder="请输入" border="none" v-model="item.standar" |
|
|
|
|
inputAlign="right" /> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
|
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'"> |
|
|
|
|
<uni-forms-item :label="item.name" label-width="450rpx" style="display: flex; align-items: center"> |
|
|
|
|
<u-checkbox :disabled="type=='view'" v-model="item.standar" :customStyle="{ justifyContent: 'space-between' }" |
|
|
|
|
:name="'sdfs'" /> |
|
|
|
|
<u-checkbox :disabled="type=='view'" v-model="item.standar" |
|
|
|
|
:customStyle="{ justifyContent: 'space-between' }" :name="'sdfs'" /> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</view> |
|
|
|
|
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'"> |
|
|
|
|
<uni-forms-item :label="item.name" label-position="top" label-width="450rpx" |
|
|
|
|
style="display: flex; align-items: center" /> |
|
|
|
|
<u-upload :disabled="type=='view'" :fileList="item.fileList" @afterRead="(e) => afterRead(e, item)" |
|
|
|
|
@delete="(e) => deletePic(e, item)" name="1" :maxCount="1"></u-upload> |
|
|
|
|
@delete="(e) => deletePic(e, item)" name="1" :maxCount="10"></u-upload> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="investigation-item" style="width: 96%; padding: 0"> |
|
|
|
@ -43,8 +44,9 @@ |
|
|
|
|
<view class="investigation-item" style="width: 96%; padding: 0"> |
|
|
|
|
<view class="detail-item"> |
|
|
|
|
<uni-forms-item label="隐患图片" label-position="top" label-width="200px" /> |
|
|
|
|
<u-upload :fileList="fileList" :disabled="type=='view'" @afterRead="(e) => afterRead2(e, 'fileList')" |
|
|
|
|
@delete="(e) => deletePic2(e, 'fileList')" name="1" :maxCount="1"></u-upload> |
|
|
|
|
<u-upload :fileList="fileList" :disabled="type=='view'" |
|
|
|
|
@afterRead="(e) => afterRead2(e, 'fileList')" @delete="(e) => deletePic2(e, 'fileList')" |
|
|
|
|
name="1" :maxCount="10"></u-upload> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="investigation-item" style="width: 96%; padding: 0"> |
|
|
|
@ -113,6 +115,8 @@ |
|
|
|
|
} |
|
|
|
|
switch ( |
|
|
|
|
item.type |
|
|
|
|
|
|
|
|
|
) { |
|
|
|
|
// case "1": |
|
|
|
|
// item.standar = 0 |
|
|
|
|
// break; |
|
|
|
@ -122,7 +126,12 @@ |
|
|
|
|
// case "3": |
|
|
|
|
// item.standar = false |
|
|
|
|
// break; |
|
|
|
|
// case "4": |
|
|
|
|
case "4": |
|
|
|
|
item.fileList = [] |
|
|
|
|
let arr=item.standar.split(',') |
|
|
|
|
for(let itm of arr){ |
|
|
|
|
item.fileList.push({url:itm,name:''}) |
|
|
|
|
} |
|
|
|
|
// item.fileList = [ |
|
|
|
|
// // { |
|
|
|
|
// // "id": "20229a8c-db46-4447-be3e-6731665f7bd0", |
|
|
|
@ -140,8 +149,7 @@ |
|
|
|
|
// // } |
|
|
|
|
// // } |
|
|
|
|
// ] |
|
|
|
|
// break; |
|
|
|
|
) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return item; |
|
|
|
|
}); |
|
|
|
@ -149,6 +157,22 @@ |
|
|
|
|
this.getData(); |
|
|
|
|
} |
|
|
|
|
if (this.json.checkedSelect) { |
|
|
|
|
console.log(this.json.checkedSelect.hdPic, 11111) |
|
|
|
|
if (this.json.checkedSelect.hdPic) { |
|
|
|
|
this.fileList = []; |
|
|
|
|
let arr = [] |
|
|
|
|
try { |
|
|
|
|
arr = this.json.checkedSelect.hdPic.split(',') |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(error) |
|
|
|
|
} |
|
|
|
|
console.log(arr, 4343242342423) |
|
|
|
|
for (let item of arr) { |
|
|
|
|
this.fileList.push({ url: item, name: '' }) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.fileList = []; |
|
|
|
|
} |
|
|
|
|
this.formData = { |
|
|
|
|
hdPic: this.json.checkedSelect.hdPic || "", |
|
|
|
|
hdDesc: this.json.checkedSelect.hdDesc || "", |
|
|
|
@ -188,18 +212,20 @@ |
|
|
|
|
status: "uploading", |
|
|
|
|
message: "上传中", |
|
|
|
|
}); |
|
|
|
|
const result = await this.uploadFilePromise(item.fileList[0].url); |
|
|
|
|
const result = await this.uploadFilePromise(event.file.url); |
|
|
|
|
const resultInfo = JSON.parse(result); |
|
|
|
|
const index = item.fileList.findIndex((v) => v.id === id); |
|
|
|
|
if (resultInfo.code == 200) { |
|
|
|
|
item.fileList.splice( |
|
|
|
|
index, |
|
|
|
|
1, |
|
|
|
|
Object.assign(item.fileList[index], { |
|
|
|
|
Object.assign(event.file, { |
|
|
|
|
status: "success", |
|
|
|
|
message: "", |
|
|
|
|
result: resultInfo, |
|
|
|
|
// url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg', |
|
|
|
|
url: resultInfo.result, |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
@ -207,10 +233,7 @@ |
|
|
|
|
item.fileList.splice( |
|
|
|
|
index, |
|
|
|
|
1, |
|
|
|
|
Object.assign(item.fileList[index], { |
|
|
|
|
status: "error", |
|
|
|
|
message: "失败", |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -245,18 +268,20 @@ |
|
|
|
|
status: "uploading", |
|
|
|
|
message: "上传中", |
|
|
|
|
}); |
|
|
|
|
const result = await this.uploadFilePromise(this[key][0].url); |
|
|
|
|
console.log(event.file) |
|
|
|
|
const result = await this.uploadFilePromise(event.file.url); |
|
|
|
|
const resultInfo = JSON.parse(result); |
|
|
|
|
const index = this[key].findIndex((v) => v.id === id); |
|
|
|
|
if (resultInfo.code == 200) { |
|
|
|
|
this[key].splice( |
|
|
|
|
index, |
|
|
|
|
1, |
|
|
|
|
Object.assign(this[key][index], { |
|
|
|
|
Object.assign(event.file, { |
|
|
|
|
status: "success", |
|
|
|
|
message: "", |
|
|
|
|
result: resultInfo, |
|
|
|
|
url: resultInfo.result, |
|
|
|
|
// url: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg', |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
@ -264,16 +289,18 @@ |
|
|
|
|
this[key].splice( |
|
|
|
|
index, |
|
|
|
|
1, |
|
|
|
|
Object.assign(this[key][index], { |
|
|
|
|
status: "error", |
|
|
|
|
message: "失败", |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
this.formData.hdPic = this[key] |
|
|
|
|
.filter((item) => item.status === "success") |
|
|
|
|
.map((item) => item.url) |
|
|
|
|
.toString(); |
|
|
|
|
let arr = [] |
|
|
|
|
for (let i = 0; i < this[key].length; i++) { |
|
|
|
|
arr.push(this[key][i].url) |
|
|
|
|
} |
|
|
|
|
this.formData.hdPic = arr.toString(); |
|
|
|
|
// this.formData.hdPic = this[key] |
|
|
|
|
// .filter((item) => item.status === "success") |
|
|
|
|
// .map((item) => item.url) |
|
|
|
|
// .toString(); |
|
|
|
|
this.changeEmit(); |
|
|
|
|
}, |
|
|
|
|
changeEmit() { |
|
|
|
@ -362,10 +389,24 @@ |
|
|
|
|
// this.$emit('select', this.investigationSelect, this.investigationList[index]) |
|
|
|
|
}, |
|
|
|
|
investigationDetailHandle() { |
|
|
|
|
|
|
|
|
|
let investigationDetailList = JSON.parse(JSON.stringify(this.investigationDetailList)) |
|
|
|
|
for (let items of investigationDetailList) { |
|
|
|
|
if (items.type == '4') { |
|
|
|
|
let arr = [] |
|
|
|
|
let standar = '' |
|
|
|
|
for (let item of items.fileList) { |
|
|
|
|
arr.push(item.url) |
|
|
|
|
} |
|
|
|
|
items.standar = arr.toString() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// console.log(investigationDetailList) |
|
|
|
|
|
|
|
|
|
this.$emit("select", { |
|
|
|
|
...this.json, |
|
|
|
|
checkedSelect: this.formData, |
|
|
|
|
extraConfigs: this.investigationDetailList, |
|
|
|
|
extraConfigs: investigationDetailList, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|