Commit 727f13eb by lxyang

feat:接口调用

parent 43a78ca2
......@@ -49,7 +49,7 @@ export function doctaskUpsert(data) {
// 选择文档
export function doctaskDocuments() {
return request({
url: '/api/doc/doctask/documents',
url: '/api/doc/document/list',
method: 'get'
})
}
......@@ -66,4 +66,12 @@ export function doctaskDelete(id) {
url: '/api/doc/doctask/delete/' + id,
method: 'get'
})
}
// 创建跟踪任务添加文档接口
export function documentUpsert(data) {
return request({
url: '/api/doc/document/upsert',
method: 'post',
data
})
}
\ No newline at end of file
......@@ -19,19 +19,20 @@
<div v-if="deleteCenter.length && !loading">
<div class="delete-center" v-for="(item, index) in deleteCenter" :key="index">
<div class="title">
<span class="title-span">{{item.docTitle}}</span>
<span>更新日期:</span>
<span class="time">{{item.data}}</span>
<span>{{item.change}}处更新</span>
<span class="time">{{dateFilter(item.updateTime)}}</span>
<span>1处更新</span>
</div>
<div class="center">
<div class="center-delete">
<div class="center-delete-tab green">新版</div>
<div class="center-delete-text" v-for="(items, indexs) in item.content" :key="indexs" v-html="items.contentText"></div>
</div>
<div class="center-delete">
<div class="center-delete-tab gray">旧版</div>
<div class="center-delete-text" v-for="(items, indexs) in item.contentOld" :key="indexs" v-html="items.contentText"></div>
</div>
<div class="center-delete">
<div class="center-delete-tab green">新版</div>
<div class="center-delete-text" v-html="item.paragraphAfter"></div>
</div>
<div class="center-delete">
<div class="center-delete-tab gray">旧版</div>
<div class="center-delete-text" v-html="item.paragraphBefore"></div>
</div>
</div>
</div>
</div>
......@@ -69,7 +70,6 @@ export default {
},
created() {
this.init()
console.log(this.$route.query)
this.$nextTick(() => {
this.tableHeight();
})
......@@ -93,86 +93,50 @@ export default {
path: '/documentManagement/taskList'
})
},
dateFilter(time) {
if (!time) {
// 当时间是null或者无效格式时我们返回空
return '-'
} else {
const date = new Date(time) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
const dateNumFun = (num) => num < 10 ? `0${num}` : num // 使用箭头函数和三目运算以及es6字符串的简单操作。因为只有一个操作不需要{} ,目的就是数字小于10,例如9那么就加上一个0,变成09,否则就返回本身。 // 这是es6的解构赋值。
const [Y, M, D, h, m, s] = [
date.getFullYear(),
dateNumFun(date.getMonth() + 1),
dateNumFun(date.getDate()),
dateNumFun(date.getHours()),
dateNumFun(date.getMinutes()),
dateNumFun(date.getSeconds())
]
return `${Y}-${M}-${D} ${h}:${m}:${s}` // 一定要注意是反引号,否则无效。
}
},
searchCustomer() {
this.loading = true;
// doctaskFinddifference(this.queryParams)
// .then(response => {
for (let i = 0; i < 10; i++) {
let data = {
data: '2022-10-18',
change: '4',
content: [ // 新数据及变化
{
contentText: '通常情况下,应当处理 input 事件,并更新组件的绑定值(或使用v-model)。否则,输入框内显示的值将不会改变。', // 这是完整的一段话
contentTextOld: '',
contentChange:[ // 这段话里有多少变化以及链接出处
{
text: '或使用v-model',
url: 'https://www.baidu.com/'
},
{
text: '输入框内显示的值',
url: 'https://www.cnblogs.com/1234wu/p/11055005.html'
},
]
},
{
contentText: '视频或直播加热的功能,提升视频或直播间热度。121212', // 这是完整的一段话
contentChange: [
{
text: '提升视频或直播间热度',
url: 'https://element.eleme.io/#/zh-CN/component/pagination#events'
},
]
},
{
contentText: '视频或直播加热的功能,提升视频或直播间热度。121212', // 这是完整的一段话
contentChange: [
{
text: '视频或直播加热的功能',
url: 'https://element.eleme.io/#/zh-CN/component/pagination#events'
},
]
}
],
contentOld: [ // 旧数据
{
contentText: '通常情况下,应当处理 input 事件,并更新组件的绑定值。否则,输入框内显示的值将不会改变。'
},
{
contentText: '视频或直播加热的功能,提升视频或直播间热度。'
},
{
contentText: '视频或直播加热的功能,提升视频或直播间热度。'
}
]
}
let content = data.content
doctaskFinddifference(this.deleteId)
.then(response => {
if (response.code === 200) {
let content = response.content.value
for (let a = 0; a < content.length; a++) {
let contentChange = content[a].contentChange
for (let b = 0; b < contentChange.length; b++) {
let text = contentChange[b].text
let url = contentChange[b].url
if (content[a].contentText.indexOf(text) >= 0) {
let values = content[a].contentText.split(text);
content[a].contentText = values.join(
`<a style="color: rgba(250, 0, 0, 1);" href="${url}" target="_blank">${text}</a>`
)
}
let difWordAfter = content[a].difWordAfter
let url = content[a].docUrl
if (content[a].paragraphAfter.indexOf(difWordAfter) >= 0) {
let values = content[a].paragraphAfter.split(difWordAfter);
content[a].paragraphAfter = values.join(
`<a style="color: rgba(250, 0, 0, 1);" href="${url}" target="_blank">${difWordAfter}</a>`
)
}
}
this.deleteCenter.push(data)
}
setTimeout(() => {
this.loading = false
}, 1000);
this.$nextTick(() => {
this.customerListHeights = this.$refs.customerListHeight.offsetHeight
this.$set(this, 'deleteCenter', content)
}
this.loading = false
this.$nextTick(() => {
this.customerListHeights = this.$refs.customerListHeight.offsetHeight
})
})
// })
// .catch(error => {
// this.loading = false;
// });
.catch(error => {
this.loading = false;
});
},
// 计算高度
tableHeight() {
......@@ -218,6 +182,9 @@ export default {
.time {
margin-right: 24px;
}
.title-span {
margin-right: 16px;
}
}
.center {
width: 100%;
......
......@@ -132,6 +132,11 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item class="second-level" v-if="form.docDocumentId === 10000" label="文档链接名称"
prop="linkName">
<el-input v-model.trim="form.linkName"
placeholder="请输入文档名称" />
</el-form-item>
<el-form-item class="second-level" v-if="form.docDocumentId === 10000" label="文档链接"
prop="link">
<el-input v-model.trim="form.link"
......@@ -178,7 +183,8 @@ import {
doctaskUpsert,
doctaskDocuments,
doctaskSubscription,
doctaskDelete
doctaskDelete,
documentUpsert
} from "@/api/system/customer";
import {
deepClone
......@@ -256,6 +262,9 @@ export default {
docDocumentId: [
{ required: true, message: "请选择文档", trigger: "blur" }
],
linkName: [
{ required: true, message: "文档链接名称不能为空", trigger: "blur" }
],
link: [
{ required: true, message: "文档链接不能为空", trigger: "blur" },
{
......@@ -315,7 +324,7 @@ export default {
this.$router.push({
path: '/documentManagement/taskListDetails',
query: {
id: row.id,
id: row.docDocumentId,
name: row.name
}
})
......@@ -430,7 +439,7 @@ export default {
};
this.searchCustomer();
},
addDoctaskDocuments() {
addDoctaskDocuments(isChange) {
this.documentOptions = []
doctaskDocuments()
.then(response => {
......@@ -442,22 +451,26 @@ export default {
}
})
}
this.documentOptions.push({
label: "其他",
value: 10000
})
if (isChange === 0) {
this.documentOptions.push({
label: "其他",
value: 10000
})
}
})
.catch(() => {
this.documentOptions.push({
label: "其他",
value: 10000
})
if (isChange === 0) {
this.documentOptions.push({
label: "其他",
value: 10000
})
}
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.addDoctaskDocuments();
this.addDoctaskDocuments(0);
this.open = true;
// this.editFlag = false;
this.title = "创建跟踪任务";
......@@ -465,7 +478,7 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.addDoctaskDocuments();
this.addDoctaskDocuments(1);
this.handleUpdateFrom(row)
this.open = true;
this.title = "修改跟踪任务";
......@@ -486,7 +499,6 @@ export default {
let form = deepClone(this.form)
let fromNew = {
name: form.name,
docDocumentId: Number(form.docDocumentId),
emails: form.emails,
docDesc: form.docDesc
}
......@@ -510,19 +522,49 @@ export default {
// 否则新建
else {
this.submitLoading = true;
let doctaskUpserts = doctaskUpsert(fromNew)
Promise.all([doctaskUpserts]).then((result) => {
if (result[0].code === 200) {
this.msgSuccess("新建成功");
this.open = false;
this.queryParams.pageindex = 1
this.searchCustomer();
if (form.docDocumentId !== 10000) {
fromNew.docDocumentId = Number(form.docDocumentId)
let doctaskUpserts = doctaskUpsert(fromNew)
Promise.all([doctaskUpserts]).then((result) => {
if (result[0].code === 200) {
this.msgSuccess("新建成功");
this.open = false;
this.queryParams.pageindex = 1
this.searchCustomer();
}
this.submitLoading = false;
}).catch((error) => {
this.msgError(error);
this.submitLoading = false;
})
} else {
let documentUpsertData = {
name: form.linkName,
docUrl: form.link
}
this.submitLoading = false;
}).catch((error) => {
this.msgError(error);
this.submitLoading = false;
})
let documentUpserts = documentUpsert(documentUpsertData)
Promise.all([documentUpserts]).then((result) => {
if (result[0].code === 200) {
fromNew.docDocumentId = result[0].content.id
doctaskUpsert(fromNew).then(response => {
if (response.code === 200) {
this.msgSuccess("新建成功");
this.open = false;
this.queryParams.pageindex = 1
this.searchCustomer();
}
this.submitLoading = false;
})
.catch((error) => {
this.msgError(error);
this.submitLoading = false;
})
}
}).catch((error) => {
this.msgError(error);
this.submitLoading = false;
})
}
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment