info.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!-- 用户编辑弹窗 -->
  2. <template>
  3. <el-form ref="form" :model="form" label-width="120px" disabled>
  4. <el-row :gutter="15">
  5. <el-col :span="8">
  6. <el-form-item label="文档类型" prop="type">
  7. <DictSelection
  8. dictName="文档类型"
  9. v-model="form.type"
  10. :disabled="true"
  11. ></DictSelection>
  12. </el-form-item>
  13. <el-form-item label="文档大小" prop="sizeUnit">
  14. <el-input v-model="form.sizeUnit"></el-input>
  15. </el-form-item>
  16. <el-form-item label="检出人" prop="checkOutUserName">
  17. <el-input v-model="form.checkOutUserName"></el-input>
  18. </el-form-item>
  19. <el-form-item label="检出时间" prop="checkOutTime">
  20. <el-input v-model="form.checkOutTime"> </el-input>
  21. </el-form-item>
  22. <el-form-item label="创建时间" prop="createTime">
  23. <el-input v-model="form.createTime"></el-input>
  24. </el-form-item>
  25. <el-form-item label="修改时间" prop="updateTime">
  26. <el-input v-model="form.updateTime"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="8">
  30. <el-form-item label="文档名称" prop="name">
  31. <el-input v-model="form.name"></el-input>
  32. </el-form-item>
  33. <el-form-item label="文档位置" prop="directoryId">
  34. <el-cascader
  35. style="width: 100%"
  36. v-model="form.directoryId"
  37. :options="folderList"
  38. :props="{
  39. value: 'id',
  40. label: 'name',
  41. children: 'sonDirectoryList',
  42. emitPath: false,
  43. checkStrictly: true
  44. }"
  45. ></el-cascader>
  46. </el-form-item>
  47. <el-form-item label="检出状态" prop="checkOutStatus">
  48. <el-input v-model="form.checkOutStatus"> </el-input>
  49. </el-form-item>
  50. <el-form-item label="创建人" prop="createUserName">
  51. <el-input v-model="form.createUserName"></el-input>
  52. </el-form-item>
  53. <el-form-item label="修改人" prop="updateUserName">
  54. <el-input v-model="form.updateUserName"></el-input>
  55. </el-form-item>
  56. <el-form-item label="备注" prop="remark">
  57. <el-input v-model="form.remark" type="textarea"></el-input>
  58. </el-form-item>
  59. </el-col>
  60. <el-col
  61. :span="8"
  62. v-if="
  63. isCreateUserId(form) ||
  64. isPower(form, 'download') ||
  65. isPower(form, 'revise')
  66. "
  67. >
  68. <el-form-item label="文档地址" prop="filePath">
  69. <el-input
  70. v-model="form.filePath"
  71. :title="form.filePath"
  72. style="width: calc(100% - 70px)"
  73. ></el-input>
  74. <div
  75. style="
  76. margin-left: 10px;
  77. cursor: pointer;
  78. background: #409eff;
  79. width: 60px;
  80. color: #fff;
  81. height: 30px;
  82. display: inline-block;
  83. text-align: center;
  84. line-height: 30px;
  85. border-radius: 3px;
  86. "
  87. @click="copyTextToClipboard(form.filePath)"
  88. >
  89. 复制</div
  90. >
  91. <!-- <el-button type="primary" size="mini" @click.native="copyTextToClipboard(form.filePath)" style="width: 60px; margin-left: 10px">复制</el-button> -->
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. </el-form>
  96. </template>
  97. <script>
  98. import { fileGetByIdAPI } from '@/api/doc-manage';
  99. import { isPower, isCreateUserId } from '../util.js';
  100. export default {
  101. props: {
  102. // 上级id
  103. parentId: [Number, String],
  104. // 文件夹数据
  105. folderList: {
  106. type: Array,
  107. default: () => []
  108. }
  109. },
  110. data() {
  111. const defaultForm = {
  112. name: '', //名称
  113. type: '', //类型
  114. sizeUnit: '', //大小
  115. unit: '', //单位
  116. remark: '', //备注
  117. status: '', //状态
  118. storagePathId: '',
  119. directoryId: '',
  120. storagePath: [],
  121. id: '',
  122. filePath: ''
  123. };
  124. return {
  125. defaultForm,
  126. isPower,
  127. isCreateUserId,
  128. // 表单数据
  129. form: { ...defaultForm },
  130. // 表单验证规则
  131. // 提交状态
  132. loading: false
  133. };
  134. },
  135. computed: {
  136. // 是否开启响应式布局
  137. styleResponsive() {
  138. return this.$store.state.theme.styleResponsive;
  139. }
  140. },
  141. created() {},
  142. watch: {
  143. parentId: function (val) {
  144. if (val) {
  145. this.init(val);
  146. }
  147. }
  148. },
  149. methods: {
  150. copyTextToClipboard(text) {
  151. // alert(1);
  152. var textArea = document.createElement('textarea');
  153. textArea.value = text;
  154. // 避免滚动到页面的最底部
  155. document.body.appendChild(textArea);
  156. textArea.focus();
  157. textArea.select();
  158. try {
  159. var successful = document.execCommand('copy');
  160. if(successful){
  161. this.$message.success('复制成功')
  162. }
  163. } catch (err) {
  164. console.error('Oops, unable to copy', err);
  165. }
  166. document.body.removeChild(textArea);
  167. },
  168. async init(val) {
  169. this.form = await fileGetByIdAPI(val);
  170. let file = this.form.storagePath[0];
  171. let fileNames = file.storePath.split('/');
  172. let url =
  173. window.location.origin +
  174. '/api/main/file/getFile?objectName=' +
  175. file.storePath +
  176. '&fullfilename=' +
  177. fileNames[fileNames.length - 1];
  178. this.form.filePath = url;
  179. console.log(this.form, 'this.form');
  180. this.form.checkOutStatus =
  181. this.form.checkOutStatus == 1 ? '已检出' : '';
  182. this.form.type = this.form.type + '';
  183. }
  184. }
  185. };
  186. </script>
  187. <style scoped lang="scss">
  188. .aaa {
  189. width: 100%;
  190. ::v-deep .upload-demo {
  191. width: 100%;
  192. .el-upload--text {
  193. width: 100%;
  194. button {
  195. width: 100%;
  196. background: #ffffff;
  197. border: 1px solid #dbdbdb;
  198. border-radius: 5px;
  199. }
  200. }
  201. .el-upload-list {
  202. transform: translate(10px, -39px);
  203. position: absolute;
  204. }
  205. }
  206. }
  207. </style>