Compare commits

..

No commits in common. "7ea11e34a9e147f5bade4f2a7bf37af0d8d718fd" and "efebd548c640c67f6ad392ac16220ed7ee0c7794" have entirely different histories.

6 changed files with 45 additions and 262 deletions

View File

@ -157,7 +157,7 @@ module.exports = {
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },], "space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/indent": ["error", 4,], "@typescript-eslint/indent": ["error", 4,],
"@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/no-inferrable-types": "off",

View File

@ -12,7 +12,4 @@
// testRankingListRequest(); // testRankingListRequest();
const arr: string[] = [];
console.log( "test" ); console.log( "test" );
console.log( "检查instanceof", arr instanceof String );

View File

@ -26,12 +26,4 @@ export const API_URL = {
// 坐席业绩查询 // 坐席业绩查询
URL_CALLER_ARCHIEVEMENT: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_caller_archievement.do", URL_CALLER_ARCHIEVEMENT: "http://10.39.0.41:8081/desktop_archievement_backend/archievement/query_caller_archievement.do",
/** 奖项相关 **/
// 查询奖励项目
// URL_RWARD_PROJECTS: "http://222.76.244.118:11101/desktop_archievement_backend/rewards/query_reward_projects.do"
URL_RWARD_PROJECTS: "http://10.39.0.41:8081/desktop_archievement_backend/rewards/query_reward_projects.do",
// 查询获奖人员
// URL_REWARD_GAINERS: "http://{{生产地址}}/desktop_archievement_backend/rewards/query_reward_gainers.do"
URL_REWARD_GAINERS: "http://222.76.244.118:11101/desktop_archievement_backend/rewards/query_reward_gainers.do",
}; };

View File

@ -1,179 +0,0 @@
/*
* @Author: Kane
* @Date: 2023-09-11 09:59:00
* @LastEditors: Kane
* @FilePath: /task_schedule/src/utils/reward.ts
* @Description: API
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { type AxiosResponse } from "axios";
import { service as instance } from "./api/request.js";
import { API_URL } from "./api/config.js";
interface RewardProject
{
rewardCode: number;
rewardName: string;
}
interface RewardProjectResponse
{
success: boolean;
message: string;
rewardList: RewardProject[] | null;
}
interface RewardGainer
{
acquiredDate: string;
callerName: string;
callerCode: string;
rewardProjectCode: string;
rewardProjectName: string;
}
interface RewardGainerResponse
{
success: boolean;
message: string;
gainerList: RewardGainer[];
}
/**
*
* @param handler
*/
function requestRewardPorjectsList( handler: any ): void
{
if ( handler === undefined || handler === null )
{
return;
}
const rewardResponse: RewardProjectResponse = {
success: false,
message: "",
rewardList: [],
};
instance.request({
url: API_URL.URL_RWARD_PROJECTS,
method: "post",
})
// 请求成功,检查服务器返回结果
.then(( response: AxiosResponse<any, any> ): void =>
{
const data = response.data ?? {};
rewardResponse.success = data.success ?? false;
rewardResponse.message = data.message ?? "";
rewardResponse.rewardList = checkRewardProjects( data.rewardList ?? []);
handler( rewardResponse, null );
})
.catch(( error: any ): void =>
{
console.log( error );
rewardResponse.success = false;
handler( rewardResponse, error );
});
}
/**
*
* @param handler
*/
function requestRewardGainers( handler: any ): void
{
if ( handler === undefined || handler === null )
{
return;
}
const rewardResponse: RewardGainerResponse = {
success: false,
message: "",
gainerList: [],
};
instance.request({
url: API_URL.URL_REWARD_GAINERS,
method: "post",
})
.then(( response: AxiosResponse<any, any> ): void =>
{
const data = response.data ?? {};
rewardResponse.success = data.success;
rewardResponse.message = data.message;
rewardResponse.gainerList = data.gainerList;
handler( rewardResponse, null );
})
.catch(( error: any ): void =>
{
console.log( error );
rewardResponse.success = false;
handler( rewardResponse, error );
});
}
// **功能函数 **********************************/
function checkRewardProjects( data: any[]): RewardProject[] | null
{
const rewardList: RewardProject[] = [];
// 检查一下参数的类型,如果不是数组返回 null
if ( !( data instanceof Array ))
{
return null;
}
data.forEach(( item: any ) =>
{
const reward = {
rewardCode: item.rewardCode ?? "",
rewardName: item.rewardName ?? "",
};
rewardList.push( reward );
});
return rewardList;
}
function checkRewardGainers( gainers: any[]): RewardGainer[] | null
{
const gainerList: RewardGainer[] = [];
if ( !( gainers instanceof Array ))
{
return null;
}
gainers.forEach(( item: RewardGainer ): void =>
{
const gainer: RewardGainer = {
acquiredDate: item.acquiredDate ?? "",
callerName: item.callerName ?? "",
callerCode: item.callerCode ?? "",
rewardProjectCode: item.rewardProjectCode ?? "",
rewardProjectName: item.rewardProjectName ?? "",
};
});
return gainerList;
}
export {
type RewardProject,
type RewardGainer,
type RewardProjectResponse,
type RewardGainerResponse,
requestRewardPorjectsList,
requestRewardGainers
};

View File

@ -39,46 +39,52 @@
/> />
</el-table> </el-table>
</div> </div>
<div class="dishonor-wrapper">
<el-divider content-position="left">
XXX
</el-divider>
<div class="toolbutton-wrapper">
<el-button type="primary">
新增
</el-button>
<el-button type="danger">
删除
</el-button>
</div>
<el-table
border
stripe
style="width:100%;"
:height="tableHeight"
>
<el-table-column type="selection" />
<el-table-column
label="坐席名称"
align="center"
/>
<el-table-column
label="奖项名称"
align="center"
/>
</el-table>
</div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { reactive, computed } from "vue"; import { reactive, computed } from "vue";
import {
type RewardProject,
type RewardGainer,
type RewardProjectResponse,
type RewardGainerResponse,
requestRewardPorjectsList,
requestRewardGainers
} from "@/utils/reward.js";
interface UI
{
rewardGainerList: RewardGainer[];
}
export default { export default {
name: "DataManagement", name: "DataManagement",
setup() setup()
{ {
const ui: UI = reactive({ const ui = reactive({});
rewardGainerList: [],
});
const tableHeight = computed((): number => const tableHeight = computed((): number =>
{ {
return 5 * 50 + 40; return 5 * 50 + 40;
}); });
const applyGainerList = ( response: RewardGainerResponse ): void =>
{
if ( response.success )
{
ui.rewardGainerList = response.gainerList;
}
};
return { return {
ui, ui,
tableHeight, tableHeight,

View File

@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.mybatis.mapper.RewardsMapper; import com.cpic.xim.mybatis.mapper.RewardsMapper;
import com.cpic.xim.mybatis.pojo.RewardGainer;
import com.cpic.xim.mybatis.pojo.RewardProject; import com.cpic.xim.mybatis.pojo.RewardProject;
import com.cpic.xim.mybatis.utils.MybatisUtils; import com.cpic.xim.mybatis.utils.MybatisUtils;
@ -30,8 +29,7 @@ public class RewardController
// 日志 // 日志
private static Logger logger = LoggerFactory.getLogger(RewardController.class); private static Logger logger = LoggerFactory.getLogger(RewardController.class);
private RewardController() private RewardController() {}
{}
/** /**
* 相应查询获奖项目清单的请求 * 相应查询获奖项目清单的请求
@ -45,8 +43,6 @@ public class RewardController
SqlSession session = null; SqlSession session = null;
logger.debug( "查询奖项清单。" );
try try
{ {
session = MybatisUtils.getSqlSession(); session = MybatisUtils.getSqlSession();
@ -57,45 +53,16 @@ public class RewardController
response.setSuccess(true); response.setSuccess(true);
response.setMessage("查询成功!"); response.setMessage("查询成功!");
response.setRewardList(rewards); response.setRewardList(rewards);
logger.debug( "查询奖项清单," + response.getMessage() + "" + rewards.toString() );
} }
catch (IOException error ) catch (IOException error )
{ {
response.setSuccess(false); response.setSuccess(false);
response.setMessage("查询失败!" + error.getMessage()); response.setMessage("查询失败!" + error.getMessage());
response.setRewardList(null); response.setRewardList(null);
logger.debug( "查询奖项清单," + response.getMessage() + "" + error.getMessage() );
} }
return response; return response;
} }
@PostMapping( "/query_reward_gainers.do" )
@ResponseBody
RewardGainersResponse queryRewardGainers()
{
RewardGainersResponse response = new RewardGainersResponse();
try
{
SqlSession session = MybatisUtils.getSqlSession();
RewardsMapper mapper = session.getMapper( RewardsMapper.class );
ArrayList<RewardGainer> gainers = mapper.queryRewardGainers();
response.setSuccess( true );
response.setMessage( "查询成功!" );
response.setGainerList( gainers );
}
catch ( IOException error )
{
response.setSuccess( false );
response.setMessage( "查询失败!" + error.getMessage() );
response.setGainerList( null );
}
return response;
}
} }