index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <search @search="reload"></search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. :pageSize="20"
  12. >
  13. <!-- 表头工具栏 -->
  14. <template v-slot:toolbar>
  15. <el-button
  16. size="small"
  17. type="primary"
  18. icon="el-icon-plus"
  19. class="ele-btn-icon"
  20. @click="openEdit('', 'add')"
  21. >新建</el-button>
  22. </template>
  23. <template v-slot:code="{ row }">
  24. <el-link type="primary" :underline="false" @click="openEdit(row, 'view')">{{ row.code }}</el-link>
  25. </template>
  26. <template v-slot:action="{ row }">
  27. <!-- <el-link type="primary" :underline="false" @click="openEdit(row, 'edit')">修改</el-link> -->
  28. <el-popconfirm
  29. v-if="row.source == 0"
  30. class="ele-action"
  31. title="确定要删除此配件记录吗?"
  32. @confirm="handleRemove(row)"
  33. >
  34. <template v-slot:reference>
  35. <el-link type="danger" :underline="false" icon="el-icon-delete">删除</el-link>
  36. </template>
  37. </el-popconfirm>
  38. <!-- <el-link type="primary" :underline="false" @click="openEdit(row, 'view')">详情</el-link> -->
  39. </template>
  40. </ele-pro-table>
  41. </el-card>
  42. <!-- 新建或编辑弹窗 -->
  43. <accessoryDialog ref="accessoryDialog" @refresh="reload" />
  44. </div>
  45. </template>
  46. <script>
  47. import search from './components/search.vue';
  48. import accessoryDialog from './components/accessoryDialog.vue';
  49. import {
  50. accessoryPage,
  51. accessoryDelete
  52. // accessoryUpdate
  53. } from '@/api/salesServiceManagement/index';
  54. // import dictMixins from '@/mixins/dictMixins';
  55. export default {
  56. // mixins: [dictMixins],
  57. components: {
  58. search,
  59. accessoryDialog
  60. },
  61. data() {
  62. return {
  63. // 加载状态
  64. loading: false
  65. };
  66. },
  67. computed: {
  68. columns() {
  69. return [
  70. {
  71. columnKey: 'index',
  72. label: '序号',
  73. type: 'index',
  74. width: 55,
  75. align: 'center',
  76. showOverflowTooltip: true,
  77. fixed: 'left'
  78. },
  79. {
  80. slot: 'code',
  81. prop: 'code',
  82. label: '编码',
  83. align: 'center',
  84. showOverflowTooltip: true
  85. },
  86. {
  87. prop: 'orderCode',
  88. label: '工单编码',
  89. align: 'center',
  90. showOverflowTooltip: true
  91. },
  92. {
  93. prop: 'categoryLevelName',
  94. label: '物品分类',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. formatter: (row) => {
  98. if (!row.details) return '';
  99. let str = '';
  100. row.details.map((el, idx) => {
  101. if (idx + 1 == row.details.length) {
  102. str += el.categoryLevelName;
  103. } else {
  104. str = el.categoryLevelName
  105. ? str + '' + el.categoryLevelName + ','
  106. : str + '';
  107. }
  108. });
  109. return str;
  110. }
  111. },
  112. // + +关键字
  113. {
  114. prop: 'categoryName',
  115. label: '物品名称',
  116. align: 'center',
  117. showOverflowTooltip: true,
  118. formatter: (row) => {
  119. if (!row.details) return '';
  120. let str = '';
  121. row.details.map((el, idx) => {
  122. if (idx + 1 == row.details.length) {
  123. str += el.categoryName;
  124. } else {
  125. str = str + '' + el.categoryName + ',';
  126. }
  127. });
  128. return str;
  129. }
  130. },
  131. {
  132. prop: 'receivingDeptName',
  133. label: '领用部门',
  134. align: 'center',
  135. showOverflowTooltip: true
  136. },
  137. // + + 时间选择
  138. {
  139. prop: 'recipientName',
  140. label: '领用人',
  141. align: 'center',
  142. showOverflowTooltip: true
  143. },
  144. {
  145. prop: 'contactName',
  146. label: '客户名称',
  147. align: 'center',
  148. showOverflowTooltip: true
  149. },
  150. {
  151. prop: 'categoryName',
  152. label: '设备名称',
  153. align: 'center',
  154. showOverflowTooltip: true,
  155. formatter: (row) => {
  156. if (!row.deviceDetails) return '';
  157. let str = '';
  158. row.deviceDetails.map((el, idx) => {
  159. if (idx + 1 == row.deviceDetails.length) {
  160. str += el.categoryName;
  161. } else {
  162. str = str + '' + el.categoryName + ',';
  163. }
  164. });
  165. return str;
  166. }
  167. },
  168. {
  169. prop: 'createTime',
  170. label: '创建时间',
  171. align: 'center',
  172. showOverflowTooltip: true
  173. },
  174. {
  175. prop: 'usageTime',
  176. label: '使用时间',
  177. align: 'center',
  178. showOverflowTooltip: true
  179. },
  180. {
  181. columnKey: 'action',
  182. slot: 'action',
  183. label: '操作',
  184. align: 'center',
  185. width: 180,
  186. resizable: false,
  187. showOverflowTooltip: true
  188. }
  189. ];
  190. }
  191. },
  192. created() {},
  193. methods: {
  194. /* 表格数据源 */
  195. datasource({ page, limit, where, order }) {
  196. return accessoryPage({ pageNum: page, size: limit, ...where });
  197. },
  198. /* 刷新表格 */
  199. reload(where) {
  200. this.$refs.table.reload({ page: 1, where });
  201. },
  202. openEdit(row, type) {
  203. this.$refs.accessoryDialog.init(row, type);
  204. },
  205. handleRemove(row) {
  206. accessoryDelete([row.id]).then((res) => {
  207. if (res) {
  208. this.$message.success('操作成功!');
  209. this.reload();
  210. }
  211. });
  212. }
  213. }
  214. };
  215. </script>
  216. <style lang="scss" scoped></style>