index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <cuttingPlanSearch
  5. @search="reload"
  6. :statusOpt="statusOpt"
  7. :activeName="activeName"
  8. ref="searchRef"
  9. >
  10. </cuttingPlanSearch>
  11. <!-- 数据表格 -->
  12. <ele-pro-table
  13. ref="table11"
  14. :initLoad="false"
  15. :columns="columns"
  16. :datasource="datasource"
  17. @columns-change="handleColumnChange"
  18. :cacheKey="cacheKeyUrl"
  19. :pageSizes="[20, 30, 40, 50, 100]"
  20. height="calc(100vh - 350px)"
  21. full-height="calc(100vh - 116px)"
  22. :page-size="20"
  23. >
  24. <template v-slot:toolbar>
  25. <el-dropdown trigger="click" @command="handleClick">
  26. <el-link type="primary" icon="el-icon-plus">创建计划</el-link>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item command="1">来源销售订单</el-dropdown-item>
  29. <el-dropdown-item command="2">来源生产计划</el-dropdown-item>
  30. </el-dropdown-menu>
  31. </el-dropdown>
  32. </template>
  33. <template v-slot:name="{ row }">
  34. <el-link type="primary" @click="handleEdit('detail', row)">{{
  35. row.name
  36. }}</el-link>
  37. </template>
  38. <template v-slot:code="{ row }">
  39. <el-link type="primary" @click="handleEdit('detail', row)">{{
  40. row.code
  41. }}</el-link>
  42. </template>
  43. <template v-slot:status="{ row }">
  44. <span :class="{ 'ele-text-danger': row.status == 3 }">
  45. {{ statusFormatter(row.status) }}
  46. </span>
  47. </template>
  48. <template v-slot:orderType="{ row }">
  49. <span>
  50. {{
  51. row.orderType == 1
  52. ? '销售订单'
  53. : row.orderType == 2
  54. ? '生产计划'
  55. : ''
  56. }}
  57. </span>
  58. </template>
  59. <template v-slot:approvalStatus="{ row }">
  60. <el-link
  61. type="primary"
  62. :underline="false"
  63. @click="handleDetails(row)"
  64. >
  65. {{ approvalStatusFormatter(row.approvalStatus) }}
  66. </el-link>
  67. </template>
  68. <!-- 操作列 -->
  69. <template v-slot:action="{ row }">
  70. <el-link
  71. type="primary"
  72. :underline="false"
  73. @click="todo(row)"
  74. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  75. >
  76. 提交
  77. </el-link>
  78. <el-link
  79. type="primary"
  80. :underline="false"
  81. icon="el-icon-edit"
  82. @click="handleEdit('edit', row)"
  83. v-if="row.approvalStatus != 2 && row.approvalStatus != 1"
  84. >
  85. 修改
  86. </el-link>
  87. <el-link
  88. @click="handleDel(row)"
  89. type="danger"
  90. :underline="false"
  91. icon="el-icon-delete"
  92. v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
  93. >
  94. 删除
  95. </el-link>
  96. </template>
  97. </ele-pro-table>
  98. </el-card>
  99. <detail ref="detailRef"></detail>
  100. <planEditDialog ref="planEditDialogRef" @success="reload" />
  101. <producePlan ref="produceRef" @success="reload"></producePlan>
  102. <process-submit-dialog
  103. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  104. v-if="processSubmitDialogFlag"
  105. ref="processSubmitDialogRef"
  106. @reload="reload"
  107. :isNotNeedProcess="false"
  108. ></process-submit-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import cuttingPlanSearch from './components/cuttingPlan-search.vue';
  113. import planEditDialog from './components/plan-edit-dialog.vue';
  114. import producePlan from './components/producePlan.vue';
  115. import detail from '@/views/materialPlan/components/detail.vue';
  116. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  117. import { getList, del, submit } from '@/api/cuttingPlan/index.js';
  118. import tabMixins from '@/mixins/tableColumnsMixin';
  119. export default {
  120. components: {
  121. cuttingPlanSearch,
  122. processSubmitDialog,
  123. detail,
  124. planEditDialog,
  125. producePlan
  126. },
  127. mixins: [tabMixins],
  128. data() {
  129. return {
  130. activeName: 'first',
  131. cacheKeyUrl: 'c32a9c7d-aps-cuttingPlan-index',
  132. columnsVersion: 1,
  133. // 加载状态
  134. loading: false,
  135. processSubmitDialogFlag: false,
  136. statusOpt: {
  137. first: [
  138. { label: '所有状态', value: null },
  139. { label: '待排产', value: '1' },
  140. { label: '待发布', value: '2' },
  141. { label: '发布失败', value: '3' },
  142. { label: '已完成', value: '6' }
  143. ]
  144. },
  145. approvalStatusOpt: {
  146. first: [
  147. { label: '未提交', value: '0' },
  148. { label: '审核中', value: '1' },
  149. { label: '审核通过', value: '2' },
  150. { label: '审核未通过', value: '3' }
  151. ]
  152. }
  153. };
  154. },
  155. computed: {
  156. // 表格列配置
  157. columns() {
  158. let num = this.columnsVersion;
  159. return [
  160. {
  161. columnKey: 'index',
  162. label: '序号',
  163. type: 'index',
  164. width: 55,
  165. align: 'center',
  166. fixed: 'left'
  167. },
  168. {
  169. slot: 'demandType',
  170. prop: 'demandType',
  171. label: '需求类型',
  172. align: 'center',
  173. formatter: (row, column, cellValue) => {
  174. return row.demandType == 1
  175. ? '生产性物资采购'
  176. : row.demandType == 6
  177. ? '外协自供料采购'
  178. : row.demandType == 7
  179. ? '外协客供料采购'
  180. : '';
  181. },
  182. width: 130,
  183. showOverflowTooltip: true,
  184. fixed: 'left'
  185. },
  186. {
  187. slot: 'name',
  188. prop: 'name',
  189. label: '名称',
  190. align: 'center',
  191. minWidth: 130,
  192. showOverflowTooltip: true,
  193. fixed: 'left'
  194. },
  195. {
  196. slot: 'code',
  197. prop: 'code',
  198. label: '编号',
  199. align: 'center',
  200. minWidth: 160,
  201. showOverflowTooltip: true,
  202. fixed: 'left'
  203. },
  204. {
  205. prop: 'planStr',
  206. label: '生产计划编码',
  207. align: 'center',
  208. width: 160,
  209. showOverflowTooltip: true
  210. },
  211. {
  212. prop: 'orderStr',
  213. label: '销售订单号',
  214. align: 'center',
  215. width: 160,
  216. showOverflowTooltip: true
  217. },
  218. {
  219. prop: 'serialNoStr',
  220. label: '客户代号',
  221. align: 'center',
  222. width: 120,
  223. showOverflowTooltip: true
  224. },
  225. {
  226. columnKey: 'status',
  227. label: '状态',
  228. align: 'center',
  229. slot: 'status',
  230. action: 'status',
  231. width: 120,
  232. showOverflowTooltip: true
  233. },
  234. {
  235. prop: 'approvalStatus',
  236. label: '审批状态',
  237. align: 'center',
  238. slot: 'approvalStatus',
  239. action: 'approvalStatus',
  240. width: 120,
  241. showOverflowTooltip: true
  242. },
  243. {
  244. prop: 'orderType',
  245. label: '来源类型',
  246. align: 'center',
  247. slot: 'orderType',
  248. action: 'orderType',
  249. width: 120,
  250. showOverflowTooltip: true
  251. },
  252. {
  253. prop: 'createUserName',
  254. label: '创建人',
  255. align: 'center',
  256. width: 120,
  257. showOverflowTooltip: true
  258. },
  259. {
  260. prop: 'createTime',
  261. label: '创建时间',
  262. align: 'center',
  263. width: 120,
  264. showOverflowTooltip: true
  265. },
  266. {
  267. columnKey: 'action',
  268. label: '操作',
  269. width: 250,
  270. align: 'center',
  271. resizable: false,
  272. fixed: 'right',
  273. slot: 'action'
  274. }
  275. ];
  276. }
  277. },
  278. methods: {
  279. statusFormatter(status) {
  280. const obj = this.statusOpt[this.activeName].find(
  281. (i) => i.value == status
  282. );
  283. return obj && obj.label;
  284. },
  285. approvalStatusFormatter(status) {
  286. const obj = this.approvalStatusOpt[this.activeName].find(
  287. (i) => i.value == status
  288. );
  289. return obj && obj.label;
  290. },
  291. reload(where = {}) {
  292. if (where.statusList) {
  293. where.statusList = where.statusList.split(',');
  294. }
  295. this.$nextTick(() => {
  296. this.$refs.table11.reload({ page: 1, where });
  297. });
  298. },
  299. /* 表格数据源 */
  300. datasource({ page, limit, where }) {
  301. where.type = 1;
  302. return getList({
  303. pageNum: page,
  304. size: limit,
  305. ...where
  306. });
  307. },
  308. handleClick(tab) {
  309. if (tab == 1) {
  310. this.$refs.planEditDialogRef.open('add');
  311. } else if (tab == 2) {
  312. this.$refs.produceRef.open('add');
  313. }
  314. },
  315. handleDetails(row) {
  316. if (row.status == 0) {
  317. this.$message.info('未提交没有审核流程');
  318. } else {
  319. this.$refs.detailRef.open(row.processInstanceId);
  320. }
  321. },
  322. handleEdit(type, row) {
  323. if (row.orderType == 1) {
  324. this.$refs.planEditDialogRef.open(type, row);
  325. } else if (row.orderType == 2) {
  326. this.$refs.produceRef.open(type, row);
  327. }
  328. },
  329. handleDel({ id }) {
  330. this.$confirm('确认删除当前数据!', '提示').then(async () => {
  331. await del([id]);
  332. this.$message.success('删除成功!');
  333. this.reload();
  334. });
  335. },
  336. todo(row) {
  337. this.processSubmitDialogFlag = true;
  338. this.$nextTick(() => {
  339. let params = {
  340. businessId: row.id,
  341. businessKey: 'baiting_code',
  342. formCreateUserId: row.createUserId,
  343. variables: {
  344. businessCode: row.code
  345. }
  346. };
  347. this.$refs.processSubmitDialogRef.init(params);
  348. });
  349. // submit({ businessId: row.id }).then((res) => {
  350. // if (res) {
  351. // this.$message.success('提交成功!');
  352. // this.reload();
  353. // }
  354. // });
  355. }
  356. }
  357. };
  358. </script>
  359. <style lang="scss" scoped></style>