index.vue 7.0 KB

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