Browse Source

用户管理-增删查改

master
DIAMOND 2 years ago
parent
commit
e222c84923
  1. 1
      src/views/page/aside/rightMenuItem/userEdit.vue
  2. 17
      src/views/page/aside/rightMenuItem/userEditModal.vue

1
src/views/page/aside/rightMenuItem/userEdit.vue

@ -35,6 +35,7 @@ const columns = [
{ title: '序号', dataIndex: 'key' }, { title: '序号', dataIndex: 'key' },
{ title: '相机名称', dataIndex: 'name' }, { title: '相机名称', dataIndex: 'name' },
{ title: '相机IP', dataIndex: 'ip' }, { title: '相机IP', dataIndex: 'ip' },
{ title: '相机ID', dataIndex: 'cbCameraParamsId' },
{ title: '登录名', dataIndex: 'userName' }, { title: '登录名', dataIndex: 'userName' },
{ title: '密码', dataIndex: 'password' }, { title: '密码', dataIndex: 'password' },
// { title: '', dataIndex: 'userType' }, // { title: '', dataIndex: 'userType' },

17
src/views/page/aside/rightMenuItem/userEditModal.vue

@ -42,6 +42,7 @@ import { onMounted, reactive, toRaw, UnwrapRef, watch } from 'vue';
import * as cameraApi from '@/axios/cameraBase/cameraApi'; import * as cameraApi from '@/axios/cameraBase/cameraApi';
import Msg from '@/utils/message'; import Msg from '@/utils/message';
interface FormState { interface FormState {
id: string
name: string; name: string;
ip: string; ip: string;
CbCameraParamsId: string; CbCameraParamsId: string;
@ -58,6 +59,7 @@ const props = defineProps({
let labelCol = { span: 6 } let labelCol = { span: 6 }
let wrapperCol = { span: 14 } let wrapperCol = { span: 14 }
const formState: UnwrapRef<FormState> = reactive({ const formState: UnwrapRef<FormState> = reactive({
id: '',
name: '', name: '',
ip: '', ip: '',
CbCameraParamsId: '', CbCameraParamsId: '',
@ -90,6 +92,20 @@ function add() {
// //
function edit() { function edit() {
console.log('编辑!', toRaw(formState)); console.log('编辑!', toRaw(formState));
return cameraApi.Update(toRaw(formState)).then(res => {
console.log(res);
if (res.data.data == true) {
Msg.success('编辑成功')
return true
}
else {
Msg.error('编辑失败,' + res.data.message)
return false
}
}).catch((err: any) => {
Msg.error('编辑失败,' + err)
return false
})
} }
// //
@ -102,6 +118,7 @@ defineExpose({
onMounted(() => { onMounted(() => {
console.log("收到了", props.editData); console.log("收到了", props.editData);
if (props.editData != null || props.editData != undefined){ if (props.editData != null || props.editData != undefined){
formState.id = props.editData.id;
formState.name = props.editData.name; formState.name = props.editData.name;
formState.ip = props.editData.ip; formState.ip = props.editData.ip;
formState.CbCameraParamsId = props.editData.cbCameraParamsId; formState.CbCameraParamsId = props.editData.cbCameraParamsId;

Loading…
Cancel
Save