122 lines
3.4 KiB
Vue
122 lines
3.4 KiB
Vue
<template>
|
|
<view>
|
|
<Navbar title="随手拍" @chickIcon="chickIcon" :showRightIcon="true" :rightIcon="'camera-fill'" />
|
|
<div class="content">
|
|
<!-- 搜索 -->
|
|
<div class="search">
|
|
<u-input
|
|
placeholder="请输入搜索内容"
|
|
suffixIcon="search"
|
|
suffixIconStyle="color: #909399"
|
|
shape="circle"
|
|
@blur="handleSearch"
|
|
></u-input>
|
|
</div>
|
|
<!-- 列表 -->
|
|
<div>
|
|
<div v-for="(item, index) in tableList" :key="index" class="list-cont">
|
|
<div class="list-item">工程名称:{{ item.proName }}</div>
|
|
<div class="list-item">问题描述:{{ item.description }}</div>
|
|
<div class="list-item">状态:{{ item.status }}</div>
|
|
<div class="list-btn">
|
|
<div><u-button type="primary" size="mini" v-if="item.status !== '已保存'" @click="handleSeeEdit(1, item)">查看</u-button></div>
|
|
<div><u-button type="primary" size="mini" v-if="item.status === '已保存'" @click="handleSeeEdit(2, item)">编辑</u-button></div>
|
|
<!-- <div><u-button type="primary" size="mini" @click="handleAdd(item)">新增隐患</u-button></div>-->
|
|
</div>
|
|
</div>
|
|
<u-empty mode="data" v-if="tableList.length === 0"></u-empty>
|
|
</div>
|
|
</div>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getSnapshotList } from '../../api/snapshot'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
searchValue: '',
|
|
tableList: []
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
// 搜索
|
|
handleSearch(value) {
|
|
console.log('🚀 ~ 搜索 ~ value:', value)
|
|
this.searchValue = value
|
|
this.getList()
|
|
},
|
|
// 点击右侧按钮
|
|
chickIcon() {
|
|
console.log('🚀 ~ 点击右侧按钮chickIcon')
|
|
const params = {
|
|
type: 'add',
|
|
}
|
|
uni.navigateTo({
|
|
url: '/pages/randomlySnapPicture/addSnapPhoto?params=' + JSON.stringify(params)
|
|
})
|
|
},
|
|
// 列表
|
|
async getList() {
|
|
console.log('🚀 ~ 获取列表')
|
|
try {
|
|
const params = { proName: this.searchValue }
|
|
console.log('🚀 ~ getList ~ params:', params)
|
|
const res = await getSnapshotList(params)
|
|
console.log('🚀 ~ getList ~ res:', res)
|
|
this.tableList = res.data
|
|
} catch (error) {
|
|
console.log('🚀 ~ error', error)
|
|
}
|
|
},
|
|
// 查看编辑
|
|
handleSeeEdit(type, item) {
|
|
console.log('🚀 ~ 查看编辑 ~ type:', type)
|
|
console.log('🚀 ~ 查看编辑 ~ item:', item)
|
|
let params = {}
|
|
if (type === 1) {
|
|
params = { type: 'view', ...item }
|
|
} else if (type === 2) {
|
|
params = { type: 'edit', ...item }
|
|
}
|
|
uni.navigateTo({
|
|
url: '/pages/randomlySnapPicture/addSnapPhoto?params=' + JSON.stringify(params)
|
|
})
|
|
},
|
|
handleAdd(item) {
|
|
console.log('🚀 ~ handleAdd ~ item:', item)
|
|
const params = { isAdd: true, ...item, title: '新增隐患' }
|
|
uni.navigateTo({
|
|
url: '/pages/hiddenDangerRectificationApproval/addHiddenDanger?params=' + JSON.stringify(params)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.content {
|
|
word-break: break-all;
|
|
.search {
|
|
margin: 0 20px 10px;
|
|
}
|
|
.list-cont {
|
|
padding: 10px;
|
|
margin: 0 10px 10px;
|
|
background-color: #f5f7fa;
|
|
border-radius: 8px;
|
|
.list-item {
|
|
margin-bottom: 10px;
|
|
}
|
|
.list-btn {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
}
|
|
}
|
|
</style>
|