123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <script>
- import { SUBMIT } from "@/api/business/purchase/apply";
- export default {
- name: "SubmitDialog",
- props: {
- selectData: {
- type: [Array],
- require: true,
- },
- },
- data() {
- return {
- title: "提交OA",
- visible: false,
- loading: false,
- };
- },
- computed: {
- disabled: {
- get() {
- const { selectData } = this;
- if (selectData.length < 1) {
- return true;
- }
- if (
- selectData.length >= 1 &&
- selectData.findIndex(({ status }) => status === "1") > -1
- ) {
- return true;
- }
- if (
- selectData.length >= 1 &&
- selectData.findIndex(({ status }) => status === "2") > -1
- ) {
- return true;
- }
- },
- set() {},
- },
- },
- watch: {},
- methods: {
- //
- open() {
- this.visible = true;
- },
- //
- hide() {
- this.visible = false;
- },
- //
- async submit(prop) {
- try {
- // try
- this.loading = true;
- const ids = prop.map((item) => item.id).join(",");
- const { msg, code } = await SUBMIT(ids);
- 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)"
- >确 认</el-button
- >
- </div>
- <el-alert
- title="是否提交数据项至OA系统"
- type="info"
- show-icon
- :closable="false"
- style="margin-bottom: 10px"
- >
- </el-alert>
- </el-dialog>
- </el-button>
- </template>
|