优化新购配件保存后无法跳转问题,解决报废图片在预报废列表不回显等问题

This commit is contained in:
BianLzhaoMin 2024-06-13 13:07:11 +08:00
parent bb5e3b844c
commit 8bc40d2f07
8 changed files with 193 additions and 160 deletions

View File

@ -11,7 +11,7 @@
<ImagePreview
v-for="(item, index) in scrapImgList"
:key="index"
src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
:src="item"
:width="`20px`"
:height="`20px`"
class="img-box"
@ -22,24 +22,23 @@
<script>
export default {
props: {
scrapImg: {
type: String,
default: () => null,
},
scrapImgUrl: {},
},
data() {
return {
scrapImgList: [
{ imgUrl: '123' },
{ imgUrl: '123' },
{ imgUrl: '123' },
],
scrapImgList: [],
impViewUrl: process.env.VUE_APP_BASE_API + '/system',
}
},
created() {
if (this.scrapImg) {
this.scrapImgList = this.scrapImg.split(',')
mounted() {
let imgList = []
if (this.scrapImgUrl) {
imgList = this.scrapImgUrl.split(',')
}
this.scrapImgList = imgList.map(
(item) => (item = this.impViewUrl + item),
)
},
}
</script>

View File

@ -68,154 +68,164 @@
</template>
<script>
import { deptTreeSelect } from '@/api/system/user'
export default {
data() {
return {
deptName: '',
deptOptions: [],
defaultProps: {
children: 'children',
label: 'label',
},
deptAmount: 0,
selDeptAmount: 0,
selDeptList: [],
}
import { deptTreeSelect } from '@/api/system/user'
export default {
props: {
deptIds: {
type: Array,
default: () => [],
},
created() {
this.getDeptTree()
},
methods: {
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then((res) => {
this.deptOptions = res.data
this.getNodeAmount(res.data)
})
},
data() {
return {
deptName: '',
deptOptions: [],
defaultProps: {
children: 'children',
label: 'label',
},
//
handleNodeClick(data) {
if (this.selDeptList.length < 1) {
this.selDeptList.push(data)
deptAmount: 0,
selDeptAmount: 0,
selDeptList: [],
}
},
created() {
this.getDeptTree()
},
methods: {
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then((res) => {
this.deptOptions = res.data
this.getNodeAmount(res.data)
})
},
//
handleNodeClick(data) {
if (this.selDeptList.length < 1) {
this.selDeptList.push(data)
} else {
let temp = false
this.selDeptList.forEach((e) => {
if (e.id === data.id) {
temp = true
}
})
if (temp) {
this.$message.error('该单位已选择,不可重复选择')
return
} else {
let temp = false
this.selDeptList.forEach((e) => {
if (e.id === data.id) {
temp = true
}
})
if (temp) {
this.$message.error('该单位已选择,不可重复选择')
return
} else {
this.selDeptList.push(data)
}
this.selDeptList.push(data)
}
}
this.selDeptAmount++
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
/* 递归部门获取所有数据 */
getNodeAmount(list) {
list.map((e) => {
if (e.children) {
this.deptAmount += e.children.length
this.getNodeAmount(e.children)
}
})
},
/* 清空按钮 */
clearDeptList() {
this.selDeptAmount = 0
this.selDeptList = []
},
/* 清除某一个 */
deleteDept(index) {
this.selDeptAmount -= 1
this.selDeptList.splice(index, 1)
},
/* 取消按钮 */
handelCancel() {
this.$emit('closeDepartSel', false)
this.selDeptList = []
this.selDeptAmount = 0
},
/* 确定按钮 */
handelSubmit() {
this.$emit('closeDepartSel', false, this.selDeptList)
this.selDeptList = []
this.selDeptAmount = 0
},
this.selDeptAmount++
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val)
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
}
/* 递归部门获取所有数据 */
getNodeAmount(list) {
list.map((e) => {
if (e.children) {
this.deptAmount += e.children.length
this.getNodeAmount(e.children)
}
})
},
/* 清空按钮 */
clearDeptList() {
this.selDeptAmount = 0
this.selDeptList = []
},
/* 清除某一个 */
deleteDept(index) {
this.selDeptAmount -= 1
this.selDeptList.splice(index, 1)
},
/* 取消按钮 */
handelCancel() {
this.$emit('closeDepartSel', 0)
this.selDeptList = []
this.selDeptAmount = 0
},
/* 确定按钮 */
handelSubmit() {
this.$emit('closeDepartSel', 1, this.selDeptList)
this.selDeptList = []
this.selDeptAmount = 0
},
/* 清空已选择的数据 */
clearNode() {
this.selDeptList = []
},
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val)
},
},
}
</script>
<style scoped lang="scss">
.depart-left {
border: 1px solid #f2f2f2;
padding: 0 !important;
}
.head-container {
height: 60px;
line-height: 60px;
text-align: center;
background-color: #f2f2f2;
}
::v-deep .el-input {
margin-bottom: 0 !important;
width: 90%;
}
::v-deep .el-input--small .el-input__inner {
border-radius: 32px;
}
.depart-left {
border: 1px solid #f2f2f2;
padding: 0 !important;
}
.head-container {
height: 60px;
line-height: 60px;
text-align: center;
background-color: #f2f2f2;
}
::v-deep .el-input {
margin-bottom: 0 !important;
width: 90%;
}
::v-deep .el-input--small .el-input__inner {
border-radius: 32px;
}
.tree-content {
padding: 15px;
}
.tree-content {
padding: 15px;
}
.depart-right {
border: 1px solid #f2f2f2;
}
.depart-right {
border: 1px solid #f2f2f2;
}
.right-header {
.right-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
span {
margin-left: 5px;
letter-spacing: 1px;
}
}
.right-container {
padding: 15px;
li {
padding: 8px 0;
display: flex;
align-items: center;
align-content: center;
justify-content: space-between;
padding: 0 15px;
span {
margin-left: 5px;
letter-spacing: 1px;
}
}
}
.right-container {
padding: 15px;
li {
padding: 8px 0;
display: flex;
align-content: center;
justify-content: space-between;
}
}
.footer-btn {
padding: 15px 5px 0;
text-align: right;
}
.footer-btn {
padding: 15px 5px 0;
text-align: right;
}
</style>

View File

@ -80,7 +80,7 @@ export const dialogConfig = {
{ t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'scrapNum', t_label: '设备数量' },
{ t_width: '', t_props: 'status', t_label: '审批状态', t_slot: 't_type' },
{ t_width: '', t_props: '', t_label: '报废原因' },
{ t_width: '', t_props: 'auditRemark', t_label: '报废原因' },
{ t_width: '', t_props: '', t_label: '损坏原因', t_slot: 't_damage' },
{ t_width: '', t_props: '', t_label: '报废图片', t_slot: 't_img' },
{ t_width: '', t_props: 'remark', t_label: '备注' },

View File

@ -118,7 +118,10 @@
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">
<ScrapImg />
<ScrapImg
v-if="data.fileUrl"
:scrapImgUrl="data.fileUrl"
/>
</template>
</TableModel>
<el-row
@ -346,7 +349,7 @@ export default {
handler(newVal) {
/* 监听外层弹框关闭 清空勾选的数据 */
if (!newVal.outerVisible) {
this.selectionList = []
this.selAuditingList = []
}
},
deep: true,

View File

@ -80,7 +80,8 @@ export const dialogConfig = {
{ t_width: '', t_props: 'specificationType', t_label: '规格型号' },
{ t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'scrapNum', t_label: '设备数量' },
{ t_width: '', t_props: 'remark', t_label: '报废原因' },
{ t_width: '', t_props: 'auditRemark', t_label: '报废原因' },
{ t_width: '', t_props: '', t_label: '损坏原因', t_slot: 't_damage' },
{ t_width: '', t_props: 'fileUrl', t_label: '报废图片', t_slot: 'imgPreview' },
],

View File

@ -112,8 +112,16 @@
:sendApi="getDialogListApi"
:config="dialogConfig"
>
<template slot="imgPreview">
<ScrapImg />
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
{{ data.scrapType == 1 ? '人为' : '自然' }}
</template>
<!-- 报废图片 -->
<template slot="imgPreview" slot-scope="{ data }">
<ScrapImg
v-if="data.fileUrl"
:scrapImgUrl="data.fileUrl"
/>
</template> </TableModel
></template>
@ -124,7 +132,10 @@
<!-- 部门选择 -->
<template v-if="dialogConfig.outerTitle === '选择审批部门'">
<SelDepart @closeDepartSel="closeDepartSel" />
<SelDepart
@closeDepartSel="closeDepartSel"
ref="selDepartRef"
/>
</template>
</template>
</DialogModel>
@ -218,23 +229,31 @@ export default {
this.temp = !this.temp
},
/* 关闭选择审批部门弹框 */
/* 确定或取消按钮触发的自定义事件 */
async closeDepartSel(val, list) {
// val === 0 ===1
if (val === 0) {
this.dialogConfig.outerVisible = false
this.$refs.listingTbRef.getList()
this.submitScrapParams.taskIdList = []
return
}
if (list.length < 1) {
this.$message.error('请选择审批部门')
return
}
this.submitScrapParams.deptIds = []
list.map((e) => {
this.submitScrapParams.deptIds.push(e.id)
})
const res = await submitScrapApi(this.submitScrapParams)
if (res.code == 200) {
this.$message.success('已提交成功')
this.dialogConfig.outerVisible = val
this.dialogConfig.outerVisible = false
this.$refs.listingTbRef.getList()
this.submitScrapParams.taskIdList = []
}
this.submitScrapParams.deptIds = this.submitScrapParams.taskIdList =
[]
this.$refs.selDepartRef.clearNode()
},
/* 批量提交报废按钮 */
handelSubmitScrap() {

View File

@ -17,6 +17,7 @@
@queryParts="queryParts"
@editParts="editParts"
@acceptParts="acceptParts"
@partsSaveSuccess="partsSaveSuccess"
/>
</div>
</template>

View File

@ -43,11 +43,11 @@ module.exports = {
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网
// target: `https://z.csgmall.com.cn`,
target: `http://10.40.92.51:28080`, //超
// target: `http://10.40.92.51:28080`, //超
// target: `http://10.40.92.81:8080`, //韩/
// target: `http://10.40.92.74:8080`,//旭/
// target: `http://10.40.92.148:28080`, //帅
// target: `http://10.40.92.253:28080`, //福
// target: `http://10.40.92.138:28080`, //帅
target: `http://10.40.92.253:28080`, //福
//******** 注意事项 ********* */
//1.全局替换qrUrl二维码扫码提供的网址-发布服务器的地址target;