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

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

View File

@ -68,154 +68,164 @@
</template> </template>
<script> <script>
import { deptTreeSelect } from '@/api/system/user' import { deptTreeSelect } from '@/api/system/user'
export default { export default {
data() { props: {
return { deptIds: {
deptName: '', type: Array,
deptOptions: [], default: () => [],
defaultProps: {
children: 'children',
label: 'label',
},
deptAmount: 0,
selDeptAmount: 0,
selDeptList: [],
}
}, },
created() { },
this.getDeptTree() data() {
}, return {
methods: { deptName: '',
/** 查询部门下拉树结构 */ deptOptions: [],
getDeptTree() { defaultProps: {
deptTreeSelect().then((res) => { children: 'children',
this.deptOptions = res.data label: 'label',
this.getNodeAmount(res.data)
})
}, },
// deptAmount: 0,
handleNodeClick(data) { selDeptAmount: 0,
if (this.selDeptList.length < 1) { selDeptList: [],
this.selDeptList.push(data) }
},
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 { } else {
let temp = false this.selDeptList.push(data)
this.selDeptList.forEach((e) => {
if (e.id === data.id) {
temp = true
}
})
if (temp) {
this.$message.error('该单位已选择,不可重复选择')
return
} else {
this.selDeptList.push(data)
}
} }
}
this.selDeptAmount++ 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
},
}, },
watch: { //
// filterNode(value, data) {
deptName(val) { if (!value) return true
this.$refs.tree.filter(val) 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.depart-left { .depart-left {
border: 1px solid #f2f2f2; border: 1px solid #f2f2f2;
padding: 0 !important; padding: 0 !important;
} }
.head-container { .head-container {
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
text-align: center; text-align: center;
background-color: #f2f2f2; background-color: #f2f2f2;
} }
::v-deep .el-input { ::v-deep .el-input {
margin-bottom: 0 !important; margin-bottom: 0 !important;
width: 90%; width: 90%;
} }
::v-deep .el-input--small .el-input__inner { ::v-deep .el-input--small .el-input__inner {
border-radius: 32px; border-radius: 32px;
} }
.tree-content { .tree-content {
padding: 15px; padding: 15px;
} }
.depart-right { .depart-right {
border: 1px solid #f2f2f2; 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; display: flex;
align-items: center; align-content: center;
justify-content: space-between; justify-content: space-between;
padding: 0 15px;
span {
margin-left: 5px;
letter-spacing: 1px;
}
} }
}
.right-container { .footer-btn {
padding: 15px; padding: 15px 5px 0;
text-align: right;
li { }
padding: 8px 0;
display: flex;
align-content: center;
justify-content: space-between;
}
}
.footer-btn {
padding: 15px 5px 0;
text-align: right;
}
</style> </style>

View File

@ -80,7 +80,7 @@ export const dialogConfig = {
{ t_width: '', t_props: 'maCode', t_label: '设备编码' }, { t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'scrapNum', t_label: '设备数量' }, { t_width: '', t_props: 'scrapNum', t_label: '设备数量' },
{ t_width: '', t_props: 'status', t_label: '审批状态', t_slot: 't_type' }, { 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_damage' },
{ t_width: '', t_props: '', t_label: '报废图片', t_slot: 't_img' }, { t_width: '', t_props: '', t_label: '报废图片', t_slot: 't_img' },
{ t_width: '', t_props: 'remark', t_label: '备注' }, { t_width: '', t_props: 'remark', t_label: '备注' },

View File

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

View File

@ -80,7 +80,8 @@ export const dialogConfig = {
{ t_width: '', t_props: 'specificationType', t_label: '规格型号' }, { t_width: '', t_props: 'specificationType', t_label: '规格型号' },
{ t_width: '', t_props: 'maCode', t_label: '设备编码' }, { t_width: '', t_props: 'maCode', t_label: '设备编码' },
{ t_width: '', t_props: 'scrapNum', 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' }, { t_width: '', t_props: 'fileUrl', t_label: '报废图片', t_slot: 'imgPreview' },
], ],

View File

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

View File

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

View File

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