Browse Source

feat: 工单添加同步禅道号功能按钮

master
AaronWu 3 weeks ago
parent
commit
9b058b0aef
  1. 4
      .env.development
  2. 18
      src/api/issue/index.ts
  3. 1
      src/assets/icons/sync.svg
  4. 8
      src/views/question/issue/columns.tsx
  5. 27
      src/views/question/issue/index.vue

4
.env.development

@ -9,8 +9,8 @@
# 只在开发模式中被载入 # 只在开发模式中被载入
# 网站前缀 # 网站前缀
# VITE_BASE_API_URL = http://192.168.2.3:8089/server/
VITE_BASE_API_URL = http://43.137.2.78:8085/server/
VITE_BASE_API_URL = http://192.168.2.3:8089/server/
# VITE_BASE_API_URL = http://43.137.2.78:8085/server/
# base api # base api
VITE_BASE_API = '/server/' VITE_BASE_API = '/server/'

18
src/api/issue/index.ts

@ -88,6 +88,24 @@ export function updateIssue(data: API.IssueType) {
}); });
} }
/**
* @description
* @param {} data
* @returns
*/
export function syncIssue(data: { id: string }) {
return request(
{
url: 'question/syncZentao',
method: 'post',
data,
},
{
isGetDataDirectly: false,
},
);
}
/** /**
* @description * @description
* @param {IssueType} data * @param {IssueType} data

1
src/assets/icons/sync.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747381193487" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2624" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M640 896 256 896c-140.8 0-256-115.2-256-256 0-147.2 128-268.8 281.6-256C332.8 230.4 473.6 128 640 128c211.2 0 384 172.8 384 384S851.2 896 640 896zM256 512c-70.4 0-128 57.6-128 128 0 70.4 57.6 128 128 128l384 0c140.8 0 256-115.2 256-256 0-140.8-115.2-256-256-256C512 256 409.6 345.6 390.4 473.6L377.6 550.4 300.8 518.4C288 512 268.8 512 256 512z" p-id="2625" fill="#3b82f6"></path></svg>

After

Width:  |  Height:  |  Size: 719 B

8
src/views/question/issue/columns.tsx

@ -140,6 +140,14 @@ export const baseColumns: TableColumnItem[] = [
required: false, required: false,
}, },
}, },
// zentaoNos
{
title: '禅道号',
align: 'center',
dataIndex: 'zentaoNos',
width: 150,
hideInSearch: true,
},
{ {
title: '创建时间', title: '创建时间',
align: 'center', align: 'center',

27
src/views/question/issue/index.vue

@ -100,6 +100,7 @@
findOneById, findOneById,
updateIssueState, updateIssueState,
addToknowledge, addToknowledge,
syncIssue,
} from '@/api/issue'; } from '@/api/issue';
import { computed, nextTick, ref, watch, onMounted } from 'vue'; import { computed, nextTick, ref, watch, onMounted } from 'vue';
import { message, Alert, Modal } from 'ant-design-vue'; import { message, Alert, Modal } from 'ant-design-vue';
@ -243,6 +244,21 @@
visible.value = false; visible.value = false;
}; };
const handleSync = async (record: TableListItem) => {
if (!record.id) return;
const res = await syncIssue({
id: record.id,
});
console.log('res: ', res);
if (res.code === 200) {
message.success('同步到禅道成功');
dynamicTableInstance?.reload();
} else {
message.error('同步到禅道失败');
}
};
const columns: any = [ const columns: any = [
...baseColumns, ...baseColumns,
{ {
@ -262,6 +278,17 @@
// label: '', // label: '',
// onClick: () => handleView(record), // onClick: () => handleView(record),
// }, // },
{
icon: 'sync',
color: '#3b82f6',
size: '15',
label: '同步到禅道',
ifShow: !record.zentaoNos,
onClick: (e) => {
e.stopPropagation();
handleSync(record);
},
},
{ {
icon: 'edit', icon: 'edit',
color: '#3b82f6', color: '#3b82f6',

Loading…
Cancel
Save