index.vue 8.8 KB

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