工种类型配置页面接口调试完成
This commit is contained in:
parent
aefbc03683
commit
7a8388a681
|
|
@ -28,6 +28,8 @@
|
||||||
v-model="data.isSpecial"
|
v-model="data.isSpecial"
|
||||||
active-text="技工"
|
active-text="技工"
|
||||||
inactive-text="普工"
|
inactive-text="普工"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
@change="onHandleChangeIsSpecial(data)"
|
@change="onHandleChangeIsSpecial(data)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -38,6 +40,8 @@
|
||||||
v-model="data.isEnable"
|
v-model="data.isEnable"
|
||||||
active-text="启用"
|
active-text="启用"
|
||||||
inactive-text="禁用"
|
inactive-text="禁用"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
@change="onHandleChangeIsEnable(data)"
|
@change="onHandleChangeIsEnable(data)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -155,6 +159,7 @@ export default {
|
||||||
postName: '', // 工种名称
|
postName: '', // 工种名称
|
||||||
isSpecial: 0, //特殊工种
|
isSpecial: 0, //特殊工种
|
||||||
isEnable: 1, // 状态
|
isEnable: 1, // 状态
|
||||||
|
id: null, // 工种id
|
||||||
},
|
},
|
||||||
addOrEditFormRules: {
|
addOrEditFormRules: {
|
||||||
postName: [
|
postName: [
|
||||||
|
|
@ -182,6 +187,10 @@ export default {
|
||||||
// 新增或修改
|
// 新增或修改
|
||||||
onHandleAddOrEditJobType(type, data) {
|
onHandleAddOrEditJobType(type, data) {
|
||||||
this.dialogConfig.outerTitle = type === 1 ? '新增' : '修改'
|
this.dialogConfig.outerTitle = type === 1 ? '新增' : '修改'
|
||||||
|
if (type === 2) {
|
||||||
|
const { postName, isSpecial, isEnable, id } = data
|
||||||
|
this.addOrEditForm = { postName, isSpecial, isEnable, id }
|
||||||
|
}
|
||||||
this.dialogConfig.outerVisible = true
|
this.dialogConfig.outerVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -192,17 +201,32 @@ export default {
|
||||||
|
|
||||||
// 特殊工种设置
|
// 特殊工种设置
|
||||||
onHandleChangeIsSpecial(data) {
|
onHandleChangeIsSpecial(data) {
|
||||||
console.log(data, '特殊工种设置')
|
const params = {
|
||||||
|
id: data.id,
|
||||||
|
isSpecial: data.isSpecial,
|
||||||
|
}
|
||||||
|
this.onHandleChangeIsSpecialOrIsEnable(params)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 状态
|
// 状态设置
|
||||||
onHandleChangeIsEnable(data) {
|
onHandleChangeIsEnable(data) {
|
||||||
console.log(data, '状态')
|
const params = {
|
||||||
|
id: data.id,
|
||||||
|
isEnable: data.isEnable,
|
||||||
|
}
|
||||||
|
this.onHandleChangeIsSpecialOrIsEnable(params)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 修改数据
|
// 修改数据
|
||||||
async onHandleChangeIsSpecialOrIsEnable(data) {
|
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() {
|
onHandleConfirmAddOrEdit() {
|
||||||
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(this.addOrEditForm, 'addOrEditForm')
|
|
||||||
|
|
||||||
const params = { ...this.addOrEditForm }
|
const params = { ...this.addOrEditForm }
|
||||||
|
if (this.dialogConfig.outerTitle === '新增') {
|
||||||
if (this.dialogConfig.outerTitle === '修改') {
|
this.$delete(params, 'id')
|
||||||
params.id = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await addAdnEditJobTypeAPI(params)
|
this.onHandleChangeIsSpecialOrIsEnable(params)
|
||||||
// console.log(res, 'res')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue