123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <div :class="[$style.searchclassify, { [$style.collapse]: fold }]">
- <div :class="$style.search">
- <!-- 创建时间 -->
- <a-card
- v-for="(item, index) in KmFullsearchData"
- :key="index"
- :bordered="false"
- :title="item.title"
- >
- <a slot="extra" @click="changeexpand(item)">
- <a-icon :type="item.expand ? 'up' : 'down'" />
- </a>
- <a-radio-group
- v-show="item.key === 0 && item.expand === true"
- v-model="conditionsParams.creationTime"
- :name="item.title + 'Radio'"
- :options="item.options"
- @change="onRadioChange"
- />
- <!-- 创建时间 自定义 -->
- <a-range-picker
- v-if="item.key === 0 && isYourself"
- v-model="yourselfTime"
- @change="onDateChange"
- >
- <a-icon slot="suffixIcon" type="calendar" />
- </a-range-picker>
- <!-- 知识分类 -->
- <km-tree-select
- v-show="item.key === 1 && item.expand === true"
- v-model="conditionsParams.category"
- :class="$style.category"
- :editable="true"
- tree-data-url="api/xcoa-mobile/v1/km-knowledge-category/knowledge-category-tree?pageId=kmKnowledge"
- @change="categoryChange"
- ></km-tree-select>
- <!-- 知识标签 -->
- <km-tag-picker
- v-show="item.key === 2 && item.expand === true"
- v-model="conditionsParams.label"
- :class="$style.category"
- :editable="true"
- @change="tagChange"
- />
- <!-- 业务领域 -->
- <km-business-area-picker
- v-show="item.key === 3 && item.expand === true"
- v-model="conditionsParams.businessArea"
- :read-only="false"
- :class="$style.category"
- @change="businessAreaChange"
- />
- <!-- 搜索范围 -->
- <a-checkbox-group
- v-show="item.key === 4 && item.expand === true"
- v-model="conditionsParams.searchRange"
- :name="item.title + 'Radio'"
- :options="item.options"
- @change="(e) => onRangeChange(e, item.title)"
- />
- <!-- 搜索范围 发起人 -->
- <div v-if="item.key === 4" :class="$style.hor">
- <span :class="$style.label"> 发起人:</span>
- <sd-user-picker
- v-model="creatorArr"
- placeholder="请选择"
- @change="userChange"
- ></sd-user-picker>
- </div>
- <!-- 搜索范围 发起部门 -->
- <div v-if="item.key === 4" :class="$style.hor">
- <span :class="$style.label"> 发起部门:</span>
- <sd-group-picker v-model="createDeptArr" @change="groupChange"></sd-group-picker>
- </div>
- </a-card>
- <div :class="$style.reset">
- <a-button type="primary" @click="reset">
- 重置
- </a-button>
- </div>
- </div>
- <a-button type="primary" :class="$style.fold" @click="foldClick">
- <a-icon :type="icontype" />
- </a-button>
- </div>
- </template>
- <script>
- import KmFullsearchData from './km-fullsearch-data.js'
- import components from './_import-components/km-fullsearch-classify-import'
- export default {
- name: 'KmFullsearchClassify',
- components,
- props: {},
- data() {
- return {
- KmFullsearchData,
- isYourself: false,
- fold: false,
- icontype: 'left',
- conditionsParams: {
- creationTime: [],
- flowStatus: [],
- searchRange: [],
- category: '',
- label: '',
- businessArea: '',
- },
- creatorArr: [],
- createDeptArr: [],
- yourselfTime: [],
- }
- },
- methods: {
- // 展开或收起
- changeexpand(item) {
- KmFullsearchData.forEach((k) => {
- if (k.key === item.key) {
- item.expand = !item.expand
- }
- })
- this.expand = !this.expand
- },
- // 单选按钮 创建时间
- onRadioChange(e) {
- if (e.target.value === 'yourself') {
- this.isYourself = true
- } else {
- this.isYourself = false
- }
- this.$emit('onSearch', e.target.value, 'searchDateType')
- },
- // 自定义时间
- onDateChange(date, dateString) {
- this.$emit('onSearch', dateString[0], 'startDate')
- this.$emit('onSearch', dateString[1], 'endDate')
- },
- // 知识分类
- categoryChange(val) {
- let arrId = ['all']
- if (val) {
- arrId = val.map((item) => item.id)
- }
- this.$emit('onSearch', arrId, 'typeIds')
- },
- // 知识标签
- tagChange(val) {
- if (val.length === 0) {
- val = ['all']
- }
- this.$emit('onSearch', val, 'tagNames')
- },
- // 业务领域
- businessAreaChange(val) {
- let arrId = ['all']
- if (val.length > 0) {
- arrId = val.map((item) => item.id)
- }
- this.$emit('onSearch', arrId, 'domainIds')
- },
- // 搜索范围
- onRangeChange(val, title) {
- this.$emit('onSearch', val, 'searchFields')
- },
- // 发起人
- userChange(val) {
- const ids = []
- if (val.length > 0) {
- val.forEach((item) => {
- ids.push(item.code)
- })
- this.$emit('onSearch', ids, 'creatorAccounts')
- } else {
- this.$emit('onSearch', ['all'], 'creatorAccounts')
- }
- },
- // 发起部门
- groupChange(val) {
- const ids = []
- if (val.length > 0) {
- val.forEach((item) => {
- ids.push(item.code)
- })
- this.$emit('onSearch', ids, 'createDeptIds')
- } else {
- this.$emit('onSearch', ['all'], 'createDeptIds')
- }
- },
- // 重置
- reset() {
- this.conditionsParams = {}
- this.creatorArr = []
- this.createDeptArr = []
- this.yourselfTime = []
- this.$emit('onSearch', '', 'reset')
- },
- // 小箭头点击事件
- foldClick() {
- this.fold = !this.fold
- if (this.fold) {
- this.icontype = 'right'
- } else {
- this.icontype = 'left'
- }
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .searchclassify {
- position: relative;
- display: flex;
- margin-right: 1rem;
- margin-left: 1rem;
- transition: width 0.2s;
- .search {
- width: 100%;
- :global(.ant-radio-wrapper) {
- margin: 5px 0.4rem;
- }
- :global(.ant-checkbox-wrapper) {
- min-width: 100px;
- margin: 5px 0.4rem;
- }
- .hor {
- display: flex;
- align-items: center;
- margin-top: 0.6rem;
- > div {
- width: 100%;
- }
- .label {
- min-width: 70px;
- margin-right: 0.5rem;
- }
- .label + span {
- width: 100%;
- }
- :global(.ant-select) {
- width: 100%;
- }
- }
- .reset {
- display: flex;
- justify-content: flex-end;
- width: 100%;
- padding-bottom: 1rem;
- background: #fff;
- }
- :global(.ant-btn-primary) {
- margin-right: 15px;
- }
- }
- .fold {
- position: absolute;
- top: calc(50% - 30px);
- right: -15px;
- z-index: 2;
- width: 15px;
- height: 75px;
- padding: 0;
- border-radius: 0 10px 10px 0;
- }
- .category {
- width: 260px;
- :global(.ant-select-selection) {
- width: 260px;
- }
- }
- }
- .collapse {
- background: transparent;
- .search {
- display: none;
- }
- }
- </style>
|