index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <equipment-search
  5. @search="reload"
  6. :networkCounts="networkCounts"
  7. ref="search"
  8. />
  9. <!-- 数据表格 -->
  10. <ele-pro-table
  11. ref="table"
  12. :columns="columns"
  13. :datasource="datasource"
  14. height="calc(100vh - 400px)"
  15. tool-class="ele-toolbar-form"
  16. cache-key="systemOrgUserTable"
  17. >
  18. <!-- 表头工具栏 -->
  19. <template v-slot:toolbar="{ row }">
  20. <el-button
  21. size="small"
  22. type="primary"
  23. icon="el-icon-plus"
  24. class="ele-btn-icon"
  25. @click="open(null, 'add')"
  26. >
  27. 新建
  28. </el-button>
  29. <!-- <el-button size="small" class="ele-btn-icon" @click="handlDelete"
  30. >删除</el-button
  31. >
  32. <el-button
  33. size="small"
  34. @click="moveTo(checkRadioData, 'move')"
  35. :disabled="checkRadioData.length == 0"
  36. class="ele-btn-icon"
  37. >移动到</el-button
  38. > -->
  39. </template>
  40. <!-- 编码列 -->
  41. <template v-slot:code="{ row }">
  42. <el-link
  43. type="primary"
  44. :underline="false"
  45. @click="open(row, 'detail')"
  46. >
  47. {{ row.code }}
  48. </el-link>
  49. </template>
  50. <template v-slot:disposalType="{ row }">
  51. {{ getDictValue('设备处置方式', row.disposalType + '') }}
  52. </template>
  53. <!-- 操作列 -->
  54. <template v-slot:action="{ row }">
  55. <el-link
  56. type="primary"
  57. :underline="false"
  58. icon="el-icon-edit"
  59. v-if="row.approvalStatus == 0"
  60. @click="submit(row)"
  61. >
  62. 提交
  63. </el-link>
  64. <el-link
  65. type="primary"
  66. :underline="false"
  67. icon="el-icon-edit"
  68. v-if="row.approvalStatus == 0"
  69. @click="open(row, 'edit')"
  70. >
  71. 编辑
  72. </el-link>
  73. <el-popconfirm
  74. class="ele-action"
  75. title="确定要删除吗?"
  76. @confirm="remove(row)"
  77. v-if="row.approvalStatus == 0"
  78. >
  79. <template v-slot:reference>
  80. <el-link type="danger" :underline="false" icon="el-icon-delete">
  81. 删除
  82. </el-link>
  83. </template>
  84. </el-popconfirm>
  85. </template>
  86. </ele-pro-table>
  87. </el-card>
  88. <edit ref="edit" @refresh="reload"></edit>
  89. </div>
  90. </template>
  91. <script>
  92. import { getList, remove,submit } from '@/api/equipmentDisposal/index.js';
  93. import dictMixins from '@/mixins/dictMixins';
  94. import equipmentSearch from './components/search.vue';
  95. import edit from './components/edit';
  96. export default {
  97. mixins: [dictMixins],
  98. components: {
  99. equipmentSearch,
  100. edit
  101. },
  102. data() {
  103. return {
  104. loading: false,
  105. // 表格列配置
  106. columns: [
  107. // {
  108. // width: 45,
  109. // type: 'selection',
  110. // columnKey: 'selection',
  111. // align: 'center'
  112. // },
  113. {
  114. columnKey: 'index',
  115. type: 'index',
  116. label: '序号',
  117. width: 55,
  118. align: 'center',
  119. showOverflowTooltip: true,
  120. fixed: 'left'
  121. },
  122. {
  123. prop: 'disposalType',
  124. slot: 'disposalType',
  125. align: 'center',
  126. label: '处置方式',
  127. showOverflowTooltip: true
  128. },
  129. {
  130. columnKey: 'code',
  131. align: 'center',
  132. prop: 'code',
  133. slot: 'code',
  134. label: '编码',
  135. showOverflowTooltip: true
  136. },
  137. {
  138. prop: 'name',
  139. align: 'center',
  140. label: '名称',
  141. showOverflowTooltip: true
  142. },
  143. {
  144. prop: 'fixCode',
  145. align: 'center',
  146. label: '固资编码',
  147. showOverflowTooltip: true,
  148. formatter: (row, column, cellValue) => {
  149. return row.deviceList.map((item) => item.fixCode).toString();
  150. }
  151. },
  152. {
  153. align: 'center',
  154. label: '物品名称',
  155. showOverflowTooltip: true,
  156. formatter: (row, column, cellValue) => {
  157. return row.deviceList.map((item) => item.name).toString();
  158. }
  159. },
  160. {
  161. prop: 'createUserName',
  162. align: 'center',
  163. label: '创建人'
  164. },
  165. {
  166. prop: 'createTime',
  167. align: 'center',
  168. label: '创建时间'
  169. },
  170. {
  171. prop: 'approvalStatus',
  172. align: 'center',
  173. label: '状态',
  174. showOverflowTooltip: true,
  175. formatter: (row, column, cellValue) => {
  176. return cellValue == 0
  177. ? '草稿'
  178. : cellValue == 1
  179. ? '审核中'
  180. : '审核通过';
  181. }
  182. },
  183. {
  184. columnKey: 'action',
  185. slot: 'action',
  186. align: 'center',
  187. label: '操作',
  188. width: 240,
  189. fixed: 'right'
  190. }
  191. ],
  192. networkCounts: {},
  193. checkRadioData: [],
  194. QRvisible: false
  195. };
  196. },
  197. computed: {},
  198. created() {
  199. this.requestDict('设备处置方式');
  200. },
  201. methods: {
  202. /* 表格数据源 */
  203. datasource({ page, limit, where }) {
  204. console.log('------reload-------');
  205. // this.getNetWork(page, limit, where, order);
  206. return getList({
  207. ...where,
  208. pageNum: page,
  209. size: limit
  210. });
  211. },
  212. /* 刷新表格 */
  213. reload(where) {
  214. this.$refs.table.reload({ pageNum: 1, where: where });
  215. },
  216. open(row, type) {
  217. this.$refs.edit.open(row, type);
  218. },
  219. submit(row) {
  220. submit({businessId:row.id}).then((res) => {
  221. this.$message.success('提交成功!');
  222. this.reload();
  223. });
  224. },
  225. remove(row) {
  226. remove([row.id]).then((res) => {
  227. this.$message.success('删除成功!');
  228. this.reload();
  229. });
  230. }
  231. }
  232. };
  233. </script>
  234. <style lang="scss" scoped>
  235. @media print {
  236. #printSection {
  237. font-size: 34px;
  238. span {
  239. font-size: 34px;
  240. }
  241. }
  242. }
  243. </style>