index.vue 9.5 KB

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