1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

处理列表文件存在判断显示

This commit is contained in:
dengfuchuan 2021-04-11 16:19:59 +08:00
parent c02520bf98
commit 1ed1043a8d
6 changed files with 74 additions and 5 deletions

View File

@ -193,3 +193,8 @@
font-size: 16px;
background-size: 16px;
}
//设置 icon 的默认颜色
.el-icon-folder-opened {
color: #f56c6c;
}

View File

@ -41,7 +41,8 @@
</div>
<div v-else-if="d.label === '操作'">
<el-button icon="el-icon-view" type="text" title="编辑" @click="edit(scope.row)" />
<el-button icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-if="scope.row.attach.length <= 0" icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-else icon="el-icon-folder-opened" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
</div>
<div v-else>{{ scope.row[d.prop] }}</div>
@ -246,6 +247,7 @@ export default {
})
}
this.list = JSON.parse(JSON.stringify(this.data))
console.log(this.list, 'this.list')
} else {
this.$message.error(data.message)
}

View File

@ -56,5 +56,12 @@ export default {
method: 'post',
data: `start=0&limit=10&where_sql=hidden_danger.hidden_danger_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
}).then(response => response.data)
},
queryAttach(keyids) {
return request({
url: `/commonAction.do`,
method: 'post',
data: `funid=queryevent&pagetype=grid&eventcode=query_attach&tablename=hidden_danger&keyids=${keyids}&is_queryrelat=0&user_id=${roles}&dataType=json&query_type=0&has_page=0`
}).then(response => response.data)
}
}

View File

@ -10,7 +10,7 @@
<el-table
ref="deptTable"
v-loading="loading"
:data="data"
:data="list"
style="width: 100%"
stripe
@selection-change="handleSelectionChange"
@ -46,7 +46,8 @@
</div>
<div v-else-if="d.label === '操作'">
<el-button icon="el-icon-view" type="text" title="编辑" @click="edit(scope.row)" />
<el-button icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-if="scope.row.attach.length <= 0" icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-else icon="el-icon-folder-opened" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
</div>
<div v-else>{{ scope.row[d.prop] }}</div>
@ -92,8 +93,10 @@ export default {
parseDay,
loading: false,
data: [],
list: [],
deptTree: [],
ids: [],
keyids: [],
isBacklog: this.$route.query.isBacklog || false,
levels: [],
pager: {
@ -221,6 +224,10 @@ export default {
if (data.success) {
this.data = data.data.root
this.pager.total = data.data.total
this.keyids = this.data.map(d => {
return d.hidden_danger__hidden_danger_id
}).join()
this.queryAttach()
setTimeout(() => {
this.loading = false
}, 200)
@ -233,6 +240,23 @@ export default {
this.whereSql = sql
this.getList()
},
queryAttach() {
api.queryAttach(this.keyids).then(data => {
if (data.success) {
if (data.data.length > 0) {
this.attachData = data.data
this.data.forEach((d, i) => {
this.data[i].attach = this.attachData.filter(v => {
return v.data_id === d.hidden_danger__hidden_danger_id
})
})
}
this.list = JSON.parse(JSON.stringify(this.data))
} else {
this.$message.error(data.message)
}
})
},
editCreate() {
const param = `/hidden_danger/hidden_reform/create`
this.$router.push(param)

View File

@ -56,5 +56,12 @@ export default {
method: 'post',
data: `start=0&limit=10&where_sql=hidden_danger.hidden_danger_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
}).then(response => response.data)
},
queryAttach(keyids) {
return request({
url: `/commonAction.do`,
method: 'post',
data: `funid=queryevent&pagetype=grid&eventcode=query_attach&tablename=hidden_danger&keyids=${keyids}&is_queryrelat=0&user_id=${roles}&dataType=json&query_type=0&has_page=0`
}).then(response => response.data)
}
}

View File

@ -10,7 +10,7 @@
<el-table
ref="deptTable"
v-loading="loading"
:data="data"
:data="list"
style="width: 100%"
stripe
@selection-change="handleSelectionChange"
@ -42,7 +42,8 @@
</div>
<div v-else-if="d.label === '操作'">
<el-button icon="el-icon-view" type="text" title="编辑" @click="edit(scope.row)" />
<el-button icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-if="scope.row.attach.length <= 0" icon="el-icon-folder" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<el-button v-else icon="el-icon-folder-opened" type="text" title="查看附件" @click="checkAttach(scope.row)" />
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
</div>
<div v-else>{{ scope.row[d.prop] }}</div>
@ -88,8 +89,10 @@ export default {
parseDay,
loading: false,
data: [],
list: [],
deptTree: [],
ids: [],
keyids: [],
isBacklog: this.$route.query.isBacklog || false,
levels: [],
pager: {
@ -197,6 +200,10 @@ export default {
if (data.success) {
this.data = data.data.root
this.pager.total = data.data.total
this.keyids = this.data.map(d => {
return d.hidden_danger__hidden_danger_id
}).join()
this.queryAttach()
setTimeout(() => {
this.loading = false
}, 200)
@ -209,6 +216,23 @@ export default {
this.whereSql = sql
this.getList()
},
queryAttach() {
api.queryAttach(this.keyids).then(data => {
if (data.success) {
if (data.data.length > 0) {
this.attachData = data.data
this.data.forEach((d, i) => {
this.data[i].attach = this.attachData.filter(v => {
return v.data_id === d.hidden_danger__hidden_danger_id
})
})
}
this.list = JSON.parse(JSON.stringify(this.data))
} else {
this.$message.error(data.message)
}
})
},
editCreate() {
const param = `/hidden_danger/hidden_review/create`
this.$router.push(param)