1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <div>
- <el-dialog v-model="dialogVisible" title="删除" width="30%" @close="closes" :close-on-click-modal="false">
- <div style="display: flex;justify-content:center;align-items: center;">
- <el-icon style="color: red;font-size: 40px;display: block;">
- <WarningFilled />
- </el-icon>
- <span style="display: block;">是否确认删除该信息?</span>
- </div>
- <div style="display: flex;justify-content:center;align-items: center;margin-top: 40px;">
- <el-button style="display: block;width: 150px;height: 30px;" @click="cancels">取消</el-button>
- <el-button style="display: block;width: 150px;height: 30px;" type="primary" @click="sureAdd">确认</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { ref, onMounted, toRefs, watch } from 'vue'
- import report from '@/api/report'
- import { ElMessage } from 'element-plus'
- export default {
- props: {
- delModal: {
- type: Boolean,
- required: true
- },
- delId: {
- type: String,
- required: true
- },
- searchReport: {
- type: Function,
- required: true
- }
- },
- setup(props, { emit }) {
- let dialogVisible = ref(false)
- let result = props.delModal
- let resultId = props.delId
- let lete = ref('')
- watch(() => props.delId, (newVal) => {
- lete.value = newVal
- })
- function reload() {
- dialogVisible.value = result
- lete.value = props.delId
- }
- function allClose() {
- dialogVisible.value = false
- emit("delrmBack", dialogVisible.value)
- }
- function allTrue() {
- report.delReport({ id: lete.value - 0 }).then(res => {
- if (res.code == 0) {
- ElMessage({
- type: "success",
- message: "删除成功"
- })
- props.searchReport()
- dialogVisible.value = false
- emit("delrmBack", dialogVisible.value)
- }
- })
- }
- onMounted(() => {
- reload()
- })
- return {
- dialogVisible,
- reload,
- closes: allClose,
- cancels: allClose,
- sureAdd: allTrue,
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|