人民医院前端

addComDispatch.vue 17KB

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