123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519 |
- <template>
- <div class="workspace height_100">
- <div shadow="never" class="workspace-card nopadding height_100">
- <div class="query-top" v-if="[2].indexOf(isOperate) == -1">
- <el-collapse>
- <el-collapse-item title="图表预览" name="1">
- <div class="chart-box">
- <total-chart ref="totalChart" />
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- <div class="height_100">
- <el-container v-if="showView">
- <el-header>
- <div id="step1">
- <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption"
- :disabled="!$permission('/workspace/project/check')"></mySearch>
- </div>
- <div style="display:flex;margin-right:10px">
- <div id="step2" v-if="[2].indexOf(isOperate) == -1">
- <span>分组查询:</span>
- <el-select v-model="group" :disabled="!$permission('/workspace/project/check')" clearable size="small"
- @change="onChange" style="width:200px">
- <el-option v-for="item in groupingOption" :key="item.value" :label="item.name" :value="item.value">
- </el-option>
- </el-select>
- </div>
- <el-button-group class="margin-left_10" id="step3" v-if="[2].indexOf(isOperate) == -1">
- <el-button :type="queryShowType === '0' ? 'primary' : ''" @click="onChange2('0')"
- size="small">列表</el-button>
- <el-button :type="queryShowType === '1' ? 'primary' : ''" @click="onChange2('1')"
- size="small">卡片</el-button>
- </el-button-group>
- <el-dropdown id="step4" trigger="click" split-button type="primary" size="small">
- <span @click="handleAdd" v-disabled="false">新增专利数据库</span>
- <el-dropdown-menu slot="dropdown" class="text-align_center">
- <el-dropdown-item @click.native="handleExport" v-if="[2].indexOf(isOperate) == -1">导出列表</el-dropdown-item>
- <el-dropdown-item @click.native="handleImport"
- :disabled="!$permission('/workspace/project/import')" v-if="[2].indexOf(isOperate) == -1">导入数据包</el-dropdown-item>
- <el-dropdown-item @click.native="handleField">显示栏位管理</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </el-header>
- <el-main class="workspace-main">
- <div v-loading="loading">
- <component v-if="showView" :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate"
- :tableData="dataList" :groupBy="group" :groupingOption="groupingOption" :searchOption="searchOption"
- :queryParams="queryParams" :column="fieldList" @option="handleOption" @on-sort="handleSort" :handleMessage="handleMessage"></component>
- </div>
- <div class="pagination" v-if="[2].indexOf(isOperate) == -1">
- <el-pagination background layout="total, prev, pager, next, jumper"
- :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
- @current-change="handleCurrentChange" :total="total">
- </el-pagination>
- </div>
- </el-main>
- <el-footer class="pagination" v-if="[2].indexOf(isOperate) != -1">
- <el-pagination backgroundx layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
- :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="total">
- </el-pagination>
- </el-footer>
- </el-container>
- </div>
- </div>
- <project-form-drawer @submit="getMessage" :common-data="commonData" ref="projectFormDrawer" />
- <field ref="field" type="patentProject" @getFieldList="getFieldList"></field>
- <customField ref="customField"></customField>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import TotalChart from "./components/TotalChart";
- import Table from "./components/view/table.vue";
- import Card from "./components/view/card.vue";
- import mergeTable from "./components/view/MergeTable.vue";
- import ProjectFormDrawer from './components/drawer/form.vue'
- import field from '@/views/components/dialog/fields.vue';
- import customField from '@/views/components/drawer/Field.vue';
- export default {
- components: {
- TotalChart,
- Table,
- Card,
- ProjectFormDrawer,
- field,
- mergeTable,
- customField
- },
- props: {
- isOperate: '',
- matterId:{},
- scenarioId:{}
- },
- data() {
- return {
- //检索字段
- searchFiled: [],
- //检索条件
- searchOption: {
- scenarioNames:this.scenarioId,
- matterNames:this.matterId,
- name:localStorage.searchContent
- },
- //专利数据库数据总数
- total: 0,
- //分页信息
- queryParams: {
- size: 10,
- current: 1,
- },
- //排序
- sort: [
- {
- "orderBy": "createTime",
- "orderType": 1
- }
- ],
- //分组集合
- groupingOption: [],
- //分组
- group: '',
- //展示的视图
- queryShowType: '0',
- //显示的视图组件
- viewType: 'Table',
- //加载
- loading: false,
- //专利数据库数据集合//分组及不分组公用此变量
- dataList: [],
- //栏位集合
- fieldList: [],
- //接受子组件消息
- handleMessage: '',
- //显示视图
- showView: false,
- };
- },
- watch: {},
- computed: {
- ...mapGetters(['userinfo']),
- commonData() {
- var a = this.$store.state.dictMessage.scenario.map(item => {
- return {
- label: item.name,
- value: item.id
- }
- })
- var obj = this.searchFiled.find(item => { return item.label == '应用场景' })
- if (obj) {
- obj.options = a
- }
- return this.$store.state.dictMessage.scenario || []
- },
- matter() {
- var a = this.$store.state.dictMessage.matter.map(item => {
- return {
- label: item.name,
- value: item.id
- }
- })
- var obj = this.searchFiled.find(item => { return item.label == '调查类型' })
- if (obj) {
- obj.options = a
- }
- return this.$store.state.dictMessage.matter || []
- }
- },
- created() { },
- async mounted() {
- this.fieldList = await this.$commonJS.getCustomField('patentProject')
- //获取检索字段和分组字段
- await this.getColumn()
- //获取应用场景统计
- // if ([2].indexOf(this.isOperate) == -1) {
- // this.getScenarioAndTypeTotal();
- // }
- //获取专利数据库列表
- this.getList()
- this.showViews()
- },
- methods: {
- //显示视图?
- showViews() {
- this.showView = false
- this.$nextTick(() => {
- this.showView = true
- })
- },
- //获取自定义栏位
- getFieldList(data) {
- this.fieldList = data
- },
- //获取检索字段和分组字段
- async getColumn() {
- let params = ['patentProject']
- await this.$api.getParamsCommon(params).then(async res => {
- if (res.code == 200) {
- // 分组字段
- let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
- this.groupingOption = this.$commonJS.getField(conditionDTOList, (u) => u.ifGroup == true, {
- name: 'name',
- value: 'value',
- })
- // 搜索字段
- this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
- label: 'name',
- value: 'value',
- type: 'type',
- })
- //为应用场景添加选项
- var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
- if(obj){
- obj.options = this.commonData.map(item=>{
- return {
- label:item.name,
- value:item.id
- }
- })
- }
- var obj = this.searchFiled.find(item=>{return item.label == '调查类型'})
- if(obj){
- obj.options = this.matter.map(item=>{
- return {
- label:item.name,
- value:item.id
- }
- })
- }
- }
- })
- this.showViews()
- },
- //获取应用场景统计
- getScenarioAndTypeTotal() {
- this.$api.getScenarioAndTypeTotal().then((response) => {
- this.queryTotal = response.data;
- this.$refs.totalChart.initData(response.data);
- });
- },
- //检索
- search(val) {
- let params = {}
- val.forEach(item => {
- if (item.type == 3) {
- params[item.value] = item.searchValue.map(itemValue => {
- return itemValue.value
- })
- } else {
- params[item.value] = item.searchValue.label
- }
- })
- this.searchOption = params
- // 调用查询接口
- this.queryParams.current = 1
- this.isGrouping()
- },
- //获取专利数据库列表/卡片数据
- getList() {
- this.queryParams.size = this.queryShowType === '0' ? 10 : 12
- var params = this.queryParams
- params = {
- ...this.queryParams,//分页信息
- searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
- orderDTOList: this.sort,//排序
- }
- this.loading = true
- this.$api.queryPatentProject(params).then(response => {
- this.dataList = response.data.data
- this.total = response.data.total
- this.loading = false
- }).catch(error => {
- this.dataList = []
- this.total = 0
- this.loading = false
- })
- },
- // 获取分组数据
- getGrouping() {
- let params = {
- ...this.queryParams,//分页信息
- searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
- orderDTOList: this.sort,//排序
- groupBy: this.group,//分组的值
- }
- this.loading = true
- this.$api.groupPatentProject(params).then(response => {
- this.dataList = response.data.data.values
- this.total = response.data.total
- this.loading = false
- }).catch(error => {
- this.dataList = []
- this.total = 0
- this.loading = false
- })
- },
- //排序
- handleSort({ column, prop, order, str }) {
- var params = {
- sort:this.sort,
- column,
- prop,
- order,
- }
- this.sort = this.$commonJS.getSortData(params)//如需要多个字段排序,则不需要清空
- this.queryParams.current = 1
- //1表示展开行2表示基础表格
- if (str == '1') {
- this.getGrouping()
- } else {//table排序
- this.getList()
- }
- },
- //分页
- handleCurrentChange(val) {
- this.queryParams.current = val;
- this.isGrouping();
- },
- //切换到分组
- onChange(val) {
- if (val != '') {
- this.viewType = 'mergeTable'
- } else {
- this.viewType = 'Table'
- }
- this.group = val
- this.queryParams.current = 1
- this.queryParams.size = 10
- this.isGrouping()//区分是否分组,调用不同请求数据
- },
- // 区分是否为分组
- isGrouping() {
- if (this.group != '') {//分组
- this.getGrouping()
- } else {//不分组
- this.getList()
- }
- },
- //切换table、卡片视图
- onChange2(type) {
- this.group = ''
- if (type == '0') {//type为0时是table页面
- this.viewType = 'Table'
- } else {//type为1时是卡片页面
- this.viewType = 'Card'
- }
- this.queryShowType = type
- this.queryParams.current = 1
- this.getList()
- // this.onChange()
- },
- //新增专利数据库
- handleAdd() {
- this.$refs.projectFormDrawer.open({
- ifUpdate: false,
- updateTime: 'day',
- crons: '',
- status: '0',
- sort: 1,
- matterIds: [],
- scenarioIds: []
- }, '新增专利数据库')
- },
- //确认提交专利数据库信息
- getMessage(val) {
- this.handleMessage = val
- this.queryParams.current = 1
- this.isGrouping()
- this.clearMessage()
- },
- clearMessage() {
- this.$nextTick(() => {
- this.handleMessage = ''
- })
- },
- //导出列表
- handleExport() {
- this.btnLoading = true
- this.$api.exportProjectList().then(response => {
- downLoad(response, getFileName('xlsx'))
- this.btnLoading = false
- }).catch(error => {
- this.btnLoading = false
- })
- },
- //导入数据包
- handleImport() {
- this.$refs.projectImport.open()
- },
- //显示栏位管理
- handleField() {
- this.$refs.field.open(this.fieldList)
- },
- //操作列
- handleOption({ option, row ,isLast}) {
- switch (option) {
- case '0'://Excel导入
- this.handleExcelImport(row)
- break
- case '1'://专利号导入
- break
- case '2'://检索条件导入
- this.handleFile(row, 1)
- break
- case '3'://任务清单
- this.handleFile(row, 0)
- break
- case '5'://报告管理
- break
- case '6'://产品架构
- break
- case '7'://事件
- break
- case '8'://其他附件
- break;
- case '9'://项目分享
- break;
- case '10'://删除
- this.deletes(row,isLast)
- break
- case 'e'://编辑
- this.handleEdit(row)
- break
- case '11':
- this.$refs.customField.open(row.id)
- break;
- }
- },
- //获取删除的id
- deletes(row,isLast) {
- this.deletePatentProject([row.id],isLast)
- },
- //删除专利数据库
- deletePatentProject(ids) {
- this.$confirm('此操作将删除该产品类别, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$api.deletePatentProject(ids).then(response => {
- if (response.code == 200) {
- this.handleMessage = '删除成功'
- this.$message.success('删除成功!');
- if (!this.group) {
- this.getList()
- }
- this.clearMessage()
- }
- })
- })
- },
- //编辑专利数据库
- handleEdit(row) {
- this.$refs.projectFormDrawer.open(JSON.parse(JSON.stringify(row)), '编辑专利数据库')
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
- <style lang="scss">
- .workspace {
- .workspace-card {
- min-height: calc(100% - 3px);
- // padding-bottom: 15px;
- .workspace-main {
- padding-top: 10px;
- width: 100%;
- }
- .el-card__body {
- height: 100%;
- }
- }
- .nopadding .el-card__body {
- padding: 0 !important;
- }
- .query-top {
- border-bottom: 1px solid #bbb;
- padding-bottom: 10px;
- .el-collapse {
- border-bottom: 0 !important;
- border-top: 0 !important;
- .el-collapse-item__wrap,
- .el-collapse-item__header {
- border-bottom: 0 !important;
- }
- .el-collapse-item__header {
- padding-left: 15px;
- font-weight: bold;
- }
- .is-active .el-collapse-item__wrap {
- border-top: 1px solid #bbb;
- }
- }
- .chart-box {
- height: 250px;
- }
- }
- }
- </style>
|