123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <script>
- import { TERMINATION } from "@/api/business/purchase/contract";
- export default {
- name: "TerminationDialog",
- props: {
- selectData: {
- type: [Array],
- require: true,
- },
- },
- data() {
- return {
- title: "终 止",
- visible: false,
- loading: false,
- };
- },
- computed: {
- disabled: {
- get() {
- if (this.selectData.length === 1) {
- const [{ status }] = this.selectData;
- if (status !== "2") {
- return true;
- } else {
- return false;
- }
- } else {
- return true;
- }
- },
- set() {},
- },
- },
- watch: {},
- methods: {
- //
- open() {
- this.visible = true;
- },
- //
- hide() {
- this.visible = false;
- },
- //
- async submit(prop) {
- try {
- // try
- this.loading = true;
- const { msg, code } = await TERMINATION({ id: prop });
- if (code === 200) {
- this.hide();
- this.$emit("success");
- this.$notify.success(msg);
- }
- } catch (err) {
- // catch
- console.error(err);
- } finally {
- // finally
- this.loading = false;
- }
- },
- },
- created() {},
- mounted() {},
- destroyed() {},
- };
- </script>
- <template>
- <el-button
- v-bind="$attrs"
- v-on="$listeners"
- :disabled="disabled"
- @click="open"
- >
- {{ title }}
- <el-dialog
- :title="title"
- :visible.sync="visible"
- width="25%"
- append-to-body
- @close="hide"
- >
- <div slot="footer">
- <el-button
- :size="$attrs.size"
- :loading="loading"
- @click="visible = false"
- >取 消</el-button
- >
- <el-button
- type="primary"
- :size="$attrs.size"
- :loading="loading"
- @click="submit(selectData[0].id)"
- >确 认</el-button
- >
- </div>
- <el-alert title="是否终止数据项?" type="info" show-icon :closable="false">
- </el-alert>
- </el-dialog>
- </el-button>
- </template>
|