workshop-manage.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <!-- 车间管理 -->
  2. <template>
  3. <div>
  4. <template v-if="!addOrUpdateVisible && !detailVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  6. <el-form-item label="项目/任务号">
  7. <el-input v-model="dataForm.orderCode" placeholder="" clearable/>
  8. </el-form-item>
  9. <el-form-item>
  10. <el-button @click="queryData()">查询</el-button>
  11. <el-button type="primary" @click="addOrUpdateHandle(0, false)">新增</el-button>
  12. </el-form-item>
  13. </el-form>
  14. <el-table
  15. :data="dataList"
  16. border
  17. v-loading="dataListLoading"
  18. style="width: 100%;">
  19. <el-table-column
  20. label="序号"
  21. type="index"
  22. width="50"
  23. align="center">
  24. </el-table-column>
  25. <el-table-column
  26. prop="projectName"
  27. header-align="center"
  28. align="center"
  29. min-width="140"
  30. :show-tooltip-when-overflow="true"
  31. label="项目名称">
  32. </el-table-column>
  33. <el-table-column
  34. prop="orderCode"
  35. header-align="center"
  36. align="center"
  37. min-width="160"
  38. :show-tooltip-when-overflow="true"
  39. label="任务号">
  40. </el-table-column>
  41. <el-table-column
  42. prop="attachList"
  43. header-align="center"
  44. align="center"
  45. :show-tooltip-when-overflow="true"
  46. label="技术协议"
  47. >
  48. <template slot-scope="scope">
  49. <el-button
  50. :disabled="
  51. !scope.row.attachList || scope.row.attachList.length === 0
  52. "
  53. type="text"
  54. size="small"
  55. @click="attachDetails(scope.row.attachList)"
  56. >查看</el-button
  57. >
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. prop="attachList1"
  62. header-align="center"
  63. align="center"
  64. :show-tooltip-when-overflow="true"
  65. label="技术文件"
  66. >
  67. <template slot-scope="scope">
  68. <el-button
  69. :disabled="
  70. !scope.row.attachList1 || scope.row.attachList1.length === 0
  71. "
  72. type="text"
  73. size="small"
  74. @click="attachDetails(scope.row.attachList1)"
  75. >查看</el-button
  76. >
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. prop="notes"
  81. header-align="center"
  82. align="center"
  83. :show-tooltip-when-overflow="true"
  84. label="备注">
  85. </el-table-column>
  86. <el-table-column
  87. prop="createTime"
  88. header-align="center"
  89. align="center"
  90. min-width="120"
  91. :show-tooltip-when-overflow="true"
  92. label="创建时间">
  93. </el-table-column>
  94. <el-table-column
  95. fixed="right"
  96. header-align="center"
  97. align="center"
  98. width="150"
  99. label="操作">
  100. <template slot-scope="scope">
  101. <el-button type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
  102. <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row, false)">编辑</el-button>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. <el-pagination
  107. @size-change="sizeChangeHandle"
  108. @current-change="currentChangeHandle"
  109. :current-page="pageIndex"
  110. :page-sizes="[10, 20, 50, 100]"
  111. :page-size="pageSize"
  112. :total="totalPage"
  113. layout="total, sizes, prev, pager, next, jumper">
  114. </el-pagination>
  115. </template>
  116. <!-- 弹窗, 新增 / 修改 -->
  117. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
  118. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  119. <attach-detail-dialog ref="attachDetail" @onChose="onChose" />
  120. </div>
  121. </template>
  122. <script>
  123. import AddOrUpdate from './workshop-add-or-update'
  124. import Detail from './file-manage-detail'
  125. import { getList } from '@/api/workshop'
  126. import AttachDetailDialog from '../common/attach-detail-dialog'
  127. export default {
  128. name: 'workshop-manage',
  129. components: {
  130. AddOrUpdate, Detail, AttachDetailDialog
  131. },
  132. data () {
  133. return {
  134. addOrUpdateVisible: false,
  135. detailVisible: false,
  136. dataForm: {},
  137. dataList: [],
  138. pageIndex: 1,
  139. pageSize: 10,
  140. totalPage: 0,
  141. dataListLoading: false,
  142. dataListSelections: [],
  143. optionsLevel: []
  144. }
  145. },
  146. created () {
  147. this.getDataList()
  148. },
  149. methods: {
  150. onChose () {
  151. this.addOrUpdateVisible = false
  152. this.detailVisible = false
  153. },
  154. // 查询
  155. queryData () {
  156. this.pageIndex = 1
  157. this.getDataList()
  158. },
  159. // 获取数据列表
  160. getDataList () {
  161. this.dataListLoading = true
  162. this.addOrUpdateVisible = false
  163. let params = {
  164. 'current': this.pageIndex,
  165. 'size': this.pageSize,
  166. 'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null
  167. }
  168. getList(params).then(({data}) => {
  169. if (data && data.code === '200') {
  170. this.dataList = data.data.records
  171. this.totalPage = Number(data.data.total)
  172. } else {
  173. this.dataList = []
  174. this.totalPage = 0
  175. }
  176. this.dataListLoading = false
  177. })
  178. },
  179. // 每页数
  180. sizeChangeHandle (val) {
  181. this.pageSize = val
  182. this.pageIndex = 1
  183. this.getDataList()
  184. },
  185. // 当前页
  186. currentChangeHandle (val) {
  187. this.pageIndex = val
  188. this.getDataList()
  189. },
  190. // 多选
  191. selectionChangeHandle (val) {
  192. this.dataListSelections = val
  193. },
  194. // 新增 / 修改
  195. addOrUpdateHandle (item, disable) {
  196. this.addOrUpdateVisible = true
  197. this.$nextTick(() => {
  198. this.$refs.addOrUpdate.init(item, disable)
  199. })
  200. },
  201. // 详情
  202. detailHandle (item) {
  203. this.detailVisible = true
  204. this.$nextTick(() => {
  205. this.$refs.detail.init(item)
  206. })
  207. },
  208. attachDetails (attachList) {
  209. this.$refs.attachDetail.init(attachList)
  210. }
  211. }
  212. }
  213. </script>
  214. <style scoped>
  215. </style>