moldFile.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true" :model="filters">
  6. <el-col :span="2">
  7. <el-form-item>
  8. <el-select v-model="filters.value" clearable placeholder="全部状态">
  9. <el-option label="待审批" value="0"></el-option>
  10. <el-option label="未通过" value="1"></el-option>
  11. <el-option label="已通过" value="2"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-form-item>
  16. <el-input v-model="filters.name" placeholder="请输入名称进行搜索"></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary">查询</el-button>
  20. </el-form-item>
  21. <el-form-item style="float: right;">
  22. <el-upload
  23. class="upload-demo"
  24. action="customize"
  25. :http-request="uploadFile"
  26. :show-file-list="false"
  27. multiple
  28. :limit="5"
  29. style="float:right;"
  30. >
  31. <el-button size="small" type="primary">上传文档</el-button>
  32. </el-upload>
  33. </el-form-item>
  34. </el-form>
  35. </el-col>
  36. <!--列表-->
  37. <el-table
  38. :data="moulds"
  39. :height="tableHeight"
  40. highlight-current-row
  41. v-loading="listLoading"
  42. style="width: 100%;"
  43. >
  44. <el-table-column type="index" width="60"></el-table-column>
  45. <el-table-column prop="name" label="模具名称" width="200" sortable></el-table-column>
  46. <el-table-column prop="type" label="文档类型" width="200" sortable></el-table-column>
  47. <el-table-column prop="uploader" label="上传者" width="200" sortable></el-table-column>
  48. <el-table-column prop="time" label="上传时间" width="200" sortable></el-table-column>
  49. <el-table-column label="上传状态" width="200" sortable>
  50. <template slot-scope="scope">
  51. <span v-if="scope.row.state == 0">待审批</span>
  52. <span v-else-if="scope.row.state == 1">未通过</span>
  53. <span v-else>已通过</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="审批" width="200" sortable>
  57. <template slot-scope="scope">
  58. <template v-if="scope.row.state == 0">
  59. <el-button size="small">通过</el-button>
  60. <el-button size="small">未通过</el-button>
  61. </template>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <!--工具条-->
  66. <el-col :span="24" class="toolbar">
  67. <el-pagination
  68. @size-change="handleSizeChange"
  69. @current-change="handleCurrentChange"
  70. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  71. :page-size="20"
  72. layout="total, sizes, prev, pager, next"
  73. :total="total"
  74. style="float:right;"
  75. ></el-pagination>
  76. </el-col>
  77. </section>
  78. </template>
  79. <script>
  80. import util from "../../common/js/util";
  81. export default {
  82. data() {
  83. return {
  84. moulds: [
  85. //临时数据
  86. {
  87. name: "墨盒类型1",
  88. type: "模具3D图档",
  89. uploader: "张有财",
  90. time: "2019-07-25",
  91. state: 0
  92. },
  93. {
  94. name: "墨盒类型啦啦",
  95. type: "模具2D图档",
  96. uploader: "张啦啦",
  97. time: "2019-05-27",
  98. state: 1
  99. }
  100. ],
  101. filters: {
  102. name: "",
  103. value: ""
  104. },
  105. listLoading: false,
  106. total: 0,
  107. tableHeight: 0
  108. };
  109. },
  110. methods: {
  111. // 分页
  112. handleCurrentChange(val) {
  113. this.page = val;
  114. // this.getUsers();
  115. },
  116. handleSizeChange(val) {
  117. this.size = val;
  118. // this.getUsers();
  119. },
  120. selsChange: function(sels) {
  121. this.sels = sels;
  122. },
  123. toMaintenance(id) {
  124. this.$router.push("/detection/" + id);
  125. },
  126. //上传
  127. uploadFile(params) {
  128. // var fileObj = params.file;
  129. // var form = new FormData();
  130. // form.append("projectId", this.proDetail.id);
  131. // form.append("file", fileObj);
  132. // this.http.uploadFile(
  133. // this.port.mold.moldFileUpload,
  134. // form,
  135. // res => {
  136. // if (res.code == "ok") {
  137. // this.$message({
  138. // message: "上传成功",
  139. // type: "success"
  140. // });
  141. // this.getFileList();
  142. // } else {
  143. // this.$message({
  144. // message: res.msg,
  145. // type: "error"
  146. // });
  147. // }
  148. // },
  149. // error => {
  150. // this.$message({
  151. // message: error,
  152. // type: "error"
  153. // });
  154. // }
  155. // );
  156. },
  157. //获取文档列表
  158. getFileList() {
  159. this.listLoading = true;
  160. this.http.post(
  161. this.port.project.fileList,
  162. {
  163. projectId: this.detailId
  164. },
  165. res => {
  166. this.listLoading = false;
  167. if (res.code == "ok") {
  168. this.files = res.data;
  169. } else {
  170. this.$message({
  171. message: res.msg,
  172. type: "error"
  173. });
  174. }
  175. },
  176. error => {
  177. this.listLoading = false;
  178. this.$message({
  179. message: error,
  180. type: "error"
  181. });
  182. }
  183. );
  184. }
  185. },
  186. created() {
  187. let height = window.innerHeight;
  188. this.tableHeight = height - 210;
  189. },
  190. mounted() {}
  191. };
  192. </script>
  193. <style scoped>
  194. </style>