123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <zz-form :cols="formCols" :data="formData" :rules="formRules" labelWidth="90" ref="form"> </zz-form>
- </template>
- <script >
- export default {
- props: ['params'],
- data() {
- return {
- formData: {
- cause: '',
- orderId: ''
- },
- formRules: {
- cause: [this.$valid.inputRequired('关闭原因')]
- },
- formCols: [
- [
- {
- label: '关闭原因',
- prop: 'cause',
- input: true
- }
- ]
- ]
- };
- },
- methods: {
- submit() {
- new Promise((resolve) => {
- this.$refs.form.validate(resolve);
- }).then(() => {
- var loading = this.$loading();
- let url = '/sc-community/workOrder/close';
- this.$http
- .post(url, this.formData)
- .then(({ status, msg }) => {
- if (status == 0) {
- this.$message.success(msg);
- this.params.callback();
- this.$emit('close');
- } else {
- this.$message.error(msg);
- }
- loading.close();
- })
- .catch(() => {
- loading.close();
- });
- });
- }
- },
- created() {
- this.formData.orderId = JSON.parse(JSON.stringify(this.params.data)).id;
- }
- };
- </script>
|