1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <script>
- import { submit } from "@/api/expend/customerExpend";
- export default {
- name: "OpenOrClose",
- props: {
- selectData: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- title: "提交",
- loading: false,
- };
- },
- computed: {
- disabled: {
- get() {
- const { selectData } = this;
- if (selectData.length < 1) {
- return true;
- }
- return false;
- },
- set() {},
- },
- },
- methods: {
- //提交
- useClick() {
- if(this.selectData.length != 1){
- this.$modal.msgWarning("请选择一条数据进行提交!");
- return;
- }
- let that = this;
- this.$modal.confirm('确认提交吗?').then(async function() {
- that.loading = true;
- return await submit(that.selectData[0]);
- }).then(() => {
- that.$modal.msgSuccess("提交成功");
- that.loading = false;
- }).catch(() => {
- that.loading = false;
- });
- },
- },
- created() {},
- };
- </script>
- <template>
- <el-button v-loading="loading" @click="useClick" :disabled="disabled" v-bind="$attrs">{{
- title
- }}</el-button>
- </template>
|