31 changed files with 1338 additions and 298 deletions
@ -0,0 +1,50 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 获取验车检查项目管理列表
|
|||
export function listPage(data) { |
|||
return request({ |
|||
url: '/scm/v1/scmvehicleinspectitem/listPage', |
|||
data, |
|||
method: 'post', |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
} |
|||
|
|||
// 保存 验车单
|
|||
export function save(data) { |
|||
return request({ |
|||
url: '/scm/v1/scmvehicleinspectitem/save', |
|||
data, |
|||
method: 'post', |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
} |
|||
|
|||
// 验车管理 新增初始化
|
|||
export function delBySids(data) { |
|||
return request({ |
|||
url: '/scm/v1/scmvehicleinspectitem/delBySids', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
} |
|||
|
|||
// 验车管理详情回显
|
|||
export function fetchDetailsBySid(sid) { |
|||
return request({ |
|||
url: '/scm/v1/scmvehicleinspectitem/fetchDetailsBySid/' + sid, |
|||
method: 'get' |
|||
}) |
|||
} |
|||
|
|||
// 通过 验车单
|
|||
export function submitCarInspectedInfo(data) { |
|||
return request({ |
|||
url: '/scm/v1/scmvehicleexamine/submitCarInspectedInfo', |
|||
data, |
|||
method: 'post', |
|||
headers: { 'Content-Type': 'application/json' } |
|||
}) |
|||
} |
|||
|
@ -0,0 +1,229 @@ |
|||
<template> |
|||
<div> |
|||
<el-upload class="upload-demo" :headers="accessToken" :action="uploadFile" :accept="accept" :data="uploadData" |
|||
:on-success="uploadImgSuccess_FuJian" :on-remove="handleRemove" :file-list="fileList_FuJian" |
|||
:on-preview="handlePictureCardPreview" :show-file-list="false" :multiple="true"> |
|||
<el-button size="mini" type="primary">点击上传</el-button> |
|||
</el-upload> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { uploadFile_yanchejiancha } from '@/api/portal/Upload' |
|||
import { getStorage } from '@/utils/auth.js' |
|||
|
|||
export default { |
|||
model: { |
|||
prop: 'name', |
|||
event: 'change' |
|||
}, |
|||
props: { |
|||
placeholder: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
bucket: { |
|||
type: String, |
|||
default: 'abc' |
|||
}, |
|||
// 长度 |
|||
width: { |
|||
type: String, |
|||
default: '270px' |
|||
}, |
|||
limit: { |
|||
type: Number, |
|||
default: 1 |
|||
}, |
|||
accept: { |
|||
type: String, |
|||
default: |
|||
'.jpg,.jpeg,.png,.JPG,.JPEG' |
|||
}, |
|||
// 文件名称 |
|||
name: { |
|||
type: Array, |
|||
required: true |
|||
}, |
|||
uploadData: { |
|||
type: Object, |
|||
default: {} |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
dialogImageUrl: '', |
|||
dialogVisible: false, |
|||
accessToken: null, |
|||
uploadFile: uploadFile_yanchejiancha, |
|||
fileList_FuJian: [], |
|||
enclosure: '', |
|||
file_add: '', |
|||
file_catch: '', |
|||
files: [], |
|||
files_list: [], |
|||
filedUrl: '', |
|||
// fileUrl: fileUrl, |
|||
// showpicture:false, |
|||
isview: false, |
|||
nameArr: '', |
|||
loadding: false, |
|||
stateName: '', |
|||
/* uploadData: { modelSid: '' },*/ |
|||
sid: '' |
|||
} |
|||
}, |
|||
watch: { |
|||
name: { |
|||
deep: true, |
|||
immediate: true, |
|||
handler(newVal, oldVal) { |
|||
console.log('aaaa1', newVal) |
|||
this.files = newVal |
|||
console.log('aaaa2', this.files) |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
this.Init() |
|||
}) |
|||
}, |
|||
created() { |
|||
this.uploadFile = uploadFile_yanchejiancha // 接口 |
|||
this.accessToken = { |
|||
token: getStorage() |
|||
} |
|||
}, |
|||
methods: { |
|||
view() { |
|||
// window.open(this.filedUrl) |
|||
}, |
|||
showImg(sid) { |
|||
// this.uploadData.sid = sid |
|||
}, |
|||
|
|||
// 页面第一次加载 |
|||
Init() { |
|||
if (this.name !== undefined) { |
|||
this.files = [] |
|||
for (var i = 0; i < this.name.length; i++) { |
|||
this.files.push({ |
|||
name: this.name[i], |
|||
url: this.name[i] |
|||
}) |
|||
} |
|||
} |
|||
}, |
|||
// 上传方案--成功后执行 |
|||
uploadImgSuccess_FuJian(response, file, fileList) { |
|||
let _this = this |
|||
console.log('您选择的file:', file) |
|||
// console.log('您传递的data:', _this.uploadData) |
|||
if (file.response.code === '200') { |
|||
this.loadding = false |
|||
// 返显图片 |
|||
this.filedUrl = this.fileUrl + file.response.data |
|||
// var uid = file.response.data |
|||
this.files.push({ |
|||
name: file.response.data.sourceFileName, |
|||
url: file.response.data.fullUrl, |
|||
size: file.response.data.size |
|||
}) |
|||
this.$emit('change', this.files) |
|||
this.$emit('eett', this.files) |
|||
// this.getUrl() |
|||
// SaveList(this.tempInfo).then(response => { |
|||
// if (response.success) { |
|||
// } |
|||
// }) |
|||
} |
|||
}, |
|||
removeImage(file, ImageFileList) { |
|||
this.files.splice(this.files.indexOf(file), 1) |
|||
const imgFiles = [] |
|||
this.files.forEach((o) => { |
|||
imgFiles.push(o.url) |
|||
}) |
|||
this.$emit('fileChange', this.files) |
|||
}, |
|||
handleRemove(file, fileList) { |
|||
console.log('file:' + JSON.stringify(file)) |
|||
console.log('fileList:' + JSON.stringify(fileList)) |
|||
this.enclosure = '' |
|||
// 1. 保存新增文件id(this.file_add) |
|||
this.getNewFileId(fileList) |
|||
// 2. 保存数据库读取的已有文件id(this.file_catch) |
|||
this.getCatchFileId(file) |
|||
// 3. 保存并拼接id |
|||
this.getFileId() |
|||
// 4. 返回拼接id |
|||
this.$emit('change', this.enclosure) |
|||
}, |
|||
// 返回this.file_add(新上传文件的id拼接集合) |
|||
getNewFileId(fileList) { |
|||
// debugger |
|||
this.file_add = '' |
|||
for (var i = 0; i < fileList.length; i++) { |
|||
if (fileList[i].response && fileList[i].response.code === '200') { |
|||
this.file_add = this.file_add + fileList[i].response.data + ',' |
|||
} |
|||
} |
|||
if (this.file_add !== '') { |
|||
this.file_add = this.file_add.substring(0, this.file_add.length - 1) |
|||
} |
|||
// console.log('1. this.file_add: ' + this.file_add) |
|||
}, |
|||
// 返回this.file_catch(数库一寸照的文件的id的拼接集合) |
|||
getCatchFileId(file) { |
|||
for (var i = 0; i < this.files_list.length; i++) { |
|||
if (this.file_catch !== '') { |
|||
// 1. 检查当前删除的文件是否是修改文件列表里面的,如果是,将修改列表里去除此id |
|||
if (this.files_list[i].name === file.name) { |
|||
// 2. 拆开file_catch到fils_arry |
|||
var fils_arry = this.file_catch.split(',') |
|||
// 3. 从fils_arry去除 this.files_list[i].id |
|||
var arry = [] |
|||
fils_arry.forEach((element) => { |
|||
// 不加载文件里面的 |
|||
if (element !== this.files_list[i].id) { |
|||
arry.push(element) |
|||
} |
|||
}) |
|||
// 4. 重新拼接成file_catch |
|||
this.file_catch = arry.join(',') |
|||
} |
|||
} |
|||
} |
|||
// console.log('2. this.file_catch:' + this.file_catch) |
|||
}, |
|||
// 保存并拼接id |
|||
getFileId() { |
|||
// console.log('3. this.file_catch:' + this.file_catch + ',this.file_add:' + this.file_add) |
|||
if (this.file_catch !== '') { |
|||
if (this.file_add !== '') { |
|||
this.enclosure = this.file_catch + ',' + this.file_add |
|||
} else { |
|||
this.enclosure = this.file_catch |
|||
} |
|||
} else { |
|||
this.enclosure = this.file_add |
|||
} |
|||
}, |
|||
handlePictureCardPreview(file) { |
|||
this.dialogImageUrl = file.url |
|||
}, |
|||
// 上传失败 |
|||
uploadError() { |
|||
this.loadding = false |
|||
}, |
|||
uploadProgrees(event, file, fileList) { |
|||
if (Number(event.percent) > 0) { |
|||
this.loadding = true |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped></style> |
@ -1,13 +1,308 @@ |
|||
<template> |
|||
|
|||
<div class="app-container"> |
|||
<!-- Start 列表页面 --> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar view-title="验车检查项目管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="100px" class="tab-header"> |
|||
<el-form-item label="项目名称"> |
|||
<el-input v-model="listQuery.params.item" placeholder="" clearable/> |
|||
</el-form-item> |
|||
<el-form-item label="是否上传图片"> |
|||
<el-select v-model="listQuery.params.isImg" placeholder="请选择" clearable filterable> |
|||
<el-option v-for="item in isImg_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" @click="handleFilter" size="small">查询</el-button> |
|||
<el-button type="primary" @click="handleReset" size="small">重置</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="listtop"> |
|||
<div class="tit">车辆检查项列表</div> |
|||
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
<div class=""> |
|||
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange"> |
|||
<el-table-column fixed width="50px" type="selection" align="center"/> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="indexMethod" align="center"/> |
|||
<el-table-column fixed label="操作" width="150px" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="primary" size="mini" @click="toEdit(scope.row)">编辑</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="项目" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.item }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="排序号" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.sortNo }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="检查结果" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.result }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="是否上传图片" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.isImg }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="照片说明" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.remarks }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
<div class="pages"> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<yanchejianchaAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="getList"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import { listPage, delBySids } from '@/api/supplychain/yanchejiancha' |
|||
import yanchejianchaAdd from './yanchejianchaAdd' |
|||
|
|||
export default { |
|||
name: 'yanchejiancha' |
|||
name: 'yanchejianchaxiangmu', |
|||
components: { |
|||
Pagination, |
|||
pageye, |
|||
ButtonBar, |
|||
yanchejianchaAdd |
|||
}, |
|||
data() { |
|||
return { |
|||
btndisabled: false, |
|||
btnList: [ |
|||
{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'toAdd', |
|||
btnLabel: '新增' |
|||
}, |
|||
{ |
|||
type: 'danger', |
|||
size: 'small', |
|||
icon: 'del', |
|||
btnKey: 'doDel', |
|||
btnLabel: '删除' |
|||
}, |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
org_list: [], |
|||
accadjType_list: [], |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
viewState: 1, |
|||
// 查询条件 ----------- |
|||
tableKey: 0, |
|||
list: [], |
|||
sids: [], |
|||
isImg_list: [ |
|||
{ |
|||
dictKey: 0, |
|||
dictValue: '否' |
|||
}, |
|||
{ |
|||
dictKey: 1, |
|||
dictValue: '是' |
|||
} |
|||
], |
|||
FormLoading: false, |
|||
listLoading: false, |
|||
listQuery: { |
|||
params: { |
|||
item: '', |
|||
isImg: '' |
|||
}, |
|||
current: 1, |
|||
size: 10, |
|||
total: 0 |
|||
}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
created() { |
|||
// 加载列表 |
|||
this.getList() |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
methods: { |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
btnHandle(btnKey) { |
|||
console.log('XXXXXXXXXXXXXXX ' + btnKey) |
|||
switch (btnKey) { |
|||
case 'toAdd': |
|||
this.toAdd() |
|||
break |
|||
case 'doDel': |
|||
this.doDel() |
|||
break |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.listQuery.current - 1) * this.listQuery.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
handleSelectionChange(row) { |
|||
const aa = [] |
|||
row.forEach((element) => { |
|||
aa.push(element.sid) |
|||
}) |
|||
this.sids = aa |
|||
console.log('sids', this.sids) |
|||
}, |
|||
// 查询列表信息 |
|||
getList() { |
|||
this.listLoading = true |
|||
listPage(this.listQuery).then((response) => { |
|||
console.log('列表查询结果:', response) |
|||
this.listLoading = false |
|||
if (response.success && response.data && response.data.total > 0) { |
|||
this.list = response.data.records |
|||
this.listQuery.total = response.data.total |
|||
} else { |
|||
this.list = [] |
|||
this.listQuery.total = 0 |
|||
} |
|||
}) |
|||
}, |
|||
// 查询按钮 |
|||
handleFilter() { |
|||
this.listQuery.current = 1 |
|||
this.getList() |
|||
}, |
|||
handleReset() { |
|||
this.listQuery = { |
|||
params: { |
|||
item: '', |
|||
isImg: '' |
|||
}, |
|||
current: 1, |
|||
size: 10, |
|||
total: 0 |
|||
} |
|||
this.getList() |
|||
}, |
|||
toAdd() { |
|||
this.viewState = 2 |
|||
this.$refs['divAdd'].showAdd() |
|||
}, |
|||
toEdit(row) { |
|||
this.viewState = 3 |
|||
this.$refs['divAdd'].showEdit(row) |
|||
}, |
|||
toInfo(row) { |
|||
this.viewState = 4 |
|||
this.$refs['divInfo'].showInfo(row) |
|||
}, |
|||
doDel() { |
|||
if (this.sids.length === 0) { |
|||
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) |
|||
return |
|||
} |
|||
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' |
|||
this.$confirm(tip, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
const loading = this.$loading({ |
|||
lock: true, |
|||
text: 'Loading', |
|||
spinner: 'el-icon-loading', |
|||
background: 'rgba(0, 0, 0, 0.7)' |
|||
}) |
|||
delBySids(this.sids).then(resp => { |
|||
loading.close() |
|||
if (resp.success) { |
|||
this.$message({ type: 'success', message: resp.msg, showClose: true }) |
|||
this.getList() |
|||
} |
|||
}).catch(e => { |
|||
loading.close() |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.btn { |
|||
padding: 15px 0 15px 0; |
|||
border: 1px solid #e0e3eb; |
|||
} |
|||
|
|||
.tab-header { |
|||
background-color: #edf1f7; |
|||
padding: 8px 20px; |
|||
margin-bottom: 0 !important; |
|||
} |
|||
|
|||
.tab-header /deep/ .el-form-item { |
|||
margin-bottom: 10px; |
|||
} |
|||
.listtop { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
border: 1px solid #dfe4ed; |
|||
height: 40px; |
|||
} |
|||
.tit { |
|||
margin-bottom: -10px; |
|||
} |
|||
.pagination { |
|||
margin-bottom: -10px; |
|||
} |
|||
</style> |
|||
|
@ -1,13 +1,310 @@ |
|||
<template> |
|||
|
|||
<div class="app-container"> |
|||
<div v-show="viewState== 1"> |
|||
<!--标题按钮部分开始--> |
|||
<div class="tab-header webtop"> |
|||
<!--标题--> |
|||
<div>{{ viewTitle }}</div> |
|||
<!--start 添加修改按钮--> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存 |
|||
</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<!--标题按钮部分结束--> |
|||
<!--Start 新增修改部分--> |
|||
<div class="listconadd"> |
|||
<div class="wlInfo"><span>车辆检查项</span></div> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>项目名称</span></div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.item" clearable class="addinputw addinputwOne" placeholder=""></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>排序号</span></div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.sortNo" clearable class="addinputw addinputwOne" placeholder=""></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>检查结果</span></div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.result" clearable class="addinputw addinputwOne" placeholder=""></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>是否上传图片</span></div> |
|||
<el-form-item> |
|||
<div class="addinputw addinputwOne"> |
|||
<el-radio v-model="formobj.isImg" :label="1">是</el-radio> |
|||
<el-radio v-model="formobj.isImg" :label="0">否</el-radio> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty spanOneWidth"><span>照片说明</span></div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.remarks" clearable class="addinputw addinputwOne" placeholder=""></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div class="tableStyle"> |
|||
<div style="margin-left: 5px;font-weight: bold;color: #ffffff">检查项内容</div> |
|||
<div class="baocun"> |
|||
<el-button type="primary" size="small" icon="el-icon-plus" class="btntopblueline" @click="addExamine()">添加 |
|||
</el-button> |
|||
</div> |
|||
</div> |
|||
<el-table :key="tableKey" :data="formobj.inspectdetail" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column fixed prop="name" label="操作" width="100px" align="center" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button size="mini" type="danger" @click="deleteExamine(scope.$index)">删除 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="排序号" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input clearable placeholder="" v-model="scope.row.sortNo"></el-input> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="内容" align="left" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input clearable placeholder="" v-model="scope.row.itemContent"></el-input> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div v-if="formobj.isImg == 1" class="tableStyle"> |
|||
<div style="margin-left: 5px;font-weight: bold;color: #ffffff">照片实例</div> |
|||
<div class="baocun"> |
|||
<el-button type="primary" size="small" icon="el-icon-plus" class="btntopblueline" @click="addPicture()">添加 |
|||
</el-button> |
|||
</div> |
|||
</div> |
|||
<el-table v-if="formobj.isImg == 1" :key="imgKey" :data="formobj.inspectimgtemp" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column fixed prop="name" label="操作" width="100px" align="center" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-button size="mini" type="danger" @click="deletePicture(scope.$index)">删除 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="照片名称" align="left" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-input clearable placeholder="" v-model="scope.row.imgTitle"></el-input> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="照片实例" align="center" width="250"> |
|||
<template slot-scope="scope"> |
|||
<div class="upload_img"> |
|||
<upload_yanchejiancha ref="uploadMoreImg" v-model="imglist" bucket="map" @change="backData($event, scope.row)" :upload-data="{type:'0001',sid: scope.row.sid}"/> |
|||
</div> |
|||
<el-button type="primary" v-if="scope.row.imgTempUrl.length > 0" size="mini" @click="handleLook(scope.row)">查看</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
<!--End 添加修改部分--> |
|||
<el-dialog title="" :visible.sync="dialogImgVisible" width="70%" :close-on-click-modal="false"> |
|||
<el-form label-position="right" class="formadd"> |
|||
<el-row style="border: 1px solid #e0e3eb;"> |
|||
<el-col :span="24"> |
|||
<el-form-item> |
|||
<div v-for="item in srcList" style="float: left"> |
|||
<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;" > |
|||
<el-image style="cursor:pointer;width: 150px;height: 150px;margin-top: 5px" :src="item" @click="magnify(item)"> |
|||
</el-image> |
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</el-dialog> |
|||
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> |
|||
<img alt="" :src="dialogUrl" width="100%"> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { save, fetchDetailsBySid } from '@/api/supplychain/yanchejiancha' |
|||
import upload_yanchejiancha from '@/components/uploadFile/upload_yanchejiancha' |
|||
|
|||
export default { |
|||
name: 'yanchejianchaAdd' |
|||
name: 'yanchejianchaAdd', |
|||
components: { |
|||
upload_yanchejiancha |
|||
}, |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
index: 0, |
|||
tableKey: 0, |
|||
imgKey: 1, |
|||
dialogImgVisible: false, |
|||
srcList: [], |
|||
imglist: [], |
|||
dialogVisible: false, |
|||
dialogUrl: '', |
|||
// 表单数据 |
|||
formobj: { |
|||
iconUrl: '', |
|||
isImg: '', |
|||
item: '', |
|||
result: '', |
|||
sid: '', |
|||
sortNo: '', |
|||
inspectdetail: [], |
|||
inspectimgtemp: [] |
|||
}, |
|||
rules: {}, |
|||
submitdisabled: false |
|||
} |
|||
}, |
|||
methods: { |
|||
showAdd() { |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.viewTitle = '【新增】车辆检查项' |
|||
this.dialogStatus = 'add' |
|||
}, |
|||
showEdit(row) { |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.viewTitle = '【编辑】车辆检查项' |
|||
this.dialogStatus = 'edit' |
|||
console.log('编辑回显', row.sid) |
|||
fetchDetailsBySid(row.sid).then((resp) => { |
|||
if (resp.success) { |
|||
this.formobj = resp.data |
|||
} |
|||
}).catch((e) => { |
|||
this.formobj = row |
|||
}) |
|||
}, |
|||
addExamine() { |
|||
this.formobj.inspectdetail.push({ |
|||
itemContent: '', |
|||
sortNo: '' |
|||
}) |
|||
}, |
|||
deleteExamine(index) { |
|||
this.formobj.inspectdetail.splice(index, 1) |
|||
}, |
|||
addPicture() { |
|||
this.formobj.inspectimgtemp.push({ |
|||
imgTempUrl: [], |
|||
imgTitle: '' |
|||
}) |
|||
}, |
|||
deletePicture(index) { |
|||
this.formobj.inspectimgtemp.splice(index, 1) |
|||
}, |
|||
backData(val, row) { |
|||
const aa = [] |
|||
if (val.length > 0) { |
|||
val.forEach((e) => { |
|||
aa.push(e.url) |
|||
}) |
|||
row.imgTempUrl = aa |
|||
} |
|||
}, |
|||
handleLook(row) { |
|||
this.dialogImgVisible = true |
|||
this.srcList = row.imgTempUrl |
|||
}, |
|||
magnify(row) { |
|||
this.dialogVisible = true |
|||
this.dialogUrl = row |
|||
}, |
|||
saveOrUpdate() { |
|||
if (this.formobj.isImg === '') { |
|||
this.$message({ showClose: true, type: 'error', message: '请勾选是否上传图片' }) |
|||
return |
|||
} |
|||
console.log(this.formobj) |
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
this.submitdisabled = true |
|||
save(this.formobj).then((resp) => { |
|||
this.submitdisabled = false |
|||
if (resp.success) { |
|||
this.$message({ |
|||
showClose: true, |
|||
type: 'success', |
|||
message: resp.msg |
|||
}) |
|||
this.handleReturn('true') |
|||
} |
|||
}).catch(() => { |
|||
this.submitdisabled = false |
|||
}) |
|||
} else { |
|||
return false |
|||
} |
|||
}) |
|||
}, |
|||
// 返回(===既判断) |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = { |
|||
iconUrl: '', |
|||
isImg: '', |
|||
item: '', |
|||
result: '', |
|||
sid: '', |
|||
sortNo: '', |
|||
inspectdetail: [], |
|||
inspectimgtemp: [] |
|||
} |
|||
this.$refs['form_obj'].resetFields() |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
.formaddcopy02 { |
|||
padding: 0px !important; |
|||
} |
|||
.wlInfo { |
|||
text-align: center; |
|||
font-size: 28px; |
|||
line-height: 60px; |
|||
border-bottom: 1px solid #e0e3eb; |
|||
} |
|||
.tableStyle { |
|||
background-color: #018ad2; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
border: 1px solid #dfe4ed; |
|||
height: 40px; |
|||
} |
|||
.spanOneWidth { |
|||
width: 100px !important; |
|||
} |
|||
.addinputwOne { |
|||
margin-left: 110px !important; |
|||
} |
|||
.upload_img { |
|||
display: inline-block; |
|||
padding-right: 10px; |
|||
} |
|||
</style> |
|||
|
|||
|
@ -1,13 +1,208 @@ |
|||
<template> |
|||
|
|||
<div class="app-container"> |
|||
<div v-show="viewState== 1"> |
|||
<!--标题按钮部分开始--> |
|||
<div class="tab-header webtop"> |
|||
<!--标题--> |
|||
<div>{{ viewTitle }}</div> |
|||
<!--start 添加修改按钮--> |
|||
<div> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
</div> |
|||
<!--标题按钮部分结束--> |
|||
<!--Start 新增修改部分--> |
|||
<div class="listconadd"> |
|||
<div class="wlInfo"><span>分公司间调车申请</span></div> |
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>项目名称</span></div> |
|||
<el-form-item> |
|||
<span class="addinputInfo addinputwOne">{{ formobj.item }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>排序号</span></div> |
|||
<el-form-item> |
|||
<span class="addinputInfo addinputwOne">{{ formobj.sortNo }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>检查结果</span></div> |
|||
<el-form-item> |
|||
<span class="addinputInfo addinputwOne">{{ formobj.result }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="span-sty spanOneWidth"><span>是否上传图片</span></div> |
|||
<el-form-item> |
|||
<span class="addinputInfo addinputwOne">{{ formobj.isImg }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="span-sty spanOneWidth"><span>照片说明</span></div> |
|||
<el-form-item> |
|||
<span class="addinputInfo addinputwOne">{{ formobj.remarks }}</span> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div class="tableStyle"> |
|||
<div style="margin-left: 5px;font-weight: bold;color: #ffffff">检查项内容</div> |
|||
</div> |
|||
<el-table :key="tableKey" :data="formobj.inspectdetail" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column label="排序号" align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.sortNo }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="内容" align="left" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.itemContent }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div v-if="formobj.isImg == 1" class="tableStyle"> |
|||
<div style="margin-left: 5px;font-weight: bold;color: #ffffff">照片实例</div> |
|||
</div> |
|||
<el-table v-if="formobj.isImg == 1" :key="imgKey" :data="formobj.inspectimgtemp" :index="index" border style="width: 100%"> |
|||
<el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/> |
|||
<el-table-column label="照片名称" align="left" header-align="center"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.imgTitle }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="照片实例" align="center" width="250"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="primary" size="mini" @click="handleLook(scope.row)">查看</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
</div> |
|||
<!--End 添加修改部分--> |
|||
<el-dialog title="" :visible.sync="dialogImgVisible" width="70%" :close-on-click-modal="false"> |
|||
<el-form label-position="right" class="formadd"> |
|||
<el-row style="border: 1px solid #e0e3eb;"> |
|||
<el-col :span="24"> |
|||
<el-form-item> |
|||
<div v-for="item in srcList" style="float: left"> |
|||
<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;" > |
|||
<el-image style="cursor:pointer;width: 150px;height: 150px;margin-top: 5px" :src="item.fileUrl" @click="magnify(item.fileUrl)"> |
|||
</el-image> |
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</el-dialog> |
|||
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> |
|||
<img alt="" :src="dialogUrl" width="100%"> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { fetchDetailsBySid } from '@/api/supplychain/yanchejiancha' |
|||
|
|||
export default { |
|||
name: 'yanchejianchaInfo' |
|||
name: 'yanchejianchaInfo', |
|||
data() { |
|||
return { |
|||
viewTitle: '', |
|||
viewState: 1, |
|||
index: 0, |
|||
tableKey: 0, |
|||
imgKey: 1, |
|||
dialogImgVisible: false, |
|||
srcList: [], |
|||
imglist: [], |
|||
dialogVisible: false, |
|||
dialogUrl: '', |
|||
// 表单数据 |
|||
formobj: { |
|||
iconUrl: '', |
|||
isImg: '', |
|||
item: '', |
|||
result: '', |
|||
sid: '', |
|||
sortNo: '', |
|||
inspectdetail: [], |
|||
inspectimgtemp: [] |
|||
}, |
|||
rules: {}, |
|||
submitdisabled: false |
|||
} |
|||
}, |
|||
methods: { |
|||
showInfo(row) { |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
this.viewTitle = '【编辑】车辆检查项' |
|||
this.dialogStatus = 'edit' |
|||
console.log('编辑回显', row.sid) |
|||
fetchDetailsBySid(row.sid).then((resp) => { |
|||
if (resp.success) { |
|||
this.formobj = resp.data |
|||
} |
|||
}).catch((e) => { |
|||
this.formobj = row |
|||
}) |
|||
}, |
|||
// 返回(===既判断) |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = { |
|||
iconUrl: '', |
|||
isImg: '', |
|||
item: '', |
|||
result: '', |
|||
sid: '', |
|||
sortNo: '', |
|||
inspectdetail: [], |
|||
inspectimgtemp: [] |
|||
} |
|||
this.$refs['form_obj'].resetFields() |
|||
this.$emit('doback') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
.formaddcopy02 { |
|||
padding: 0px !important; |
|||
} |
|||
.wlInfo { |
|||
text-align: center; |
|||
font-size: 28px; |
|||
line-height: 90px; |
|||
border-bottom: 1px solid #e0e3eb; |
|||
} |
|||
.tableStyle { |
|||
background-color: #018ad2; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
border: 1px solid #dfe4ed; |
|||
height: 40px; |
|||
} |
|||
.spanOneWidth { |
|||
width: 100px !important; |
|||
} |
|||
.addinputwOne { |
|||
margin-left: 110px !important; |
|||
} |
|||
.upload_img { |
|||
display: inline-block; |
|||
padding-right: 10px; |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue