fileMessage.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <!-- 详情文件 -->
  3. <div class="height_100">
  4. <el-container>
  5. <el-header style="display: flex;justify-content: space-between;align-items: center;">
  6. <div>
  7. <!-- <mySearch :SearchFields="searchFiled" @search="search" :searchValue="searchOption"></mySearch> -->
  8. </div>
  9. <div style="display:flex;margin-right:10px">
  10. <!-- <el-button-group class="margin-left_10">
  11. <el-button :type="queryShowType === '0' ? 'primary' : ''" @click="onChange2('0')" size="small">列表</el-button>
  12. <el-button :type="queryShowType === '1' ? 'primary' : ''" @click="onChange2('1')" size="small">卡片</el-button>
  13. </el-button-group> -->
  14. <el-button type="primary" size="small" @click="uploadFile">上传文件</el-button>
  15. </div>
  16. </el-header>
  17. <el-main>
  18. <el-table :data="tableData" style="width: 100%;" border header-row-class-name="custom-table-header"
  19. >
  20. <el-table-column label="#" align="center" width="100px">
  21. <template slot-scope="scope">
  22. <div>
  23. {{ scope.$index + 1 }}
  24. </div>
  25. </template>
  26. </el-table-column>
  27. <el-table-column v-for="item in columnList" :key="item.value" :prop="item.value"
  28. :render-header="$commonJS.renderHeaderMethods" :label="item.name" sortable align="center">
  29. <template slot-scope="scope">
  30. <div v-if="['name'].includes(item.value)">
  31. <!-- <el-link @click="handleItem(scope.row, item.value)"> -->
  32. <span v-html="$commonJS.getColumnData(scope.row, item)"></span>
  33. <!-- </el-link> -->
  34. </div>
  35. <div v-else-if="['ifFinal'].includes(item.value)"
  36. v-html="$commonJS.getColumnData(scope.row, item, null, { data: ifFinal })"></div>
  37. <!-- <div v-else-if="['type'].includes(item.value)"
  38. v-html="$commonJS.getColumnData(scope.row, item, null, { data: taskType })"></div>
  39. <div v-else-if="['status'].includes(item.value)"
  40. v-html="$commonJS.getColumnData(scope.row, item, null, { data: taskStatus })"></div> -->
  41. <div v-else v-html="$commonJS.getColumnData(scope.row, item)"></div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="操作" align="center" width="150px">
  45. <template slot-scope="scope">
  46. <div>
  47. <!-- <el-button type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button> -->
  48. <!-- <el-button type="danger" @click="handleDelete(scope.row)">删除</el-button> -->
  49. <el-dropdown split-button type="primary" size="small" @command="handleCommand($event,scope.row)" @click="handleCommand('0',scope.row)">
  50. 预览
  51. <el-dropdown-menu slot="dropdown">
  52. <el-dropdown-item command="1">下载</el-dropdown-item>
  53. <el-dropdown-item command="2" divided style="color: red;" v-if="scope.row.id">删除</el-dropdown-item>
  54. </el-dropdown-menu>
  55. </el-dropdown>
  56. </div>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. </el-main>
  61. <!-- <el-footer class="pagination">
  62. <el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
  63. :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="queryParams.total">
  64. </el-pagination>
  65. </el-footer> -->
  66. </el-container>
  67. <uploadFile ref="uploadFile" @isSuccess="isSuccess" :processId="processId"></uploadFile>
  68. </div>
  69. </template>
  70. <script>
  71. import { optionsData } from './mixins/index2'
  72. import uploadFile from './dialog/uploadFile.vue'
  73. import {File} from '@/utils/model/menu/mixins'
  74. export default {
  75. props: ['id', 'processId'],
  76. mixins: [optionsData,File],
  77. components: {
  78. uploadFile
  79. },
  80. data() {
  81. return {
  82. ifFinal: {
  83. false: '否',
  84. true: '是',
  85. },
  86. // 数据源
  87. tableData: [],
  88. // table栏位信息
  89. columnList: [
  90. {
  91. name: "文件流程",
  92. type: "String",
  93. value: "path",
  94. },
  95. {
  96. name: "文件上传人",
  97. type: "Integer",
  98. value: "createName",
  99. },
  100. {
  101. name: "文件上传时间",
  102. type: "DateTime",
  103. value: "createTime",
  104. },
  105. {
  106. name: "文件类型",
  107. type: "String",
  108. value: "type",
  109. },
  110. {
  111. name: "是否最终文件",
  112. type: "DateTime",
  113. value: "endFile",
  114. },
  115. {
  116. name: "说明",
  117. type: "DateTime",
  118. value: "description",
  119. },
  120. ],
  121. // 分页信息
  122. queryParams: {
  123. current: 1,
  124. size: 10,
  125. total: 0,
  126. },
  127. // 检索字段
  128. searchFiled: [],
  129. // 检索字符串
  130. searchOption: {},
  131. //排序字段
  132. sort: [{ "orderBy": "createTime", "orderType": 1 }],
  133. // 复制传过来的参数
  134. pathObjCopy: this.processId,
  135. }
  136. },
  137. watch: {
  138. processId(val) {
  139. if (val) {
  140. this.pathObjCopy = val
  141. this.getList()
  142. }
  143. },
  144. },
  145. computed: {
  146. },
  147. async mounted() {
  148. // 获取table栏位
  149. this.columnList = await this.$commonJS.getCustomField('patentDigProjectFiles')
  150. // 获取栏位
  151. // await this.getColumn()
  152. // 获取数据
  153. await this.getList()
  154. },
  155. methods: {
  156. // 新增/更新文件列表成功
  157. isSuccess(val) {
  158. this.getList()
  159. },
  160. // 获取检索及分组栏位
  161. async getColumn() {
  162. let params = ['patentDigProjectFiles']
  163. await this.$api.getParamsCommon(params).then(res => {
  164. if (res.code == 200) {
  165. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  166. // 检索字段
  167. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  168. label: 'name',
  169. value: 'value',
  170. type: 'type',
  171. })
  172. //为所属流程及最终文件添加选项
  173. let arr = ["processId", 'ifFinal']
  174. arr.forEach(item => {
  175. var obj = this.searchFiled.find(item2 => { return item2.value == item })
  176. if(obj){
  177. if (item == "processId") {//所属流程
  178. obj.options = this.pathOptions
  179. } else {//最终文件
  180. let isFile = [
  181. {label:'是',value:true},
  182. {label:'否',value:false},
  183. ]
  184. obj.options = isFile
  185. }
  186. }
  187. })
  188. }
  189. })
  190. },
  191. // 获取数据
  192. async getList() {
  193. let searchOption2 = {
  194. processId: this.pathObjCopy,//流程节点id
  195. projectId: this.id,//固有检索
  196. // ...this.searchOption
  197. }
  198. var searchFiled2 = this.$commonJS.objectToArray(searchOption2)
  199. var searchOption1 = this.searchOption
  200. if (this.searchOption.constructor == Object) {
  201. searchOption1 = this.$commonJS.objectToArray(this.searchOption)
  202. }
  203. let searchOption = [
  204. ...searchFiled2,//固有检索字段
  205. ...searchOption1
  206. ]
  207. let params = {
  208. ...this.queryParams,//分页信息
  209. searchQuery: this.$commonJS.objectToString(searchOption || {}),//检索条件
  210. orderDTOList: this.sort,//排序信息
  211. }
  212. this.$api.queryPatentDigProjectFiles(searchOption2).then(res => {
  213. if (res.code == 200) {
  214. this.tableData = res.data.data
  215. this.queryParams.total = this.tableData.length
  216. }
  217. }).catch(error => {
  218. this.tableData = []
  219. this.queryParams.total = 0
  220. })
  221. },
  222. // 搜索
  223. search(val) {
  224. let params = {}
  225. val.forEach(item => {
  226. if (item.type == 3) {
  227. params[item.value] = item.searchValue.map(itemValue => {
  228. return itemValue.value
  229. })
  230. } else {
  231. params[item.value] = item.searchValue.label
  232. }
  233. })
  234. // 返回字符串
  235. this.searchOption = this.$commonJS.ArrayToArray(val)
  236. // 调用查询接口
  237. this.queryParams.current = 1
  238. this.getList()
  239. },
  240. //排序
  241. sortChange({ column, prop, order }) {
  242. //如需要多个字段排序,则不需要清空
  243. var params = {
  244. sort: this.sort,
  245. column,
  246. prop,
  247. order,
  248. }
  249. this.sort = this.$commonJS.getSortData(params)
  250. this.queryParams.current = 1
  251. this.getList()
  252. },
  253. // 上传文件按钮
  254. uploadFile() {
  255. this.$refs.uploadFile.open(null, this.id)
  256. },
  257. // 编辑文件按钮
  258. handleEdit(row) {
  259. this.$refs.uploadFile.open(row)
  260. },
  261. // 删除
  262. handleCommand(event, row) {
  263. row.guid = row.fileGuid
  264. switch (event) {
  265. case '0'://预览
  266. this.preview(row)
  267. break;
  268. case '1'://下载
  269. this.downLoad(row)
  270. break;
  271. case '2'://删除
  272. this.handleDeletes([row.id])
  273. break;
  274. default:
  275. break;
  276. }
  277. },
  278. handleDeletes(ids) {
  279. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  280. confirmButtonText: '确定',
  281. cancelButtonText: '取消',
  282. type: 'warning'
  283. }).then(() => {
  284. this.$api.deletePatentDigProjectFiles(ids).then(res => {
  285. if (res.code == 200) {
  286. this.$message.success('删除文件成功')
  287. this.queryParams.current = 1
  288. this.getList()
  289. }
  290. })
  291. }).catch(() => {
  292. this.$message.info('已取消删除')
  293. });
  294. },
  295. // 分页
  296. handleCurrentChange(val) {
  297. this.queryParams.current = val
  298. this.getList()
  299. },
  300. },
  301. }
  302. </script>
  303. <style lang="scss" scoped></style>