dispatchTsk.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <zz-form :cols="formCols" :data="formData" :rules="formRules" labelWidth="90" ref="form"> </zz-form>
  3. </template>
  4. <script >
  5. export default {
  6. props: ['params'],
  7. data() {
  8. return {
  9. formData: {
  10. cause: '',
  11. orderId: ''
  12. },
  13. formRules: {
  14. cause: [this.$valid.inputRequired('关闭原因')]
  15. },
  16. formCols: [
  17. [
  18. {
  19. label: '关闭原因',
  20. prop: 'cause',
  21. input: true
  22. }
  23. ]
  24. ]
  25. };
  26. },
  27. methods: {
  28. submit() {
  29. new Promise((resolve) => {
  30. this.$refs.form.validate(resolve);
  31. }).then(() => {
  32. var loading = this.$loading();
  33. let url = '/sc-community/workOrder/close';
  34. this.$http
  35. .post(url, this.formData)
  36. .then(({ status, msg }) => {
  37. if (status == 0) {
  38. this.$message.success(msg);
  39. this.params.callback();
  40. this.$emit('close');
  41. } else {
  42. this.$message.error(msg);
  43. }
  44. loading.close();
  45. })
  46. .catch(() => {
  47. loading.close();
  48. });
  49. });
  50. }
  51. },
  52. created() {
  53. this.formData.orderId = JSON.parse(JSON.stringify(this.params.data)).id;
  54. }
  55. };
  56. </script>