123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div>
- <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>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="cancels">取消</el-button>
- <el-button type="primary" @click="sureClick">
- 确定
- </el-button>
- </span>
- </template>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import { ref, onMounted, toRefs, watch } from 'vue';
- import { ElMessage } from 'element-plus';
- import litLine from '@/api/litLine';
- export default {
- props: {
- delModal: {
- type: Boolean,
- required: true
- },
- needList: {
- type: Object,
- required: true
- },
- sunSearch: {
- type: Function,
- required: true
- },
- flashId: {
- type: String,
- required: true,
- },//litline.vue传过来的电压id
- checkFlash: {
- type: Function,
- required: true,
- },//litline.vue传过来的便于刷新页面的方法
- },
- setup(props, { emit }) {
- let dialogVisible = ref(false)
- let result = props.delModal
- let lastList = props.needList
- let delId = ref('')
- let { cancels, sureClick } = toRefs(props)
- let flashIds = ref("")//本组件的电压等级id
- watch(() => props.flashId, (newVal) => {
- flashIds.value = newVal
- })
- function lineList() {
- delId.value = lastList.id
- dialogVisible.value = result
- flashIds.value = props.flashId
- }
- function canBack() {
- dialogVisible.value = false
- emit("delBack", dialogVisible.value)
- }
- function sureGet() {
- litLine.delLine({ id: delId.value - 0 }).then(res => {
- if (res.code == 0) {
- ElMessage({
- type: "success",
- message: "删除成功",
- duration: 1500
- })
- if (flashIds.value) {
- props.checkFlash(flashIds.value)
- } else {
- props.sunSearch()
- }
- dialogVisible.value = false
- emit("delBack", dialogVisible.value)
- }
- })
- }
- onMounted(() => {
- lineList()
- })
- return {
- dialogVisible,
- cancels: canBack,
- sureClick: sureGet,
- closes: canBack,
- flashIds,
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|