index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <script>
  2. import useColumns from "./columns";
  3. import { ITEM ,ToOA} from "@/api/business/purchase/contract";
  4. export default {
  5. name: "SeeFormModel",
  6. props: {
  7. dict: {
  8. type: Object,
  9. },
  10. selectData: {
  11. type: [Array],
  12. require: true,
  13. },
  14. title: {
  15. type: String,
  16. },
  17. },
  18. components: {
  19. ElSuperDescriptions: () =>
  20. import("@/components/super-descriptions/index.vue"),
  21. SubmButton: () => import("../submit/index.vue"),
  22. ElSuperTable: () => import("@/components/super-table/index.vue"),
  23. ElSuperForm: () => import("@/components/super-form/index.vue"),
  24. },
  25. data() {
  26. const {
  27. TabColumns,
  28. TableColumns,
  29. TabColumns: [
  30. {
  31. item: { key: tabName },
  32. },
  33. ],
  34. } = useColumns();
  35. return {
  36. column: 2,
  37. loading: false,
  38. loadingText: "",
  39. params: {},
  40. tabName: tabName,
  41. TabColumns: TabColumns,
  42. TableColumns: TableColumns,
  43. };
  44. },
  45. computed: {
  46. id: {
  47. get() {
  48. const { title, selectData } = this.$props;
  49. const id = title.split("-")[1];
  50. return id ? id : selectData[0].id;
  51. },
  52. set() {},
  53. },
  54. },
  55. watch: {},
  56. methods: {
  57. async fetchItem(prop) {
  58. try {
  59. // try
  60. this.loading = true;
  61. this.loadingText = "获取合同中";
  62. const { code, data } = await ITEM(prop);
  63. if (code === 200) {
  64. this.params = data;
  65. } else {
  66. }
  67. } catch (err) {
  68. // catch
  69. console.error(err);
  70. } finally {
  71. // finally
  72. this.loading = false;
  73. }
  74. },
  75. //
  76. async open(prop) {
  77. this.fetchItem(prop ? prop : this.id);
  78. },
  79. //
  80. async hide() {
  81. this.$emit("close");
  82. },
  83. async handleJump(){
  84. console.log(this.params,'params');
  85. try {
  86. const {name} = this.$store.state.user;
  87. let {code,oaUrl} = await ToOA(name,this.params.flowId);
  88. if(code == 200){
  89. window.open(oaUrl);
  90. }
  91. } catch (error) {
  92. }finally{
  93. }
  94. }
  95. },
  96. created() {
  97. this.open();
  98. },
  99. mounted() {},
  100. destroyed() {},
  101. };
  102. </script>
  103. <template>
  104. <div
  105. v-loading="loading"
  106. :element-loading-text="loadingText"
  107. style="height: 100vh; display: flex; flex-direction: column"
  108. >
  109. <div
  110. style="
  111. height: 50px;
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. padding: 0 18px;
  116. "
  117. >
  118. <h4 class="m-0" style="font-weight: 500; flex: 1">
  119. {{ title.split("-")[0] }}
  120. </h4>
  121. <el-button
  122. v-if="params.flowId && params.flowId !== ''"
  123. type="primary" :size="$attrs.size" :loading="loading" @click="handleJump">
  124. 流程跳转
  125. </el-button>
  126. <subm-button
  127. :size="$attrs.size"
  128. :select-data="[{...this.params}]"
  129. @success="fetchItem(params.id)"
  130. ></subm-button>
  131. <!-- <el-button
  132. type="primary"
  133. :size="$attrs.size"
  134. :loading="loading"
  135. @click="useSubmit('superForm')"
  136. >确 认</el-button
  137. > -->
  138. <el-button :size="$attrs.size" :loading="loading" @click="hide"
  139. >取 消</el-button
  140. >
  141. </div>
  142. <div v-if="params.code" style="flex: 1; overflow-y: auto">
  143. <el-super-form
  144. v-if="params.code"
  145. v-model="params"
  146. :dict="dict"
  147. :size="$attrs.size"
  148. :columns="TableColumns"
  149. ref="superForm"
  150. label-width="auto"
  151. label-position="right"
  152. style="padding: 18px"
  153. >
  154. </el-super-form>
  155. <!-- <el-super-descriptions
  156. v-if="params.code"
  157. v-model="params"
  158. :dict="dict"
  159. :column="column"
  160. :size="$attrs.size"
  161. :columns="TableColumns"
  162. style="padding: 18px"
  163. >
  164. </el-super-descriptions> -->
  165. </div>
  166. <el-tabs
  167. v-if="params.code"
  168. v-model="tabName"
  169. :size="$attrs.size"
  170. style="margin: 0 18px 18px"
  171. >
  172. <el-tab-pane
  173. v-for="{ item, TableColumns: columns } in TabColumns"
  174. :key="item.key"
  175. :name="item.key"
  176. :label="item.title"
  177. lazy
  178. >
  179. <div style="height: 25vh; display: flex">
  180. <el-super-table
  181. v-model="params[item.key]"
  182. :size="$attrs.size"
  183. :dict="dict"
  184. :columns="columns"
  185. :iconOperation="false"
  186. >
  187. </el-super-table>
  188. </div>
  189. </el-tab-pane>
  190. </el-tabs>
  191. </div>
  192. </template>