| | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const dialogVisible = ref(false) |
| | | const dialogVisibleProcess = ref(false) |
| | | let roleList = ref([]) |
| | | //工序 |
| | | const processValue = ref() |
| | | let userRole= ref({ |
| | | userId:'', |
| | | roles:[] |
| | | }) |
| | | let processRow = ref({ |
| | | process: null, |
| | | userId:null |
| | | }) |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | |
| | | }, |
| | | }) |
| | | onBeforeMount(()=>{ |
| | | let columns = [{title: t('basicData.operate'), width: 133, slots: { default: 'button_slot' }}] |
| | | let columns = [{title: t('basicData.operate'), width: 213, slots: { default: 'button_slot' }}] |
| | | const columnName = { |
| | | loginName: t('user.userId'), |
| | | userName:t('user.user'), |
| | | // address:'地址', |
| | | address:t('report.workingProcedure'), |
| | | // phone:'电话', |
| | | role:t('role.role'), |
| | | createTime:t('basicData.creationTime') |
| | |
| | | |
| | | }) |
| | | onMounted(()=>{ |
| | | selectProcess(); |
| | | request.get('/userInfo/findAll').then(res=>{ |
| | | console.log(res.data) |
| | | let arr = res.data.users[0] |
| | | arr.forEach(item=>{ |
| | | let bValues = item.userRoleList.map(item => item.role); |
| | |
| | | gridOptions.data = res.data.users[0] |
| | | roleList.value = res.data.role[0] |
| | | }) |
| | | |
| | | }) |
| | | |
| | | const getTableRow = (row,type) => { |
| | |
| | | }) |
| | | break |
| | | } |
| | | case 'editProcess': { |
| | | dialogVisibleProcess.value = true |
| | | processRow.value.userId = row.id |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | done() |
| | | } |
| | | |
| | | const selectProcess = () => { |
| | | request.post('userInfo/selectProcess').then(res=>{ |
| | | processRow.value.process=res.data.process |
| | | }) |
| | | } |
| | | |
| | | const roleUpdate = () => { |
| | | userRole.value.roles = [userRole.value.roles] |
| | | request.post('userRole/updateUserRole',userRole.value).then(res=>{ |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const updateProcess = () => { |
| | | let userId=processRow.value.userId |
| | | if (processValue.value!=null){ |
| | | request.post(`userInfo/updateProcess/${userId}/${processValue.value}`).then(res=>{ |
| | | if(res.code==200 && res.data===true){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | router.push({path:'/main/user/userList',query:{random:Math.random()}}) |
| | | } |
| | | |
| | | }) |
| | | dialogVisible.value = false |
| | | }else { |
| | | ElMessage.warning(t('report.pleaseSelectAProcessFirst')) |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100% ;"> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | > |
| | | <template #filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | > |
| | | <template #filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input |
| | | type="type" |
| | | v-model="option.data" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{ $t('user.setUpRoles') }}</el-button> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | </vxe-grid> |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{ $t('user.setUpRoles') }}</el-button> |
| | | <el-button @click="getTableRow(row,'editProcess')" link type="primary" size="small">{{ $t('user.setProcess') }}</el-button> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | </vxe-grid> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | title="角色选择" |
| | | :title="$t('user.roleSelection')" |
| | | width="30%" |
| | | :before-close="handleClose" |
| | | > |
| | | <span> |
| | | <el-checkbox v-for="(item) in roleList" |
| | | <el-radio v-for="(item) in roleList" |
| | | :label="item.id" |
| | | v-model="userRole.roles" > |
| | | {{item.role}} |
| | | </el-checkbox> |
| | | </el-radio> |
| | | </span> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">{{ $t('basicData.cancelButtonText') }}</el-button> |
| | | <el-button type="primary" @click="roleUpdate"> |
| | | {{ $t('basicData.confirmButtonText') }} |
| | | </el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog |
| | | v-model="dialogVisibleProcess" |
| | | :title="$t('user.roleSelection')" |
| | | width="30%" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-select v-model="processValue" clearable :placeholder="$t('reportingWorks.selectProcess')" default-value="default_city" style="width: 120px"> |
| | | <el-option |
| | | v-for="item in processRow['process']" |
| | | :key="item.id" |
| | | :label="item.basic_name" |
| | | :value="item.basic_name" |
| | | /> |
| | | </el-select> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="dialogVisibleProcess = false">{{ $t('basicData.cancelButtonText') }}</el-button> |
| | | <el-button type="primary" @click="updateProcess"> |
| | | {{ $t('basicData.confirmButtonText') }} |
| | | </el-button> |
| | | </span> |
| | |
| | | .dialog-footer button:first-child { |
| | | margin-right: 10px; |
| | | } |
| | | .head{ |
| | | width: 100%; |
| | | height: 35px; |
| | | } |
| | | |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 0px); |
| | | } |
| | | </style> |