index.vue 8.0 KB

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