processSet.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="process-set">
  3. <process-set-item v-loading="loading" :list="list" type="edit" @callback="callback"></process-set-item>
  4. <el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px"
  5. :append-to-body="true">
  6. <process-form v-if="visible" @callback="callback" :isUpdate="isUpdate" :itemId="itemId"
  7. :productCouponModelId="part.id">
  8. </process-form>
  9. </el-dialog>
  10. </div>
  11. </template>
  12. <script>
  13. const processSetItem = () => import('./processSetItem.vue');
  14. const processForm = () => import('./processForm');
  15. import {
  16. getProcessSetData,
  17. deleteProcessSetData
  18. } from '@/api/system'
  19. import {
  20. mapGetters
  21. } from 'vuex';
  22. export default {
  23. props: ['part'],
  24. data() {
  25. return {
  26. list: [],
  27. loading: false,
  28. itemId: '',
  29. visible: false,
  30. isUpdate: false
  31. }
  32. },
  33. mounted() {
  34. this.init();
  35. },
  36. methods: {
  37. init() {
  38. this.loading = true;
  39. getProcessSetData(this.part.id).then(res => {
  40. if (res.state) {
  41. this.list = res.data;
  42. }
  43. this.loading = false;
  44. })
  45. },
  46. edit() {
  47. let data = this.$store.getters.processSet;
  48. this.itemId = data.id;
  49. switch (data.type) {
  50. case 'insert':
  51. this.visible = true;
  52. this.isUpdate = false;
  53. break;
  54. case 'update':
  55. this.visible = true;
  56. this.isUpdate = true;
  57. break;
  58. case 'delete':
  59. this.deleteDepartment();
  60. break;
  61. default:
  62. break;
  63. }
  64. },
  65. deleteDepartment() {
  66. this.$confirm('确定要删除该过程?', () => {
  67. deleteProcessSetData(this.itemId).then(res => {
  68. if (res.state) {
  69. this.$message.success('操作成功');
  70. this.init();
  71. }
  72. })
  73. });
  74. },
  75. callback(type) {
  76. this.visible = false;
  77. if (type === 'init') this.init();
  78. }
  79. },
  80. computed: {
  81. ...mapGetters(['processSet'])
  82. },
  83. components: {
  84. processSetItem,
  85. processForm
  86. },
  87. watch: {
  88. processSet() {
  89. this.edit()
  90. }
  91. },
  92. }
  93. </script>
  94. <style lang="scss">
  95. .process-set {
  96. width: 100%;
  97. height: 100%;
  98. overflow-y: auto;
  99. padding: 15px;
  100. .process-set-item {
  101. padding-left: 40px;
  102. position: relative;
  103. }
  104. .process-set-insert {
  105. font-size: 12px;
  106. color: $--color-primary;
  107. border: 1px solid $--color-primary;
  108. padding: 2px 5px;
  109. display: inline;
  110. border-radius: 3px;
  111. cursor: pointer;
  112. opacity: 0.8;
  113. }
  114. .process-item-title {
  115. padding: 5px 0;
  116. .label {
  117. font-weight: bold;
  118. color: $--color-text-primary;
  119. font-size: $--font-size-large;
  120. }
  121. .el-icon-edit-outline {
  122. margin-left: 10px;
  123. }
  124. .el-icon-delete,
  125. .el-icon-edit-outline {
  126. padding: 2px;
  127. cursor: pointer;
  128. }
  129. }
  130. .process-item-content {
  131. padding: 5px 0;
  132. }
  133. .process-set-state {
  134. width: 20px;
  135. height: 20px;
  136. border-radius: 50%;
  137. position: absolute;
  138. left: 7px;
  139. top: 6px;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. }
  144. .process-set-state-1 {
  145. width: 8px;
  146. height: 8px;
  147. border-radius: 50%;
  148. }
  149. .process-set-state-2 {
  150. width: 14px;
  151. height: 14px;
  152. border-radius: 50%;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. }
  157. .line {
  158. position: absolute;
  159. left: 16px;
  160. width: 2px;
  161. }
  162. .line-top {
  163. top: 0;
  164. height: 6px;
  165. }
  166. .line-bottom {
  167. top: 26px;
  168. bottom: 0;
  169. }
  170. .success {
  171. .process-set-state,
  172. .line {
  173. background: rgba(0, 180, 42, 0.4);
  174. }
  175. .process-set-state-1 {
  176. background: rgba(0, 180, 42, 1);
  177. }
  178. .process-set-state-2 {
  179. background: rgba(0, 180, 42, 0.6);
  180. }
  181. }
  182. .error {
  183. .process-set-state,
  184. .line {
  185. background: rgba(245, 63, 63, 0.4);
  186. }
  187. .process-set-state-1 {
  188. background: rgba(245, 63, 63, 1);
  189. }
  190. .process-set-state-2 {
  191. background: rgba(245, 63, 63, 0.6);
  192. }
  193. }
  194. .waiting {
  195. .process-set-state,
  196. .line {
  197. background: rgba(255, 125, 0, 0.4);
  198. }
  199. .process-set-state-1 {
  200. background: rgba(255, 125, 0, 1);
  201. }
  202. .process-set-state-2 {
  203. background: rgba(255, 125, 0, 0.6);
  204. }
  205. }
  206. .info {
  207. .process-set-state,
  208. .line {
  209. background: rgba(144, 157, 143, 0.4);
  210. }
  211. .process-set-state-1 {
  212. background: rgba(144, 157, 143, 1);
  213. }
  214. .process-set-state-2 {
  215. background: rgba(144, 157, 143, 0.6);
  216. }
  217. }
  218. }
  219. </style>