bug修改

This commit is contained in:
zhaoxiao
2021-10-11 17:54:44 +08:00
parent 38a6e71c03
commit 942a56e7d5
6 changed files with 116 additions and 18 deletions
@@ -34,8 +34,11 @@
@change="handleImportExcel" v-has="'company:import'">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<a-button type="primary" icon="export" @click="handleExportXls('单位/开票信息')" v-has="'company:export'">导出</a-button>
<a-button type="primary" icon="download" @click="downTemplate('单位/开票信息导入模板')" v-has="'company:downTemplate'">下载模板</a-button>
<a-button type="primary" icon="export" @click="handleExportXls('单位/开票信息')" v-has="'company:export'">导出
</a-button>
<a-button type="primary" icon="download" @click="downTemplate('单位/开票信息导入模板')" v-has="'company:downTemplate'">
下载模板
</a-button>
<a-button type="danger" icon="delete" @click="batchDel" v-has="'company:batchDel'">批量删除</a-button>
</div>
<!-- 操作按钮区域-end-->
@@ -61,9 +64,10 @@
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="handleAudit(record.id)" v-if="record.dataSource===2 && record.status===2" v-has="'company:confirm'">确认</a>
<a @click="handleAudit(record.id)" v-if="record.dataSource===2 && record.status===2"
v-has="'company:confirm'">确认</a>
<a @click="handleEdit(record)" v-has="'company:edit'">编辑</a>
<a @click="handleDelete(record.id)" v-has="'company:delete'">删除</a>
<a @click="confirmDelete(record)" v-has="'company:delete'">删除</a>
</span>
</a-table>
</div>
@@ -78,7 +82,8 @@ import JEllipsis from '@comp/jero/JEllipsis'
import BusinessManagementModule from './modules/BusinessManagementModule'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconImg from '@/assets/imgs/icon/icon_company_management.png'
import { aduitCompany } from '../../api/incomePaymentsApi'
import { aduitCompany, checkContactByCompany } from '../../api/incomePaymentsApi'
import { getAction } from '../../api/manage'
export default {
name: 'BusinessManagement',
@@ -177,9 +182,9 @@ export default {
const that = this
this.$confirm({
title: '确认',
content: '确认该单位信息吗?',
content: '确认该单位/开票信息吗?',
onOk: function () {
aduitCompany({id: id}).then((res) => {
aduitCompany({ id: id }).then((res) => {
if (res.success) {
that.$message.success(res.result)
that.loadData()
@@ -189,6 +194,91 @@ export default {
})
}
})
},
/**
* 单个删除的确认
* @param record
*/
confirmDelete(record) {
const that = this
checkContactByCompany({ id: record.id }).then((res) => {
if (res.success) {
let confirmContent = '确定要删除该企业吗?'
if (res.result && res.result.length > 0) {
confirmContent = `${ res.result.join(',').toString() }下有联系人,确定要删除该企业吗?`
}
this.$confirm({
title: '确认删除',
content: confirmContent,
onOk: function () {
getAction(that.url.delete, { id: record.id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
} else {
that.$message.warning(res.message)
}
})
},
batchDel() {
if (!this.url.deleteBatch) {
this.$message.error('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return
} else {
let ids = ''
for (let a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ','
}
checkContactByCompany({ id: ids }).then((res) => {
if (res.success) {
let confirmContent = '是否删除选中数据?'
if (res.result && res.result.length > 0) {
confirmContent = `${res.result.join(',').toString()}下有联系人,确定要删除选中企业吗?`
}
const that = this
this.$confirm({
title: '确认删除',
content: confirmContent,
onOk: function () {
that.loading = true
getAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的全部数据,如果是的话页码减一
if (that.ipagination.current > 1 && (that.ipagination.current === Math.ceil(that.ipagination.total / that.ipagination.pageSize)) &&
that.selectedRowKeys.length === that.dataSource.length
) {
that.ipagination.current -= 1
}
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
} else {
this.$message.warning(res.message)
}
})
}
}
}
}