删除按钮

haicang
jwg 3 weeks ago
parent f001558602
commit 6591dd8b71

@ -15,35 +15,93 @@
</div> --> </div> -->
<div class="ct-md"> <div class="ct-md">
<div class="mt5"> <div class="mt5">
申请类型{{getDictDataLabel(DICT_TYPE.BS_BILL_TYPE,itemData.billType) || ''}} 申请类型{{
getDictDataLabel(DICT_TYPE.BS_BILL_TYPE, itemData.billType) ||
''
}}
</div> </div>
<div class="mt5"> <div class="mt5">申请人{{ itemData.nickname }}</div>
申请人{{itemData.nickname}} <div class="mt5">项目名称 {{ itemData.projectName }}</div>
</div> <div class="mt5">申请部门 {{ userInfo.dept.name }}</div>
<div class="mt5"> <div style="margin-top: 0.3rem">
项目名称 {{itemData.projectName}} 申请时间
</div> {{ dayjs(itemData.createTime).format('YY/MM/DD HH:ss') }}
<div class="mt5">
申请部门 {{userInfo.dept.name}}
</div>
<div style="margin-top: 0.3rem;">
申请时间 {{dayjs(itemData.createTime).format('YY/MM/DD HH:ss')}}
</div> </div>
</div> </div>
<div class="cr-bt" style="margin-top: 0.6rem;"> <div class="cr-bt" style="margin-top: 0.6rem">
<div class="tags" :style="`border: 1px solid ${handleFilterStatus(DICT_TYPE.BS_EXPENSE_APPLY_STATUS,itemData.status).color};color:${handleFilterStatus(DICT_TYPE.BS_EXPENSE_APPLY_STATUS,itemData.status).color}`"> {{handleFilterStatus(DICT_TYPE.BS_EXPENSE_APPLY_STATUS,itemData.status).label}}</div> <div
class="tags"
:style="`border: 1px solid ${
handleFilterStatus(
DICT_TYPE.BS_EXPENSE_APPLY_STATUS,
itemData.status
).color
};color:${
handleFilterStatus(
DICT_TYPE.BS_EXPENSE_APPLY_STATUS,
itemData.status
).color
}`"
>
{{
handleFilterStatus(
DICT_TYPE.BS_EXPENSE_APPLY_STATUS,
itemData.status
).label
}}
</div>
</div> </div>
</div> </div>
<div class="box-rt"> <div class="box-rt">
<!-- {{listType}} --> <!-- {{listType}} -->
<van-icon class="icon-box" v-hasPermi="[listType === 'myNewTrips' ? 'bs:expense-apply:myquery' : 'bs:expense-apply:query']" @click="handleShow(itemData)" name="eye-o" color="#05A9FF" size="25" /> <van-icon
class="icon-box"
v-hasPermi="[
listType === 'myNewTrips'
? 'bs:expense-apply:myquery'
: 'bs:expense-apply:query'
]"
@click="handleShow(itemData)"
name="eye-o"
color="#05A9FF"
size="25"
/>
<!-- <van-icon class="icon-box" v-hasPermi="['bs:expense-apply:create']" v-if="listType !== 'myNewTrips'" @click="handleEdit(itemData.id,itemData.status)" name="edit" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':''" size="25" /> <!-- <van-icon class="icon-box" v-hasPermi="['bs:expense-apply:create']" v-if="listType !== 'myNewTrips'" @click="handleEdit(itemData.id,itemData.status)" name="edit" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':''" size="25" />
<van-icon class="icon-box" v-hasPermi="['bs:expense-apply:delete']" v-if="listType !== 'myNewTrips'" @click="handleDel(itemData.id,itemData.status,temData.creator)" name="delete-o" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':'#EC3359'" size="25" /> <van-icon class="icon-box" v-hasPermi="['bs:expense-apply:delete']" v-if="listType !== 'myNewTrips'" @click="handleDel(itemData.id,itemData.status,temData.creator)" name="delete-o" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':'#EC3359'" size="25" />
--> -->
<van-icon class="icon-box" v-hasPermi="['bs:expense-apply:create']" v-if="listType == 'myNewTrips'" @click="handleEdit(itemData)" name="edit" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':''" size="25" /> <van-icon
<van-icon class="icon-box" v-hasPermi="['bs:expense-apply:mydelete']" v-if="listType == 'myNewTrips'" @click="handleDel(itemData.id,itemData.status,temData.creator)" name="delete-o" :color="!(itemData.status==0 || (itemData.status==3 && userInfo.id ==itemData.creator)) ?'#ccc':'#EC3359'" size="25" /> class="icon-box"
v-hasPermi="['bs:expense-apply:create']"
v-if="listType == 'myNewTrips'"
@click="handleEdit(itemData)"
name="edit"
:color="
!(
itemData.status == 0 ||
(itemData.status == 3 && userInfo.id == itemData.creator)
)
? '#ccc'
: ''
"
size="25"
/>
<van-icon
class="icon-box"
v-hasPermi="['bs:expense-apply:mydelete']"
v-if="listType == 'myNewTrips'"
@click="handleDel(itemData.id, itemData.status, itemData.creator)"
name="delete-o"
:color="
!(
itemData.status == 0 ||
(itemData.status == 3 && userInfo.id == itemData.creator)
)
? '#ccc'
: '#EC3359'
"
size="25"
/>
</div> </div>
</div> </div>
</div> </div>
@ -51,8 +109,8 @@
</template> </template>
<script> <script>
import { handleFilterStatus } from "@/utils/dict"; import { handleFilterStatus } from '@/utils/dict'
import { deleteExpenseApply, deleteMyExpenseApply } from "@/api/bs/expenseApply"; import { deleteExpenseApply, deleteMyExpenseApply } from '@/api/bs/expenseApply'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { Dialog } from 'vant' import { Dialog } from 'vant'
export default { export default {
@ -60,13 +118,10 @@ export default {
listType: String, listType: String,
itemData: { itemData: {
required: true, required: true,
default: () => { } default: () => {}
}, }
},
components: {
}, },
components: {},
data() { data() {
return { return {
jumoStudentId: null jumoStudentId: null
@ -77,13 +132,11 @@ export default {
this.handleUpdataInfo() this.handleUpdataInfo()
} }
}, },
mounted() { mounted() {},
},
computed: { computed: {
userInfo() { userInfo() {
return JSON.parse(window.localStorage.getItem('userInfo') || { dept: {} }) return JSON.parse(window.localStorage.getItem('userInfo') || { dept: {} })
}, }
}, },
methods: { methods: {
handleShow(obj) { handleShow(obj) {
@ -95,7 +148,7 @@ export default {
}, },
handleEdit(obj) { handleEdit(obj) {
const { id, status, billType, creator } = obj const { id, status, billType, creator } = obj
if (!(status==0 || (status ==3 && this.userInfo.id ==creator))) { if (!(status == 0 || (status == 3 && this.userInfo.id == creator))) {
return return
} }
this.jumoStudentId = id this.jumoStudentId = id
@ -104,27 +157,29 @@ export default {
query: { id, type: 'edit', listType: this.listType, billType } query: { id, type: 'edit', listType: this.listType, billType }
}) })
}, },
handleDel(id, status,creator) { handleDel(id, status, creator) {
if (!(status==0 || (status ==3 && this.userInfo.id ==creator))) { if (!(status == 0 || (status == 3 && this.userInfo.id == creator))) {
return return
} }
Dialog.confirm({ Dialog.confirm({
title: '提示', title: '提示',
message: '你确定要删除吗?', message: '你确定要删除吗?'
}) }).then(() => {
.then(() => { let api =
let api = this.listType === 'myNewTrips' ? deleteMyExpenseApply : deleteExpenseApply this.listType === 'myNewTrips'
api(id).then(() => { ? deleteMyExpenseApply
this.$emit('onAllRefresh') : deleteExpenseApply
}) api(id).then(() => {
this.$emit('onAllRefresh')
}) })
})
}, },
handleFilterStatus, handleFilterStatus,
dayjs, dayjs,
handleUpdataInfo() { handleUpdataInfo() {
this.jumoStudentId = null this.jumoStudentId = null
this.$emit('onUpdataInfo', this.itemData.id) this.$emit('onUpdataInfo', this.itemData.id)
}, }
} }
} }
</script> </script>

Loading…
Cancel
Save