index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <div class="workspace height_100">
  3. <!-- <div class="query-top" v-if="[2].indexOf(isOperate) == -1">
  4. <el-collapse>
  5. <el-collapse-item title="图表预览" name="1">
  6. <div class="chart-box">
  7. <total-chart ref="totalChart" />
  8. </div>
  9. </el-collapse-item>
  10. </el-collapse>
  11. </div> -->
  12. <div class="height_100">
  13. <el-container v-if="showView">
  14. <el-header>
  15. <div id="step1">
  16. <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption"></mySearch>
  17. </div>
  18. <div style="display:flex;margin-right:10px">
  19. <div id="step2" v-if="[2].indexOf(isOperate) == -1">
  20. <span>分组查询:</span>
  21. <el-select v-model="group" clearable size="small"
  22. @change="onChange" style="width:200px">
  23. <el-option v-for="item in groupingOption" :key="item.value" :label="item.name" :value="item.value">
  24. </el-option>
  25. </el-select>
  26. </div>
  27. <el-button-group class="margin-left_10" id="step3" v-if="[2].indexOf(isOperate) == -1">
  28. <el-button :type="queryShowType === '2' ? 'primary' : ''" @click="onChange2('2')"
  29. size="small">可视化</el-button>
  30. <el-button :type="queryShowType === '0' ? 'primary' : ''" @click="onChange2('0')"
  31. size="small">列表</el-button>
  32. <el-button :type="queryShowType === '1' ? 'primary' : ''" @click="onChange2('1')"
  33. size="small">卡片</el-button>
  34. </el-button-group>
  35. <el-dropdown id="step4" trigger="click" split-button type="primary" size="small">
  36. <span @click="handleAdd" v-disabled="false">新增专利数据库</span>
  37. <el-dropdown-menu slot="dropdown" class="text-align_center">
  38. <!-- <el-dropdown-item @click.native="handleExport" v-if="[2].indexOf(isOperate) == -1">导出列表</el-dropdown-item>
  39. <el-dropdown-item @click.native="handleImport" v-if="[2].indexOf(isOperate) == -1">导入数据包</el-dropdown-item> -->
  40. <el-dropdown-item @click.native="handleField">显示栏位管理</el-dropdown-item>
  41. </el-dropdown-menu>
  42. </el-dropdown>
  43. </div>
  44. </el-header>
  45. <el-main class="workspace-main height_100">
  46. <div v-loading="loading" class="height_100">
  47. <component v-if="showView" :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate"
  48. :tableData="dataList" :groupBy="group" :groupingOption="groupingOption" :searchOption="searchOption" :scenario="commonData" :matter="matter"
  49. :queryParams="queryParams" :column="fieldList" @option="handleOption" @on-sort="handleSort" :handleMessage="handleMessage"></component>
  50. </div>
  51. </el-main>
  52. <el-footer class="pagination" v-if="[2].indexOf(isOperate) == -1 && this.queryShowType != '2'">
  53. <el-pagination backgroundx layout="total,sizes, prev, pager, next, jumper" :current-page.sync="queryParams.current"
  54. :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="total">
  55. </el-pagination>
  56. </el-footer>
  57. </el-container>
  58. </div>
  59. <project-form-drawer @submit="getMessage" :common-data="commonData" ref="projectFormDrawer" />
  60. <field ref="field" type="patentProject" @getFieldList="getFieldList"></field>
  61. <!-- 项目分享 -->
  62. <patentShare ref="patentShare"></patentShare>
  63. </div>
  64. </template>
  65. <script>
  66. import { mapGetters } from 'vuex'
  67. import TotalChart from "./components/TotalChart";
  68. import Table from "./components/view/table.vue";
  69. import Card from "./components/view/card.vue";
  70. import mergeTable from "./components/view/MergeTable.vue";
  71. import ProjectFormDrawer from './components/drawer/form.vue'
  72. import field from '@/views/components/dialog/fields.vue';
  73. import patentShare from '@/views/components/drawer/Share.vue';
  74. export default {
  75. components: {
  76. TotalChart,
  77. Table,
  78. Card,
  79. ProjectFormDrawer,
  80. field,
  81. mergeTable,
  82. patentShare,
  83. },
  84. props: {
  85. isOperate: '',
  86. matterId:{},
  87. scenarioId:{},
  88. eventName:'',
  89. eventId:''
  90. },
  91. data() {
  92. return {
  93. //检索字段
  94. searchFiled: [],
  95. //检索条件
  96. searchOption: {
  97. scenarioNames:this.scenarioId,
  98. matterNames:this.matterId,
  99. name:localStorage.searchContent,
  100. eventNames:this.eventName
  101. },
  102. //专利数据库数据总数
  103. total: 0,
  104. //分页信息
  105. queryParams: {
  106. size: 10,
  107. current: 1,
  108. },
  109. //排序
  110. sort: [
  111. {
  112. "orderBy": "createTime",
  113. "orderType": 1
  114. }
  115. ],
  116. //分组集合
  117. groupingOption: [],
  118. //分组
  119. group: '',
  120. //展示的视图
  121. queryShowType: '0',
  122. //显示的视图组件
  123. viewType: 'Table',
  124. //加载
  125. loading: false,
  126. //专利数据库数据集合//分组及不分组公用此变量
  127. dataList: [],
  128. //栏位集合
  129. fieldList: [],
  130. //接受子组件消息
  131. handleMessage: '',
  132. //显示视图
  133. showView: false,
  134. };
  135. },
  136. watch: {},
  137. computed: {
  138. ...mapGetters(['userinfo']),
  139. commonData() {
  140. var a = this.$store.state.dictMessage.scenario.map(item => {
  141. return {
  142. label: item.name,
  143. value: item.id
  144. }
  145. })
  146. var obj = this.searchFiled.find(item => { return item.label == '应用场景' })
  147. if (obj) {
  148. obj.options = a
  149. }
  150. return this.$store.state.dictMessage.scenario || []
  151. },
  152. matter() {
  153. var a = this.$store.state.dictMessage.matter.map(item => {
  154. return {
  155. label: item.name,
  156. value: item.id
  157. }
  158. })
  159. var obj = this.searchFiled.find(item => { return item.label == '调查类型' })
  160. if (obj) {
  161. obj.options = a
  162. }
  163. return this.$store.state.dictMessage.matter || []
  164. }
  165. },
  166. created() { },
  167. async mounted() {
  168. this.fieldList = await this.$commonJS.getCustomField('patentProject')
  169. //获取检索字段和分组字段
  170. await this.getColumn()
  171. //获取专利数据库列表
  172. this.getList()
  173. this.showViews()
  174. },
  175. methods: {
  176. //显示视图?
  177. showViews() {
  178. this.showView = false
  179. this.$nextTick(() => {
  180. this.showView = true
  181. })
  182. },
  183. //获取自定义栏位
  184. getFieldList(data) {
  185. this.fieldList = []
  186. this.$nextTick(()=>{
  187. this.fieldList = data
  188. })
  189. },
  190. //获取检索字段和分组字段
  191. async getColumn() {
  192. let params = ['patentProject']
  193. await this.$api.getParamsCommon(params).then(async res => {
  194. if (res.code == 200) {
  195. // 分组字段
  196. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  197. this.groupingOption = this.$commonJS.getField(conditionDTOList, (u) => u.ifGroup == true, {
  198. name: 'name',
  199. value: 'value',
  200. })
  201. // 搜索字段
  202. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  203. label: 'name',
  204. value: 'value',
  205. type: 'type',
  206. })
  207. //为应用场景添加选项
  208. var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
  209. if(obj){
  210. obj.options = this.commonData.map(item=>{
  211. return {
  212. label:item.name,
  213. value:item.id
  214. }
  215. })
  216. }
  217. var obj = this.searchFiled.find(item=>{return item.label == '调查类型'})
  218. if(obj){
  219. obj.options = this.matter.map(item=>{
  220. return {
  221. label:item.name,
  222. value:item.id
  223. }
  224. })
  225. }
  226. }
  227. })
  228. this.showViews()
  229. },
  230. //检索
  231. search(val) {
  232. let params = {}
  233. val.forEach(item => {
  234. if (item.type == 3) {
  235. params[item.value] = item.searchValue.map(itemValue => {
  236. return itemValue.value
  237. })
  238. } else {
  239. params[item.value] = item.searchValue.label
  240. }
  241. })
  242. this.searchOption = this.$commonJS.ArrayToArray(val)
  243. // 调用查询接口
  244. this.queryParams.current = 1
  245. this.isGrouping()
  246. },
  247. //获取专利数据库列表/卡片数据
  248. getList() {
  249. this.queryParams.size = this.queryShowType === '0' ? 10 : 12
  250. var params = this.queryParams
  251. params = {
  252. ...this.queryParams,//分页信息
  253. searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
  254. orderDTOList: this.sort,//排序
  255. }
  256. this.loading = true
  257. this.$api.queryPatentProject(params).then(response => {
  258. this.dataList = response.data.data
  259. this.total = response.data.total
  260. this.loading = false
  261. }).catch(error => {
  262. this.dataList = []
  263. this.total = 0
  264. this.loading = false
  265. })
  266. },
  267. // 获取分组数据
  268. getGrouping() {
  269. let params = {
  270. ...this.queryParams,//分页信息
  271. searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
  272. orderDTOList: [
  273. {
  274. orderBy:this.group,
  275. orderType:this.sort[0].orderType
  276. }
  277. ],//排序
  278. groupBy: this.group,//分组的值
  279. }
  280. this.loading = true
  281. this.$api.groupPatentProject(params).then(response => {
  282. this.dataList = response.data.data.values
  283. this.total = response.data.total
  284. this.loading = false
  285. }).catch(error => {
  286. this.dataList = []
  287. this.total = 0
  288. this.loading = false
  289. })
  290. },
  291. //排序
  292. handleSort({ column, prop, order, str }) {
  293. var params = {
  294. sort:this.sort,
  295. column,
  296. prop,
  297. order,
  298. }
  299. this.sort = this.$commonJS.getSortData(params)//如需要多个字段排序,则不需要清空
  300. this.queryParams.current = 1
  301. //1表示展开行2表示基础表格
  302. if (str == '1') {
  303. this.getGrouping()
  304. } else {//table排序
  305. this.getList()
  306. }
  307. },
  308. //分页
  309. handleCurrentChange(val) {
  310. this.queryParams.current = val;
  311. this.isGrouping();
  312. },
  313. //切换到分组
  314. onChange(val) {
  315. if (val != '') {
  316. this.viewType = 'mergeTable'
  317. this.queryShowType = '0'
  318. } else {
  319. this.queryShowType = '0'
  320. this.viewType = 'Table'
  321. }
  322. this.group = val
  323. this.queryParams.current = 1
  324. this.queryParams.size = 10
  325. this.isGrouping()//区分是否分组,调用不同请求数据
  326. },
  327. // 区分是否为分组
  328. isGrouping() {
  329. if (this.group != '') {//分组
  330. this.getGrouping()
  331. } else {//不分组
  332. this.getList()
  333. }
  334. },
  335. //切换table、卡片视图
  336. onChange2(type) {
  337. var viewTypes = {
  338. '0':'Table',
  339. '1':'Card',
  340. '2':'TotalChart'
  341. }
  342. this.group = ''
  343. this.queryShowType = type
  344. this.viewType = viewTypes[type]
  345. if(type == 2){
  346. return false
  347. }
  348. this.queryParams.current = 1
  349. this.getList()
  350. // this.onChange()
  351. },
  352. //新增专利数据库
  353. handleAdd() {
  354. this.$refs.projectFormDrawer.open({
  355. ifUpdate: false,
  356. updateTime: 'day',
  357. crons: '',
  358. status: '0',
  359. sort: 1,
  360. matterIds:this.matterId || [],
  361. scenarioIds:this.scenarioId || [],
  362. eventName:this.eventName,
  363. eventId:this.eventId
  364. }, '新增专利数据库')
  365. },
  366. //确认提交专利数据库信息
  367. getMessage(val) {
  368. this.handleMessage = val
  369. this.queryParams.current = 1
  370. this.isGrouping()
  371. this.clearMessage()
  372. },
  373. clearMessage() {
  374. this.$emit('submit',true)
  375. this.$nextTick(() => {
  376. this.handleMessage = ''
  377. })
  378. },
  379. //导出列表
  380. handleExport() {
  381. this.btnLoading = true
  382. this.$api.exportProjectList().then(response => {
  383. downLoad(response, getFileName('xlsx'))
  384. this.btnLoading = false
  385. }).catch(error => {
  386. this.btnLoading = false
  387. })
  388. },
  389. //导入数据包
  390. handleImport() {
  391. this.$refs.projectImport.open()
  392. },
  393. //显示栏位管理
  394. handleField() {
  395. this.$refs.field.open(this.fieldList)
  396. },
  397. //操作列
  398. async handleOption({ option, row ,isLast}) {
  399. if(!(await this.$permission.projectPermission(row.id))){
  400. this.$showPermissionDialog()
  401. return false
  402. }
  403. switch (option) {
  404. case '0'://Excel导入
  405. this.patentImport(row,1)
  406. break
  407. case '1'://专利号导入
  408. this.patentImport(row,2)
  409. break
  410. case '2'://检索条件导入
  411. this.patentImport(row,4)
  412. break
  413. case '3'://任务清单
  414. this.taskList(row)
  415. break
  416. case '5'://报告管理
  417. this.reportFile(row)
  418. break
  419. case '6'://产品架构
  420. this.framework(row)
  421. break
  422. case '7'://事件
  423. break
  424. case '8'://其他附件
  425. this.otherFiles(row)
  426. break;
  427. case '9'://项目分享
  428. this.$refs.patentShare.open(row.id)
  429. break;
  430. case '10'://删除
  431. this.deletes(row,isLast)
  432. break
  433. case 'e'://编辑
  434. this.handleEdit(row)
  435. break
  436. }
  437. },
  438. otherFiles(row){
  439. },
  440. //任务清单
  441. taskList(row){
  442. this.$router.push(
  443. {
  444. path:'/myTask',
  445. query:{
  446. projectId:row.id
  447. }
  448. }
  449. )
  450. },
  451. //报告文档
  452. reportFile(row){
  453. this.$router.push(
  454. {
  455. path:'/reportFiles',
  456. query:{
  457. projectId:row.id
  458. }
  459. }
  460. )
  461. },
  462. //架构
  463. framework(row){
  464. var data = row.productOrCategory
  465. if(!data){
  466. this.$message.warning('该专利数据库没有产品或产品结构')
  467. return false
  468. }
  469. var form = {
  470. name:data.name,
  471. id:data.id,
  472. type:data.type == 3?1:data.type,
  473. }
  474. let router = this.$router.resolve({
  475. path: '/frameworkIndex',
  476. query: {
  477. row: JSON.stringify(form),
  478. projectId:row.id
  479. }
  480. })
  481. window.open(router.href, '_blank')
  482. },
  483. //专利导入
  484. patentImport(row,type){
  485. var form = {
  486. importToId:row.id,
  487. importToType:0,
  488. type:type,
  489. ifUpdate:row.ifUpdate,
  490. crons:row.crons
  491. }
  492. this.$commonJS.toImportParent(form,type)
  493. },
  494. //获取删除的id
  495. deletes(row,isLast) {
  496. this.deletePatentProject([row.id],isLast)
  497. },
  498. //删除专利数据库
  499. deletePatentProject(ids) {
  500. this.$confirm('此操作将删除该产品类别, 是否继续?', '提示', {
  501. confirmButtonText: '确定',
  502. cancelButtonText: '取消',
  503. type: 'warning'
  504. }).then(() => {
  505. this.$api.deletePatentProject(ids).then(response => {
  506. if (response.code == 200) {
  507. this.handleMessage = '删除成功'
  508. this.$message.success('删除成功!');
  509. if (!this.group) {
  510. this.getList()
  511. }
  512. this.clearMessage()
  513. }
  514. })
  515. })
  516. },
  517. //编辑专利数据库
  518. handleEdit(row) {
  519. var form = JSON.parse(JSON.stringify(row))
  520. if(form.productOrCategory){
  521. form.products = {
  522. treeType:form.productOrCategory.type,
  523. fieldId:form.productOrCategory.id,
  524. name:form.productOrCategory.name,
  525. valueIds:[]
  526. }
  527. form.structureId = form.productOrCategory.valueIds?form.productOrCategory.valueIds[0]:''
  528. }
  529. this.$refs.projectFormDrawer.open(form, '编辑专利数据库')
  530. },
  531. },
  532. };
  533. </script>
  534. <style lang="scss" scoped></style>
  535. <style lang="scss">
  536. .workspace {
  537. .workspace-card {
  538. min-height: calc(100% - 3px);
  539. // padding-bottom: 15px;
  540. .workspace-main {
  541. padding-top: 10px;
  542. width: 100%;
  543. }
  544. .el-card__body {
  545. height: 100%;
  546. }
  547. }
  548. .nopadding .el-card__body {
  549. padding: 0 !important;
  550. }
  551. .query-top {
  552. border-bottom: 1px solid #bbb;
  553. padding-bottom: 10px;
  554. .el-collapse {
  555. border-bottom: 0 !important;
  556. border-top: 0 !important;
  557. .el-collapse-item__wrap,
  558. .el-collapse-item__header {
  559. border-bottom: 0 !important;
  560. }
  561. .el-collapse-item__header {
  562. padding-left: 15px;
  563. font-weight: bold;
  564. }
  565. .is-active .el-collapse-item__wrap {
  566. border-top: 1px solid #bbb;
  567. }
  568. }
  569. .chart-box {
  570. height: 250px;
  571. }
  572. }
  573. }
  574. </style>