工种类型配置页面接口调试完成
This commit is contained in:
parent
aefbc03683
commit
7a8388a681
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue