return.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <view class="page">
  3. <view class="vtitle">归还信息</view>
  4. <view class="form_group">
  5. <view class="lable">扫码</view>
  6. <view class="tag" @click="qr()">
  7. <text class="span" style="width: 90%;">{{ code }}</text>
  8. <text class="icon code">&#xe60e;</text>
  9. </view>
  10. </view>
  11. <view class="form_group" v-if="op == '设备借用11'">
  12. <view class="lable">设备所属部门</view>
  13. <view class="tag">
  14. <view class="span">
  15. <picker @change="bindChange($event, 'dept')" :range="array1">
  16. <view class="picks">{{ item.dept ? item.dept : '选择2' }}</view>
  17. </picker>
  18. </view>
  19. <text class="icon more">&#xe631;</text>
  20. </view>
  21. </view>
  22. <view class="form_group">
  23. <view class="lable">归还者</view>
  24. <view class="tag">
  25. <input v-model="item.ghz" placeholder="归还者" />
  26. <text class="icon more">&#xe631;</text>
  27. </view>
  28. </view>
  29. <view class="form_group">
  30. <view class="lable">手机号</view>
  31. <view class="tag">
  32. <input v-model="item.tel" placeholder="输入手机号" />
  33. <text class="icon more">&#xe631;</text>
  34. </view>
  35. </view>
  36. <view class="vtitle">归还设备信息</view>
  37. <view v-for="(item, index) in list" :key="index" class="item">
  38. <view class="form_group">
  39. <view class="lable">序号</view>
  40. <view class="tag">
  41. <text class="span">{{ index + 1 }}</text>
  42. </view>
  43. </view>
  44. <view class="form_group">
  45. <view class="lable">计量编号</view>
  46. <view class="tag">
  47. <text class="span">{{ item.items.__Q0YnOcfMqiTpVsTiDEh.value }}</text>
  48. </view>
  49. </view>
  50. <view class="form_group">
  51. <view class="lable">设备名称</view>
  52. <view class="tag">
  53. <text class="span">{{ item.items.__khn9SQnzgWNPt0aHldp.value }}</text>
  54. </view>
  55. </view>
  56. <view class="form_group">
  57. <view class="lable">型号规格</view>
  58. <view class="tag">
  59. <text class="span">{{ item.items.__fpUc5yOsHgSHeHPFHim.value }}</text>
  60. </view>
  61. </view>
  62. <view class="form_group">
  63. <view class="lable">测量范围</view>
  64. <view class="tag">
  65. <text class="span">{{ item.items.__soGLIaAxvM0O0NTVt1c.value }}</text>
  66. </view>
  67. </view>
  68. <view class="form_group">
  69. <view class="lable">制造商</view>
  70. <view class="tag">
  71. <text class="span">{{ item.items.__aPTYvYeakxz299A7Thk.value }}</text>
  72. </view>
  73. </view>
  74. <view class="form_group">
  75. <view class="lable">内部编号</view>
  76. <view class="tag">
  77. <text class="span">{{ item.items.__dRIZk7xLPVCO6rqJbs7.value }}</text>
  78. </view>
  79. </view>
  80. <view class="form_group">
  81. <button class="btn del" @click="del(item)">移除</button>
  82. </view>
  83. </view>
  84. <u-empty v-if="list.length == 0"></u-empty>
  85. <view class="footer">
  86. <view class="flex">
  87. <view class="f"><button class="btn br" @click="submission()">提交</button></view>
  88. <!-- <view class="f" v-if="state == 1"><button class="btn br back" @click="back()">回退</button></view>
  89. <view class="f"><button class="btn" @click="validate()">保存</button></view>-->
  90. </view>
  91. </view>
  92. <u-popup :show="show" mode="bottom" @close="show = false" closeable round="15">
  93. <view class="popup">
  94. <u-divider text="提交流程面板"></u-divider>
  95. <scroll-view scroll-y="true" style="height: 300rpx;">
  96. <view v-for="(item, index) in nextNodes" :key="index" class="bitem"
  97. @click="bselect(item, 'nextNodes')">
  98. <view class="icon select check" v-if="item.check">&#xe600;</view>
  99. <view class="icon select" v-else>&#xe8bb;</view>
  100. <view class="title">{{ item.name }}</view>
  101. </view>
  102. </scroll-view>
  103. <view class="confrim-btn"><button class="btn" @click="submit()">确定</button></view>
  104. </view>
  105. </u-popup>
  106. <u-popup :show="bshow" mode="bottom" @close="bshow = false" closeable round="15">
  107. <view class="popup">
  108. <u-divider text="回退流程面板"></u-divider>
  109. <scroll-view scroll-y="true" style="height: 300rpx;">
  110. <view v-for="(item, index) in backNodes" :key="index" class="bitem"
  111. @click="bselect(item, 'backNodes')">
  112. <view class="icon select check" v-if="item.check">&#xe600;</view>
  113. <view class="icon select" v-else>&#xe8bb;</view>
  114. <view class="title">{{ item.name }}</view>
  115. </view>
  116. </scroll-view>
  117. <view class="confrim-btn"><button class="btn" @click="workflowsback()">确定</button></view>
  118. </view>
  119. </u-popup>
  120. </view>
  121. </template>
  122. <script>
  123. let qrcode = require('@/common/code.js');
  124. export default {
  125. data() {
  126. return {
  127. bitem: {
  128. applicationId: '__gAPYBW4YxB3UePM3lqO',
  129. exparams: {},
  130. formId: '__0FLGNncOS1lz0T9jsFn',
  131. id: '__79Wtw03ya4dJUDGPyAN',
  132. isRelate: 'undefined',
  133. parentId: '',
  134. sign: '',
  135. subDocuments: [],
  136. templateForm: '',
  137. versions: '0'
  138. },
  139. btitem: {
  140. applicationId: '__gAPYBW4YxB3UePM3lqO',
  141. exparams: {},
  142. formId: '__0FLGNncOS1lz0T9jsFn',
  143. id: '__79Wtw03ya4dJUDGPyAN',
  144. isRelate: 'undefined',
  145. parentId: '',
  146. sign: '',
  147. subDocuments: [],
  148. templateForm: '',
  149. versions: '0'
  150. },
  151. geteq: {
  152. DEVID: '',
  153. allow: 'false',
  154. appId: '__gAPYBW4YxB3UePM3lqO',
  155. datetime: '1670485443880',
  156. detp: '',
  157. fieldid: '__iLwKGJTxD89ZKnFzo2Y',
  158. formId: '__w9J1gxcIWgXmNw6pE1F',
  159. isEdit: 'true',
  160. mutil: 'true',
  161. parentId: '__NYI0rVs0LXbiW21z6Nv',
  162. searchForm: 'false',
  163. selectOne: 'false',
  164. viewId: '__ajlFXbohdIXtn7ErzZq'
  165. },
  166. item: {},
  167. op: '设备归还',
  168. current: 0,
  169. code: '',
  170. list: [],
  171. show: false,
  172. bshow: false,
  173. itemt: {},
  174. up: {},
  175. content: '标题',
  176. nextNodes: [],
  177. backNodes: [],
  178. items: {
  179. document: {
  180. items: {}
  181. }
  182. },
  183. runViewDialogConfirmScript: {
  184. docId: "__DIl607e1fsiknRgGRQj",
  185. document: {
  186. items: {
  187. group: "",
  188. depttool: "",
  189. UNIT: "柳工",
  190. borrower: "",
  191. tel: "",
  192. remarks: ""
  193. },
  194. },
  195. fieldId: "__0TQu1UrRbMZVX1UvtBL",
  196. formId: "__w9J1gxcIWgXmNw6pE1F",
  197. viewId: "__ajlFXbohdIXtn7ErzZq",
  198. _selects: "__sIJiL5GlxEYoL095Vo9",
  199. },
  200. };
  201. },
  202. onLoad(e) {
  203. this.op = e.op;
  204. this.empty();
  205. //选中审批人员监听函数,其它类型的参考这个
  206. uni.$on('select', res => {
  207. console.log('asd:' + JSON.stringify(res));
  208. });
  209. },
  210. onReady() {
  211. uni.setNavigationBarTitle({
  212. title: this.op
  213. });
  214. },
  215. methods: {
  216. //提交或回退
  217. bselect(e, tag) {
  218. this[tag].forEach(item => {
  219. item.check = false;
  220. });
  221. e.check = true;
  222. this.itemt.nextNodeIds = [];
  223. this.itemt.nextNodeIds.push(e.id);
  224. this.$forceUpdate();
  225. }, //详情
  226. qr() {
  227. // 调用uni提供的调用相机api
  228. uni.chooseImage({
  229. sizeType: ['original'],
  230. sourceType: ['camera'],
  231. count: 1,
  232. success: res => {
  233. const tempFilePaths = res.tempFilePaths[0]; // 获取到二维码图片的链接
  234. qrcode.decode(tempFilePaths); // 解析二维码图片
  235. qrcode.callback = r => {
  236. this.code = r;
  237. this.geteq.DEVID = this.code;
  238. if (this.list.length == 0) {
  239. console.log('getEq:1');
  240. this.getEq();
  241. } else {
  242. this.list.forEach(item => {
  243. if (item.items.__O1qcaazksjAzDcrvJLk.value == this.geteq
  244. .DEVID) {
  245. uni.showModal({
  246. title: '提示',
  247. content: '该设备已经选择过了',
  248. showCancel: false,
  249. success: res => {
  250. if (res.confirm) {
  251. // uni.navigateBack();
  252. }
  253. }
  254. });
  255. } else {
  256. console.log('getEq:2');
  257. this.getEq();
  258. }
  259. });
  260. }
  261. console.log('asd:' + r);
  262. this.$forceUpdate();
  263. };
  264. }
  265. });
  266. },
  267. //选择结果形式
  268. change(e) {
  269. this.current = e;
  270. console.log('aa:' + this.radio[this.current].name);
  271. },
  272. //选择实验类型
  273. bindChange(e, type) {
  274. this.item[type] = this.array1[e.target.value];
  275. this.$forceUpdate();
  276. },
  277. //选择审批人员
  278. select() {
  279. uni.navigateTo({
  280. url: '/pages/index/select'
  281. });
  282. },
  283. getEq() {
  284. this.http.request({
  285. url: this.http.urls.re_list +
  286. 'parentId=' +
  287. this.geteq.parentid,
  288. data: this.geteq,
  289. method: 'POST',
  290. success: res => {
  291. console.log('res2:' + JSON.stringify(res.data.data.data));
  292. if (res.data.errcode == 0) {
  293. res.data.data.data.forEach(item => {
  294. this.list.push(item);
  295. });
  296. }
  297. }
  298. });
  299. },
  300. empty() {
  301. this.http.request({
  302. url: this.http.urls.return_empty,
  303. data: this.item,
  304. success: res => {
  305. //console.log('res2:' + JSON.stringify(res));
  306. this.item = res.data.data.items;
  307. this.bitem.id = res.data.data.id;
  308. this.bitem.formId = res.data.data.formid;
  309. this.bitem.versions = res.data.data.versions;
  310. this.geteq.parentid = res.data.data.id;
  311. //创建时组建提交流程面板请求数据
  312. this.iteml = res.data.data;
  313. this.items.applicationId = '__gAPYBW4YxB3UePM3lqO';
  314. this.items.docId = this.iteml.id;
  315. this.items.id = this.iteml.id;
  316. this.items.formId = this.iteml.formid;
  317. this.items.parentId = '';
  318. this.items.subSelects = [];
  319. this.items.templateForm = '';
  320. this.items.viewId = '';
  321. this.items.document.items = this.item;
  322. this.items.document.applicationId = '__gAPYBW4YxB3UePM3lqO';
  323. this.items.document.exparams = {};
  324. this.items.document.formId = this.iteml.formid;
  325. this.items.document.id = this.iteml.id;
  326. this.items.document.parentId = '';
  327. this.items.document.sign = '';
  328. this.items.document.stateId = this.iteml.stateid;
  329. this.items.document.subDocuments = [];
  330. this.items.document.templateForm = '';
  331. this.items.document.versions = '0';
  332. }
  333. });
  334. },
  335. //移除借用设备信息
  336. del(item) {
  337. this.list.splice(this.list.indexOf(item), 1);
  338. },
  339. ghls_empty() {
  340. this.list.forEach(item => {
  341. this.http.request({
  342. url: this.http.urls.ghls_empty,
  343. data: this.item,
  344. success: res => {
  345. console.log('tool_borrowing_empty:' + JSON.stringify(res));
  346. //this.item = res.data.data.items;
  347. console.log('this.bitem:' + JSON.stringify(this.bitem));
  348. this.btitem.id = res.data.data.id;
  349. this.btitem.formId = res.data.data.formid;
  350. this.btitem.versions = res.data.data.versions;
  351. this.btitem.parentId = this.bitem.id;
  352. //this.btitem.parent=this.bitem.id;
  353. this.btitem.items = res.data.data.items;
  354. this.btitem.items.DEVID = item.items.__O1qcaazksjAzDcrvJLk.value;//1
  355. this.btitem.items.EQUNR = item.items.__Q0YnOcfMqiTpVsTiDEh.value; //1
  356. this.btitem.items.EQKTX = item.items.__khn9SQnzgWNPt0aHldp.value; //1
  357. this.btitem.items.TYPBZ = item.items.__fpUc5yOsHgSHeHPFHim.value; //1
  358. this.btitem.items.CLFW = item.items.__soGLIaAxvM0O0NTVt1c.value; //1
  359. this.btitem.items.NPLDA = item.items.__G47scKcbMDon7HgDiQ5.value; //1
  360. this.btitem.items.SERGE = item.items.__3mveBfEF1si9RCAp9Sv.value; //1
  361. this.btitem.items.HERST = item.items.__aPTYvYeakxz299A7Thk.value; //1
  362. this.btitem.items.return_date = this.util.getDate('time'); //借用日期
  363. this.btitem.items.returning_state = ""; //归还状态
  364. this.btitem.items.TPLNR = item.items.__8BoEUIvmeOIjLiAwO9R.value; //1
  365. this.btitem.items.INTNUM = item.items.__dRIZk7xLPVCO6rqJbs7.value; //1
  366. this.btitem.items.NUMBER = item.items.__hImw4lGXCFmwyAx4fD8.value;//1
  367. console.log('this.btitem1:' + JSON.stringify(this.btitem));
  368. this.validate();
  369. //console.log('res2:' + JSON.stringify(res.data.data));
  370. }
  371. });
  372. });
  373. },
  374. //提交
  375. validate() {
  376. this.http.request({
  377. url: this.http.urls.validate +
  378. '?parentId=' +
  379. this.btitem.parentId,
  380. data: this.btitem,
  381. method: 'POST',
  382. success: res => {
  383. console.log('validate1:' + JSON.stringify(res));
  384. this.updateparent(this.btitem.parentId, this.btitem.id);
  385. }
  386. });
  387. },
  388. updateparent(parent, id) {
  389. this.http.request({
  390. url: this.http.urls.ip2 + 'liug/app?parent=' + parent + '&id=' + id + '&table=tlk_ghlsb',
  391. method: 'POST',
  392. success: res => {
  393. console.log('validate1:' + JSON.stringify(res));
  394. }
  395. });
  396. },
  397. //提交流程面板
  398. submission() {
  399. //this.validatet();
  400. this.http.request({
  401. url: this.http.urls.documents + this.bitem.id + '/panels/submission',
  402. data: this.items,
  403. method: 'POST',
  404. success: res => {
  405. //this.item=res.data.data;
  406. //console.log('zx22:' + JSON.stringify(res));
  407. this.show = true;
  408. this.title = res.data.data.name;
  409. this.nextNodes = res.data.data.nextNodes;
  410. this.itemt.flowId = res.data.data.flowId;
  411. this.itemt.flowType = '80';
  412. this.itemt.currentNodeId = res.data.data.currentNodeId;
  413. this.itemt.attitude = '';
  414. this.itemt.signature = '';
  415. this.itemt.submitTo = '';
  416. this.itemt.circulatorInfo = '';
  417. this.itemt.subFlowApproverInfo = '';
  418. this.itemt.subFlowApproverInfoAll = '';
  419. this.itemt.document = this.items.document;
  420. //this.content=res.data.data.formname;
  421. }
  422. });
  423. }, //提交流程
  424. submit() {
  425. //this.itemt.document.items.purpose="试验目的5656";
  426. //this.itemt.document.items.title="标题5656";
  427. if (this.itemt.document.items.ghz == '' || this.itemt.document.items.ghz == null) {
  428. uni.showModal({
  429. title: '提示',
  430. content: '请填写归还人',
  431. showCancel: false,
  432. success: res => {
  433. if (res.confirm) {
  434. //uni.navigateBack();
  435. }
  436. this.ghls_empty();
  437. }
  438. });
  439. return;
  440. }
  441. /*
  442. if (this.itemt.document.items.tel == '' || this.itemt.document.items.tel == null) {
  443. uni.showModal({
  444. title: '提示',
  445. content: '请填写手机号',
  446. showCancel: false,
  447. success: res => {
  448. if (res.confirm) {
  449. //uni.navigateBack();
  450. }
  451. }
  452. });
  453. return;
  454. }
  455. */
  456. this.itemt.applicationId = '__gAPYBW4YxB3UePM3lqO';
  457. this.itemt.docId = this.iteml.id;
  458. this.itemt.id = this.iteml.id;
  459. this.itemt.formId = this.iteml.formid;
  460. this.itemt.parentId = '';
  461. this.itemt.subFlowApprover = [];
  462. this.itemt.subSelects = [];
  463. this.itemt.submitTo = [];
  464. this.itemt.templateForm = '';
  465. this.itemt.viewId = '';
  466. this.http.request({
  467. url: this.http.urls.documents + this.id + '/workflows/submit',
  468. data: this.itemt,
  469. method: 'PUT',
  470. success: res => {
  471. //this.item=res.data.data;
  472. console.log('zx22:' + JSON.stringify(res));
  473. if (res.data.errcode == 0) {
  474. uni.showModal({
  475. title: '提示',
  476. content: res.data.data,
  477. showCancel: false,
  478. success: res => {
  479. if (res.confirm) {
  480. uni.navigateBack();
  481. }
  482. }
  483. });
  484. } else {
  485. uni.showModal({
  486. title: '提示',
  487. content: res.data.errmsg,
  488. showCancel: false,
  489. success: res => {
  490. if (res.confirm) {
  491. //uni.navigateBack();
  492. }
  493. }
  494. });
  495. }
  496. this.show = false;
  497. this.title = res.data.data.name;
  498. this.nextNodes = res.data.data.nextNodes;
  499. }
  500. });
  501. }, //刷新数据
  502. //提交
  503. add() {
  504. this.http.request({
  505. url: this.http.urls.user_task_add,
  506. data: this.item,
  507. method: 'POST',
  508. success: res => {
  509. uni.showModal({
  510. title: '提示',
  511. content: '提交成功',
  512. showCancel: false,
  513. success: res => {
  514. if (res.confirm) {
  515. uni.navigateBack();
  516. }
  517. }
  518. });
  519. }
  520. });
  521. }
  522. }
  523. };
  524. </script>
  525. <style lang="scss">
  526. .page {
  527. padding-bottom: 80px;
  528. }
  529. .item {
  530. margin-bottom: 10px;
  531. }
  532. .del {
  533. width: 70%;
  534. background-color: #e64340;
  535. }
  536. </style>