人民医院前端

addComDispatch.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <page-meta :root-font-size="getFontSizeValue"></page-meta>
  3. <view class="wrapper">
  4. <view class="form">
  5. <!-- 基础表单校验 -->
  6. <uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData">
  7. <uni-forms-item label="工单类别" required name="WorkOrderCategory">
  8. <order-select :orderType="valiFormData.WorkOrderCategory" @post-select-data="postSelectData"
  9. :typeid="2000" :readonly="readonly"></order-select>
  10. </uni-forms-item>
  11. <uni-forms-item label="申请部门" required name="ApplicationDept">
  12. <uni-data-picker placeholder="请选择申请部门" :localdata="deptDataTree"
  13. v-model="valiFormData.ApplicationDept" @nodeclick="deptNodeclick" :showSearch= "showSearch">
  14. </uni-data-picker>
  15. </uni-forms-item>
  16. <uni-forms-item label="申请人" required name="ApplicantName">
  17. <uni-combox :candidates="candidates" placeholder="输入搜索内容" @input="handleInput" v-model="valiFormData.ApplicantName"></uni-combox>
  18. </uni-forms-item>
  19. <uni-forms-item label="联系电话" required name="Phone">
  20. <uni-easyinput v-model="valiFormData.Phone" placeholder="请输入联系电话" />
  21. </uni-forms-item>
  22. <uni-forms-item label="科室位置" required name="Location">
  23. <uni-easyinput v-model="valiFormData.Location" placeholder="请输入科室位置" />
  24. </uni-forms-item>
  25. <view style="margin: 15px 0;" v-show="valiFormData.WorkOrderCategory && flag[flaginfo]">
  26. <view style="margin-bottom: 15px;">
  27. <text class="infoTittle">{{flagName[flaginfo]}}</text>
  28. <uni-icons type="plus" size="30" color="#007aff" @click="plusClck()"></uni-icons>
  29. <uni-icons type="minus" size="30" color="#007aff" @click="minusClck()"></uni-icons>
  30. </view>
  31. <view style="width: 100%;height: 80px;" v-for="(item, index) in dicList">
  32. <view class="dicSelect" v-if="identification==='JC' || identification==='FJ'">
  33. <uni-data-picker class="uni_item" placeholder="请选择标本信息" :localdata="dataOrderType" @nodeclick="(e)=>nodeclickMuter(e,index)">
  34. </uni-data-picker>
  35. </view>
  36. <view v-if="identification!=='JC' && identification!=='FJ'" class="dicSelect">
  37. <dictionaries-select :flag="flag[flaginfo]" :valInfo="index" :val="item.F_DicId + ','+ item.F_DicName"
  38. @post-select-dic="postSelectDic"></dictionaries-select>
  39. </view>
  40. <view class="dicNum">
  41. <uni-number-box v-model="item.F_Number" />
  42. </view>
  43. <view style="display: block;width: 100%;text-align: center;" v-if="identification === '2001' || identification === '2003'">
  44. <uni-data-checkbox v-model="item.F_IsBorrow" :localdata="F_IsBorrowTypesList" />
  45. </view>
  46. </view>
  47. </view>
  48. <!-- <uni-forms-item label="送达地点" required name="ToPlace">
  49. <dictionaries-select flag="SDKS" @post-select-dic="postSelectDicPlace" v-if="identification === '2006' || identification === 'JC' || identification === 'FJ'"></dictionaries-select>
  50. <uni-easyinput v-model="valiFormData.ToPlace" placeholder="请输入送达地点" v-else/>
  51. </uni-forms-item> -->
  52. <uni-forms-item label="备注" name="Content">
  53. <uni-easyinput type="textarea" v-model="valiFormData.Content" placeholder="请输入备注" />
  54. </uni-forms-item>
  55. <uni-forms-item label="红处方数量" required name="redPrescriptionNum" v-show="flaginfo == '2004' ">
  56. <uni-number-box v-model="redPrescriptionNum" />
  57. </uni-forms-item>
  58. <!-- <uni-forms-item label="紧急程度" name="EmergencyTypes">
  59. <uni-data-checkbox v-model="valiFormData.EmergencyTypes" :localdata="EmergencyTypesList" />
  60. </uni-forms-item> -->
  61. <uni-forms-item label="附件" name="">
  62. <view class="example-body">
  63. <!-- <upload @post-string-data="getImgData" :imgUrlList="imgUrlList"></upload> -->
  64. <l-file ref="lFile" :logo="logo" @up-success="onSuccess"></l-file>
  65. <view class="padding" style="margin-top: 10px;">
  66. <button class="mini-btn" type="primary" size="mini" @tap="onUpload">上传</button>
  67. </view>
  68. <view class="padding">
  69. <uni-file-picker limit="5" file-mediatype="all" :value="fileLists" @delete="deleteFile"></uni-file-picker>
  70. </view>
  71. </view>
  72. </uni-forms-item>
  73. </uni-forms>
  74. <view class="btnClass">
  75. <button type="primary" :disabled="disabledButton" @click="submit('valiForm')">提交工单</button>
  76. </view>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import orderSelect from "@/pages/components/orderSelect/orderSelect"
  82. import indexConfig from '@/config/index.config';
  83. import {
  84. filterTreeDatas,
  85. filterSelectData
  86. } from '@/utils/dataTreating.js'
  87. import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
  88. import upload from '@/pages/components/upload/upload.vue' //upload
  89. import uploadFile from '@/pages/components/upload/uploadFile.vue' //upload
  90. import newfile from '@/pages/components/upload-imagesAndvideo/index.vue' //upload
  91. import dictionariesSelect from '@/pages/components/dictionariesSelect/dictionariesSelect.vue' //upload
  92. export default {
  93. components: {
  94. upload,
  95. uploadFile,
  96. newfile,
  97. orderSelect,
  98. dictionariesSelect
  99. },
  100. data() {
  101. return {
  102. dataOrderType:[],
  103. identification: '', // 工单标识
  104. getFontSizeValue:'1rem',
  105. showSearch: true,
  106. logo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F00%2F07%2F155788a6d8a5c42.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1619847627&t=2da40b583002205c204d980b54b35040',
  107. isShowIsEnd: false,
  108. readonly: false,
  109. disabledButton: false,
  110. // 校验表单数据
  111. valiFormData: {
  112. WorkOrderCategory: '', //工单类别
  113. ApplicationDept: '', //申请部门
  114. Applicant: '', //申请人
  115. ApplicantName: '',
  116. Phone: '', //联系电话
  117. Location: '', // 科室位置
  118. ToPlace: '', // 送达地点
  119. Content: '', // 工单内容
  120. DealDept: '', // 维修部门
  121. DealMan: '', // 维修人
  122. File: '', // 文件
  123. opt: 2,
  124. EmergencyTypes: '',
  125. },
  126. F_IsBorrowTypesList:[{
  127. text: '借',
  128. value: '1'
  129. },{
  130. text: '还',
  131. value: '2'
  132. }],
  133. EmergencyTypesList: [{
  134. text: '一般',
  135. value: '一般'
  136. },{
  137. text: '紧急',
  138. value: '紧急'
  139. }],
  140. redPrescriptionNum: 0, // 红处方数量
  141. workorderid: '',
  142. stepData: pageData.stepData,
  143. departMain: '',
  144. imgUrlList: [], // 附件数据
  145. imgIdList: [], //上传附件id
  146. clickImgState: 0, // 图片回显的状态
  147. departList: [],
  148. deptDataTree: [], // 科室-部门数据
  149. ApplicantData: [], // 获取人员数据
  150. assignedDepartData: [], //指派部门数据
  151. MaintenancerData: [], //指派人数据
  152. orderApplicantData: [], // 用户人员信息
  153. userListSelect: [],
  154. typeid: 0,
  155. candidates: [],
  156. // 标本信息(BBXX),设备信息(SBXX),物资信息(WZXX),病床信息(BCXX),药品信息(YPXX)
  157. flagid: ["2001","2002","2003","2006","2005","9129","9130"],
  158. flaginfo: '',
  159. fileLists: [],
  160. flag: {
  161. "2006": 'BBXX',
  162. "2001": 'SBXX',
  163. "2002": 'WZXX',
  164. "2003": 'BCXX',
  165. "2005": 'YPXX',
  166. "9129": 'BBXX',
  167. "9130": 'BBXX'
  168. },
  169. flagName: {
  170. "2001": '设备信息',
  171. "2002": '物资信息',
  172. "2003": '病床信息',
  173. "2006": '标本信息',
  174. "2005": '药品信息',
  175. "9129": '标本信息',
  176. "9130": '标本信息'
  177. },
  178. dicList: [{
  179. F_DicId: 0,
  180. F_DicName: '',
  181. F_Number: 1,
  182. F_IsBorrow: ''
  183. }],
  184. // 校验规则
  185. rules: {
  186. WorkOrderCategory: {
  187. rules: [{
  188. required: true,
  189. errorMessage: '请选择工单类别'
  190. }]
  191. },
  192. ApplicationDept: {
  193. rules: [{
  194. required: true,
  195. errorMessage: '请选择申请科室'
  196. }]
  197. },
  198. ApplicantName: {
  199. rules: [{
  200. required: true,
  201. errorMessage: '请选择申请人'
  202. }]
  203. },
  204. Phone: {
  205. rules: [{
  206. required: true,
  207. errorMessage: '清输入联系电话'
  208. }]
  209. },
  210. // Content: {
  211. // rules: [{
  212. // required: true,
  213. // errorMessage: '清输入工单内容'
  214. // }]
  215. // }
  216. },
  217. }
  218. },
  219. onLoad(option) {
  220. this.getFontSizeValue = uni.getStorageSync('fontSizeValue')+'rem'
  221. this.workorderid = option.wid
  222. // 添加工单,申请人默认当前登录人
  223. if(uni.getStorageSync("deptId")){
  224. this.valiFormData.ApplicationDept = uni.getStorageSync("deptId")
  225. pageData.getApplicant(uni.getStorageSync("deptId"), (res, data, candidates) => {
  226. this.candidates = candidates
  227. this.ApplicantData = res
  228. this.orderApplicantData = data
  229. if(uni.getStorageSync("userCode")) {
  230. this.valiFormData.Applicant = uni.getStorageSync("userCode")
  231. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, uni.getStorageSync("userCode"))
  232. const user = this.orderApplicantData.find((o) => {
  233. return o.usercode === this.valiFormData.Applicant.toString()
  234. })
  235. if (user) {
  236. this.valiFormData.Phone = user.usertelphone
  237. }
  238. this.getLocation(this.valiFormData.Applicant)
  239. }
  240. })
  241. }
  242. // 部门数据
  243. pageData.getDet((res, data) => {
  244. console.log(res)
  245. this.departList = data
  246. this.deptDataTree = res
  247. this.assignedDepartData = res
  248. })
  249. if(this.workorderid) {
  250. this.readonly = true
  251. this.getDetail()
  252. }
  253. window.scrollTo(0,0)
  254. },
  255. watch: {
  256. 'departList': function() {
  257. this.valiFormData.ApplicationDept = this.$mHelper.findParents(this.departList,this.valiFormData.ApplicationDept).split('/').length + '_'+ this.valiFormData.ApplicationDept
  258. }
  259. },
  260. methods: {
  261. getBBxx(){
  262. let str
  263. if(this.identification == 'JC'){
  264. str = '急查标本'
  265. }
  266. if(this.identification == 'FJ'){
  267. str = '非急查标本'
  268. }
  269. pageData.getBB(str,(res, data) => {
  270. this.dataOrderType = res
  271. })
  272. },
  273. nodeclickMuter(e,index){
  274. this.dicList[index].F_DicId = e.value
  275. this.dicList[index].F_DicName = e.text
  276. },
  277. // 获取科室位置
  278. postSelectDicPlace(res) {
  279. this.valiFormData.ToPlace = res.split(',')[1]
  280. },
  281. // 删除附件
  282. deleteFile(res) {
  283. const num = this.fileLists.findIndex(v => v.url === res.tempFile.path);
  284. this.fileLists.splice(num, 1)
  285. },
  286. /* 附件上传 */
  287. onUpload() {
  288. this.$refs.lFile.upload({
  289. //替换为你的上传接口地址
  290. url: indexConfig.baseUrl + "/FaultRepair/UploadFile",
  291. // 服务端接收附件的key
  292. name: 'file',
  293. //根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
  294. header: {
  295. Authorization: uni.getStorageSync('Admin-Token')
  296. },
  297. })
  298. },
  299. // 附件上传
  300. onSuccess(res) {
  301. res.data.data.forEach(v => {
  302. this.fileLists.push({
  303. url: indexConfig.baseUrl + v.F_FileUrl,
  304. extname: v.F_FileType,
  305. name: v.F_FileName.substring(19),
  306. id: v.F_FileId
  307. })
  308. })
  309. },
  310. postImgData(res) {
  311. },
  312. // 工单类别
  313. postSelectData(e,id,type,ident) {
  314. console.log(e,id,type,ident)
  315. this.identification = ident
  316. this.flaginfo = String(id)
  317. this.valiFormData.WorkOrderCategory = e
  318. if(this.flagid.indexOf(this.flaginfo) > -1) {
  319. this.dicList = [{
  320. F_DicId: 0,
  321. F_DicName: '',
  322. F_Number: 1
  323. }]
  324. }else{
  325. this.dicList = 0
  326. }
  327. this.getBBxx()
  328. },
  329. // 综合调度信息
  330. postSelectDic(e, index) {
  331. this.dicList[index].F_DicId = e.split(',')[0]
  332. this.dicList[index].F_DicName = e.split(',')[1]
  333. },
  334. plusClck() {
  335. const params = {
  336. F_DicId: 0,
  337. F_DicName: '',
  338. F_Number: 1
  339. }
  340. this.dicList.push(params)
  341. },
  342. minusClck() {
  343. this.dicList.splice(this.dicList.length - 1, 1)
  344. },
  345. clearTagAdmin(value){
  346. this.userListSelect = this.userListSelect.filter(item => item != value);
  347. },
  348. // 申请部门
  349. deptNodeclick(e) {
  350. if (e) {
  351. this.valiFormData.ApplicationDept = e.value
  352. pageData.getApplicant(e.value.split('_')[1], (res, data, candidates) => {
  353. this.candidates = candidates
  354. console.log(this.candidates)
  355. this.ApplicantData = res
  356. this.orderApplicantData = data
  357. })
  358. this.candidates = []
  359. this.valiFormData.Applicant = ''
  360. this.valiFormData.ApplicantName = ''
  361. this.valiFormData.Phone = ''
  362. this.valiFormData.Location = ''
  363. this.valiFormData.ToPlace = ''
  364. this.getDeptLocation(e.value.split('_')[1])
  365. }
  366. },
  367. //科室位置
  368. getDeptLocation(id){
  369. this.$http.get("Department/GetModel", {deptid:id}).then((response) => {
  370. if (response.state.toLowerCase() === "success") {
  371. this.valiFormData.Location = response.data.F_Location
  372. this.valiFormData.ToPlace = response.data.F_Location
  373. }
  374. })
  375. },
  376. handleInput(res) {
  377. let e = this.$mHelper.getValueByText(res,this.ApplicantData)
  378. this.valiFormData.Applicant = e
  379. this.valiFormData.ApplicantName = res
  380. const user = this.orderApplicantData.find((o) => {
  381. return o.usercode === e.toString()
  382. })
  383. if (user) {
  384. this.valiFormData.Phone = user.usertelphone
  385. }
  386. this.getLocation(this.valiFormData.Applicant)
  387. },
  388. // 地址
  389. getLocation(user) {
  390. this.$http.get("UserAccount/GetModel", {usercode: user}).then((response) => {
  391. if (response.state.toLowerCase() === "success") {
  392. this.valiFormData.Location = response.data.F_Location
  393. this.valiFormData.ToPlace = response.data.F_Location
  394. }
  395. })
  396. },
  397. // 指派部门
  398. maintenanceNodeclick(e) {
  399. if(e) {
  400. this.departMain = e.value
  401. pageData.getApplicant(e.value, (res) => {
  402. this.MaintenancerData = res
  403. })
  404. }
  405. },
  406. maintenanceclosed() {
  407. this.valiFormData.DealDept = this.departMain
  408. },
  409. //指派人
  410. changeMaintenancer(e) {
  411. this.valiFormData.DealMan = e
  412. },
  413. // 工单提交
  414. submit(ref) {
  415. // console.log(this.dicList)
  416. // return
  417. if(this.identification === '2001' || this.identification === '2003'){
  418. if(!this.dicList[0].F_DicName){
  419. this.$mHelper.toast('请选择物资信息')
  420. return
  421. }
  422. }
  423. if(!this.dicList[0].F_DicName){
  424. this.dicList = null
  425. }
  426. this.imgIdList = []
  427. this.disabledButton = true
  428. this.fileLists.forEach(v =>{
  429. this.imgIdList.push(v.id)
  430. })
  431. this.$refs[ref].validate().then(res => {
  432. const params = {
  433. WorkOrderCategory: this.valiFormData.WorkOrderCategory, //工单类别
  434. ApplicationDept: this.valiFormData.ApplicationDept.split('_')[1], //申请部门
  435. Applicant: this.valiFormData.Applicant, //申请人
  436. Phone: this.valiFormData.Phone, //联系电话
  437. Location: this.valiFormData.Location, // 科室位置
  438. // ToPlace: this.valiFormData.ToPlace, // 送达地点
  439. Content: this.valiFormData.Content, // 工单内容
  440. DealDept: this.valiFormData.DealDept, // 维修部门
  441. DealMan: this.valiFormData.DealMan, // 维修人
  442. File: this.$mHelper.getImgString(this.imgIdList), // 文件
  443. detailists: this.dicList,
  444. opt: this.valiFormData.opt,
  445. // EmergencyTypes: this.valiFormData.EmergencyTypes,
  446. cfnum: this.redPrescriptionNum
  447. }
  448. if(this.workorderid) {
  449. params.WorkOrderCode = this.workorderid
  450. params.usertype = 1
  451. this.$mHelper.httpPost("Scheduling/UpdateSchedulingWorkOrder", this.serialize(params), 1, res => this.disabledButton = res)
  452. }else{
  453. this.$mHelper.httpPost("Scheduling/AddSchedulingWorkOrder", this.serialize(params), 1, res => this.disabledButton = res)
  454. }
  455. }).catch(err => {
  456. this.disabledButton = false
  457. console.log('err', err);
  458. })
  459. },
  460. serialize(obj, prefix) {
  461. const str = []
  462. let p
  463. if (obj.length === 0) {
  464. // str.push(encodeURIComponent(prefix) + '=1')
  465. } else {
  466. for (p in obj) {
  467. if (obj.hasOwnProperty(p)) {
  468. const k = prefix ? prefix + '[' + p + ']' : p
  469. let v = obj[p]
  470. if (v instanceof Date) {
  471. v = parseTime(v)
  472. }
  473. str.push((v !== null && typeof v === 'object') ? this.serialize(v, k) : encodeURIComponent(k) +'=' + encodeURIComponent(v))
  474. }
  475. }
  476. }
  477. return str.join('&')
  478. },
  479. getDetail() {
  480. const params = {
  481. WorkOrderCode: this.workorderid,
  482. type: 0
  483. }
  484. this.$http.get("Scheduling/GetWorkOrder", params).then((response) => {
  485. if (response.state.toLowerCase() === "success") {
  486. this.valiFormData.WorkOrderCategory = response.data[0].F_WorkOrderCategory // 工单类别
  487. this.valiFormData.Content = response.data[0].F_Content // 工单内容
  488. if(response.data[0].F_ApplicationDept) {
  489. this.valiFormData.ApplicationDept = response.data[0].F_ApplicationDept.trim() // 申请部门
  490. pageData.getApplicant(this.valiFormData.ApplicationDept, (res) => {
  491. this.ApplicantData = res
  492. })
  493. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, response.data[0].F_Applicant)
  494. this.valiFormData.Applicant = response.data[0].F_Applicant //申请人
  495. }
  496. this.valiFormData.Phone = response.data[0].F_Phone // 联系电话
  497. this.valiFormData.Location = response.data[0].F_Location
  498. // this.valiFormData.ToPlace = response.data[0].F_ToPlace
  499. this.valiFormData.File = response.data[0].F_File
  500. // this.valiFormData.EmergencyTypes = response.data[0].F_EmergencyTypes
  501. const ps = []
  502. response.data[0].PSInfo.forEach(v => {
  503. ps.push({
  504. F_DicId: v.F_DicId,
  505. F_DicName: v.F_DicName,
  506. F_Number: v.F_Number
  507. })
  508. })
  509. this.dicList = ps
  510. if (response.data[0].FileUrl) {
  511. response.data[0].FileUrl.forEach((v, n) => {
  512. //详情图片回显
  513. this.fileLists.push({
  514. url: v.F_FileUrl,
  515. extname: v.F_FileType,
  516. name: v.F_FileName.substring(19),
  517. id:v.F_FileId
  518. })
  519. })
  520. }
  521. }
  522. }).catch((e) => {
  523. console.log(e);
  524. })
  525. },
  526. // 上传图片
  527. getImgData(data) {
  528. this.clickImgState = 1
  529. this.imgIdList = data
  530. },
  531. }
  532. }
  533. </script>
  534. <style lang="scss" scoped>
  535. @import '@/common/addFormDeep.scss';
  536. .wrapper {
  537. padding: 10px 15px;
  538. background-color: #fff;
  539. .form {
  540. .infoTittle {
  541. align-items: center;
  542. text-align: left;
  543. font-size: 14px;
  544. color: #606266;
  545. height: 36px;
  546. padding: 0 12px 0 0;
  547. vertical-align: middle;
  548. flex-shrink: 0;
  549. // box-sizing: border-box;
  550. margin-right: 10px;
  551. }
  552. .dicSelect {
  553. width: 65%;
  554. display: inline-block;
  555. margin-right: 10px;
  556. margin-bottom: 15px;
  557. }
  558. .dicNum {
  559. width: 30%;
  560. display: inline-block;
  561. }
  562. /deep/.uni-icons[data-v-a2e81f6e] {
  563. vertical-align: middle;
  564. }
  565. .point {
  566. color: #f00;
  567. vertical-align: middle;
  568. margin-right: 2px;
  569. }
  570. }
  571. }
  572. </style>