MergeApplicantSelect.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div>
  3. <el-dialog title="选择申请人/权利人" :visible.sync="visible" width="900px" append-to-body destroy-on-close
  4. :before-close="close" top="3vh">
  5. <div class="patent-applicant-merge-select">
  6. <el-form :inline="true">
  7. <el-form-item label="当前名称">
  8. <el-input v-model="queryParams.name" size="small" placeholder="请输入当前名称"></el-input>
  9. </el-form-item>
  10. <!-- <el-form-item label="标准名称">
  11. <el-input v-model="queryParams.shortName" size="small" placeholder="请输入标准名称"></el-input>
  12. </el-form-item> -->
  13. <el-form-item>
  14. <el-button type="primary" size="small" @click="getList">查询</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-table v-loading="loading" :data="tableData" border header-row-class-name="custom-table-header"
  18. @sort-change="sortChange">
  19. <el-table-column align="center" width="55">
  20. <!-- <template slot="header">
  21. <el-checkbox :checked="selectAll" @change="onChange3"></el-checkbox>
  22. </template> -->
  23. <template slot-scope="scope">
  24. <el-checkbox :label="scope.row.name" @change="onChange(scope.row)" v-if="!loading"
  25. :checked="ruleForm.mergedName.indexOf(scope.row.name) !== -1"></el-checkbox>
  26. </template>
  27. </el-table-column>
  28. <el-table-column sortable="custom" prop="name" label="当前名称" align="center"
  29. show-overflow-tooltip></el-table-column>
  30. <!-- <el-table-column sortable="custom" prop="shortName" label="标准名称" align="center" show-overflow-tooltip></el-table-column>
  31. <el-table-column sortable="custom" prop="merge" label="是否合并" align="center" show-overflow-tooltip>
  32. <template slot-scope="scope">
  33. <span v-if="scope.row.merge">是</span>
  34. <span v-else>否</span>
  35. </template>
  36. </el-table-column> -->
  37. <el-table-column sortable="custom" prop="countryName" label="国家" align="center" width="150"
  38. show-overflow-tooltip></el-table-column>
  39. <el-table-column prop="addressStr" label="地址" align="center" show-overflow-tooltip></el-table-column>
  40. </el-table>
  41. <div class="pagination">
  42. <el-pagination :current-page.sync="queryParams.pageNum" :page-size="queryParams.pageSize" :total="total"
  43. @current-change="handleCurrentChange" layout="total, prev, pager, next, jumper" background></el-pagination>
  44. </div>
  45. </div>
  46. <div slot="footer" class="dialog-footer">
  47. <el-button @click="close">关 闭</el-button>
  48. <el-button type="primary" @click="submit" :loading="btnLoading">确 定</el-button>
  49. </div>
  50. </el-dialog>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. selectAll: false,
  58. visible: false,
  59. loading: false,
  60. btnLoading: false,
  61. total: 0,
  62. tableData: [],
  63. queryParams: {
  64. name: '',
  65. // shortName: '',
  66. pageSize: 10,
  67. pageNum: 1,
  68. projectId: 0,
  69. // prop: 'id',
  70. // order: 'desc',
  71. // from: 'select',
  72. // mergeId: 0
  73. },
  74. }
  75. },
  76. mounted() {
  77. },
  78. methods: {
  79. open(row) {
  80. this.ruleForm = { ...row }
  81. if (row.id) {
  82. } else {
  83. this.$set(this.ruleForm, 'mergedName', [])
  84. }
  85. this.visible = true
  86. this.selectAll = false
  87. this.queryParams.projectId = row.projectId
  88. this.queryParams.pageNum = 1
  89. // this.queryParams.mergeId = row.id
  90. this.getList()
  91. },
  92. close() {
  93. this.visible = false
  94. },
  95. sortChange({ column, prop, order }) {
  96. if (!order) {
  97. this.queryParams.prop = 'id'
  98. this.queryParams.order = 'desc'
  99. this.getList()
  100. return false
  101. }
  102. const o = {
  103. 'descending': 'desc',
  104. 'ascending': 'asc',
  105. }
  106. switch (prop) {
  107. case 'shortName':
  108. this.queryParams.prop = 'bname'
  109. break
  110. case 'countryName':
  111. this.queryParams.prop = 'country'
  112. break
  113. default:
  114. this.queryParams.prop = prop
  115. }
  116. this.queryParams.order = o[order]
  117. this.getList()
  118. },
  119. onChange(row) {
  120. const index = this.ruleForm.mergedName.indexOf(row.name)
  121. if (index === -1) {
  122. this.ruleForm.mergedName.push(row.name)
  123. } else {
  124. this.ruleForm.mergedName.splice(index, 1)
  125. }
  126. },
  127. onChange3() {
  128. this.selectAll = !this.selectAll
  129. if (this.selectAll) {
  130. let params = {
  131. ...this.queryParams,
  132. type: 0,
  133. }
  134. params.pageSize = 9999999
  135. this.loading = true
  136. this.$api.getMergePerson(params).then(response => {
  137. this.ruleForm.mergedName = response.data.data.map(item => item.name)
  138. this.loading = false
  139. }).catch(error => {
  140. this.loading = false
  141. })
  142. } else {
  143. this.loading = true
  144. this.ruleForm.mergedName = []
  145. this.$nextTick(() => {
  146. this.loading = false
  147. })
  148. }
  149. },
  150. // 获取人员信息
  151. getList() {
  152. this.loading = true
  153. let params = {
  154. type: 0,
  155. ...this.queryParams
  156. }
  157. this.$api.getMergePerson(params).then(response => {
  158. this.tableData = response.data.data
  159. this.total = response.data.total
  160. this.loading = false
  161. }).catch(error => {
  162. this.loading = false
  163. })
  164. },
  165. handleCurrentChange(val) {
  166. this.queryParams.pageNum = val;
  167. this.getList();
  168. },
  169. // 确认按钮
  170. submit() {
  171. if (this.ruleForm.mergedName.length === 0) {
  172. this.$message.error('请选择申请人')
  173. return false
  174. }
  175. this.btnLoading = true
  176. let params = {
  177. type: 0,
  178. ...this.ruleForm,
  179. }
  180. if (this.ruleForm.id) {
  181. this.$api.updateMergePerson(params).then(response => {
  182. if (response.code == 200) {
  183. this.$message.success('编辑成功')
  184. this.btnLoading = false
  185. this.$emit('selectClose')
  186. this.close()
  187. }
  188. }).catch(error => {
  189. this.btnLoading = false
  190. })
  191. } else {
  192. this.$api.mergePerson(params).then(response => {
  193. if (response.code == 200) {
  194. this.$message.success('新增成功')
  195. this.btnLoading = false
  196. this.$emit('selectClose')
  197. this.close()
  198. }
  199. }).catch(error => {
  200. this.btnLoading = false
  201. })
  202. }
  203. // this.$api.editPatentApplicant(this.ruleForm).then(response => {
  204. // this.$message.success('编辑成功')
  205. // this.btnLoading = false
  206. // this.close()
  207. // }).catch(error => {
  208. // this.btnLoading = false
  209. // })
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss">
  215. .patent-applicant-merge-select {
  216. .pagination {
  217. text-align: center;
  218. margin: 20px 0;
  219. }
  220. .el-checkbox__label {
  221. display: none !important;
  222. }
  223. }
  224. </style>