borrowing.vue 17 KB

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