detailDialog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible.sync="visible"
  6. v-if="visible"
  7. title="详情"
  8. :append-to-body="true"
  9. :close-on-click-modal="false"
  10. :maxable="true"
  11. :resizable="true"
  12. width="70%"
  13. >
  14. <div class="switch">
  15. <div class="switch_left">
  16. <ul>
  17. <li
  18. v-for="item in tabOptions"
  19. :key="item.key"
  20. :class="{ active: activeComp == item.key }"
  21. @click="activeComp = item.key"
  22. >
  23. {{ item.name }}
  24. </li>
  25. </ul>
  26. </div>
  27. </div>
  28. <div v-show="activeComp === 'main'">
  29. <!-- <div class="row">主题: {{ form.businessName }}</div>
  30. <div class="row">提交人: {{ form.processInstance?.startUserNickname }}</div>
  31. <div class="row">提交时间: {{ form.createTime }}</div> -->
  32. <fm-generate-form
  33. v-if="Object.keys(form?.formJson || {}).length !== 0"
  34. :data="jsonData"
  35. :value="form.valueJson"
  36. :edit="false"
  37. ref="generateForm"
  38. >
  39. <template v-slot:blank_adopzrdd="scope">
  40. <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index">
  41. <div class="blank_adopzrdd">
  42. <span>{{ index + 1 }}报销事项:</span>
  43. <el-input
  44. v-model="scope.model.blank_adopzrdd[index].remark"
  45. type="textarea"
  46. style="width: calc(100% - 80px)"
  47. ></el-input>
  48. </div>
  49. <div class="blank_adopzrdd">
  50. <span>金额:</span>
  51. <el-input
  52. v-model="scope.model.blank_adopzrdd[index].price"
  53. type="number"
  54. style="width: calc(100% - 80px)"
  55. ></el-input>
  56. </div>
  57. <div class="blank_adopzrdd">
  58. <span>附件:</span>
  59. <fileMain v-model="scope.model.blank_adopzrdd[index].file" type="view" ></fileMain>
  60. </div>
  61. </div>
  62. </template>
  63. <template v-slot:eom_contact="scope">
  64. <div class="eom_contact">
  65. <el-input
  66. v-model="scope.model.eom_contact.name"
  67. style="width: 100%"
  68. :disabled="view"
  69. ></el-input>
  70. </div>
  71. </template>
  72. <!-- 关联工单 -->
  73. <template v-slot:manage_workorder="scope">
  74. <div class="manage_workorder">
  75. <el-input
  76. v-model="scope.model.manage_workorder.code"
  77. style="width: 100%"
  78. :disabled="view"
  79. ></el-input>
  80. </div>
  81. </template>
  82. <!-- 差旅 -->
  83. <template v-slot:blank_business_component="scope">
  84. <businessComponent
  85. ref="blank_business_component"
  86. id="blank_business_component"
  87. :generateForm="$refs.generateForm"
  88. :info="scope.model"
  89. :view="view"
  90. ></businessComponent>
  91. </template>
  92. <!-- 印章使用 -->
  93. <template v-slot:blank_use_seal="scope">
  94. <useSealComponent
  95. ref="blank_use_seal"
  96. id="blank_use_seal"
  97. :generateForm="$refs.generateForm"
  98. :info="scope.model"
  99. :view="view"
  100. ></useSealComponent>
  101. </template>
  102. <!-- 资质使用 -->
  103. <template v-slot:blank_use_qualification="scope">
  104. <useQualificationComponent
  105. ref="blank_use_qualification"
  106. id="blank_use_qualification"
  107. :generateForm="$refs.generateForm"
  108. :info="scope.model"
  109. :view="view"
  110. ></useQualificationComponent>
  111. </template>
  112. <!-- 产品规格 -->
  113. <template v-slot:blank_product_specification="scope">
  114. <productSpecificationComponent
  115. ref="blank_product_specification"
  116. id="blank_product_specification"
  117. :generateForm="$refs.generateForm"
  118. :info="scope.model"
  119. :view="view"
  120. ></productSpecificationComponent>
  121. </template>
  122. <!-- 事件 -->
  123. <template v-slot:blank_event_component="scope">
  124. <eventComponent
  125. ref="blank_event_component"
  126. id="blank_event_component"
  127. :generateForm="$refs.generateForm"
  128. :info="scope.model"
  129. :view="view"
  130. ></eventComponent>
  131. </template>
  132. <!-- 补发 -->
  133. <template v-slot:blank_reissue_component="scope">
  134. <reissueComponent
  135. ref="blank_reissue_component"
  136. id="blank_reissue_component"
  137. :generateForm="$refs.generateForm"
  138. :info="scope.model"
  139. :view="view"
  140. ></reissueComponent>
  141. </template>
  142. <!-- 申领单(临床/非临床) -->
  143. <template v-slot:blank_application_component="scope">
  144. <applicationComponent
  145. ref="blank_application_component"
  146. id="blank_application_component"
  147. :generateForm="$refs.generateForm"
  148. :info="scope.model"
  149. ></applicationComponent>
  150. </template>
  151. <!-- 采购申请单(行政采购) -->
  152. <template v-slot:blank_purchase_requisition="scope">
  153. <purchaseRequisitionComponent
  154. ref="blank_purchase_requisition"
  155. id="blank_purchase_requisition"
  156. :generateForm="$refs.generateForm"
  157. :info="scope.model"
  158. ></purchaseRequisitionComponent>
  159. </template>
  160. <!-- 出差申请单 -->
  161. <template v-slot:blank_business_trip="scope">
  162. <businessTripComponent
  163. ref="blank_business_trip"
  164. id="blank_business_trip"
  165. :generateForm="$refs.generateForm"
  166. :info="scope.model"
  167. ></businessTripComponent>
  168. </template>
  169. </fm-generate-form>
  170. <async-biz-form-component
  171. v-else
  172. :businessId="form?.businessId"
  173. :businessType="form?.businessType"
  174. ref="bziRef"
  175. :isView="true"
  176. ></async-biz-form-component>
  177. </div>
  178. <bpmDetail
  179. v-if="activeComp === 'bpm' && form.processInstance.id"
  180. :id="form.processInstance.id"
  181. ></bpmDetail>
  182. <div slot="footer" class="footer">
  183. <el-button @click="visible = false">返回</el-button>
  184. </div>
  185. </ele-modal>
  186. </template>
  187. <script>
  188. import bpmDetail from '@/views/bpm/processInstance/detailNew.vue';
  189. import Vue from 'vue';
  190. import { getToken } from '@/utils/token-util';
  191. import businessComponent from '@/BIZComponents/processSubmitDialog/components/businessComponent.vue';
  192. import useSealComponent from '@/BIZComponents/processSubmitDialog/components/useSealComponent.vue';
  193. import useQualificationComponent from '@/BIZComponents/processSubmitDialog/components/useQualificationComponent.vue';
  194. import productSpecificationComponent from '@/BIZComponents/processSubmitDialog/components/productSpecificationComponent.vue';
  195. import eventComponent from '@/BIZComponents/processSubmitDialog/components/eventComponent.vue';
  196. import reissueComponent from '@/BIZComponents/processSubmitDialog/components/reissueComponent.vue';
  197. import applicationComponent from '@/BIZComponents/processSubmitDialog/components/applicationComponent.vue';
  198. import purchaseRequisitionComponent from '@/BIZComponents/processSubmitDialog/components/purchaseRequisitionComponent.vue';
  199. import businessTripComponent from '@/BIZComponents/processSubmitDialog/components/businessTripComponent.vue';
  200. export default {
  201. components: {
  202. bpmDetail,
  203. businessComponent,
  204. useSealComponent,
  205. useQualificationComponent,
  206. productSpecificationComponent,
  207. eventComponent,
  208. reissueComponent,
  209. applicationComponent,
  210. purchaseRequisitionComponent,
  211. businessTripComponent
  212. },
  213. data() {
  214. return {
  215. activeComp: 'main',
  216. form: {
  217. processInstance: {}
  218. },
  219. tabOptions: [
  220. { key: 'main', name: '业务详情' },
  221. { key: 'bpm', name: '流程详情' }
  222. ],
  223. visible: false,
  224. jsonData: {}
  225. };
  226. },
  227. methods: {
  228. // 库存批次拆合审批使用专用详情组件,兼容历史流程路由数据。
  229. isStockBatchChange() {
  230. return (
  231. String(this.form.businessCode || '').startsWith('PCBG') ||
  232. String(this.form.pcViewRouter || '').includes('stockBatchChange') ||
  233. String(this.form.pcViewRouter || '').includes(
  234. 'warehouseManagement/stockLedger'
  235. )
  236. );
  237. },
  238. getBusinessComponentRouter() {
  239. const router = this.form.pcViewRouter;
  240. const invalidViewRouter = String(router || '').includes(
  241. 'warehouseManagement/stockLedger'
  242. );
  243. if (this.isStockBatchChange() && (!router || invalidViewRouter)) {
  244. return '/bpm/handleTask/components/stockBatchChange/detailDialog.vue';
  245. }
  246. const businessKey = String(
  247. this.form.businessKey ||
  248. this.form.processDefinitionKey ||
  249. this.form.processInstance?.processDefinitionId?.split(':')[0] ||
  250. this.form.processInstance?.processDefinition?.key ||
  251. ''
  252. );
  253. const fallback =
  254. businessKey === 'contact_approve'
  255. ? '/bpm/handleTask/components/contact/contactDetailDialog.vue'
  256. : '';
  257. const path = String(!router || router === '/' ? fallback : router).trim();
  258. if (!path || path === '/' || !path.startsWith('/')) return '';
  259. return path;
  260. },
  261. async open(row) {
  262. this.form = _.cloneDeep(row);
  263. // 兼容后端附件字段名为 file 或 files(详情只读,统一到 file 字段)
  264. const adoptList = this.form?.valueJson?.blank_adopzrdd;
  265. if (Array.isArray(adoptList)) {
  266. adoptList.forEach((item) => {
  267. if (item && item.file == null && item.files != null) {
  268. item.file = item.files;
  269. }
  270. });
  271. }
  272. if (this.form?.formJson?.makingJson) {
  273. this.jsonData = JSON.parse(this.form.formJson.makingJson);
  274. this.jsonData.config.dataSource &&
  275. this.jsonData.config.dataSource.forEach((item) => {
  276. item.headers = {
  277. Authorization: getToken()
  278. };
  279. });
  280. }
  281. this.activeComp = 'main';
  282. this.visible = true;
  283. console.log('this.form.pcViewRouter', this.form.pcViewRouter);
  284. const router = this.getBusinessComponentRouter();
  285. if (!router) {
  286. console.error('流程表单路由未配置', {
  287. pcViewRouter: this.form.pcViewRouter,
  288. businessCode: this.form.businessCode,
  289. businessType: this.form.businessType
  290. });
  291. this.$message.error(
  292. '流程未配置 PC 详情路由(pcViewRouter),请在流程定义中填写业务详情组件路径'
  293. );
  294. return;
  295. }
  296. Vue.component('async-biz-form-component', (resolve) => {
  297. require([`@/views${router}`], resolve);
  298. });
  299. },
  300. cancel() {
  301. this.$nextTick(() => {
  302. this.form = {};
  303. this.visible = false;
  304. });
  305. }
  306. }
  307. };
  308. </script>
  309. <style scoped lang="scss">
  310. .ele-dialog-form {
  311. .el-form-item {
  312. margin-bottom: 10px;
  313. }
  314. }
  315. .headbox {
  316. display: flex;
  317. justify-content: space-between;
  318. align-items: center;
  319. .amount {
  320. font-size: 14px;
  321. font-weight: bold;
  322. }
  323. }
  324. .blank_adopzrdd {
  325. display: flex;
  326. align-items: center;
  327. > span {
  328. display: inline-block;
  329. width: 80px;
  330. }
  331. margin-bottom: 10px;
  332. }
  333. .row {
  334. margin-bottom: 10px;
  335. margin-top: 10px;
  336. margin-left: 10px;
  337. }
  338. </style>