list.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <ele-pro-table
  6. ref="table"
  7. row-key="id"
  8. :columns="columns"
  9. :datasource="datasource"
  10. :cache-key="cacheKeyUrl"
  11. autoAmendPage
  12. >
  13. <template v-slot:toolbar>
  14. <el-button
  15. type="primary"
  16. size="mini"
  17. icon="el-icon-plus"
  18. @click="openEdit('add')"
  19. >新建</el-button
  20. >
  21. </template>
  22. <template v-slot:code="{ row }">
  23. <el-link
  24. type="primary"
  25. :underline="false"
  26. @click="preview(row, 'view')"
  27. >{{ row.code }}</el-link
  28. >
  29. </template>
  30. <template v-slot:action="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. icon="el-icon-edit"
  35. @click="openEdit('edit', row)"
  36. v-if="row.isUpdate != 1 && [0, 3].includes(row.approvalStatus)"
  37. >
  38. 编辑
  39. </el-link>
  40. <el-link
  41. type="primary"
  42. :underline="false"
  43. icon="el-icon-edit"
  44. @click="approvalSubmit(row)"
  45. v-if="row.isUpdate != 1 && [0, 3].includes(row.approvalStatus)"
  46. >
  47. 发布
  48. </el-link>
  49. <el-link
  50. type="primary"
  51. :underline="false"
  52. icon="el-icon-edit"
  53. @click="openEdit('edit', row, true)"
  54. v-if="row.isUpdate != 1 && [2].includes(row.approvalStatus)"
  55. >
  56. 变更
  57. </el-link>
  58. <el-link
  59. type="primary"
  60. :underline="false"
  61. icon="el-icon-edit"
  62. @click="preview(row)"
  63. >
  64. 预览
  65. </el-link>
  66. <el-popconfirm
  67. class="ele-action"
  68. title="确定要删除此条数据吗?"
  69. @confirm="remove(row.id)"
  70. v-if="row.isUpdate != 1 && [0, 3].includes(row.approvalStatus)"
  71. >
  72. <template v-slot:reference>
  73. <el-link type="danger" :underline="false" icon="el-icon-delete">
  74. 删除
  75. </el-link>
  76. </template>
  77. </el-popconfirm>
  78. </template>
  79. </ele-pro-table>
  80. </el-card>
  81. <edit ref="editRef" @reload="reload" :template="type"></edit>
  82. <preview ref="previewRef" @reload="reload"></preview>
  83. <processSubmitDialog
  84. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  85. v-if="processSubmitDialogFlag"
  86. ref="processSubmitDialogRef"
  87. @reload="search"
  88. ></processSubmitDialog>
  89. </div>
  90. </template>
  91. <script>
  92. import dictMixins from '@/mixins/dictMixins';
  93. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  94. import {
  95. getQmsReportTemplatePageList,
  96. deleteQmsReportTemplate
  97. } from '@/api/qmsreporttemplate/index';
  98. import edit from './edit.vue';
  99. import preview from './preview.vue';
  100. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  101. export default {
  102. mixins: [dictMixins, tableColumnsMixin],
  103. components: { edit, preview, processSubmitDialog },
  104. props: {
  105. type: {
  106. type: String,
  107. default: ''
  108. }
  109. },
  110. data() {
  111. return {
  112. columns: [
  113. {
  114. width: 50,
  115. type: 'index',
  116. columnKey: 'index',
  117. align: 'center',
  118. label: '序号'
  119. },
  120. {
  121. prop: 'code',
  122. label: '模板编码',
  123. align: 'center',
  124. slot: 'code',
  125. minWidth: 110,
  126. showOverflowTooltip: true
  127. },
  128. {
  129. prop: 'name',
  130. label: '模板名称',
  131. align: 'center',
  132. minWidth: 110,
  133. showOverflowTooltip: true
  134. },
  135. {
  136. prop: 'isEnabled',
  137. label: '是否启用',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. minWidth: 150,
  141. formatter: (row) => {
  142. switch (row.isEnabled) {
  143. case 0:
  144. return '禁用';
  145. case 1:
  146. return '启用';
  147. default:
  148. return '';
  149. }
  150. }
  151. },
  152. {
  153. label: '版本号',
  154. prop: 'version',
  155. align: 'center',
  156. formatter: (row) => {
  157. return `${row.versionSymbol}${row.bigVersion}${row.versionMark}${row.smallVersion}`;
  158. }
  159. },
  160. {
  161. prop: 'remark',
  162. label: '备注',
  163. align: 'center',
  164. minWidth: 110,
  165. showOverflowTooltip: true
  166. },
  167. {
  168. label: '状态',
  169. prop: 'approvalStatus',
  170. formatter: (row) => {
  171. return row.approvalStatus == 0
  172. ? '待发布'
  173. : row.approvalStatus == 1
  174. ? '审批中'
  175. : row.approvalStatus == 2
  176. ? '已发布'
  177. : '审核不通过';
  178. },
  179. align: 'center'
  180. },
  181. {
  182. columnKey: 'action',
  183. label: '操作',
  184. width: 280,
  185. align: 'center',
  186. resizable: false,
  187. fixed: 'right',
  188. slot: 'action',
  189. showOverflowTooltip: true
  190. }
  191. ],
  192. processSubmitDialogFlag: false,
  193. cacheKeyUrl: 'mes-259231040-material-table'
  194. };
  195. },
  196. computed: {
  197. seekList() {
  198. return [
  199. {
  200. label: '模板名称:',
  201. value: 'name',
  202. type: 'input',
  203. placeholder: '请输入'
  204. },
  205. {
  206. label: '模板编码:',
  207. value: 'code',
  208. type: 'input',
  209. placeholder: '请输入'
  210. }
  211. ];
  212. }
  213. },
  214. methods: {
  215. // 刷新表格
  216. reload(where = {}) {
  217. this.$refs.table.reload({
  218. where
  219. });
  220. },
  221. /* 表格数据源 */
  222. datasource({ page, limit, where, order }) {
  223. // 参数
  224. const body = {
  225. ...where,
  226. ...order,
  227. pageNum: page,
  228. size: limit,
  229. type: this.type
  230. };
  231. return getQmsReportTemplatePageList(body);
  232. },
  233. search(where) {
  234. this.reload(where);
  235. },
  236. remove(id) {
  237. deleteQmsReportTemplate([id]).then(() => {
  238. this.$message.success('删除成功');
  239. this.reload();
  240. });
  241. },
  242. openEdit(type, data, isChange) {
  243. this.$refs.editRef.open(type, data, isChange);
  244. },
  245. preview(row, type) {
  246. this.$refs.previewRef.open(type, row);
  247. },
  248. async approvalSubmit(res) {
  249. this.processSubmitDialogFlag = true;
  250. this.$nextTick(() => {
  251. let params = {
  252. businessId: res.id,
  253. businessKey: 'qms_quality_report_template_release',
  254. formCreateUserId: res.createUserId,
  255. variables: {
  256. businessCode: res.code,
  257. businessName: res.name,
  258. businessType: '模板变更'
  259. }
  260. };
  261. this.$refs.processSubmitDialogRef.init(params);
  262. });
  263. }
  264. }
  265. };
  266. </script>
  267. <style></style>