index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <search class="seep-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. v-if="$hasPermission('eom:sparepartsapply:save')"
  17. size="small"
  18. type="primary"
  19. icon="el-icon-plus"
  20. class="ele-btn-icon"
  21. @click="openEdit('', 'add')"
  22. >新建</el-button
  23. >
  24. </template>
  25. <template v-slot:code="{ row }">
  26. <el-link
  27. type="primary"
  28. :underline="false"
  29. @click="openEdit(row, 'view')"
  30. >{{ row.code }}</el-link
  31. >
  32. </template>
  33. <template v-slot:action="{ row }">
  34. <el-link
  35. type="primary"
  36. v-if="
  37. row.source == 0 && $hasPermission('eom:sparepartsapply:update')
  38. "
  39. :underline="false"
  40. @click="openEdit(row, 'edit')"
  41. >修改</el-link
  42. >
  43. <!-- <el-link
  44. type="primary"
  45. v-if="row.source == 0"
  46. :underline="false"
  47. @click="openProcess(row)"
  48. >发起流程</el-link
  49. > -->
  50. <el-popconfirm
  51. v-if="
  52. row.source == 0 && $hasPermission('eom:sparepartsapply:delete')
  53. "
  54. class="ele-action"
  55. title="确定要删除此配件记录吗?"
  56. @confirm="handleRemove(row)"
  57. >
  58. <template v-slot:reference>
  59. <el-link type="danger" :underline="false" icon="el-icon-delete"
  60. >删除</el-link
  61. >
  62. </template>
  63. </el-popconfirm>
  64. </template>
  65. </ele-pro-table>
  66. </el-card>
  67. <process-submit-dialog
  68. :isNotNeedProcess="false"
  69. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  70. v-if="processSubmitDialogFlag"
  71. ref="processSubmitDialogRef"
  72. @reload="reload"
  73. ></process-submit-dialog>
  74. <!-- 新建或编辑弹窗 -->
  75. <accessoryDialog ref="accessoryDialog" @refresh="reload" />
  76. </div>
  77. </template>
  78. <script>
  79. import search from './components/search.vue';
  80. import accessoryDialog from './components/accessoryDialog.vue';
  81. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  82. import {
  83. accessoryPage,
  84. accessoryDelete
  85. // accessoryUpdate
  86. } from '@/api/salesServiceManagement/index';
  87. // import dictMixins from '@/mixins/dictMixins';
  88. export default {
  89. // mixins: [dictMixins],
  90. components: {
  91. search,
  92. accessoryDialog,
  93. processSubmitDialog
  94. },
  95. data() {
  96. return {
  97. // 加载状态
  98. loading: false,
  99. processSubmitDialogFlag: false // 加载状态 弹窗
  100. };
  101. },
  102. computed: {
  103. columns() {
  104. return [
  105. {
  106. columnKey: 'index',
  107. label: '序号',
  108. type: 'index',
  109. width: 55,
  110. align: 'center',
  111. showOverflowTooltip: true,
  112. fixed: 'left'
  113. },
  114. {
  115. slot: 'code',
  116. prop: 'code',
  117. label: '编码',
  118. align: 'center',
  119. showOverflowTooltip: true
  120. },
  121. {
  122. prop: 'orderCode',
  123. label: '工单编码',
  124. align: 'center',
  125. showOverflowTooltip: true
  126. },
  127. {
  128. prop: 'approvalStatus',
  129. label: '审核状态',
  130. align: 'center',
  131. showOverflowTooltip: true,
  132. formatter: (_row, _column, cellValue) => {
  133. return cellValue == 0
  134. ? '未提交'
  135. : cellValue == 1
  136. ? '审核中'
  137. : cellValue == 2
  138. ? '审核通过'
  139. : cellValue == 3
  140. ? '审核不通过'
  141. : '';
  142. }
  143. },
  144. {
  145. prop: 'categoryLevelName',
  146. label: '物品分类',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. formatter: (row) => {
  150. if (!row.details) return '';
  151. let str = '';
  152. row.details.map((el, idx) => {
  153. if (idx + 1 == row.details.length) {
  154. str += el.categoryLevelName;
  155. } else {
  156. str = el.categoryLevelName
  157. ? str + '' + el.categoryLevelName + ','
  158. : str + '';
  159. }
  160. });
  161. return str;
  162. }
  163. },
  164. // + +关键字
  165. {
  166. prop: 'categoryName',
  167. label: '物品名称',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. formatter: (row) => {
  171. if (!row.details) return '';
  172. let str = '';
  173. row.details.map((el, idx) => {
  174. if (idx + 1 == row.details.length) {
  175. str += el.categoryName;
  176. } else {
  177. str = str + '' + el.categoryName + ',';
  178. }
  179. });
  180. return str;
  181. }
  182. },
  183. {
  184. prop: 'receivingDeptName',
  185. label: '领用部门',
  186. align: 'center',
  187. showOverflowTooltip: true
  188. },
  189. // + + 时间选择
  190. {
  191. prop: 'recipientName',
  192. label: '领用人',
  193. align: 'center',
  194. showOverflowTooltip: true
  195. },
  196. {
  197. prop: 'contactName',
  198. label: '客户名称',
  199. align: 'center',
  200. showOverflowTooltip: true
  201. },
  202. {
  203. prop: 'categoryName',
  204. label: '设备名称',
  205. align: 'center',
  206. showOverflowTooltip: true,
  207. formatter: (row) => {
  208. if (!row.deviceDetails) return '';
  209. let str = '';
  210. row.deviceDetails.map((el, idx) => {
  211. if (idx + 1 == row.deviceDetails.length) {
  212. str += el.categoryName;
  213. } else {
  214. str = str + '' + el.categoryName + ',';
  215. }
  216. });
  217. return str;
  218. }
  219. },
  220. {
  221. prop: 'createTime',
  222. label: '创建时间',
  223. align: 'center',
  224. showOverflowTooltip: true
  225. },
  226. {
  227. prop: 'usageTime',
  228. label: '使用时间',
  229. align: 'center',
  230. showOverflowTooltip: true
  231. },
  232. {
  233. columnKey: 'action',
  234. slot: 'action',
  235. label: '操作',
  236. align: 'center',
  237. width: 180,
  238. resizable: false,
  239. showOverflowTooltip: true
  240. }
  241. ];
  242. }
  243. },
  244. created() {},
  245. methods: {
  246. /* 表格数据源 */
  247. datasource({ page, limit, where, order }) {
  248. return accessoryPage({ pageNum: page, size: limit, ...where });
  249. },
  250. /* 刷新表格 */
  251. reload(where) {
  252. this.$refs.table.reload({ page: 1, where });
  253. },
  254. openEdit(row, type) {
  255. this.$refs.accessoryDialog.init(row, type);
  256. },
  257. handleRemove(row) {
  258. accessoryDelete([row.id]).then((res) => {
  259. if (res) {
  260. this.$message.success('操作成功!');
  261. this.reload();
  262. }
  263. });
  264. },
  265. openProcess(data) {
  266. this.processSubmitDialogFlag = true;
  267. this.$nextTick(() => {
  268. let params = {
  269. businessId: data.id,
  270. businessKey: 'eom_sh_bpbj',
  271. formCreateUserId: data.createUserId,
  272. variables: {
  273. businessCode: data.code,
  274. businessName: data.receivingDeptName,
  275. businessType: '申请备品备件'
  276. }
  277. };
  278. this.$refs.processSubmitDialogRef.init(params);
  279. });
  280. }
  281. }
  282. };
  283. </script>
  284. <style lang="scss" scoped>
  285. ::v-deep .el-input__inner::placeholder {
  286. font-size: 13px;
  287. }
  288. ::v-deep .seep-search {
  289. .el-input__inner {
  290. padding: 0 5px 0 10px;
  291. }
  292. }
  293. </style>