chenlu
2024-12-27 f425a29a2273a81478f3533476e3c8bd7743a0e4
用户列表界面添加用户工序设置
6个文件已修改
103 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/lang/zh.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/system/user/UserList.vue 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserInfoController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/userInfo/UserMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/userInfo/UserService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/userInfo/User.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/zh.js
@@ -818,6 +818,7 @@
        userId:'用户ID',
        user:'用户',
        setUpRoles:'设置角色',
        setProcess:'设置工序',
        changePassword:'修改密码',
        OldPassword:'旧密码',
        TheNewPassword:'新密码',
north-glass-erp/northglass-erp/src/views/system/user/UserList.vue
@@ -9,10 +9,17 @@
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({
@@ -58,11 +65,11 @@
  },
})
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')
@@ -81,6 +88,7 @@
})
onMounted(()=>{
  selectProcess();
  request.get('/userInfo/findAll').then(res=>{
    let arr = res.data.users[0]
    arr.forEach(item=>{
@@ -90,6 +98,7 @@
    gridOptions.data = res.data.users[0]
    roleList.value = res.data.role[0]
  })
})
const getTableRow =  (row,type) => {
@@ -114,6 +123,11 @@
      })
      break
    }
    case 'editProcess': {
      dialogVisibleProcess.value = true
      processRow.value.userId = row.id
      break
    }
  }
}
@@ -121,6 +135,12 @@
const handleClose = (done) => {
  userRole.value.roles = []
  done()
}
const selectProcess = () => {
  request.post('userInfo/selectProcess').then(res=>{
     processRow.value.process=res.data.process
  })
}
const roleUpdate = () => {
@@ -133,6 +153,23 @@
  })
  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'))
  }
}
@@ -162,6 +199,7 @@
        <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>
@@ -193,6 +231,29 @@
      </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>
      </template>
    </el-dialog>
  </div>
</template>
north-glass-erp/src/main/java/com/example/erp/controller/userInfo/UserInfoController.java
@@ -61,4 +61,18 @@
    public Result findAll(){
        return Result.seccess(userService.findAll());
    }
    @ApiOperation("查询所有工序")
    @SaCheckPermission("userList.search")
    @PostMapping("selectProcess")
    public Result selectProcess(){
        return Result.seccess(userService.selectProcessSv());
    }
    @ApiOperation("修改用户工序")
    @SaCheckPermission("userList.search")
    @PostMapping("updateProcess/{id}/{process}")
    public Result updateProcess(@PathVariable Integer id,@PathVariable String process){
        return Result.seccess(userService.updateProcessSv(id,process));
    }
}
north-glass-erp/src/main/java/com/example/erp/mapper/userInfo/UserMapper.java
@@ -36,4 +36,6 @@
    Boolean updatePassWordById(Integer id,String passWord);
    Boolean updateUserNameById(Integer id,String userName);
    Boolean updateProcessMp(Integer id, String process);
}
north-glass-erp/src/main/java/com/example/erp/service/userInfo/UserService.java
@@ -9,6 +9,7 @@
import com.example.erp.entity.userInfo.Role;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.entity.userInfo.User;
import com.example.erp.mapper.pp.ProductionSchedulingMapper;
import com.example.erp.mapper.userInfo.*;
import com.example.erp.tools.TokenTools;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,12 +33,14 @@
    private final UserRoleMapper userRoleMapper;
   private final PermissionRoleMapper permissionRoleMapper;
    private final ProductionSchedulingMapper productionSchedulingMapper;
    public UserService(UserMapper userMapper, RoleMapper roleMapper, PermissionRoleMapper permissionRoleMapper, UserRoleMapper userRoleMapper) {
    public UserService(UserMapper userMapper, RoleMapper roleMapper, PermissionRoleMapper permissionRoleMapper, UserRoleMapper userRoleMapper, ProductionSchedulingMapper productionSchedulingMapper) {
        this.userMapper = userMapper;
        this.roleMapper = roleMapper;
        this.permissionRoleMapper = permissionRoleMapper;
        this.userRoleMapper = userRoleMapper;
        this.productionSchedulingMapper = productionSchedulingMapper;
    }
@@ -183,5 +186,15 @@
        return userMapper.userDelete(id);
    }
    public Map<String, Object> selectProcessSv() {
        Map<String, Object> map = new HashMap<>();
        map.put("process", productionSchedulingMapper.selectProcess());
        return map;
    }
    public Boolean updateProcessSv(Integer id, String process) {
        return userMapper.updateProcessMp(id,process);
    }
}
north-glass-erp/src/main/resources/mapper/userInfo/User.xml
@@ -7,6 +7,7 @@
        <id property="id" column="id"/>
        <result property="loginName" column="login_name"/>
        <result property="userName" column="user_name"/>
        <result property="address" column="address"/>
        <result property="createTime" column="create_time"/>
        <collection property="userRoleList" ofType="com.example.erp.entity.userInfo.UserRole">
@@ -84,4 +85,9 @@
        set user_name=#{userName},update_time=now()
        where id=#{id}
    </update>
    <update id="updateProcessMp">
        update erp_user_info.user
        set address=#{process},update_time=now()
        where id=#{id}
    </update>
</mapper>