阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
6.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="app-container row-container">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <div class="head-search">
  6. <!-- 搜索 -->
  7. <el-input v-model="query.blurry" clearable size="small" placeholder="输入规则名称搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  8. <!-- @input="changePid" -->
  9. <treeselect
  10. v-model="query.source"
  11. :options="sourceOptions"
  12. :load-options="loadSource"
  13. style="width: 320px;"
  14. placeholder="请选择源分类(文件库分类)"
  15. />
  16. <treeselect
  17. v-model="query.target"
  18. :options="targetOptions"
  19. :load-options="loadSource"
  20. style="width: 320px;"
  21. placeholder="请选择目标门类(整理库/管理库门类)"
  22. />
  23. <rrOperation />
  24. </div>
  25. <crudOperation :permission="permission">
  26. <template v-slot:middle>
  27. <el-button v-permission="permission.edit" size="mini" :disabled="crud.selections.length !== 1" @click="toEdit(crud.selections[0])">
  28. <i class="iconfont icon-bianji" />
  29. 编辑
  30. </el-button>
  31. </template>
  32. </crudOperation>
  33. </div>
  34. <!--表单渲染-->
  35. <el-dialog class="dialog-middle" append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" title="新增对应">
  36. <div class="setting-dialog">
  37. <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
  38. <el-form-item label="源分类" prop="source">
  39. <treeselect
  40. v-model="form.source"
  41. :options="sourceOptions"
  42. :load-options="loadSource"
  43. style="width: 400px;"
  44. placeholder="请选择源分类(文件库分类)"
  45. />
  46. </el-form-item>
  47. <el-form-item label="目标门类" prop="target">
  48. <treeselect
  49. v-model="form.target"
  50. :options="targetOptions"
  51. :load-options="loadSource"
  52. style="width: 400px;"
  53. placeholder="请选择目标门类(整理库/管理库门类)"
  54. />
  55. </el-form-item>
  56. </el-form>
  57. <div slot="footer" class="dialog-footer">
  58. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  59. <el-button :loading="crud.status.cu === 2" type="primary" @click="toCorresForm">确定</el-button>
  60. </div>
  61. </div>
  62. </el-dialog>
  63. <eForm ref="corresForm" />
  64. <!--表格渲染-->
  65. <div class="container-wrap">
  66. <span class="right-top-line" />
  67. <span class="left-bottom-line" />
  68. <el-table
  69. ref="table"
  70. v-loading="crud.loading"
  71. :data="crud.data"
  72. row-key="id"
  73. @select="crud.selectChange"
  74. @select-all="crud.selectAllChange"
  75. @selection-change="crud.selectionChangeHandler"
  76. @cell-dblclick="tableDoubleClick"
  77. >
  78. <el-table-column type="selection" width="55" />
  79. <el-table-column :show-overflow-tooltip="true" prop="name" label="规则名称" />
  80. <el-table-column :show-overflow-tooltip="true" prop="sourceClassify" label="源分类(文件库-文件表)" />
  81. <el-table-column :show-overflow-tooltip="true" prop="target" label=" 目标门类(整理库/管理库-文件表)" />
  82. <el-table-column :show-overflow-tooltip="true" prop="number" label="已对应字段数量" />
  83. <el-table-column prop="createTime" label="创建日期" width="200px">
  84. <template slot-scope="scope">
  85. <div>{{ scope.row.createTime | parseTime }}</div>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import crudMenu from '@/api/system/menu'
  94. import Treeselect from '@riophae/vue-treeselect'
  95. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  96. import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
  97. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  98. import rrOperation from '@crud/RR.operation'
  99. import crudOperation from '@crud/CRUD.operation'
  100. import eForm from './module/form.vue'
  101. // crud交由presenter持有
  102. const defaultForm = { id: null, target: null, source: null }
  103. export default {
  104. name: 'FieldCorresManage',
  105. components: { crudOperation, rrOperation, Treeselect, eForm },
  106. cruds() {
  107. return CRUD({
  108. title: '对应关系',
  109. url: 'api/menus',
  110. crudMethod: { },
  111. optShow: {
  112. add: true,
  113. edit: false,
  114. del: true,
  115. reset: false,
  116. download: true,
  117. group: false
  118. }
  119. })
  120. },
  121. mixins: [presenter(), header(), form(defaultForm), crud()],
  122. data() {
  123. return {
  124. sourceOptions: [],
  125. targetOptions: [],
  126. permission: {
  127. },
  128. rules: {
  129. source: [
  130. { required: true, message: '请选择源分类(文件库分类)', trigger: 'input' }
  131. ],
  132. target: [
  133. { required: true, message: '请选择目标门类(整理库/管理库门类)', trigger: 'input' }
  134. ]
  135. }
  136. }
  137. },
  138. methods: {
  139. // 新增与编辑前做的操作
  140. [CRUD.HOOK.afterToCU](crud, form) {
  141. },
  142. toCorresForm() {
  143. this.$refs.corresForm.corresVisible = true
  144. },
  145. // table - 双击查看详情
  146. tableDoubleClick(row) {
  147. this.$refs.corresForm.title = '对应关系'
  148. this.$refs.corresForm.corresVisible = true
  149. },
  150. toEdit() {
  151. this.$refs.corresForm.title = '编辑对应关系'
  152. this.$refs.corresForm.corresVisible = true
  153. },
  154. loadSource({ action, parentNode, callback }) {
  155. if (action === LOAD_CHILDREN_OPTIONS) {
  156. crudMenu.getMenusTree(parentNode.id).then(res => {
  157. parentNode.children = res.map(function(obj) {
  158. if (!obj.leaf) {
  159. obj.children = null
  160. }
  161. return obj
  162. })
  163. setTimeout(() => {
  164. callback()
  165. }, 100)
  166. })
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. </style>