|
@@ -26,7 +26,9 @@
|
|
<script>
|
|
<script>
|
|
import {
|
|
import {
|
|
getWelfarePage,
|
|
getWelfarePage,
|
|
- getWelfareDetail
|
|
|
|
|
|
+ getWelfareDetail,
|
|
|
|
+ getWelfareCategoryPage,
|
|
|
|
+ deleteWelfare
|
|
} from '@/api/salary'
|
|
} from '@/api/salary'
|
|
import welfareListEdit from './welfareListEdit.vue'
|
|
import welfareListEdit from './welfareListEdit.vue'
|
|
export default {
|
|
export default {
|
|
@@ -37,25 +39,7 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
title: '',
|
|
title: '',
|
|
- searchItems: [
|
|
|
|
- {
|
|
|
|
- label: '福利名称',
|
|
|
|
- name: 'name',
|
|
|
|
- type: 'input',
|
|
|
|
- option: {
|
|
|
|
- placeholder: '请输入补助名称'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- label: '福利类别',
|
|
|
|
- name: 'subsidyPersonnelCategoryId',
|
|
|
|
- type: 'autocomplete',
|
|
|
|
- option: {
|
|
|
|
- placeholder: '请输入补助分类',
|
|
|
|
- fetchSuggestions: this.fetchSuggestions
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
|
|
+ subsidyPersonnelCategoryIdItems: [],
|
|
searchValues: {},
|
|
searchValues: {},
|
|
headers: [
|
|
headers: [
|
|
{
|
|
{
|
|
@@ -86,7 +70,36 @@ export default {
|
|
current: 1,
|
|
current: 1,
|
|
size: 10
|
|
size: 10
|
|
},
|
|
},
|
|
- orders: []
|
|
|
|
|
|
+ orders: [],
|
|
|
|
+ loadingSelect: false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ searchItems () {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ label: '福利名称',
|
|
|
|
+ prop: 'subsidyName',
|
|
|
|
+ type: 'input',
|
|
|
|
+ option: {
|
|
|
|
+ placeholder: '请输入补助名称'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: '福利类别',
|
|
|
|
+ prop: 'subsidyPersonnelCategoryId',
|
|
|
|
+ type: 'select',
|
|
|
|
+ option: {
|
|
|
|
+ placeholder: '请输入补助分类',
|
|
|
|
+ filterable: true,
|
|
|
|
+ remote: true,
|
|
|
|
+ remoteMethod: this.remoteMethod,
|
|
|
|
+ defaultFirstOption: true,
|
|
|
|
+ loading: this.loadingSelect,
|
|
|
|
+ items: this.subsidyPersonnelCategoryIdItems
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
@@ -94,6 +107,7 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async init () {
|
|
async init () {
|
|
|
|
+ this.loading = true
|
|
try {
|
|
try {
|
|
const { data } = await getWelfarePage({
|
|
const { data } = await getWelfarePage({
|
|
entity: this.searchValues,
|
|
entity: this.searchValues,
|
|
@@ -106,6 +120,8 @@ export default {
|
|
this.total = data.total
|
|
this.total = data.total
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.$message.error(error)
|
|
this.$message.error(error)
|
|
|
|
+ } finally {
|
|
|
|
+ this.loading = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onSearch () {
|
|
onSearch () {
|
|
@@ -116,21 +132,67 @@ export default {
|
|
this.pageInfo.current = page
|
|
this.pageInfo.current = page
|
|
this.init()
|
|
this.init()
|
|
},
|
|
},
|
|
- fetchSuggestions (str, cb) {},
|
|
|
|
|
|
+ async remoteMethod (str) {
|
|
|
|
+ try {
|
|
|
|
+ this.loadingSelect = true
|
|
|
|
+ const { data } = await getWelfareCategoryPage({
|
|
|
|
+ page: {
|
|
|
|
+ current: 1,
|
|
|
|
+ size: 10
|
|
|
|
+ },
|
|
|
|
+ entity: {
|
|
|
|
+ title: str || null
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.subsidyPersonnelCategoryIdItems = data.records
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.subsidyPersonnelCategoryIdItems = []
|
|
|
|
+ this.$message.error(error)
|
|
|
|
+ } finally {
|
|
|
|
+ this.loadingSelect = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
onAdd () {
|
|
onAdd () {
|
|
this.title = '新增福利'
|
|
this.title = '新增福利'
|
|
- this.$refs.welfareListEditRefs.open()
|
|
|
|
|
|
+ this.$refs.welfareListEditRefs.open({
|
|
|
|
+ subsidyPersonnelCategoryId: null,
|
|
|
|
+ subsidySalary: null,
|
|
|
|
+ subsidyTag: null,
|
|
|
|
+ subsidyCheck: 0,
|
|
|
|
+ subsidyName: null
|
|
|
|
+ })
|
|
},
|
|
},
|
|
async onEdit (item) {
|
|
async onEdit (item) {
|
|
this.title = '编辑福利'
|
|
this.title = '编辑福利'
|
|
try {
|
|
try {
|
|
const { data } = await getWelfareDetail({ id: item.subsidyCategoryId })
|
|
const { data } = await getWelfareDetail({ id: item.subsidyCategoryId })
|
|
- this.$refs.welfareListEditRefs.open(data)
|
|
|
|
|
|
+ this.$refs.welfareListEditRefs.open({
|
|
|
|
+ subsidyCategoryId: data.subsidyCategoryId,
|
|
|
|
+ subsidyPersonnelCategoryId: data.subsidyPersonnelCategoryId,
|
|
|
|
+ subsidySalary: data.subsidySalary,
|
|
|
|
+ subsidyTag: data.subsidyTag,
|
|
|
|
+ subsidyCheck: data.subsidyCheck,
|
|
|
|
+ subsidyName: data.subsidyName
|
|
|
|
+ })
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.$message.error(error)
|
|
this.$message.error(error)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onDelete () {}
|
|
|
|
|
|
+ onDelete (item) {
|
|
|
|
+ this.$confirm('确定删除?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(async () => {
|
|
|
|
+ try {
|
|
|
|
+ await deleteWelfare({ id: item.subsidyCategoryId })
|
|
|
|
+ this.$message.success('删除成功')
|
|
|
|
+ this.init()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error(error)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|