forked from dyf/dyf-vue-ui
修改一些体验性问题
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<div class="main">
|
||||
<div class="TopTool">
|
||||
<div class="button-row">
|
||||
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true,formRef)">新增维修</el-button>
|
||||
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true, formRef)">新增维修</el-button>
|
||||
<el-button type="primary" plain icon="Download" @click.stop="ExportRecord()">导出</el-button>
|
||||
<el-button type="danger" plain icon="Delete" @click.stop="DropRecord()">批量删除</el-button>
|
||||
</div>
|
||||
@ -47,7 +47,7 @@
|
||||
v-model="advanceSearch.Date"
|
||||
type="daterange"
|
||||
format="YYYY-MM-DD"
|
||||
style="width: 240px;"
|
||||
style="width: 240px"
|
||||
value-format="YYYY-MM-DD"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
@ -74,7 +74,7 @@
|
||||
<el-table-column label="操作" align="center" fixed="right" width="280" class-name="small-padding fixed-width opt">
|
||||
<template #default="scope">
|
||||
<div class="center">
|
||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true,formRef)">编辑</el-text>
|
||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, false)">详情</el-text>
|
||||
<el-text class="mx-1" type="danger" @click.stop="DropRecord([scope.row])">删除</el-text>
|
||||
</div>
|
||||
@ -101,8 +101,7 @@
|
||||
:draggable="true"
|
||||
>
|
||||
<div class="form">
|
||||
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules" >
|
||||
|
||||
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
||||
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
||||
<!-- <el-input v-model="selectedRow['deviceName']" :readonly="true" @click.stop="ShowDevice('Edit', true)" placeholder="请选择设备" /> -->
|
||||
<el-select v-model="cEdit.deviceId" placeholder="选择设备" clearable :disabled="!cEdit.isEdit" filterable>
|
||||
@ -143,6 +142,7 @@
|
||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
||||
:limit="9"
|
||||
list-type="picture-card"
|
||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
||||
>
|
||||
<el-icon>
|
||||
<Plus />
|
||||
@ -154,7 +154,7 @@
|
||||
<img :src="file.url" class="el-upload-list__item-thumbnail" />
|
||||
|
||||
<!-- 操作按钮组 -->
|
||||
<div class="el-upload-list__item-actions">
|
||||
<div class="el-upload-list__item-actions" v-show="cEdit.isEdit">
|
||||
<!-- 自定义删除按钮 -->
|
||||
<span class="el-upload-list__item-delete" @click.stop="dropImg('before', file, index)">
|
||||
<el-icon>
|
||||
@ -179,6 +179,7 @@
|
||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
||||
:limit="9"
|
||||
list-type="picture-card"
|
||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
||||
>
|
||||
<el-icon>
|
||||
<Plus />
|
||||
@ -189,7 +190,7 @@
|
||||
<!-- 图片缩略图 -->
|
||||
<img :src="file.url" class="el-upload-list__item-thumbnail" />
|
||||
<!-- 操作按钮组 -->
|
||||
<div class="el-upload-list__item-actions">
|
||||
<div class="el-upload-list__item-actions" v-show="cEdit.isEdit">
|
||||
<!-- 自定义删除按钮 -->
|
||||
<span class="el-upload-list__item-delete" @click.stop="dropImg('after', file, index)">
|
||||
<el-icon>
|
||||
@ -338,7 +339,6 @@
|
||||
import api from '@/api/equipmentManagement/repairRecords/index';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
|
||||
var grid = ref(null);
|
||||
var deviceGrid = ref(null);
|
||||
|
||||
@ -490,15 +490,12 @@ function DropRecord(arr = undefined) {
|
||||
() => {
|
||||
showloading('fullLoading');
|
||||
arr = arr.map((item) => item.recordId);
|
||||
api.dropRepir(arr).then(res=>{
|
||||
if(res && res.code==200){
|
||||
api.dropRepir(arr).then((res) => {
|
||||
if (res && res.code == 200) {
|
||||
Search();
|
||||
}
|
||||
alert(res.msg);
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
hideConfirm,
|
||||
'提示'
|
||||
@ -511,7 +508,7 @@ function ToggleAdvance() {
|
||||
}
|
||||
|
||||
//显示编辑
|
||||
function ShowEdit(item = undefined, isEdit = true,formEl=undefined) {
|
||||
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
||||
Status.ShowEditPop = true;
|
||||
let def = {
|
||||
recordId: null, //维修记录id
|
||||
@ -590,9 +587,9 @@ function ShowEdit(item = undefined, isEdit = true,formEl=undefined) {
|
||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
||||
});
|
||||
|
||||
if (!formEl) return
|
||||
if (!formEl) return;
|
||||
|
||||
formEl.validate();
|
||||
formEl.validate();
|
||||
}
|
||||
if (item) {
|
||||
selectedRow.value['deviceName'] = item.deviceName;
|
||||
@ -671,80 +668,79 @@ var dropImg = (type, file, index) => {
|
||||
//保存表单数据
|
||||
function SaveFormData(formEl: FormInstance | undefined) {
|
||||
if (!cEdit.isEdit) {
|
||||
CloseEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formEl) return
|
||||
if (!formEl) return;
|
||||
|
||||
let submit=()=>{
|
||||
showloading('fullLoading');
|
||||
setTimeout(() => {
|
||||
let promise = null;
|
||||
let submit = () => {
|
||||
showloading('fullLoading');
|
||||
setTimeout(() => {
|
||||
let promise = null;
|
||||
|
||||
let formData = new FormData();
|
||||
let formData = new FormData();
|
||||
|
||||
let keys = Object.keys(cEdit);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key == 'isEdit') {
|
||||
continue;
|
||||
let keys = Object.keys(cEdit);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key == 'isEdit') {
|
||||
continue;
|
||||
}
|
||||
if (cEdit[key] === null || cEdit[key] === undefined) {
|
||||
continue;
|
||||
}
|
||||
formData.append(key, cEdit[key]);
|
||||
}
|
||||
if (cEdit[key] === null || cEdit[key] === undefined) {
|
||||
continue;
|
||||
}
|
||||
formData.append(key, cEdit[key]);
|
||||
}
|
||||
|
||||
// 添加第一个控件的文件
|
||||
if (beforeFile.value.length > 0) {
|
||||
for (let i = 0; i < beforeFile.value.length; i++) {
|
||||
let file = beforeFile.value[i];
|
||||
if (file && !file.id) {
|
||||
formData.append('beforeFile', file);
|
||||
// 添加第一个控件的文件
|
||||
if (beforeFile.value.length > 0) {
|
||||
for (let i = 0; i < beforeFile.value.length; i++) {
|
||||
let file = beforeFile.value[i];
|
||||
if (file && !file.id) {
|
||||
formData.append('beforeFile', file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (afterFile.value.length > 0) {
|
||||
// formData.append('afterFile', afterFile.value[0]);
|
||||
if (afterFile.value.length > 0) {
|
||||
// formData.append('afterFile', afterFile.value[0]);
|
||||
|
||||
for (let i = 0; i < afterFile.value.length; i++) {
|
||||
let file = afterFile.value[i];
|
||||
if (file && !file.id) {
|
||||
formData.append('afterFile', file);
|
||||
for (let i = 0; i < afterFile.value.length; i++) {
|
||||
let file = afterFile.value[i];
|
||||
if (file && !file.id) {
|
||||
formData.append('afterFile', file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cEdit.recordId) {
|
||||
promise = api.updateRepair(formData);
|
||||
} else {
|
||||
promise = api.addRepir(formData);
|
||||
}
|
||||
if (cEdit.recordId) {
|
||||
promise = api.updateRepair(formData);
|
||||
} else {
|
||||
promise = api.addRepir(formData);
|
||||
}
|
||||
|
||||
promise
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
alert('操作成功');
|
||||
CloseEdit();
|
||||
Search();
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
ResetFormData();
|
||||
hideloading();
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
promise
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
alert('操作成功');
|
||||
CloseEdit();
|
||||
Search();
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
ResetFormData();
|
||||
hideloading();
|
||||
});
|
||||
}, 0);
|
||||
};
|
||||
formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
submit();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//导出
|
||||
@ -1079,12 +1075,16 @@ input:focus {
|
||||
}
|
||||
|
||||
:deep .el-upload-list--picture-card .el-upload-list__item .el-upload-list__item,
|
||||
.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item{
|
||||
margin:0px ;
|
||||
.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
// :deep .el-upload-list__item,.el-upload-list__item{
|
||||
// margin-right: 8px !important;
|
||||
// }
|
||||
|
||||
:deep .hide-add-btn .el-upload.is-disabled,
|
||||
.hide-add-btn .el-upload.is-disabled {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user