123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <script>
- import useColumns from "./columns";
- import { ITEM ,ToOA} from "@/api/business/purchase/contract";
- export default {
- name: "SeeFormModel",
- props: {
- dict: {
- type: Object,
- },
- selectData: {
- type: [Array],
- require: true,
- },
- title: {
- type: String,
- },
- },
- components: {
- ElSuperDescriptions: () =>
- import("@/components/super-descriptions/index.vue"),
- SubmButton: () => import("../submit/index.vue"),
- ElSuperTable: () => import("@/components/super-table/index.vue"),
- ElSuperForm: () => import("@/components/super-form/index.vue"),
- },
- data() {
- const {
- TabColumns,
- TableColumns,
- TabColumns: [
- {
- item: { key: tabName },
- },
- ],
- } = useColumns();
- return {
- column: 2,
- loading: false,
- loadingText: "",
- params: {},
- tabName: tabName,
- TabColumns: TabColumns,
- TableColumns: TableColumns,
- };
- },
- computed: {
- id: {
- get() {
- const { title, selectData } = this.$props;
- const id = title.split("-")[1];
- return id ? id : selectData[0].id;
- },
- set() {},
- },
- },
- watch: {},
- methods: {
- async fetchItem(prop) {
- try {
- // try
- this.loading = true;
- this.loadingText = "获取合同中";
- const { code, data } = await ITEM(prop);
- if (code === 200) {
- this.params = data;
- } else {
- }
- } catch (err) {
- // catch
- console.error(err);
- } finally {
- // finally
- this.loading = false;
- }
- },
- //
- async open(prop) {
- this.fetchItem(prop ? prop : this.id);
- },
- //
- async hide() {
- this.$emit("close");
- },
- async handleJump(){
- console.log(this.params,'params');
- try {
- const {name} = this.$store.state.user;
- let {code,oaUrl} = await ToOA(name,this.params.flowId);
- if(code == 200){
- window.open(oaUrl);
- }
-
- } catch (error) {
-
- }finally{
- }
- }
- },
- created() {
- this.open();
- },
- mounted() {},
- destroyed() {},
- };
- </script>
- <template>
- <div
- v-loading="loading"
- :element-loading-text="loadingText"
- style="height: 100vh; display: flex; flex-direction: column"
- >
- <div
- style="
- height: 50px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 18px;
- "
- >
- <h4 class="m-0" style="font-weight: 500; flex: 1">
- {{ title.split("-")[0] }}
- </h4>
- <el-button
- v-if="params.flowId && params.flowId !== ''"
- type="primary" :size="$attrs.size" :loading="loading" @click="handleJump">
- 流程跳转
- </el-button>
- <subm-button
- :size="$attrs.size"
- :select-data="[{...this.params}]"
- @success="fetchItem(params.id)"
- ></subm-button>
- <!-- <el-button
- type="primary"
- :size="$attrs.size"
- :loading="loading"
- @click="useSubmit('superForm')"
- >确 认</el-button
- > -->
- <el-button :size="$attrs.size" :loading="loading" @click="hide"
- >取 消</el-button
- >
- </div>
- <div v-if="params.code" style="flex: 1; overflow-y: auto">
- <el-super-form
- v-if="params.code"
- v-model="params"
- :dict="dict"
- :size="$attrs.size"
- :columns="TableColumns"
- ref="superForm"
- label-width="auto"
- label-position="right"
- style="padding: 18px"
- >
-
- </el-super-form>
- <!-- <el-super-descriptions
- v-if="params.code"
- v-model="params"
- :dict="dict"
- :column="column"
- :size="$attrs.size"
- :columns="TableColumns"
- style="padding: 18px"
- >
- </el-super-descriptions> -->
- </div>
- <el-tabs
- v-if="params.code"
- v-model="tabName"
- :size="$attrs.size"
- style="margin: 0 18px 18px"
- >
- <el-tab-pane
- v-for="{ item, TableColumns: columns } in TabColumns"
- :key="item.key"
- :name="item.key"
- :label="item.title"
- lazy
- >
- <div style="height: 25vh; display: flex">
- <el-super-table
- v-model="params[item.key]"
- :size="$attrs.size"
- :dict="dict"
- :columns="columns"
- :iconOperation="false"
- >
- </el-super-table>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
- </template>
|