viewIndex.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="patentMiningIndex">
  3. <el-container>
  4. <el-header>
  5. <div>
  6. <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption"
  7. :disabled="!$permission('/workspace/project/check')"></mySearch>
  8. </div>
  9. <div style="display:flex;margin-right:10px">
  10. <el-button-group class="margin-left_10" v-if="[2].indexOf(isOperate) == -1">
  11. <el-button :type="viewType === 'commonTable' ? 'primary' : ''" @click="onChange2('commonTable')"
  12. size="small">列表</el-button>
  13. <el-button :type="viewType === 'commonCard' ? 'primary' : ''" @click="onChange2('commonCard')"
  14. size="small">卡片</el-button>
  15. </el-button-group>
  16. <el-dropdown trigger="click" split-button type="primary" size="small" @command="handleCommand($event)">
  17. <span @click="handleAdd">创建项目</span>
  18. <el-dropdown-menu slot="dropdown" class="text-align_center">
  19. <el-dropdown-item command="0">显示栏位管理</el-dropdown-item>
  20. </el-dropdown-menu>
  21. </el-dropdown>
  22. </div>
  23. </el-header>
  24. <el-main>
  25. <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList" :column="columnList"
  26. :group="group" :queryParams="queryParams" @option="handleOption" @sort="handleSort"></component>
  27. </el-main>
  28. <el-footer class="pagination">
  29. <div>
  30. <el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
  31. :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="total">
  32. </el-pagination>
  33. </div>
  34. </el-footer>
  35. </el-container>
  36. <addAndEditProject ref="addAndEditProject" @isSuccess="isSuccess"></addAndEditProject>
  37. <fields ref="field" type="patentDigProject" @getFieldList="getFieldList"></fields>
  38. </div>
  39. </template>
  40. <script>
  41. import commonTable from './view/commonTable.vue';
  42. import addAndEditProject from './dialog/addAndEditProject.vue';
  43. import fields from '@/views/components/dialog/fields.vue';
  44. export default {
  45. components: {
  46. commonTable,
  47. addAndEditProject,
  48. fields,
  49. },
  50. props: {
  51. isOperate: ''
  52. },
  53. data() {
  54. return {
  55. //当前组件名称
  56. viewType: 'commonTable',
  57. //专利挖掘项目数据集合
  58. dataList: [],
  59. //分页
  60. queryParams: {
  61. size: 10,
  62. current: 0,
  63. },
  64. //当前分组的值
  65. group: '',
  66. // 分组字段数组
  67. groupingOption:[],
  68. //排序
  69. sort: [ { "orderBy": "createTime", "orderType": 1 } ],
  70. //总数
  71. total: 0,
  72. //检索字段
  73. searchFiled: [
  74. {
  75. label: '项目名称',
  76. value: 'name',
  77. type: 1,
  78. placeholder: '请输入项目名称'
  79. },
  80. {
  81. label: '创建人',
  82. value: 'createPerson',
  83. type: 1,
  84. placeholder: '请输入创建人名称'
  85. },
  86. ],
  87. //检索条件
  88. searchOption: {},
  89. // table栏位信息
  90. columnList: [],
  91. // 获取
  92. };
  93. },
  94. watch: {},
  95. computed: {},
  96. created() { },
  97. async mounted() {
  98. // 获取table栏位
  99. this.columnList = await this.$commonJS.getCustomField('patentDigProject')
  100. //获取检索、分组字段
  101. await this.getColumn()
  102. // 获取table数据
  103. this.getList()
  104. },
  105. methods: {
  106. //显示栏位管理
  107. getFieldList(data){
  108. this.columnList = data
  109. },
  110. // 获取检索及分组栏位
  111. async getColumn() {
  112. let params = ['patentDigProject']
  113. await this.$api.getParamsCommon(params).then(res => {
  114. if (res.code == 200) {
  115. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  116. // 分组字段
  117. this.groupingOption = this.$commonJS.getField(conditionDTOList, (u) => u.ifGroup == true, {
  118. name: 'name',
  119. value: 'value',
  120. })
  121. // 检索字段
  122. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  123. label: 'name',
  124. value: 'value',
  125. type: 'type',
  126. })
  127. //为array类型添加选项
  128. // var obj = this.searchFiled.find(item => { return item.label == '应用场景' })
  129. // if (obj) {
  130. // obj.options = this.scene.map(item => {
  131. // return {
  132. // label: item.name,
  133. // value: item.id
  134. // }
  135. // })
  136. // }
  137. }
  138. })
  139. this.showView = false
  140. this.$nextTick(() => {
  141. this.showView = true
  142. })
  143. },
  144. // 新增、编辑成功信息
  145. isSuccess(val) {
  146. this.getList()
  147. },
  148. //获取检索组件传过来的数据
  149. search(val) {
  150. let params = {}
  151. val.forEach(item => {
  152. if (item.type == 3) {
  153. params[item.value]=item.searchValue.map(itemValue => {
  154. return itemValue.value
  155. })
  156. } else {
  157. params[item.value]=item.searchValue.label
  158. }
  159. })
  160. // 返回条件对象
  161. this.searchOption.searchQuery=params
  162. // 调用查询接口
  163. this.queryParams.current = 1
  164. this.getList()
  165. },
  166. //排序
  167. handleSort({ column, prop, order }) {
  168. this.sort=[]//如需要多个字段排序,则不需要清空
  169. if (order == null) {
  170. return;
  171. }
  172. var orderType = {
  173. ascending: 0,
  174. descending:1
  175. }
  176. var params = this.sort.find(item => {
  177. return item.orderBy == prop
  178. })
  179. if (params) {
  180. params.orderType = orderType[order]
  181. } else {
  182. params = {}
  183. params.orderBy = prop
  184. params.orderType = orderType[order]
  185. this.sort.push(params)
  186. }
  187. this.queryParams.current = 1
  188. this.getList()
  189. },
  190. //分页
  191. handleCurrentChange(val) {
  192. this.queryParams.current = val;
  193. this.getList();
  194. },
  195. //获取专利挖掘项目数据列表
  196. getList() {
  197. let params = {
  198. ...this.queryParams,//分页信息
  199. searchQuery: this.$commonJS.objectToString(this.searchOption.searchQuery || {}),//检索条件
  200. orderDTOList: this.sort,//排序
  201. }
  202. this.$api.queryPatentDigProject(params).then(res => {
  203. if (res.code == 200) {
  204. this.dataList = res.data.data
  205. this.total = res.data.total
  206. }
  207. }).catch(error => {
  208. this.dataList = []
  209. this.total = 0
  210. this.$message.error(error.message)
  211. })
  212. },
  213. //创建项目按钮,添加其他企业专利数据库
  214. handleAdd() {
  215. this.$refs.addAndEditProject.open()
  216. },
  217. // 创建项目按钮下拉菜单内容
  218. handleCommand(ev) {
  219. switch (ev) {
  220. case '0'://显示栏位管理
  221. this.$refs.field.open(this.columnList)
  222. break;
  223. default:
  224. break;
  225. }
  226. },
  227. //切换视图
  228. onChange2(val) {
  229. this.viewType = val
  230. this.queryParams.current=1
  231. this.getList()
  232. },
  233. //操作列
  234. handleOption({ option, row }) {
  235. switch (option) {
  236. case '0'://设置定时任务
  237. // this.$refs.addAndEditDB.open(row, true)
  238. break;
  239. case '1'://删除
  240. this.projectDelete(row)
  241. break;
  242. case 'e'://编辑
  243. this.$refs.addAndEditProject.open(row)
  244. break;
  245. }
  246. },
  247. // 删除项目
  248. projectDelete(row) {
  249. this.projectDeletes([row.id])
  250. },
  251. // 删除项目
  252. projectDeletes(ids,isLast) {
  253. this.$confirm('此操作将删除该项目, 是否继续?', '提示', {
  254. confirmButtonText: '确定',
  255. cancelButtonText: '取消',
  256. type: 'warning'
  257. }).then(() => {
  258. this.$api.deletePatentDigProject(ids).then(res => {
  259. if (res.code == 200) {
  260. // if(isLast){
  261. // this.isGrouping()
  262. // }else{
  263. this.getList()
  264. // }
  265. // this.handleMessage = '删除成功'
  266. // this.clearMessage()
  267. this.$message.success('删除成功!');
  268. }
  269. })
  270. }).catch(() => {
  271. this.$message.info('已取消删除');
  272. });
  273. },
  274. },
  275. };
  276. </script>
  277. <style lang="scss" scoped>
  278. .patentMiningIndex {
  279. height: 100%;
  280. }
  281. </style>