index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <search ref="search" @search="search"></search>
  5. <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
  6. <!-- 表头工具栏 -->
  7. <template v-slot:toolbar>
  8. <el-button
  9. size="small"
  10. type="primary"
  11. icon="el-icon-plus"
  12. class="ele-btn-icon"
  13. @click="openEdit('add')"
  14. >
  15. 添加
  16. </el-button>
  17. </template>
  18. <template v-slot:type="{ row }">
  19. {{ getDictValue('质检计划类型', row.type) }}
  20. </template>
  21. <template v-slot:qualityMode="{ row }">
  22. {{ getDictValue('质检方式', row.qualityMode) }}
  23. </template>
  24. <template v-slot:accessory="scope">
  25. <el-link
  26. v-for="link in scope.row.accessory"
  27. :key="link.id"
  28. type="primary"
  29. :underline="false"
  30. @click="downloadFile(link)"
  31. >
  32. {{ link.name }}
  33. </el-link>
  34. </template>
  35. <!-- 操作列 -->
  36. <template v-slot:action="{ row }">
  37. <el-link
  38. type="primary"
  39. :underline="false"
  40. icon="el-icon-edit"
  41. @click="openEdit('detail', row)"
  42. v-if="row.status == 1"
  43. >
  44. 详情
  45. </el-link>
  46. <el-link
  47. type="primary"
  48. :underline="false"
  49. icon="el-icon-edit"
  50. @click="openEdit('edit', row)"
  51. v-if="row.status == 0"
  52. >
  53. 修改
  54. </el-link>
  55. <el-link
  56. type="primary"
  57. :underline="false"
  58. icon="el-icon-edit"
  59. v-if="row.status == 0"
  60. @click="openEdit('issued', row)"
  61. >
  62. 下发
  63. </el-link>
  64. <el-popconfirm
  65. class="ele-action"
  66. title="确定要删除吗?"
  67. @confirm="remove(row)"
  68. v-if="row.status == 0"
  69. >
  70. <template v-slot:reference>
  71. <el-link type="danger" :underline="false" icon="el-icon-delete">
  72. 删除
  73. </el-link>
  74. </template>
  75. </el-popconfirm>
  76. </template>
  77. </ele-pro-table>
  78. </el-card>
  79. <edit ref="edit" @done="done"></edit>
  80. </div>
  81. </template>
  82. <script>
  83. import search from './components/search.vue';
  84. import edit from './components/edit.vue';
  85. import { getList, removeItem } from '@/api/inspectionPlan';
  86. import dictMixins from '@/mixins/dictMixins';
  87. import {getFile} from "@/api/system/file";
  88. export default {
  89. mixins: [dictMixins],
  90. components: {
  91. search,
  92. edit
  93. },
  94. data() {
  95. return {
  96. columns: [
  97. {
  98. prop: 'code',
  99. label: '编码',
  100. width: 160
  101. },
  102. {
  103. label: '名称',
  104. prop: 'name'
  105. },
  106. // {
  107. // prop: 'batchNo',
  108. // label: '批号'
  109. // },
  110. {
  111. label: '类型',
  112. prop: 'type',
  113. slot: 'type',
  114. width: 120
  115. },
  116. {
  117. label: '质检方式',
  118. prop: 'qualityMode',
  119. slot: 'qualityMode',
  120. width: 120
  121. },
  122. {
  123. label: '计划来源编码',
  124. prop: 'planSourceCode'
  125. },
  126. {
  127. label: '自动派单',
  128. prop: 'autoOrder',
  129. formatter: (row, column, cellValue) => {
  130. return cellValue == 1 ? '是' : '否';
  131. }
  132. },
  133. // {
  134. // prop: 'productName',
  135. // label: '产品名称',
  136. // },
  137. // {
  138. // prop: 'productCode',
  139. // label: '产品编码',
  140. // },
  141. // {
  142. // prop: 'specification',
  143. // label: '规格',
  144. // },
  145. // {
  146. // prop: 'brandNo',
  147. // label: '牌号',
  148. // },
  149. // {
  150. // prop: 'productNumber',
  151. // label: '数量',
  152. // width: 60
  153. // },
  154. {
  155. label: '执行部门',
  156. prop: 'groupName'
  157. },
  158. {
  159. label: '执行人',
  160. prop: 'executeName',
  161. width: 80
  162. },
  163. {
  164. label: '计划开始时间',
  165. prop: 'planStartTime'
  166. },
  167. {
  168. label: '计划结束时间',
  169. prop: 'planEndTime'
  170. },
  171. {
  172. label: '附件',
  173. prop: 'accessory',
  174. slot: 'accessory'
  175. },
  176. {
  177. label: '状态',
  178. prop: 'status',
  179. width: 70,
  180. formatter: (row, column, cellValue) => {
  181. return cellValue == 1 ? '已下发' : '未下发';
  182. }
  183. },
  184. {
  185. columnKey: 'action',
  186. label: '操作',
  187. width: 220,
  188. align: 'center',
  189. resizable: false,
  190. slot: 'action',
  191. showOverflowTooltip: true
  192. }
  193. ]
  194. };
  195. },
  196. created() {
  197. this.requestDict('质检计划类型');
  198. this.requestDict('质检方式');
  199. },
  200. methods: {
  201. datasource({ page, where, limit }) {
  202. return getList({
  203. ...where,
  204. pageNum: page,
  205. size: limit
  206. });
  207. },
  208. search(where) {
  209. this.$refs.table.reload({
  210. where: where,
  211. page: 1
  212. });
  213. },
  214. openEdit(type, row) {
  215. this.$refs.edit.open(type, row);
  216. },
  217. downloadFile(file) {
  218. getFile({objectName: file.storePath}, file.name);
  219. },
  220. remove(row) {
  221. removeItem([row.id])
  222. .then((message) => {
  223. this.$message.success(message);
  224. this.done();
  225. })
  226. .catch((e) => {});
  227. },
  228. done() {
  229. this.$refs.search.search();
  230. }
  231. }
  232. };
  233. </script>