detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view class="pages">
  3. <view class="vtitle">检测申请方填写</view>
  4. <view class="form_group">
  5. <view class="lable">委托单编号</view>
  6. <view class="tag">
  7. <text class="span">{{ item.wt_num }}</text>
  8. <text class="icon more">&#xe631;</text>
  9. </view>
  10. </view>
  11. <view class="form_group">
  12. <view class="lable">标题</view>
  13. <view class="tag">
  14. <input v-model="item.title" placeholder="输入标题" />
  15. <text class="icon more">&#xe631;</text>
  16. </view>
  17. </view>
  18. <view class="form_group">
  19. <view class="lable">申请单位/部门</view>
  20. <view class="tag">
  21. <input v-model="item.dept" placeholder="输入申请单位/部门" />
  22. <text class="icon more">&#xe631;</text>
  23. </view>
  24. </view>
  25. <view class="form_group">
  26. <view class="lable">试验目的</view>
  27. <view class="tag">
  28. <input v-model="item.purpose" placeholder="输入试验目的" />
  29. <text class="icon more">&#xe631;</text>
  30. </view>
  31. </view>
  32. <view class="form_group">
  33. <view class="lable">申请人</view>
  34. <view class="tag">
  35. <input v-model="item.applicant" placeholder="输入申请人" />
  36. <text class="icon more">&#xe631;</text>
  37. </view>
  38. </view>
  39. <view class="form_group">
  40. <view class="lable">电话</view>
  41. <view class="tag">
  42. <input v-model="item.tel" placeholder="输入电话" />
  43. <text class="icon more">&#xe631;</text>
  44. </view>
  45. </view>
  46. <view class="form_group">
  47. <view class="lable">试验部门</view>
  48. <view class="tag">
  49. <input v-model="item.test_dept" placeholder="输入试验部门" />
  50. <text class="icon more">&#xe631;</text>
  51. </view>
  52. </view>
  53. <view class="form_group">
  54. <view class="lable">所属项目</view>
  55. <view class="tag">
  56. <input v-model="item.item" placeholder="输入所属项目" />
  57. <text class="icon more">&#xe631;</text>
  58. </view>
  59. </view>
  60. <view class="form_group">
  61. <view class="lable">试验类型</view>
  62. <view class="tag">
  63. <view class="span">
  64. <picker @change="bindChange($event, 'experiment_type')" :range="array2">
  65. <view class="picks">{{ item.experiment_type ? item.experiment_type : '选择2' }}</view>
  66. </picker>
  67. <picker @change="bindChange($event, 'product')" :range="array1">
  68. <view class="picks">{{ item.product ? item.product : '选择1' }}</view>
  69. </picker>
  70. </view>
  71. <text class="icon more">&#xe631;</text>
  72. </view>
  73. </view>
  74. <view class="form_group">
  75. <view class="lable">项目编号</view>
  76. <view class="tag">
  77. <input v-model="item.item_num" placeholder="输入项目编号" />
  78. <text class="icon more">&#xe631;</text>
  79. </view>
  80. </view>
  81. <view class="form_group">
  82. <view class="lable">结果形式</view>
  83. <view class="tag"><u-subsection :list="radio" :current="current" @change="change"></u-subsection></view>
  84. </view>
  85. <view class="form_group">
  86. <view class="lable">模板</view>
  87. <view class="tag" @click="dshow = true">
  88. <text class="span">2个模板</text>
  89. <text class="icon more">&#xe631;</text>
  90. </view>
  91. </view>
  92. <view class="form_group">
  93. <view class="lable">附件上传</view>
  94. <view class="tag" @click="dshow = true"><text class="span">最大上传5个</text></view>
  95. </view>
  96. <view class="form_group">
  97. <uni-file-picker :limit="5" @select="upload($event, item)" file-mediatype="all">
  98. <button class="up">
  99. <text class="icon">&#xe604;</text>
  100. <text>选择文件</text>
  101. </button>
  102. </uni-file-picker>
  103. <view class="ufiles">
  104. <view class="fil" v-for="(item, index) in item.unstructured" :key="index" @click="look(item)">
  105. <view class="icon" v-if="item.fileType.toLowerCase() == '.png' || item.fileType.toLowerCase() == '.jpg'">&#xe63e;</view>
  106. <view class="icon" v-else>&#xeb66;</view>
  107. <view class="name">
  108. <view class="omit">{{ item.name }}</view>
  109. <view class="desc">{{ (item.size / 1024).toFixed(2) }}kb</view>
  110. </view>
  111. <view class="del" @click.stop="del(item)">删除</view>
  112. <view class="clear"></view>
  113. </view>
  114. </view>
  115. </view>
  116. <view class="vtitle">设置审批人员</view>
  117. <view class="form_group" @click="select('1')">
  118. <view class="lable">需求审核-产品经理或主管人员</view>
  119. <view class="tag">
  120. <text class="span">{{ item.WTXQSH }}</text>
  121. <text class="icon more">&#xe631;</text>
  122. </view>
  123. </view>
  124. <view class="form_group" @click="select('2')">
  125. <view class="lable">试验审核-试验对接人</view>
  126. <view class="tag">
  127. <text class="span">{{ item.WTSYSH }}</text>
  128. <text class="icon more">&#xe631;</text>
  129. </view>
  130. </view>
  131. <view class="form_group" @click="select('3')">
  132. <view class="lable">需求批准-本部门领导</view>
  133. <view class="tag">
  134. <text class="span">{{ item.WTXQPZ }}</text>
  135. <text class="icon more">&#xe631;</text>
  136. </view>
  137. </view>
  138. <view class="form_group" @click="select('4')">
  139. <view class="lable">试验批准</view>
  140. <view class="tag">
  141. <text class="span">{{ item.WTSYPZ }}</text>
  142. <text class="icon more">&#xe631;</text>
  143. </view>
  144. </view>
  145. <view class="form_group" @click="select('5')">
  146. <view class="lable">任务分派-任务分派人</view>
  147. <view class="tag">
  148. <text class="span">{{ item.WTRWFP }}</text>
  149. <text class="icon more">&#xe631;</text>
  150. </view>
  151. </view>
  152. <view class="vtitle">样机</view>
  153. <view class="form_group">
  154. <view class="lable">GH560</view>
  155. <view class="tag">
  156. <text class="span">XH890656565556</text>
  157. <text class="icon more">&#xe631;</text>
  158. </view>
  159. </view>
  160. <view class="form_group">
  161. <view class="lable">GH560</view>
  162. <view class="tag">
  163. <text class="span">XH890656565556</text>
  164. <text class="icon more">&#xe631;</text>
  165. </view>
  166. </view>
  167. <view class="footer" v-if="btnshow">
  168. <view class="flex">
  169. <view class="f"><button class="btn br" @click="submission()">提交</button></view>
  170. <view class="f" v-if="state == 1"><button class="btn br back" @click="back()">回退</button></view>
  171. </view>
  172. </view>
  173. <u-popup :show="dshow" mode="center" @close="dshow = false" round="5" closeable customStyle="width:92%">
  174. <view class="popup">
  175. <u-divider text="模板下载"></u-divider>
  176. <view class="citem" @click="download('https://img-operation.csdnimg.cn/csdn/silkroad/img/1670234405428.jpg')">
  177. <view class="title omit">提交流程面板提交流程面板提交流程面板</view>
  178. <view class="xz">点击下载</view>
  179. </view>
  180. <view class="citem" @click="download('https://img-operation.csdnimg.cn/csdn/silkroad/img/1670234405428.jpg')">
  181. <view class="title omit">提交流程面板提交流程面板提交流程面板</view>
  182. <view class="xz">点击下载</view>
  183. </view>
  184. <view class="citem" @click="download('https://img-operation.csdnimg.cn/csdn/silkroad/img/1670234405428.jpg')">
  185. <view class="title omit">提交流程面板提交流程面板提交流程面板</view>
  186. <view class="xz">点击下载</view>
  187. </view>
  188. </view>
  189. </u-popup>
  190. <u-popup :show="show" mode="bottom" @close="show = false" closeable round="15">
  191. <view class="popup">
  192. <u-divider text="提交流程面板"></u-divider>
  193. <scroll-view scroll-y="true" style="height: 300rpx;">
  194. <view v-for="(item, index) in nextNodes" :key="index" class="bitem" @click="bselect(item, 'nextNodes')">
  195. <view class="icon select check" v-if="item.check">&#xe600;</view>
  196. <view class="icon select" v-else>&#xe8bb;</view>
  197. <view class="title">{{ item.name }}</view>
  198. </view>
  199. </scroll-view>
  200. <view class="confrim-btn"><button class="btn" @click="submit()">确定</button></view>
  201. </view>
  202. </u-popup>
  203. <u-popup :show="bshow" mode="bottom" @close="bshow = false" closeable round="15">
  204. <view class="popup">
  205. <u-divider text="回退流程面板"></u-divider>
  206. <scroll-view scroll-y="true" style="height: 300rpx;">
  207. <view v-for="(item, index) in backNodes" :key="index" class="bitem" @click="bselect(item, 'backNodes')">
  208. <view class="icon select check" v-if="item.check">&#xe600;</view>
  209. <view class="icon select" v-else>&#xe8bb;</view>
  210. <view class="title">{{ item.name }}</view>
  211. </view>
  212. </scroll-view>
  213. <view class="confrim-btn"><button class="btn" @click="workflowsback()">确定</button></view>
  214. </view>
  215. </u-popup>
  216. </view>
  217. </template>
  218. <script>
  219. let qrcode = require('@/common/code.js');
  220. export default {
  221. data() {
  222. return {
  223. ip: this.http.urls.ip,
  224. p: {},
  225. item: {},
  226. current: 0,
  227. radio: [
  228. {
  229. name: '正式报告'
  230. },
  231. {
  232. name: '仅原始数据'
  233. },
  234. {
  235. name: '协助试验'
  236. }
  237. ],
  238. id: '',
  239. items: {
  240. document: {
  241. items: {}
  242. }
  243. },
  244. array1: ['类型1', '类型2', '类型3', '类型4'], //实验类型1
  245. array2: ['类型2', '类型12', '类型13', '类型14'], //实验类型2
  246. show: false,
  247. bshow: false,
  248. dshow: false,
  249. itemt: {},
  250. up: {},
  251. content: '标题',
  252. nextNodes: [],
  253. backNodes: [],
  254. touser: {
  255. nodeid: '1649917385058',
  256. isToPerson: true,
  257. userids: '__jFFZYvLIG6uFc7CdBMg'
  258. },
  259. btnshow: false,
  260. state: 0
  261. };
  262. },
  263. onLoad(e) {
  264. this.id = e.id;
  265. //传过来的id
  266. this.state = e.ste;
  267. if (e.ste == 1) {
  268. /* this.http.request({
  269. url: this.http.urls.xxxx + e.id,
  270. success: res => {
  271. this.item = res.data.data;
  272. }
  273. }); */
  274. this.getDocuments();
  275. } else if (e.ste == 2) {
  276. this.empty();
  277. }
  278. //选中审批人员监听函数,其它类型的参考这个
  279. uni.$on('select', res => {
  280. console.log('asd2:' + JSON.stringify(res));
  281. if (res.ste == 1) {
  282. this.item.WTXQSH = res.items.__L5a8n9ZH5gJC0CL1s6X.value;
  283. } else if (res.ste == 2) {
  284. this.item.WTSYSH = res.items.__0ils0bIBD7Vf90TjVb3.value;
  285. } else if (res.ste == 3) {
  286. this.item.WTXQPZ = res.items.__uiMgMPHg9jmqTXzwdzl.value;
  287. } else if (res.ste == 4) {
  288. this.item.WTSYPZ = res.items.__WSh3KXD8wfeyU3FbipN.value;
  289. } else if (res.ste == 5) {
  290. this.item.WTRWFP = res.items.__IzBqxyYJhOYJntHpmEv.value;
  291. }
  292. });
  293. },
  294. methods: {
  295. //选择实验类型
  296. bindChange(e, type) {
  297. this.item[type] = this.array1[e.target.value];
  298. this.$forceUpdate();
  299. },
  300. //下载模板
  301. download(url) {
  302. const a = document.createElement('a');
  303. a.href = url;
  304. a.download = 'download';
  305. a.click();
  306. this.dshow = false;
  307. },
  308. //提交或回退
  309. bselect(e, tag) {
  310. this[tag].forEach(item => {
  311. item.check = false;
  312. });
  313. e.check = true;
  314. this.itemt.nextNodeIds = [];
  315. this.itemt.nextNodeIds.push(e.id);
  316. this.$forceUpdate();
  317. }, //详情
  318. getDocuments() {
  319. this.http.request({
  320. url: this.http.urls.documents + this.id,
  321. data: this.item,
  322. success: res => {
  323. this.item = res.data.data.items;
  324. this.p = res.data.data;
  325. this.item.unstructured = JSON.parse(this.item.unstructured);
  326. if (this.p.lastFlowOperation == undefined || this.p.auditorList.includes(this.getUser().id)) {
  327. console.log('this.p1:' + JSON.stringify(this.p));
  328. this.btnshow = true;
  329. }
  330. //this.current=res.data.data.items.report_type;
  331. if (this.item.report_type == '正式报告') {
  332. this.current = 0;
  333. } else if (this.item.report_type == '仅原始数据') {
  334. this.current = 1;
  335. } else if (this.item.report_type == '协助试验') {
  336. this.current = 2;
  337. }
  338. this.iteml = res.data.data;
  339. this.items.applicationId = '__gAPYBW4YxB3UePM3lqO';
  340. this.items.docId = this.iteml.id;
  341. this.items.id = this.iteml.id;
  342. this.items.formId = this.iteml.formid;
  343. this.items.parentId = '';
  344. this.items.subSelects = [];
  345. this.items.templateForm = '';
  346. this.items.viewId = '';
  347. this.items.document.items = this.item;
  348. this.items.document.applicationId = '__gAPYBW4YxB3UePM3lqO';
  349. this.items.document.exparams = {};
  350. this.items.document.formId = this.iteml.formid;
  351. this.items.document.id = this.iteml.id;
  352. this.items.document.parentId = '';
  353. this.items.document.sign = '';
  354. this.items.document.stateId = this.iteml.stateid;
  355. this.items.document.subDocuments = [];
  356. this.items.document.templateForm = '';
  357. this.items.document.versions = '0';
  358. }
  359. });
  360. },
  361. empty() {
  362. this.btnshow = true;
  363. this.http.request({
  364. url: this.http.urls.empty,
  365. data: this.item,
  366. success: res => {
  367. console.log('res2:' + JSON.stringify(res));
  368. this.item = res.data.data.items;
  369. this.p = res.data.data;
  370. console.log('this.p1:' + JSON.stringify(this.p));
  371. //this.current=res.data.data.items.report_type;
  372. if (this.item.report_type == '正式报告') {
  373. this.current = 0;
  374. } else if (this.item.report_type == '仅原始数据') {
  375. this.current = 1;
  376. } else if (this.item.report_type == '协助试验') {
  377. this.current = 2;
  378. }
  379. this.iteml = res.data.data;
  380. this.items.applicationId = '__gAPYBW4YxB3UePM3lqO';
  381. this.items.docId = this.iteml.id;
  382. this.items.id = this.iteml.id;
  383. this.items.formId = this.iteml.formid;
  384. this.items.parentId = '';
  385. this.items.subSelects = [];
  386. this.items.templateForm = '';
  387. this.items.viewId = '';
  388. this.items.document.items = this.item;
  389. this.items.document.applicationId = '__gAPYBW4YxB3UePM3lqO';
  390. this.items.document.exparams = {};
  391. this.items.document.formId = this.iteml.formid;
  392. this.items.document.id = this.iteml.id;
  393. this.items.document.parentId = '';
  394. this.items.document.sign = '';
  395. this.items.document.stateId = this.iteml.stateid;
  396. this.items.document.subDocuments = [];
  397. this.items.document.templateForm = '';
  398. this.items.document.versions = '0';
  399. }
  400. });
  401. },
  402. //选择结果形式
  403. change(e) {
  404. this.current = e;
  405. console.log('aa:' + this.radio[this.current].name);
  406. this.item.report_type = this.radio[this.current].name;
  407. },
  408. //选择审批人员
  409. select(e) {
  410. uni.navigateTo({
  411. url: '/pages/index/select?ste=' + e
  412. });
  413. },
  414. //选择文件上传
  415. upload(e, item) {
  416. uni.showLoading({ title: '正在上传.....', mask: true });
  417. e.tempFilePaths.forEach((temp, index) => {
  418. uni.uploadFile({
  419. url: this.http.urls.upload,
  420. filePath: temp,
  421. name: 'files',
  422. formData: {
  423. applicationId: '__gAPYBW4YxB3UePM3lqO',
  424. allowedTypes: '00',
  425. fieldId: this.id + '_unstructured',
  426. fileSaveMode: '00',
  427. path: 'ITEM_PATH',
  428. actionType: ''
  429. },
  430. header: { accessToken: this.getUser().accessToken },
  431. success: res => {
  432. uni.hideLoading();
  433. let data = JSON.parse(res.data);
  434. if (data.errcode == 0) {
  435. this.item.unstructured.push({
  436. name: data.data[0].fileName,
  437. path: data.data[0].filePath,
  438. size: data.data[0].fileSize,
  439. fileType: data.data[0].fileType
  440. });
  441. this.$forceUpdate();
  442. } else {
  443. uni.showModal({ content: '上传失败', showCancel: false });
  444. }
  445. },
  446. fail: res => {
  447. uni.hideLoading();
  448. uni.showModal({ content: '上传失败', showCancel: false });
  449. }
  450. });
  451. });
  452. },
  453. //删除上传的文件
  454. del(item) {
  455. this.item.unstructured.splice(this.item.unstructured.indexOf(item), 1);
  456. },
  457. //文件预览
  458. look(item) {
  459. console.log('asd:' + JSON.stringify(item));
  460. uni.openDocument({
  461. //新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。
  462. filePath: this.ip + item.path,
  463. showMenu: true,
  464. success: res => {
  465. console.log('打开文档成功');
  466. }
  467. });
  468. },
  469. //提交
  470. add() {
  471. this.http.request({
  472. url: this.http.urls.user_task_add,
  473. data: this.item,
  474. method: 'POST',
  475. success: res => {
  476. uni.showModal({
  477. title: '提示',
  478. content: '提交成功',
  479. showCancel: false,
  480. success: res => {
  481. if (res.confirm) {
  482. uni.navigateBack();
  483. }
  484. }
  485. });
  486. }
  487. });
  488. },
  489. //提交流程面板
  490. submission() {
  491. this.http.request({
  492. url: this.http.urls.documents + this.id + '/panels/submission',
  493. data: this.items,
  494. method: 'POST',
  495. success: res => {
  496. //this.item=res.data.data;
  497. console.log('zx22:' + JSON.stringify(res));
  498. this.show = true;
  499. this.title = res.data.data.name;
  500. this.nextNodes = res.data.data.nextNodes;
  501. this.itemt.flowId = res.data.data.flowId;
  502. this.itemt.flowType = '80';
  503. this.itemt.currentNodeId = res.data.data.currentNodeId;
  504. this.itemt.attitude = '';
  505. this.itemt.signature = '';
  506. this.itemt.submitTo = '';
  507. this.itemt.circulatorInfo = '';
  508. this.itemt.subFlowApproverInfo = '';
  509. this.itemt.subFlowApproverInfoAll = '';
  510. this.itemt.document = this.items.document;
  511. //this.content=res.data.data.formname;
  512. }
  513. });
  514. }, //提交流程
  515. submit() {
  516. //this.itemt.document.items.purpose="试验目的5656";
  517. //this.itemt.document.items.title="标题5656";
  518. this.itemt.applicationId = '__gAPYBW4YxB3UePM3lqO';
  519. this.itemt.docId = this.iteml.id;
  520. this.itemt.id = this.iteml.id;
  521. this.itemt.formId = this.iteml.formid;
  522. this.itemt.parentId = '';
  523. this.itemt.subFlowApprover = [];
  524. this.itemt.subSelects = [];
  525. this.itemt.submitTo = [];
  526. this.itemt.templateForm = '';
  527. this.itemt.viewId = '';
  528. this.http.request({
  529. url: this.http.urls.documents + this.id + '/workflows/submit',
  530. data: this.itemt,
  531. method: 'PUT',
  532. success: res => {
  533. //this.item=res.data.data;
  534. console.log('zx22:' + JSON.stringify(res));
  535. this.show = false;
  536. this.title = res.data.data.name;
  537. this.nextNodes = res.data.data.nextNodes;
  538. uni.$emit('index');
  539. uni.redirectTo({
  540. url: '/pages/index/index'
  541. });
  542. //this.content=res.data.data.formname;
  543. }
  544. });
  545. }, //刷新数据
  546. //回退流程面板
  547. back() {
  548. this.http.request({
  549. url: this.http.urls.documents + this.id + '/panels/back',
  550. data: this.items,
  551. method: 'POST',
  552. success: res => {
  553. //this.item=res.data.data;
  554. console.log('zx22:' + JSON.stringify(res.data.data));
  555. this.bshow = true;
  556. this.title = res.data.data.name;
  557. this.backNodes = res.data.data.backNodes;
  558. this.itemt.flowId = res.data.data.flowId;
  559. this.itemt.flowType = '81';
  560. this.itemt.currentNodeId = res.data.data.currentNodeId;
  561. this.itemt.attitude = '';
  562. this.itemt.signature = '';
  563. this.itemt.submitTo = '';
  564. this.itemt.circulatorInfo = '';
  565. this.itemt.subFlowApproverInfo = '';
  566. this.itemt.subFlowApproverInfoAll = '';
  567. this.itemt.document = this.items.document;
  568. //this.content=res.data.data.formname;
  569. }
  570. });
  571. }, //提交回退流程
  572. workflowsback() {
  573. //this.itemt.document.items.purpose="试验目的111";
  574. this.itemt.applicationId = '__gAPYBW4YxB3UePM3lqO';
  575. this.itemt.docId = this.iteml.id;
  576. this.itemt.id = this.iteml.id;
  577. this.itemt.formId = this.iteml.formid;
  578. this.itemt.parentId = '';
  579. this.itemt.subFlowApprover = [];
  580. this.itemt.subSelects = [];
  581. this.itemt.submitTo = [];
  582. this.itemt.templateForm = '';
  583. this.itemt.viewId = '';
  584. this.http.request({
  585. url: this.http.urls.documents + this.id + '/workflows/back',
  586. data: this.itemt,
  587. method: 'PUT',
  588. success: res => {
  589. //this.item=res.data.data;
  590. console.log('zx22:' + JSON.stringify(res));
  591. this.bshow = false;
  592. this.title = res.data.data.name;
  593. this.nextNodes = res.data.data.nextNodes;
  594. uni.$emit('index');
  595. uni.redirectTo({
  596. url: '/pages/index/index'
  597. });
  598. //this.content=res.data.data.formname;
  599. }
  600. });
  601. }
  602. }
  603. };
  604. </script>
  605. <style lang="scss">
  606. .pages {
  607. padding-bottom: 85px;
  608. }
  609. </style>