index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-quotation @search="reload"> </search-quotation>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 350px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. cache-key="eomContactPageTable"
  16. >
  17. <!-- 表头工具栏 -->
  18. <template v-slot:toolbar>
  19. <el-button
  20. size="small"
  21. type="primary"
  22. icon="el-icon-plus"
  23. class="ele-btn-icon"
  24. @click="openEdit('add', {})"
  25. >
  26. 新建
  27. </el-button>
  28. <el-button
  29. size="small"
  30. type="danger"
  31. el-icon-delete
  32. class="ele-btn-icon"
  33. @click="allDelBtn"
  34. :disabled="selection?.length === 0"
  35. >
  36. 批量删除
  37. </el-button>
  38. </template>
  39. <!-- 查看详情列 -->
  40. <template v-slot:requirementCode="{ row }">
  41. <el-link type="primary" :underline="false" @click="openDetail(row)">
  42. {{ row.requirementCode }}</el-link
  43. >
  44. </template>
  45. <!-- 状态 -->
  46. <template v-slot:status="{ row }">
  47. {{ getStatus(row.status) }}
  48. </template>
  49. <!-- 操作列 -->
  50. <template v-slot:action="{ row }">
  51. <el-link
  52. type="primary"
  53. :underline="false"
  54. icon="el-icon-edit"
  55. @click="openEdit('edit', row)"
  56. v-if="[0, 3].includes(row.status)"
  57. >
  58. 修改
  59. </el-link>
  60. <el-link
  61. type="primary"
  62. :underline="false"
  63. icon="el-icon-plus"
  64. @click="sub(row)"
  65. v-if="[0, 3].includes(row.status)"
  66. >
  67. 提交
  68. </el-link>
  69. <el-popconfirm
  70. class="ele-action"
  71. title="确定要删除此信息吗?"
  72. @confirm="remove([row.id])"
  73. v-if="[0, 3].includes(row.status)"
  74. >
  75. <template v-slot:reference>
  76. <el-link type="danger" :underline="false" icon="el-icon-delete">
  77. 删除
  78. </el-link>
  79. </template>
  80. </el-popconfirm>
  81. <el-link
  82. type="primary"
  83. icon="el-icon-plus"
  84. v-if="[2].includes(row.status)"
  85. @click="openPurchasePlanManage(row)"
  86. >
  87. 生成采购计划
  88. </el-link>
  89. </template>
  90. </ele-pro-table>
  91. </div>
  92. </el-card>
  93. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  94. <add-plan-dialog ref="addPlanRef" @done="reload"></add-plan-dialog>
  95. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  96. <!-- 多选删除弹窗 -->
  97. <pop-modal
  98. :visible.sync="delVisible"
  99. content="是否确定删除?"
  100. @done="commitBtn"
  101. />
  102. </div>
  103. </template>
  104. <script>
  105. import searchQuotation from './components/searchQuotation.vue';
  106. import addDialog from './components/addDialog.vue';
  107. import addPlanDialog from '../../purchasingManage/purchasePlanManage/components/addDialog.vue';
  108. import detailDialog from './components/detailDialog.vue';
  109. import popModal from '@/components/pop-modal';
  110. import dictMixins from '@/mixins/dictMixins';
  111. import {
  112. getTableList,
  113. deleteInformation,
  114. submit
  115. } from '@/api/purchasingManage/purchaseNeedManage';
  116. export default {
  117. mixins: [dictMixins],
  118. components: {
  119. searchQuotation,
  120. popModal,
  121. addDialog,
  122. detailDialog,
  123. addPlanDialog
  124. },
  125. data() {
  126. return {
  127. selection: [], //单选中集合
  128. delVisible: false, //批量删除弹框状态
  129. loading: false, // 加载状态
  130. columns: [
  131. {
  132. width: 45,
  133. type: 'selection',
  134. columnKey: 'selection',
  135. align: 'center'
  136. },
  137. {
  138. columnKey: 'index',
  139. label: '序号',
  140. type: 'index',
  141. width: 55,
  142. align: 'center',
  143. showOverflowTooltip: true,
  144. fixed: 'left'
  145. },
  146. {
  147. prop: 'requirementCode',
  148. slot: 'requirementCode',
  149. label: '需求编码',
  150. align: 'center',
  151. showOverflowTooltip: true,
  152. minWidth: 200
  153. },
  154. {
  155. prop: 'sourceType',
  156. label: '需求来源类型',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 140
  160. },
  161. {
  162. prop: 'requireDeptName',
  163. label: '需求部门',
  164. align: 'center',
  165. slot: 'requireDeptName',
  166. showOverflowTooltip: true,
  167. minWidth: 200
  168. },
  169. {
  170. prop: 'requireUserName',
  171. label: '需求人',
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. minWidth: 140
  175. },
  176. {
  177. prop: 'finishDate',
  178. label: '完成日期',
  179. align: 'center',
  180. showOverflowTooltip: true,
  181. minWidth: 140
  182. },
  183. {
  184. prop: 'createTime',
  185. label: '创建时间',
  186. align: 'center',
  187. showOverflowTooltip: true,
  188. minWidth: 170
  189. },
  190. {
  191. prop: 'status',
  192. label: '状态',
  193. align: 'center',
  194. slot: 'status',
  195. showOverflowTooltip: true,
  196. minWidth: 120
  197. },
  198. {
  199. prop: 'remark',
  200. label: '备注',
  201. align: 'center',
  202. showOverflowTooltip: true,
  203. minWidth: 170
  204. },
  205. {
  206. columnKey: 'action',
  207. label: '操作',
  208. width: 230,
  209. align: 'center',
  210. resizable: false,
  211. slot: 'action',
  212. showOverflowTooltip: true,
  213. fixed: 'right'
  214. }
  215. ]
  216. };
  217. },
  218. methods: {
  219. /* 表格数据源 */
  220. datasource({ page, limit, where, order }) {
  221. return getTableList({
  222. pageNum: page,
  223. size: limit,
  224. ...where
  225. });
  226. },
  227. /* 刷新表格 */
  228. reload(where) {
  229. this.$refs.table.reload({ page: 1, where });
  230. },
  231. //新增编辑
  232. openEdit(type, row) {
  233. this.$refs.addDialogRef.open(type, row, row.id);
  234. this.$refs.addDialogRef.$refs.form &&
  235. this.$refs.addDialogRef.$refs.form.clearValidate();
  236. },
  237. //生成采购计划
  238. openPurchasePlanManage(row) {
  239. this.$refs.addPlanRef.open('add', row);
  240. this.$refs.addPlanRef.$refs.form &&
  241. this.$refs.addPlanRef.$refs.form.clearValidate();
  242. },
  243. //批量删除
  244. allDelBtn() {
  245. if (this.selection.length === 0) return;
  246. this.delVisible = true;
  247. },
  248. //删除接口
  249. remove(delData) {
  250. deleteInformation(delData).then((res) => {
  251. this.$message.success('删除成功!');
  252. this.reload();
  253. });
  254. },
  255. //删除弹框确定
  256. commitBtn() {
  257. const dataId = this.selection.map((v) => v.id);
  258. this.remove(dataId);
  259. },
  260. //查看详情
  261. openDetail(row) {
  262. this.$refs.contactDetailDialogRef.open(row);
  263. },
  264. sub(res) {
  265. submit({
  266. businessId: res.id
  267. })
  268. .then((res) => {
  269. this.$message.success('提交成功');
  270. this.reload();
  271. })
  272. .catch((e) => {
  273. this.$message.error(e.message);
  274. });
  275. },
  276. //获取状态
  277. getStatus(status) {
  278. return status == 0
  279. ? '未提交'
  280. : status == 1
  281. ? '审核中'
  282. : status == 2
  283. ? '审核通过'
  284. : status == 3
  285. ? '审核不通过'
  286. : '';
  287. }
  288. }
  289. };
  290. </script>
  291. <style lang="scss" scoped>
  292. :deep(.el-link--inner) {
  293. margin-left: 0px !important;
  294. }
  295. .sys-organization-list {
  296. height: calc(100vh - 264px);
  297. box-sizing: border-box;
  298. border-width: 1px;
  299. border-style: solid;
  300. overflow: auto;
  301. }
  302. .sys-organization-list :deep(.el-tree-node__content) {
  303. height: 40px;
  304. & > .el-tree-node__expand-icon {
  305. margin-left: 10px;
  306. }
  307. }
  308. </style>