index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <ele-modal
  3. title="弹窗示例"
  4. :maxable="true"
  5. custom-class="ele-dialog-form long-dialog-form"
  6. :centered="true"
  7. :visible.sync="visible"
  8. :close-on-click-modal="false"
  9. width="85%"
  10. append-to-body
  11. @close="handleClose"
  12. >
  13. <ele-pro-table
  14. style="min-height: 400px"
  15. ref="fileTable"
  16. :columns="columns"
  17. :datasource="workList"
  18. >
  19. <template v-slot:starttime="{ row, $index }">
  20. <el-date-picker
  21. v-model="row.starttime"
  22. type="datetime"
  23. value-format="yyyy-MM-dd HH:mm:ss"
  24. placeholder="选择开始日期"
  25. >
  26. </el-date-picker>
  27. </template>
  28. <template v-slot:endtime="{ row, $index }">
  29. <el-date-picker
  30. v-model="row.endtime"
  31. type="datetime"
  32. value-format="yyyy-MM-dd HH:mm:ss"
  33. placeholder="选择结束日期"
  34. >
  35. </el-date-picker>
  36. </template>
  37. <template v-slot:wuping="{ row }">
  38. <el-button type="primary" @click="goDetails(row, 'wuping')"
  39. >物品({{ dataLeng(row, 'wuping') }})</el-button
  40. >
  41. </template>
  42. <template v-slot:zysx="{ row }">
  43. <el-button type="primary" @click="goDetails(row, 'zysx')"
  44. >注意事项({{ dataLeng(row, 'zysx') }})</el-button
  45. >
  46. </template>
  47. <template v-slot:action="{ row }">
  48. <el-link type="primary" @click="saveData(row)" :underline="false"
  49. >保存</el-link
  50. >
  51. </template>
  52. <!-- 表头工具栏 -->
  53. </ele-pro-table>
  54. <Details
  55. v-if="detailsVisible"
  56. :detailsVisible="detailsVisible"
  57. @close="close"
  58. :list="list"
  59. />
  60. </ele-modal>
  61. </template>
  62. <script>
  63. import Details from './details.vue';
  64. import { listByParam } from '@/api/produce/workOrder';
  65. export default {
  66. components: { Details },
  67. data() {
  68. return {
  69. visible: false,
  70. columns: [
  71. {
  72. columnKey: 'index',
  73. label: '序号',
  74. type: 'index',
  75. width: 55,
  76. align: 'center',
  77. showOverflowTooltip: true
  78. },
  79. {
  80. label: '编码',
  81. prop: 'code',
  82. width: 110,
  83. align: 'center',
  84. showOverflowTooltip: true
  85. },
  86. {
  87. label: '名称',
  88. prop: 'name',
  89. width: 180,
  90. align: 'center',
  91. showOverflowTooltip: true
  92. },
  93. {
  94. label: '内容',
  95. prop: 'defaultValue',
  96. minWidth: 300,
  97. align: 'center',
  98. showOverflowTooltip: true
  99. },
  100. {
  101. slot: 'wuping',
  102. label: '物品',
  103. prop: 'wuping',
  104. width: 130,
  105. align: 'center',
  106. showOverflowTooltip: true
  107. },
  108. {
  109. slot: 'zysx',
  110. label: '注意事项',
  111. prop: 'zysx',
  112. width: 130,
  113. align: 'center',
  114. showOverflowTooltip: true
  115. },
  116. {
  117. label: '工时',
  118. prop: 'hs',
  119. width: 100,
  120. align: 'center',
  121. showOverflowTooltip: true
  122. },
  123. {
  124. label: '开始时间',
  125. slot: 'starttime',
  126. prop: 'starttime',
  127. width: 250,
  128. align: 'center',
  129. showOverflowTooltip: true
  130. },
  131. {
  132. label: '结束时间',
  133. slot: 'endtime',
  134. prop: 'endtime',
  135. width: 250,
  136. align: 'center',
  137. showOverflowTooltip: true
  138. },
  139. {
  140. columnKey: 'action',
  141. slot: 'action',
  142. label: '操作',
  143. align: 'center',
  144. width: 130,
  145. resizable: false,
  146. showOverflowTooltip: true
  147. }
  148. ],
  149. workList: [
  150. {
  151. name: '哈哈哈哈哈哈哈',
  152. timeFlag: false
  153. },
  154. {
  155. name: '哈哈哈哈哈哈哈',
  156. time: '',
  157. timeFlag: true
  158. },
  159. {
  160. name: '哈哈哈哈哈哈哈',
  161. wuping: [
  162. {
  163. code: '物品'
  164. }
  165. ]
  166. },
  167. {
  168. name: '哈哈哈哈哈哈哈',
  169. zysx: [
  170. {
  171. code: '注意事项'
  172. }
  173. ]
  174. },
  175. {
  176. name: '哈哈哈哈哈哈哈'
  177. },
  178. {
  179. name: '哈哈哈哈哈哈哈'
  180. },
  181. {
  182. name: '哈哈哈哈哈哈哈'
  183. },
  184. {
  185. name: '哈哈哈哈哈哈哈'
  186. }
  187. ],
  188. detailsVisible: false,
  189. list: []
  190. };
  191. },
  192. computed: {
  193. dataLeng() {
  194. return (row, type) => {
  195. if (!row[type]) {
  196. return 0;
  197. }
  198. return row[type].length;
  199. };
  200. }
  201. },
  202. methods: {
  203. open(id) {
  204. console.log(id, 'id ----');
  205. this.visible = true;
  206. this.getList(id);
  207. },
  208. getList(id) {
  209. listByParam(id)
  210. .then((res) => {
  211. console.log(res, 'res ---');
  212. })
  213. .catch((err) => {
  214. console.log(err, 'err');
  215. });
  216. },
  217. // 保存
  218. saveData(row) {
  219. // 注意判断时间 是否填写
  220. console.log('这里做最后的提交', row);
  221. },
  222. handleClose() {
  223. this.visible = false;
  224. },
  225. close() {
  226. this.detailsVisible = false;
  227. },
  228. goDetails(row, type) {
  229. if (!row[type] || row[type].length == 0) {
  230. return this.$message.warning('暂无详细数据');
  231. }
  232. this.list = row[type];
  233. this.detailsVisible = true;
  234. }
  235. }
  236. };
  237. </script>