communication.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-luohu" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">沟通记录</block>
  6. </cu-custom>
  7. <view>
  8. <view class="cu-form-group">
  9. <view class="title">表单编号:</view>
  10. <input placeholder="请输入表单编号" v-model="form.biaoDanBianHao" name="input" :disabled="true"></input>
  11. </view>
  12. <view class="cu-form-group">
  13. <view class="title">客户单位名称:</view>
  14. <input placeholder="请输入客户单位名称" v-model="form.xuanZeKeHu" name="input" disabled></input>
  15. <!-- <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  16. v-if="form.keHuDanWeiMingChe != ''" @click="form.keHuDanWeiMingChe = ''"></u-icon> -->
  17. </view>
  18. <view class="cu-form-group">
  19. <view class="title">客户联系人:</view>
  20. <input placeholder="请输入客户联系人" v-model="form.keHuLianXiRen" name="input"
  21. :disabled="id && id != '' ? true: false"></input>
  22. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  23. v-if="form.keHuLianXiRen != '' && id == ''" @click="form.keHuLianXiRen = ''"></u-icon>
  24. </view>
  25. <view class="cu-form-group">
  26. <view class="title">委托单号:</view>
  27. <text style="width: 100%;" @click="getShow">{{getWeiTuo(form.weiTuoDanHao)}}</text>
  28. <u-button type="success" size="mini" @click="getShow" v-if="form.weiTuoDanHao == '' && id == ''">选择
  29. </u-button>
  30. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  31. v-if="form.weiTuoDanHao != '' && id == ''" @click="form.weiTuoDanHao = ''"></u-icon>
  32. </view>
  33. <view class="cu-form-group">
  34. <view class="title">联系电话:</view>
  35. <input placeholder="请输入联系电话" v-model="form.lianXiDianHua" name="input"
  36. :disabled="id && id != '' ? true: false"></input>
  37. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  38. v-if="form.lianXiDianHua != '' && id == ''" @click="form.lianXiDianHua = ''"></u-icon>
  39. </view>
  40. <view class="cu-form-group">
  41. <view class="title">样品名称:</view>
  42. <textarea maxlength="-1" v-model="form.yangPinMingCheng" placeholder="请输入样品名称" auto-height="true"
  43. :disabled="id && id != '' ? true: false"></textarea>
  44. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  45. v-if="form.yangPinMingCheng != '' && id == ''" @click="form.yangPinMingCheng = ''"></u-icon>
  46. </view>
  47. <view class="cu-form-group">
  48. <view class="title">样品编号:</view>
  49. <textarea maxlength="-1" v-model="form.yangPinBianHao" placeholder="请输入样品编号" auto-height="true"
  50. :disabled="id && id != '' ? true: false"></textarea>
  51. <!-- <input placeholder="请输入样品编号" v-model="form.yangPinBianHao" name="input"
  52. :disabled="id && id != '' ? true: false"></input> -->
  53. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  54. v-if="form.yangPinBianHao != '' && id == ''" @click="form.yangPinBianHao = '' && id == ''"></u-icon>
  55. </view>
  56. <view class="cu-form-group">
  57. <view class="title">样品类型:</view>
  58. <textarea maxlength="-1" v-model="form.yangPinLeiXing" placeholder="请输入样品类型" auto-height="true"
  59. :disabled="id && id != '' ? true: false"></textarea>
  60. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  61. v-if="form.yangPinLeiXing != '' && id == ''" @click="form.yangPinLeiXing = ''"></u-icon>
  62. </view>
  63. <view class="cu-form-group">
  64. <view class="title">报告编号:</view>
  65. <textarea maxlength="-1" v-model="form.baoGaoBianHao" placeholder="请输入报告编号" auto-height="true"
  66. :disabled="id && id != '' ? true: false"></textarea>
  67. <u-icon class="uni-icon" name="close-circle-fill" color="rgb(192, 196, 204)" size="42"
  68. v-if="form.baoGaoBianHao != '' && id == ''" @click="form.baoGaoBianHao = ''"></u-icon>
  69. </view>
  70. <view class="cu-form-group">
  71. <view class="title">沟通类型:</view>
  72. <input placeholder="请选择沟通类型" v-model="form.gouTongLeiXing" name="input" disabled></input>
  73. <u-button type="success" size="mini" @click="sheetShow = true" v-if="id == ''">选择</u-button>
  74. </view>
  75. <uni-section title="沟通内容" type="line" padding>
  76. <textarea maxlength="-1" v-model="form.gouTongNeiRong" placeholder="意见和建议"
  77. :disabled="id && id != '' ? true: false"></textarea>
  78. </uni-section>
  79. <!-- <uni-section title="上传附件" type="line">
  80. <view class="example-body">
  81. <uni-file-picker limit="5" file-mediatype="all" @select="select" @progress="progress"
  82. @success="success" @fail="fail" @delete="deleteMe" :auto-upload="false" ref="uploadMe">
  83. </uni-file-picker>
  84. </view>
  85. </uni-section> -->
  86. <uni-section title="签名" type="line" padding>
  87. <view style="width: 100%;">
  88. <view style="text-align: right;width: 100%;" v-if="typeValue != '1'">
  89. <view>
  90. <u-button type="primary" size="mini" @click="qianming(0)" class="btn-back-color">
  91. 签名</u-button>
  92. <u-button type="primary" size="mini" @click="deqianming(0)" style="margin-left: 15rpx;"
  93. v-if="form.keHu != ''">
  94. 取消</u-button>
  95. </view>
  96. </view>
  97. <view style="width: 100%;" v-if="form.keHu != ''">
  98. <image :src="form.keHu" style="width: 100%;height: 500rpx;border: 1px #eee solid;">
  99. </image>
  100. </view>
  101. </view>
  102. </uni-section>
  103. <uni-section title="沟通内容确定" type="line" padding v-if="id != '' && form.leiXing != '2'">
  104. <textarea maxlength="-1" v-model="form.gouTongQueDingNei" placeholder="意见和建议"
  105. :disabled="true"></textarea>
  106. </uni-section>
  107. <view class="padding flex flex-direction" v-if="typeValue == '3'">
  108. <u-button type="success" class="btn btn-back-color" @click="onSubmit">提交
  109. </u-button>
  110. </view>
  111. <view class="padding flex flex-direction" v-if="typeValue == '2'">
  112. <u-button type="success" class="btn btn-back-color" @click="onAgree">同意
  113. </u-button>
  114. </view>
  115. </view>
  116. <u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback"></u-action-sheet>
  117. <u-popup mode="center" v-model="popupShow">
  118. <view style="padding: 30rpx;background: #FFFFFF;width: 100%;">
  119. <view class="cu-form-group ">
  120. <view class="title">签名</view>
  121. </view>
  122. <autograph @save="save" @clear="clear" @close="close"></autograph>
  123. </view>
  124. </u-popup>
  125. <lin-popup ref="picker" :title="'委托单选择'" :list="weiTuoList" @onConfirm="onConfirm"></lin-popup>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. ACCESS_TOKEN,
  131. USER_NAME,
  132. USER_INFO
  133. } from "@/common/util/constants" // 拉取登录token,userName,userInfo
  134. import http from '@/common/service/http.js'
  135. import autograph from '@/components/autograph/autograph'
  136. export default {
  137. components: {
  138. autograph
  139. },
  140. data() {
  141. return {
  142. typeValue: '3',
  143. id: '',
  144. sheetShow: false,
  145. taskId: '',
  146. form: {
  147. xuanZeKeHu: '',
  148. biaoDanBianHao: '',
  149. buMenName: '',
  150. keHuDanWeiMingChe: '',
  151. keHuLianXiRen: '',
  152. weiTuoDanHao: '',
  153. lianXiDianHua: '',
  154. yangPinMingCheng: '',
  155. yangPinBianHao: '',
  156. yangPinLeiXing: '',
  157. baoGaoBianHao: '',
  158. gouTongLeiXing: '',
  159. gouTongNeiRong: '',
  160. keHu: '',
  161. gouTongQueDingNei: '',
  162. leiXing: '1'
  163. },
  164. fuJianShangChuanArray: [],
  165. popupShow: false,
  166. list: [{
  167. text: '投诉'
  168. }, {
  169. text: '委托单'
  170. }, {
  171. text: '检测项目'
  172. }, {
  173. text: '样品信息修改'
  174. }, {
  175. text: '检测结果'
  176. }, {
  177. text: '检测报告退回'
  178. }, {
  179. text: '其它'
  180. }],
  181. kehuXinXinList: [],
  182. weiTuoList: []
  183. }
  184. },
  185. onLoad(options) {
  186. this.getKehu()
  187. if (options.id) {
  188. this.id = options.id
  189. this.getDe(options.id)
  190. } else {
  191. this.getGtbh()
  192. }
  193. if (options.id) {
  194. this.typeValue = options.typeValue
  195. }
  196. },
  197. methods: {
  198. actionSheetCallback(e) {
  199. this.form.gouTongLeiXing = this.list[e].text
  200. },
  201. // 获取上传状态
  202. select(file) {
  203. //读取文件大小
  204. var fileSize = file.size;
  205. let token = uni.getStorageSync(ACCESS_TOKEN)
  206. if (fileSize > 1048576) {
  207. that.$message({
  208. type: 'error',
  209. showClose: true,
  210. duration: 3000,
  211. message: '文件大于1M!'
  212. });
  213. return false;
  214. }
  215. let that = this
  216. for (let e in file.tempFilePaths) {
  217. console.log("000", file.tempFiles[e].file)
  218. var extName = file.tempFiles[e].file.name.substring(file.tempFiles[e].file.name.lastIndexOf('.'));
  219. const path = file.tempFilePaths[e];
  220. uni.uploadFile({
  221. // url: http.apiHosp + 'ibps/platform/v3/file/upload/mobile', //仅为示例,非真实的接口地址
  222. url: http.apiHosp + '/ibps/platform/v3/file/upload', //仅为示例,非真实的接口地址
  223. filePath: path,
  224. name: 'file',
  225. formData: {
  226. 'ext': '.jpg'
  227. },
  228. header: {
  229. 'X-Authorization-access_token': token,
  230. 'X-Authorization-systemid': ''
  231. },
  232. success: (uploadFileRes) => {
  233. let data = JSON.parse(uploadFileRes.data)
  234. that.fuJianShangChuanArray.push({
  235. fileid: file.tempFiles[e].file.uuid,
  236. uploadid: data.data.id
  237. })
  238. }
  239. });
  240. }
  241. return true;
  242. console.log('选择文件:')
  243. },
  244. // 删除
  245. deleteMe(file) {
  246. for (let e in this.fuJianShangChuanArray) {
  247. if (this.fuJianShangChuanArray[e].fileid == file.tempFile.uuid) {
  248. this.fuJianShangChuanArray.splice(e, 1)
  249. }
  250. }
  251. },
  252. // 获取上传进度
  253. progress(e) {
  254. console.log('上传进度:', e)
  255. },
  256. // 上传成功
  257. success(file) {
  258. console.log('上传成功', file)
  259. },
  260. // 上传失败
  261. fail(e) {
  262. console.log('上传失败:', e)
  263. },
  264. //弹出框显示
  265. qianming(index) {
  266. this.qianshow = true
  267. this.qianIndex = index
  268. this.popupShow = true
  269. },
  270. //清除签名
  271. deqianming(index) {
  272. if (index == 0) {
  273. this.form.keHu = ''
  274. }
  275. },
  276. //保存签名
  277. save(val) {
  278. if (this.qianIndex == 0) {
  279. this.form.keHu = val
  280. }
  281. this.qianshow = false
  282. this.popupShow = false
  283. },
  284. //清除签名
  285. clear(val) {
  286. if (this.qianIndex == 0) {
  287. this.form.keHu = ''
  288. }
  289. },
  290. /**
  291. * 关闭签名弹窗
  292. */
  293. close() {
  294. this.popupShow = false
  295. },
  296. //获取样品编号
  297. getGtbh(callback) {
  298. let smsParams = {
  299. alias: "gtbh"
  300. };
  301. let this_ = this
  302. this.$http.post("/ibps/business/v3/jc/sys/getNextIdByAlias", smsParams).then(res => {
  303. if (res.data.state == 200) {
  304. const data = res.data.data
  305. this.form.biaoDanBianHao = data
  306. }
  307. });
  308. },
  309. getKehu() {
  310. let info = uni.getStorageSync(USER_INFO);
  311. if (info) {
  312. this.form.xuanZeKeHu = info.user.qq
  313. this.form.lianXiDianHua = info.user.mobile
  314. this.form.keHuDanWeiMingChe = info.user.id
  315. this.form.keHuLianXiRen = info.user.fullname
  316. this.form.keHuDanWeiMingChe = info.user.id
  317. }
  318. this.getWeiTuoList()
  319. },
  320. getDe(id) {
  321. uni.showLoading({
  322. mask: true,
  323. title: 'loading'
  324. });
  325. let sql =
  326. `select * from t_khgtjlb where id_ = ${id}`
  327. let requestData = this.$sig(sql)
  328. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  329. if (res.data.state == 200) {
  330. const data = res.data.variables.data[0]
  331. this.form = {
  332. id: data.id_,
  333. xuanZeKeHu: data.xuan_ze_ke_hu_,
  334. biaoDanBianHao: data.biao_dan_bian_hao,
  335. buMenName: data.xuan_ze_ke_hu_,
  336. keHuDanWeiMingChe: data.ke_hu_dan_wei_min,
  337. keHuLianXiRen: data.ke_hu_lian_xi_ren,
  338. weiTuoDanHao: data.wei_tuo_dan_hao_,
  339. lianXiDianHua: data.lian_xi_dian_hua_,
  340. yangPinMingCheng: data.yang_pin_ming_che,
  341. yangPinBianHao: data.yang_pin_bian_hao,
  342. yangPinLeiXing: data.yang_pin_lei_xing,
  343. baoGaoBianHao: data.bao_gao_bian_hao_,
  344. gouTongLeiXing: data.gou_tong_lei_xing,
  345. gouTongNeiRong: data.gou_tong_nei_rong,
  346. keHu: data.ke_hu_,
  347. gouTongQueDingNei: data.gou_tong_que_ding,
  348. leiXing: data.lei_xing_
  349. }
  350. if (data.lei_xing_ == '2' && data.shi_fou_guo_shen_ == '已编制') {
  351. this.getTaskId(data.id_)
  352. }
  353. uni.hideLoading()
  354. }
  355. })
  356. },
  357. onSubmit() {
  358. uni.showLoading({
  359. title: '加载中',
  360. mask: true
  361. })
  362. let info = uni.getStorageSync(USER_INFO);
  363. let useId = info.user.id
  364. let detpId = info.org.id
  365. var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
  366. var time = nowDate.toJSON().split('T').join(' ').substr(0, 10);
  367. let para = {
  368. "parameters": [{
  369. "key": "defId",
  370. "value": "1056942070293331968"
  371. },
  372. {
  373. "key": "version",
  374. "value": "0"
  375. },
  376. {
  377. "key": "data",
  378. "value": ""
  379. }
  380. ]
  381. }
  382. this.form.bianZhiRen = useId
  383. this.form.bianZhiShiJian = time
  384. this.form.bianZhiBuMen = detpId
  385. this.form.shiFouGuoShen = "已编制"
  386. para.parameters[2].value = JSON.stringify(this.form);
  387. let that = this;
  388. this.$http.post("ibps/business/v3/bpm/instance/start", para).then(res => {
  389. if (res.data.state == 200) {
  390. this.$methCommon.getPrompt('提交成功!')
  391. uni.hideLoading();
  392. this.getPageA()
  393. }
  394. }).catch((err) => {
  395. });
  396. },
  397. onAgree() {
  398. uni.showLoading({
  399. title: '加载中',
  400. mask: true
  401. })
  402. let info = uni.getStorageSync(USER_INFO);
  403. let useId = info.user.id
  404. let detpId = info.org.id
  405. this.form.gouTongRenYuan = useId
  406. this.form.gouTongRiQi = this.$methCommon.time(10)
  407. this.form.gouTongBuMen = detpId
  408. this.form.shiFouGuoShen = "1"
  409. let editData = {
  410. data: JSON.stringify(this.form),
  411. opinion: '同意',
  412. taskId: this.taskId
  413. }
  414. this.$http.post("/ibps/business/v3/bpm/task/agree", editData).then(res => {
  415. if (res.data.state == 200) {
  416. this.$methCommon.getPrompt('同意成功!')
  417. uni.hideLoading();
  418. this.getPageA()
  419. } else {
  420. this.$methCommon.getPrompt('同意异常!', 'fail')
  421. uni.hideLoading()
  422. }
  423. });
  424. },
  425. //根据委托单id查询 taskId
  426. getTaskId(id) {
  427. let sql =
  428. `select TASK_ID_ from ibps_bpm_tasks where NAME_ = '确认' and NODE_ID_ = 'Activity_1vrp3i4' and PROC_DEF_KEY_ = 'Process_183pepd' and EXEC_ID_ = (select PROC_INST_ID_ from act_ru_execution where ACT_ID_ = 'Activity_1vrp3i4' and BUSINESS_KEY_ = '${id}') ORDER BY CREATE_TIME_ desc`
  429. let requestData = this.$sig(sql)
  430. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  431. if (res.data.state == 200) {
  432. let result = res.data.variables.data[0]
  433. this.taskId = result.TASK_ID_
  434. }
  435. })
  436. },
  437. //委托信息
  438. getWeiTuoList() {
  439. let info = uni.getStorageSync(USER_INFO);
  440. let useId = info.user.id
  441. let sql =
  442. `select id_,wei_tuo_bian_hao_ from t_lhwtsqb where create_by_ = '${useId}' order by create_time_ desc`
  443. let requestData = this.$sig(sql)
  444. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  445. if (res.data.state == 200) {
  446. const datas = res.data.variables.data
  447. if (datas.length > 0) {
  448. datas.forEach((item, index) => {
  449. this.$set(item, 'name', item.wei_tuo_bian_hao_)
  450. })
  451. this.weiTuoList = datas
  452. }
  453. }
  454. })
  455. },
  456. // 拉取样品列表数据
  457. getData(id) {
  458. let info = uni.getStorageSync(USER_INFO);
  459. let useId = info.user.id
  460. let sql =
  461. `select id_,yang_pin_bian_hao,yang_pin_ming_che,yang_pin_lei_xing,yang_pin_lei_er_,yang_pin_lei_san_,yang_pin_lei_si_ from t_lhypb where parent_id_ = '${id}' order by create_time_ desc`
  462. let requestData = this.$sig(sql)
  463. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  464. if (res.data.state == 200) {
  465. const datas = res.data.variables.data
  466. if (datas.length > 0) {
  467. let list = []
  468. let list1 = []
  469. let list3 = []
  470. datas.forEach(item => {
  471. if (item.yang_pin_lei_xing) {
  472. list.push(item.yang_pin_lei_xing)
  473. }
  474. if (item.yang_pin_lei_er_) {
  475. list.push(item.yang_pin_lei_er_)
  476. }
  477. if (item.yang_pin_lei_san_) {
  478. list.push(item.yang_pin_lei_san_)
  479. }
  480. if (item.yang_pin_lei_si_) {
  481. list.push(item.yang_pin_lei_si_)
  482. }
  483. list1.push(item.yang_pin_bian_hao)
  484. list3.push(item.yang_pin_ming_che)
  485. })
  486. var list2 = [...new Set(list)]
  487. this.form.yangPinLeiXing = list2.join(",")
  488. this.form.yangPinBianHao = list1.join(",")
  489. this.form.yangPinMingCheng = list3.join(",")
  490. }
  491. }
  492. })
  493. },
  494. getBaoGaoList(id) {
  495. let info = uni.getStorageSync(USER_INFO);
  496. let useId = info.user.id
  497. let sql =
  498. `select id_,bao_gao_bian_hao_ from t_lhjcbgb where wei_tuo_id_ = '${id}'`
  499. let requestData = this.$sig(sql)
  500. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  501. if (res.data.state == 200) {
  502. const datas = res.data.variables.data
  503. if (datas.length > 0) {
  504. let list = []
  505. datas.forEach((item, index) => {
  506. list.push(item.bao_gao_bian_hao_)
  507. })
  508. this.form.baoGaoBianHao = list.join(",")
  509. }
  510. }
  511. })
  512. },
  513. getShow() {
  514. if (this.id != '') {
  515. return
  516. }
  517. this.$refs['picker'].show();
  518. },
  519. onConfirm(index, item) {
  520. this.form.weiTuoDanHao = item.id_
  521. this.getData(item.id_)
  522. this.getBaoGaoList(item.id_)
  523. },
  524. getWeiTuo(id) {
  525. if (id) {
  526. let itemData = this.weiTuoList.find(item => item.id_ == id)
  527. if (itemData) {
  528. return itemData.wei_tuo_bian_hao_
  529. } else {
  530. return ''
  531. }
  532. } else {
  533. return ''
  534. }
  535. },
  536. getPageA() {
  537. let pages = getCurrentPages()
  538. let prevPage = pages[pages.length - 2]
  539. prevPage.$vm.getValue()
  540. uni.navigateBack({
  541. dalta: 1
  542. })
  543. }
  544. }
  545. }
  546. </script>
  547. <style lang="scss" scoped>
  548. .cu-form-group .title {
  549. min-width: 180rpx;
  550. }
  551. .btn {
  552. margin: 15rpx
  553. }
  554. </style>