修改
This commit is contained in:
parent
bc1fefe4b8
commit
63d719cb11
@ -8,7 +8,7 @@
|
||||
<img
|
||||
v-if="options.img"
|
||||
v-bind:src="options.img"
|
||||
title="点击上传头像"
|
||||
title="点击上传图片"
|
||||
style="width: 100px; height: 100px; line-height: 200px"
|
||||
/>
|
||||
<i
|
||||
@ -24,15 +24,15 @@
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
:title="title"
|
||||
title="上传图片"
|
||||
:visible.sync="openimg"
|
||||
width="800px"
|
||||
width="950px"
|
||||
append-to-body
|
||||
@opened="modalOpened"
|
||||
@close="closeDialog"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
||||
<el-col :xs="24" :md="0" :style="{ height: '350px' }">
|
||||
<vue-cropper
|
||||
ref="cropper"
|
||||
:img="options.img"
|
||||
@ -47,7 +47,12 @@
|
||||
</el-col>
|
||||
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
||||
<div class="avatar-upload-preview">
|
||||
<img :src="previews.url" :style="previews.img" />
|
||||
<img
|
||||
style="width: 100%; height: 100%"
|
||||
v-if="previews.url"
|
||||
:src="previews.url"
|
||||
/>
|
||||
<div v-else></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -126,8 +131,8 @@ export default {
|
||||
options: {
|
||||
img: null, //裁剪图片的地址
|
||||
autoCrop: true, // 是否默认生成截图框
|
||||
autoCropWidth: 200, // 默认生成截图框宽度
|
||||
autoCropHeight: 200, // 默认生成截图框高度
|
||||
autoCropWidth: 300, // 默认生成截图框宽度
|
||||
autoCropHeight: 300, // 默认生成截图框高度
|
||||
fixedBox: true, // 固定截图框大小 不允许改变
|
||||
},
|
||||
previews: {},
|
||||
@ -200,34 +205,34 @@ export default {
|
||||
);
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
this.previews.data = file;
|
||||
this.previews.url = URL.createObjectURL(file);
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => {
|
||||
this.options.img = reader.result;
|
||||
// this.options.img = reader.result;
|
||||
};
|
||||
}
|
||||
},
|
||||
// 上传图片
|
||||
uploadImg() {
|
||||
// console.log(this.types);
|
||||
this.$refs.cropper.getCropBlob((data) => {
|
||||
let formData = new FormData();
|
||||
formData.append("file", data);
|
||||
formData.append("type", this.types);
|
||||
updateNurseStationHeads(formData).then((response) => {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
console.log(this.items);
|
||||
console.log(this.types);
|
||||
if (this.types == "attributePitureUrl") {
|
||||
this.items.attributePitureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
this.openimg = false;
|
||||
});
|
||||
let formData = new FormData();
|
||||
formData.append("file", this.previews.data);
|
||||
formData.append("type", this.types);
|
||||
updateNurseStationHeads(formData).then((response) => {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
console.log(this.items);
|
||||
console.log(this.types);
|
||||
if (this.types == "attributePitureUrl") {
|
||||
this.items.attributePitureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
this.openimg = false;
|
||||
});
|
||||
},
|
||||
// 实时预览
|
||||
realTime(data) {
|
||||
console.log(data);
|
||||
this.previews = data;
|
||||
},
|
||||
// 关闭窗口
|
||||
@ -239,6 +244,17 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.avatar-upload-preview {
|
||||
position: absolute;
|
||||
top: 0%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0%);
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
border-radius: 0%;
|
||||
box-shadow: 0 0 4px #ccc;
|
||||
overflow: hidden;
|
||||
}
|
||||
.user-info-head {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@ -374,7 +374,7 @@
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="护理项目耗材" >
|
||||
<el-form-item label="护理项目耗材">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@ -714,7 +714,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
imageUrl: "",
|
||||
imgone:"",
|
||||
imgone: "",
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
@ -861,8 +861,8 @@ export default {
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert(
|
||||
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
||||
response.msg +
|
||||
"</div>",
|
||||
response.msg +
|
||||
"</div>",
|
||||
"导入结果",
|
||||
{ dangerouslyUseHTMLString: true }
|
||||
);
|
||||
@ -952,7 +952,6 @@ export default {
|
||||
},
|
||||
/** 耗材列表 */
|
||||
listStationConsumable() {
|
||||
|
||||
listStationConsumable(this.StationConsumablequeryParams).then(
|
||||
(response) => {
|
||||
this.stationConsumableList = response.rows;
|
||||
@ -993,7 +992,7 @@ export default {
|
||||
cancel() {
|
||||
console.log(this.form.nurseStationItem);
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone!= this.form.nurseStationItem.itemPictureUrl) {
|
||||
if (this.imgone != this.form.nurseStationItem.itemPictureUrl) {
|
||||
obj.pictureUrlList.push(this.form.nurseStationItem.itemPictureUrl);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
@ -1021,19 +1020,21 @@ export default {
|
||||
}
|
||||
},
|
||||
delnurseStationItemPrices(item) {
|
||||
if (item.ids && !item.id) {
|
||||
if (item.ids && !item.nurseItemPriceId) {
|
||||
if (this.form.nurseStationItemPrices.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.form.nurseStationItemPrices =
|
||||
this.form.nurseStationItemPrices.filter((e) => e.ids != item.ids);
|
||||
}
|
||||
} else if (!item.ids && item.id) {
|
||||
} else if (!item.ids && item.nurseItemPriceId) {
|
||||
if (this.form.nurseStationItemPrices.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.form.nurseStationItemPrices =
|
||||
this.form.nurseStationItemPrices.filter((e) => e.id != item.id);
|
||||
this.form.nurseStationItemPrices.filter(
|
||||
(e) => e.nurseItemPriceId != item.nurseItemPriceId
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1113,12 +1114,13 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.StationConsumablequeryParams.nurseStationId = null
|
||||
this.StationConsumablequeryParams.nurseStationId = null;
|
||||
const id = row.id || this.ids;
|
||||
getNurseItem(id).then((response) => {
|
||||
console.log(response);
|
||||
this.form = response.data;
|
||||
this.StationConsumablequeryParams.nurseStationId=response.data.nurseStationItem.nurseStationId
|
||||
this.StationConsumablequeryParams.nurseStationId =
|
||||
response.data.nurseStationItem.nurseStationId;
|
||||
this.imgone = this.form.nurseStationItem.itemPictureUrl;
|
||||
if (this.form.nurseStationItemPrices == []) {
|
||||
var obj = {
|
||||
@ -1162,6 +1164,9 @@ export default {
|
||||
console.log(valid);
|
||||
if (valid) {
|
||||
if (this.form.nurseStationItem.id != null) {
|
||||
this.form.nurseStationItemPrices.forEach((e) => {
|
||||
e.nurseStationItemId = this.form.nurseStationItem.id;
|
||||
});
|
||||
updateNurseItem(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
@ -1170,7 +1175,7 @@ export default {
|
||||
} else {
|
||||
addNurseItem(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$forceUpdate()
|
||||
this.$forceUpdate();
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
@ -1190,7 +1195,7 @@ export default {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleExport() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user