communication.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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="id == ''">
  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. <view class="padding flex flex-direction" v-if="id == ''">
  104. <u-button type="success" class="btn btn-back-color" @click="onSubmit">提交
  105. </u-button>
  106. </view>
  107. </view>
  108. <u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback"></u-action-sheet>
  109. <u-popup mode="center" v-model="popupShow">
  110. <view style="padding: 30rpx;background: #FFFFFF;width: 100%;">
  111. <view class="cu-form-group ">
  112. <view class="title">签名</view>
  113. </view>
  114. <autograph @save="save" @clear="clear" @close="close"></autograph>
  115. </view>
  116. </u-popup>
  117. <lin-popup ref="picker" :title="'委托单选择'" :list="weiTuoList" @onConfirm="onConfirm"></lin-popup>
  118. </view>
  119. </template>
  120. <script>
  121. import {
  122. ACCESS_TOKEN,
  123. USER_NAME,
  124. USER_INFO
  125. } from "@/common/util/constants" // 拉取登录token,userName,userInfo
  126. import http from '@/common/service/http.js'
  127. import autograph from '@/components/autograph/autograph'
  128. export default {
  129. components: {
  130. autograph
  131. },
  132. data() {
  133. return {
  134. id: '',
  135. sheetShow: false,
  136. form: {
  137. xuanZeKeHu: '',
  138. biaoDanBianHao: '',
  139. buMenName: '',
  140. keHuDanWeiMingChe: '',
  141. keHuLianXiRen: '',
  142. weiTuoDanHao: '',
  143. lianXiDianHua: '',
  144. yangPinMingCheng: '',
  145. yangPinBianHao: '',
  146. yangPinLeiXing: '',
  147. baoGaoBianHao: '',
  148. gouTongLeiXing: '',
  149. gouTongNeiRong: '',
  150. keHu: ''
  151. },
  152. fuJianShangChuanArray: [],
  153. popupShow: false,
  154. list: [{
  155. text: '投诉'
  156. }, {
  157. text: '委托单'
  158. }, {
  159. text: '检测项目'
  160. }, {
  161. text: '样品信息修改'
  162. }, {
  163. text: '检测结果'
  164. }, {
  165. text: '检测报告退回'
  166. }, {
  167. text: '其它'
  168. }],
  169. kehuXinXinList: [],
  170. weiTuoList: []
  171. }
  172. },
  173. onLoad(options) {
  174. this.getKehu()
  175. if (options.id) {
  176. this.id = options.id
  177. this.getDe(options.id)
  178. } else {
  179. this.getGtbh()
  180. }
  181. },
  182. methods: {
  183. actionSheetCallback(e) {
  184. this.form.gouTongLeiXing = this.list[e].text
  185. },
  186. // 获取上传状态
  187. select(file) {
  188. //读取文件大小
  189. var fileSize = file.size;
  190. let token = uni.getStorageSync(ACCESS_TOKEN)
  191. if (fileSize > 1048576) {
  192. that.$message({
  193. type: 'error',
  194. showClose: true,
  195. duration: 3000,
  196. message: '文件大于1M!'
  197. });
  198. return false;
  199. }
  200. let that = this
  201. for (let e in file.tempFilePaths) {
  202. console.log("000", file.tempFiles[e].file)
  203. var extName = file.tempFiles[e].file.name.substring(file.tempFiles[e].file.name.lastIndexOf('.'));
  204. const path = file.tempFilePaths[e];
  205. uni.uploadFile({
  206. // url: http.apiHosp + 'ibps/platform/v3/file/upload/mobile', //仅为示例,非真实的接口地址
  207. url: http.apiHosp + '/ibps/platform/v3/file/upload', //仅为示例,非真实的接口地址
  208. filePath: path,
  209. name: 'file',
  210. formData: {
  211. 'ext': '.jpg'
  212. },
  213. header: {
  214. 'X-Authorization-access_token': token,
  215. 'X-Authorization-systemid': ''
  216. },
  217. success: (uploadFileRes) => {
  218. let data = JSON.parse(uploadFileRes.data)
  219. that.fuJianShangChuanArray.push({
  220. fileid: file.tempFiles[e].file.uuid,
  221. uploadid: data.data.id
  222. })
  223. }
  224. });
  225. }
  226. return true;
  227. console.log('选择文件:')
  228. },
  229. // 删除
  230. deleteMe(file) {
  231. for (let e in this.fuJianShangChuanArray) {
  232. if (this.fuJianShangChuanArray[e].fileid == file.tempFile.uuid) {
  233. this.fuJianShangChuanArray.splice(e, 1)
  234. }
  235. }
  236. },
  237. // 获取上传进度
  238. progress(e) {
  239. console.log('上传进度:', e)
  240. },
  241. // 上传成功
  242. success(file) {
  243. console.log('上传成功', file)
  244. },
  245. // 上传失败
  246. fail(e) {
  247. console.log('上传失败:', e)
  248. },
  249. //弹出框显示
  250. qianming(index) {
  251. this.qianshow = true
  252. this.qianIndex = index
  253. this.popupShow = true
  254. },
  255. //清除签名
  256. deqianming(index) {
  257. if (index == 0) {
  258. this.form.keHu = ''
  259. }
  260. },
  261. //保存签名
  262. save(val) {
  263. if (this.qianIndex == 0) {
  264. this.form.keHu = val
  265. }
  266. this.qianshow = false
  267. this.popupShow = false
  268. },
  269. //清除签名
  270. clear(val) {
  271. if (this.qianIndex == 0) {
  272. this.form.keHu = ''
  273. }
  274. },
  275. /**
  276. * 关闭签名弹窗
  277. */
  278. close() {
  279. this.popupShow = false
  280. },
  281. //获取样品编号
  282. getGtbh(callback) {
  283. let smsParams = {
  284. alias: "gtbh"
  285. };
  286. let this_ = this
  287. this.$http.post("/ibps/business/v3/jc/sys/getNextIdByAlias", smsParams).then(res => {
  288. if (res.data.state == 200) {
  289. const data = res.data.data
  290. this.form.biaoDanBianHao = data
  291. }
  292. });
  293. },
  294. getKehu() {
  295. let info = uni.getStorageSync(USER_INFO);
  296. if (info) {
  297. this.form.xuanZeKeHu = info.user.qq
  298. this.form.lianXiDianHua = info.user.mobile
  299. this.form.keHuDanWeiMingChe = info.user.id
  300. this.form.keHuLianXiRen = info.user.fullname
  301. this.form.keHuDanWeiMingChe = info.user.id
  302. }
  303. this.getWeiTuoList()
  304. },
  305. getDe(id) {
  306. uni.showLoading({
  307. mask: true,
  308. title: 'loading'
  309. });
  310. let sql =
  311. `select * from t_khgtjlb where id_ = ${id}`
  312. let requestData = this.$sig(sql)
  313. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  314. if (res.data.state == 200) {
  315. const data = res.data.variables.data[0]
  316. this.form = {
  317. xuanZeKeHu: data.xuan_ze_ke_hu_,
  318. biaoDanBianHao: data.biao_dan_bian_hao,
  319. buMenName: data.xuan_ze_ke_hu_,
  320. keHuDanWeiMingChe: data.ke_hu_lian_xi_ren,
  321. keHuLianXiRen: data.ke_hu_lian_xi_ren,
  322. weiTuoDanHao: data.wei_tuo_dan_hao_,
  323. lianXiDianHua: data.lian_xi_dian_hua_,
  324. yangPinMingCheng: data.yang_pin_ming_che,
  325. yangPinBianHao: data.yang_pin_bian_hao,
  326. yangPinLeiXing: data.yang_pin_lei_xing,
  327. baoGaoBianHao: data.bao_gao_bian_hao_,
  328. gouTongLeiXing: data.gou_tong_lei_xing,
  329. gouTongNeiRong: data.gou_tong_nei_rong,
  330. keHu: data.ke_hu_
  331. }
  332. uni.hideLoading()
  333. }
  334. })
  335. },
  336. onSubmit() {
  337. let info = uni.getStorageSync(USER_INFO);
  338. let useId = info.user.id
  339. let detpId = info.org.id
  340. var nowDate = new Date((new Date).getTime() + 8 * 60 * 60 * 1000)
  341. var time = nowDate.toJSON().split('T').join(' ').substr(0, 10);
  342. let para = {
  343. "parameters": [{
  344. "key": "defId",
  345. "value": "1056942070293331968"
  346. },
  347. {
  348. "key": "version",
  349. "value": "0"
  350. },
  351. {
  352. "key": "data",
  353. "value": ""
  354. }
  355. ]
  356. }
  357. this.form.bianZhiRen = useId
  358. this.form.bianZhiShiJian = time
  359. this.form.bianZhiBuMen = detpId
  360. this.form.shiFouGuoShen = "已编制"
  361. para.parameters[2].value = JSON.stringify(this.form);
  362. let that = this;
  363. this.$http.post("ibps/business/v3/bpm/instance/start", para).then(res => {
  364. if (res.data.state == 200) {
  365. this.$tip.success("提交成功!")
  366. this.$Router.replace({
  367. name: 'index'
  368. })
  369. }
  370. }).catch((err) => {
  371. let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误,请稍后再试"
  372. this.$tip.error(msg);
  373. });
  374. },
  375. //委托信息
  376. getWeiTuoList() {
  377. let info = uni.getStorageSync(USER_INFO);
  378. let useId = info.user.id
  379. let sql =
  380. `select id_,wei_tuo_bian_hao_ from t_lhwtsqb where create_by_ = '${useId}' order by create_time_ desc`
  381. let requestData = this.$sig(sql)
  382. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  383. if (res.data.state == 200) {
  384. const datas = res.data.variables.data
  385. if (datas.length > 0) {
  386. datas.forEach((item, index) => {
  387. this.$set(item, 'name', item.wei_tuo_bian_hao_)
  388. })
  389. this.weiTuoList = datas
  390. }
  391. }
  392. })
  393. },
  394. // 拉取样品列表数据
  395. getData(id) {
  396. let info = uni.getStorageSync(USER_INFO);
  397. let useId = info.user.id
  398. let sql =
  399. `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`
  400. let requestData = this.$sig(sql)
  401. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  402. if (res.data.state == 200) {
  403. const datas = res.data.variables.data
  404. if (datas.length > 0) {
  405. let list = []
  406. let list1 = []
  407. let list3 = []
  408. datas.forEach(item => {
  409. if (item.yang_pin_lei_xing) {
  410. list.push(item.yang_pin_lei_xing)
  411. }
  412. if (item.yang_pin_lei_er_) {
  413. list.push(item.yang_pin_lei_er_)
  414. }
  415. if (item.yang_pin_lei_san_) {
  416. list.push(item.yang_pin_lei_san_)
  417. }
  418. if (item.yang_pin_lei_si_) {
  419. list.push(item.yang_pin_lei_si_)
  420. }
  421. list1.push(item.yang_pin_bian_hao)
  422. list3.push(item.yang_pin_ming_che)
  423. })
  424. var list2 = [...new Set(list)]
  425. this.form.yangPinLeiXing = list2.join(",")
  426. this.form.yangPinBianHao = list1.join(",")
  427. this.form.yangPinMingCheng = list3.join(",")
  428. }
  429. }
  430. })
  431. },
  432. getBaoGaoList(id) {
  433. let info = uni.getStorageSync(USER_INFO);
  434. let useId = info.user.id
  435. let sql =
  436. `select id_,bao_gao_bian_hao_ from t_lhjcbgb where wei_tuo_id_ = '${id}'`
  437. let requestData = this.$sig(sql)
  438. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  439. if (res.data.state == 200) {
  440. const datas = res.data.variables.data
  441. if (datas.length > 0) {
  442. let list = []
  443. datas.forEach((item, index) => {
  444. list.push(item.bao_gao_bian_hao_)
  445. })
  446. this.form.baoGaoBianHao = list.join(",")
  447. }
  448. }
  449. })
  450. },
  451. getShow() {
  452. if (this.id != '') {
  453. return
  454. }
  455. this.$refs['picker'].show();
  456. },
  457. onConfirm(index, item) {
  458. this.form.weiTuoDanHao = item.id_
  459. this.getData(item.id_)
  460. this.getBaoGaoList(item.id_)
  461. },
  462. getWeiTuo(id) {
  463. if (id) {
  464. let itemData = this.weiTuoList.find(item => item.id_ == id)
  465. return itemData.wei_tuo_bian_hao_
  466. } else {
  467. return ''
  468. }
  469. }
  470. }
  471. }
  472. </script>
  473. <style lang="scss" scoped>
  474. .cu-form-group .title {
  475. min-width: 180rpx;
  476. }
  477. .btn {
  478. margin: 15rpx
  479. }
  480. </style>