工种类型配置页面接口调试完成

This commit is contained in:
BianLzhaoMin 2025-08-13 09:13:33 +08:00
parent aefbc03683
commit 7a8388a681
1 changed files with 31 additions and 11 deletions

View File

@ -28,6 +28,8 @@
v-model="data.isSpecial"
active-text="技工"
inactive-text="普工"
:active-value="1"
:inactive-value="0"
@change="onHandleChangeIsSpecial(data)"
/>
</template>
@ -38,6 +40,8 @@
v-model="data.isEnable"
active-text="启用"
inactive-text="禁用"
:active-value="1"
:inactive-value="0"
@change="onHandleChangeIsEnable(data)"
/>
</template>
@ -155,6 +159,7 @@ export default {
postName: '', //
isSpecial: 0, //
isEnable: 1, //
id: null, // id
},
addOrEditFormRules: {
postName: [
@ -182,6 +187,10 @@ export default {
//
onHandleAddOrEditJobType(type, data) {
this.dialogConfig.outerTitle = type === 1 ? '新增' : '修改'
if (type === 2) {
const { postName, isSpecial, isEnable, id } = data
this.addOrEditForm = { postName, isSpecial, isEnable, id }
}
this.dialogConfig.outerVisible = true
},
@ -192,17 +201,32 @@ export default {
//
onHandleChangeIsSpecial(data) {
console.log(data, '特殊工种设置')
const params = {
id: data.id,
isSpecial: data.isSpecial,
}
this.onHandleChangeIsSpecialOrIsEnable(params)
},
//
//
onHandleChangeIsEnable(data) {
console.log(data, '状态')
const params = {
id: data.id,
isEnable: data.isEnable,
}
this.onHandleChangeIsSpecialOrIsEnable(params)
},
//
async onHandleChangeIsSpecialOrIsEnable(data) {
console.log(data, '修改数据')
const res = await addAdnEditJobTypeAPI(data)
if (res.code === 200) {
this.$modal.msgSuccess('操作成功')
this.$refs.jobTypeTableRef.getTableList()
this.handleCloseDialogOuter()
} else {
this.$modal.msgError(res.msg)
}
},
//
@ -215,16 +239,12 @@ export default {
onHandleConfirmAddOrEdit() {
this.$refs.addOrEditFormRef.validate(async (valid) => {
if (valid) {
console.log(this.addOrEditForm, 'addOrEditForm')
const params = { ...this.addOrEditForm }
if (this.dialogConfig.outerTitle === '修改') {
params.id = null
if (this.dialogConfig.outerTitle === '新增') {
this.$delete(params, 'id')
}
const res = await addAdnEditJobTypeAPI(params)
// console.log(res, 'res')
this.onHandleChangeIsSpecialOrIsEnable(params)
}
})
},