Commit ee074c32 authored by YIyiyi's avatar YIyiyi

pref:添加事项搜索条件

parent 4f3f263e
......@@ -7,29 +7,30 @@
<div class="left-btn">
<a-button type="danger" @click="handleDelAll"> 批量移除 </a-button>
</div>
<div class="search-box">
<!-- <a-select
style="width: 180px"
allowClear
v-model="leftSearch.deptName"
class="select-department"
placeholder="请选择部门"
>
<a-select-option
v-for="v in deptList"
:key="v.id"
:value="v.name"
<div>
<a-space>
<a-select
style="width: 120px"
allowClear
v-model="leftSource"
class="select-department"
placeholder="事项来源"
>
{{ v.name }}
</a-select-option>
</a-select> -->
<a-input-search
v-model="searchLeftVal"
placeholder="请输入事项名称搜索"
enter-button="搜索"
@search="onSearchLeft"
allowClear
/>
<a-select-option :value="0">
一体化添加
</a-select-option>
<a-select-option :value="1">
手动添加
</a-select-option>
</a-select>
<a-input-search
v-model="searchLeftVal"
placeholder="请输入事项名称搜索"
enter-button="搜索"
@search="onSearchLeft"
allowClear
/>
</a-space>
</div>
</div>
</div>
......@@ -74,7 +75,7 @@
</template>
<div class="matter-name">{{ text.matterName }}</div>
</a-tooltip>
<a-tag v-if="text.source === 0" color="green"> 一体化添加 </a-tag>
<a-tag v-if="text.source == 0" color="green"> 一体化添加 </a-tag>
<a-tag v-else color="blue"> 手动添加 </a-tag>
</template>
<!-- 到现场次数 -->
......@@ -118,13 +119,29 @@
<a-button class="add-btn" @click="addMatter"> 新增事项 </a-button>
</div>
<div>
<a-input-search
v-model="searchRightVal"
placeholder="请输入事项名称搜索"
enter-button="搜索"
@search="onSearchRight"
allowClear
/>
<a-space>
<a-select
style="width: 120px"
allowClear
v-model="rightSource"
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化事项
</a-select-option>
<a-select-option :value="1">
自建事项
</a-select-option>
</a-select>
<a-input-search
v-model="searchRightVal"
placeholder="请输入事项名称搜索"
enter-button="搜索"
@search="onSearchRight"
allowClear
/>
</a-space>
</div>
</div>
</div>
......@@ -171,8 +188,8 @@
</template>
<div class="matter-name">{{ text.matterName }}</div>
</a-tooltip>
<a-tag v-if="text.source === 0" color="green"> 一体化添加 </a-tag>
<a-tag v-else color="blue"> 手动添加 </a-tag>
<a-tag v-if="text.source == 0" color="green"> 一体化事项 </a-tag>
<a-tag v-else color="blue"> 自建事项 </a-tag>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text">
......@@ -284,6 +301,8 @@ export default {
rightColumns,
leftLoading: false,
rightLoading: false,
leftSource: undefined, // 左边来源
rightSource: undefined, // 右边来源
selectedRowKeys: [],
matterSiteData: [], // 站点事项
matterDataList: [], //事项列表数据
......@@ -320,6 +339,7 @@ export default {
page: this.leftCurrent,
size: this.leftSize,
siteId: this.siteId,
source: this.leftSource,
matterName: `%${this.searchLeftVal}%`,
...search,
});
......@@ -340,6 +360,7 @@ export default {
page: this.rightCurrent,
size: this.rightSize,
matterName: this.searchRightVal,
source: this.rightSource,
...search,
});
if (res.data.code === 1) {
......@@ -615,4 +636,4 @@ export default {
// .table-content {
// height: 500px;
// }
</style>
\ No newline at end of file
</style>
......@@ -101,14 +101,32 @@
</div> -->
<div class="color_title flex jcb">
<span>站点事项列表:</span>
<a-input-search
style="width: 300px"
placeholder="输入事项名称搜索"
enter-button="搜索"
allowClear
@search="onSearchMatter"
v-model="matterNameSearch"
/>
<div>
<a-space>
<a-select
style="width: 120px"
allowClear
v-model="source"
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化添加
</a-select-option>
<a-select-option :value="1">
手动添加
</a-select-option>
</a-select>
<a-input-search
style="width: 300px"
placeholder="输入事项名称搜索"
enter-button="搜索"
allowClear
@search="onSearchMatter"
v-model="matterNameSearch"
/>
</a-space>
</div>
</div>
<div style="margin-top: 10px">
<a-table
......@@ -137,6 +155,11 @@
{{ (page - 1) * 10 + index + 1 }}
</span>
</template>
<!-- 来源 -->
<template slot="source" slot-scope="text">
<a-tag v-if="text.source == 0" color="green"> 一体化事项 </a-tag>
<a-tag v-else color="blue"> 自建事项 </a-tag>
</template>
</a-table>
</div>
<!-- <a-form-model
......@@ -240,6 +263,11 @@ const matterColumns = [
title: "事项名称",
dataIndex: "matterName",
},
{
title: "来源",
width: "15%",
scopedSlots: { customRender: "source" },
},
];
export default {
components: {
......@@ -247,6 +275,7 @@ export default {
},
data() {
return {
source: undefined,
leftColumns,
matterColumns,
visible: false,
......@@ -267,7 +296,7 @@ export default {
allDel: "", // 批量删除id
windowInfo: {},
formData: {
isShow: 0,
isShow: 1,
sort: 0,
},
// rules: {
......@@ -307,6 +336,7 @@ export default {
size: 10,
siteId: this.windowInfo.siteId,
matterName: `%${this.matterNameSearch}%`,
source: this.source,
// deptId: this.windowInfo.deptId,
});
let { data, total } = res.data.data;
......@@ -526,4 +556,4 @@ export default {
display: flex;
align-items: center;
}
</style>
\ No newline at end of file
</style>
import axios from 'axios'
import axios from "axios";
// import Cookie from 'js-cookie'
// 跨域认证信息 header 名
// const xsrfHeaderName = 'Authtoken'
axios.defaults.timeout = 5000
// axios.defaults.timeout = 5000
// axios.defaults.withCredentials = true
// axios.defaults.xsrfHeaderName = xsrfHeaderName
// axios.defaults.xsrfCookieName = xsrfHeaderName
......@@ -21,9 +21,9 @@ axios.defaults.timeout = 5000
// http method
const METHOD = {
GET: 'get',
POST: 'post'
}
GET: "get",
POST: "post",
};
/**
* axios请求
......@@ -32,14 +32,14 @@ const METHOD = {
* @param params 请求参数
* @returns {Promise<AxiosResponse<T>>}
*/
async function request (url, method, params, config) {
async function request(url, method, params, config) {
switch (method) {
case METHOD.GET:
return axios.get(url, { params, ...config })
return axios.get(url, { params, ...config });
case METHOD.POST:
return axios.post(url, params, config)
return axios.post(url, params, config);
default:
return axios.get(url, { params, ...config })
return axios.get(url, { params, ...config });
}
}
......@@ -104,59 +104,59 @@ async function request (url, method, params, config) {
* @param interceptors
* @param options
*/
function loadInterceptors (interceptors, options) {
const { request, response } = interceptors
function loadInterceptors(interceptors, options) {
const { request, response } = interceptors;
// 加载请求拦截器
request.forEach(item => {
let { onFulfilled, onRejected } = item
if (!onFulfilled || typeof onFulfilled !== 'function') {
onFulfilled = config => config
request.forEach((item) => {
let { onFulfilled, onRejected } = item;
if (!onFulfilled || typeof onFulfilled !== "function") {
onFulfilled = (config) => config;
}
if (!onRejected || typeof onRejected !== 'function') {
onRejected = error => Promise.reject(error)
if (!onRejected || typeof onRejected !== "function") {
onRejected = (error) => Promise.reject(error);
}
axios.interceptors.request.use(
config => onFulfilled(config, options),
error => onRejected(error, options)
)
})
(config) => onFulfilled(config, options),
(error) => onRejected(error, options)
);
});
// 加载响应拦截器
response.forEach(item => {
let { onFulfilled, onRejected } = item
if (!onFulfilled || typeof onFulfilled !== 'function') {
onFulfilled = response => response
response.forEach((item) => {
let { onFulfilled, onRejected } = item;
if (!onFulfilled || typeof onFulfilled !== "function") {
onFulfilled = (response) => response;
}
if (!onRejected || typeof onRejected !== 'function') {
onRejected = error => Promise.reject(error)
if (!onRejected || typeof onRejected !== "function") {
onRejected = (error) => Promise.reject(error);
}
axios.interceptors.response.use(
response => onFulfilled(response, options),
error => onRejected(error, options)
)
})
(response) => onFulfilled(response, options),
(error) => onRejected(error, options)
);
});
}
/**
* 解析 url 中的参数
* @param url
* @returns {Object}
*/
function parseUrlParams (url) {
const params = {}
if (!url || url === '' || typeof url !== 'string') {
return params
function parseUrlParams(url) {
const params = {};
if (!url || url === "" || typeof url !== "string") {
return params;
}
const paramsStr = url.split('?')[1]
const paramsStr = url.split("?")[1];
if (!paramsStr) {
return params
return params;
}
const paramsArr = paramsStr.replace(/&|=/g, ' ').split(' ')
const paramsArr = paramsStr.replace(/&|=/g, " ").split(" ");
for (let i = 0; i < paramsArr.length / 2; i++) {
const value = paramsArr[i * 2 + 1]
params[paramsArr[i * 2]] = value === 'true' ? true : (value === 'false' ? false : value)
const value = paramsArr[i * 2 + 1];
params[paramsArr[i * 2]] =
value === "true" ? true : value === "false" ? false : value;
}
return params
return params;
}
// 获取Cookie
......@@ -174,4 +174,4 @@ export {
loadInterceptors,
parseUrlParams,
// getCookie
}
};
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