feat:添加在线、案例的添加搜索重置编辑已完成

This commit is contained in:
Ggysh-7
2022-11-26 16:06:15 +08:00
parent 90d5c8cd87
commit 093feb913e
6 changed files with 232 additions and 86 deletions

View File

@@ -26,13 +26,13 @@
<a-input
v-model:value="inputV1"
style="width: 264px; height: 40px; border-radius: 8px"
placeholder="请输入项目名称"
placeholder="请输入案例标题"
/>
</div>
</div>
</div>
<div class="mi_btns">
<div class="btn btn1" @click="getAllCaseText">
<div class="btn btn1" @click="searchList()">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
@@ -45,6 +45,23 @@
<div class="main_table">
<a-table
v-if="edit"
class="ant-table-striped"
:row-class-name="
(_record, index) => (index % 2 === 1 ? 'table-striped' : null)
"
:row-selection="{
type:'radio',
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
:columns="tableDataFunc()"
:data-source="tableData"
:loading="tableDataTotal === -1 ? true : false"
:pagination="false"
/>
<a-table
v-else
class="ant-table-striped"
:row-class-name="
(_record, index) => (index % 2 === 1 ? 'table-striped' : null)
@@ -81,9 +98,10 @@
</a-drawer>
</template>
<script>
import { reactive, toRefs } from "vue";
import { onMounted, reactive, toRefs } from "vue";
import * as api from "../../api/indexCase.js";
import * as apiTask from "../../api/indexTaskadd";
// import { setCookie } from "../../api/method"
import { message } from "ant-design-vue";
import { RouterEditTask } from "@/api/indexTask";
// import { addTempTask } from "../../api/indexTaskadd";
@@ -142,6 +160,7 @@ export default {
currentPage: 1,
tableDataTotal: 0,
pageSize: 10,
searching:false,
selectedRowKeys: [],
apiTaskList: [],
inputV1: "",
@@ -177,7 +196,6 @@ export default {
key: "authorName",
width: "200px",
align: "center",
className: "classify",
},
{
title: "导入时间",
@@ -185,7 +203,6 @@ export default {
key: "time",
width: "400px",
align: "center",
className: "classify",
},
];
return columns;
@@ -205,7 +222,24 @@ export default {
const getTableDate = (tableData) => {
let data = tableData;
let array = [];
data.map((value, index) => {
if(state.searching){
data.map((value, index) => {
let obj = {
key: index,
authorId: value.authorId,
authorName: value.authorName,
companyId: value.companyId,
coverUrl: value.coverUrl,
id: value.id,
casesId: value.casesId,
title: value.title,
};
if(obj.title == state.inputV1){
array.push(obj);
}
});
} else {
data.map((value, index) => {
let obj = {
key: index,
authorId: value.authorId,
@@ -218,6 +252,7 @@ export default {
};
array.push(obj);
});
}
state.tableData = array;
};
//获取全部案例信息接口
@@ -227,8 +262,8 @@ export default {
keyWord: state.inputV1,
orderAsc: true,
orderField: "",
pageIndex: 0,
pageSize: 0,
pageIndex: state.currentPage,
pageSize: state.pageSize,
top: true,
})
.then((res) => {
@@ -313,13 +348,29 @@ export default {
}
}
};
//搜索案例列表
const searchList = ()=> {
if(state.inputV1 !== ''){
state.searching = true
getAllCaseText()
}else {
state.searching = false
resetCase()
}
}
//重置案例信息
const resetCase = () => {
state.inputV1 = ""
state.searching = false
state.selectedRowKeys=[]
state.currentPage = 1
getAllCaseText();
};
onMounted(()=>{
// let cookie =
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2Njk0MjgwNTAsImV4cCI6MTY2OTQzNTI1MCwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.9ea5ce6d4cd43c2c17f21a293e4dc0d362c2a404b9d50fae5c49fed5a238fb1a";
// setCookie("token", cookie, 10);
})
return {
...toRefs(state),
afterVisibleChange,
@@ -330,6 +381,7 @@ export default {
getTableDate,
updateTask,
getAllCaseText,
searchList,
resetCase,
};
},
@@ -447,10 +499,6 @@ export default {
.main_table {
position: relative;
padding-bottom: 80px;
.classify {
margin-left: 10px !important;
padding-left: 9px !important;
}
.ant-checkbox-wrapper {
align-items: center;
margin-top: -2px;