人民医院前端

addComDispatch.vue 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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="工号搜索">
  12. <uni-easyinput v-model="usercodeSearch" placeholder="请输入工号" @blur="getUserData"/>
  13. </uni-forms-item>
  14. <uni-forms-item label="申请科室" required name="ApplicationDept">
  15. <uni-data-picker :readonly="true" placeholder="请选择申请科室" :localdata="deptDataTree"
  16. v-model="valiFormData.ApplicationDept" @nodeclick="deptNodeclick" :showSearch="showSearch"
  17. @popupclosed="popupclosedDept" @searchTrue="departSearchTrue">
  18. </uni-data-picker>
  19. </uni-forms-item>
  20. <uni-forms-item label="科室电话" name="DeptPhone">
  21. <uni-easyinput v-model="valiFormData.DeptPhone" placeholder="请输入联系电话" />
  22. </uni-forms-item>
  23. <uni-forms-item label="申请人" required name="ApplicantName">
  24. <uni-combox :disabled="true" :candidates="candidates" placeholder="输入搜索内容" @input="handleInput"
  25. v-model="valiFormData.ApplicantName"></uni-combox>
  26. </uni-forms-item>
  27. <uni-forms-item label="联系电话" required name="Phone">
  28. <uni-easyinput v-model="valiFormData.Phone" placeholder="请输入联系电话" />
  29. </uni-forms-item>
  30. <uni-forms-item label="报工位置" required name="Location">
  31. <uni-easyinput v-model="valiFormData.Location" placeholder="请输入报工位置" />
  32. </uni-forms-item>
  33. <view style="margin: 15px 0;" v-show="valiFormData.WorkOrderCategory && flag[flaginfo]">
  34. <view style="margin-bottom: 15px;">
  35. <text class="infoTittle"><text
  36. v-show="flaginfo==='2001' || flaginfo==='2003'|| flaginfo==='127548'|| flaginfo==='10617' || flaginfo==='9129'|| flaginfo==='9130' || flaginfo==='2007'|| flaginfo==='10806'"
  37. style="color: red;">*</text>{{flagName[flaginfo]}}</text>
  38. <uni-icons type="plus" size="30" color="#007aff" @click="plusClck()"></uni-icons>
  39. <uni-icons type="minus" size="30" color="#007aff" @click="minusClck()"></uni-icons>
  40. </view>
  41. <view style="width: 100%;height: 85px;" v-for="(item, index) in dicList">
  42. <view class="dicSelect" v-if="identification==='JC' || identification==='FJ'">
  43. <uni-data-picker class="uni_item" placeholder="请选择标本信息" :localdata="dataOrderType"
  44. @nodeclick="(e)=>nodeclickMuter(e,index)">
  45. </uni-data-picker>
  46. </view>
  47. <view style="margin-bottom: 2px;width: 100%;" v-if="identification==='2007'">
  48. <uni-data-picker placeholder="请选择科室" v-model="item.F_ToDept"
  49. @popupclosed="popupclosedDeptww" :showSearch="showSearch" :localdata="deptDataTree"
  50. @nodeclick="(e)=>nodeclickDept(e,index)">
  51. </uni-data-picker>
  52. </view>
  53. <view v-if="identification!=='JC' && identification!=='FJ'" class="dicSelect">
  54. <dictionaries-select v-if="identification!=='2007'" :flag="flag[flaginfo]" :valInfo="index"
  55. :val="item.F_DicId + ','+ item.F_DicName" @post-select-dic="postSelectDic">
  56. </dictionaries-select>
  57. <luyj-select-lay v-if="identification==='2007'" lay-omit name="name" :options="bloodList"
  58. :zindex="1" slabel='text' @selectitem="(e)=>selectitem(e,index)">
  59. </luyj-select-lay>
  60. </view>
  61. <view class="dicNum">
  62. <uni-number-box v-model="item.F_Number" />
  63. </view>
  64. <view style="display: block;width: 100%;text-align: center;"
  65. v-if="identification === '2001' || identification === '2003'|| identification === 'YQT'">
  66. <uni-data-checkbox v-model="item.F_IsBorrow" :localdata="F_IsBorrowTypesList" />
  67. </view>
  68. </view>
  69. </view>
  70. <!-- <uni-forms-item label="送达地点" required name="ToPlace">
  71. <dictionaries-select flag="SDKS" @post-select-dic="postSelectDicPlace" v-if="identification === '2006' || identification === 'JC' || identification === 'FJ'"></dictionaries-select>
  72. <uni-easyinput v-model="valiFormData.ToPlace" placeholder="请输入送达地点" v-else/>
  73. </uni-forms-item> -->
  74. <uni-forms-item label="备注" name="Content">
  75. <uni-easyinput type="textarea" v-model="valiFormData.Content" placeholder="请输入备注" />
  76. </uni-forms-item>
  77. <uni-forms-item label="红处方数量" required name="redPrescriptionNum" v-show="flaginfo == '2004' ">
  78. <uni-number-box v-model="redPrescriptionNum" />
  79. </uni-forms-item>
  80. <!-- <uni-forms-item label="紧急程度" name="EmergencyTypes">
  81. <uni-data-checkbox v-model="valiFormData.EmergencyTypes" :localdata="EmergencyTypesList" />
  82. </uni-forms-item> -->
  83. <uni-forms-item label="附件" name="">
  84. <view class="example-body">
  85. <!-- <upload @post-string-data="getImgData" :imgUrlList="imgUrlList"></upload> -->
  86. <l-file ref="lFile" :logo="logo" @up-success="onSuccess"></l-file>
  87. <view class="padding" style="margin-top: 10px;">
  88. <button class="mini-btn" type="primary" size="mini" @tap="onUpload">上传</button>
  89. </view>
  90. <view class="padding">
  91. <uni-file-picker limit="5" file-mediatype="all" :value="fileLists" @delete="deleteFile">
  92. </uni-file-picker>
  93. </view>
  94. </view>
  95. </uni-forms-item>
  96. </uni-forms>
  97. <view class="btnClass">
  98. <button type="primary" :disabled="disabledButton" @click="submit('valiForm')">提交工单</button>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import orderSelect from "@/pages/components/orderSelect/orderSelect"
  105. import indexConfig from '@/config/index.config';
  106. import {
  107. filterTreeDatas,
  108. filterSelectData
  109. } from '@/utils/dataTreating.js'
  110. import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
  111. import upload from '@/pages/components/upload/upload.vue' //upload
  112. import uploadFile from '@/pages/components/upload/uploadFile.vue' //upload
  113. import newfile from '@/pages/components/upload-imagesAndvideo/index.vue' //upload
  114. import dictionariesSelect from '@/pages/components/dictionariesSelect/dictionariesSelect.vue' //upload
  115. import { encrypt,decrypt } from "@/utils/secretKey"
  116. export default {
  117. components: {
  118. upload,
  119. uploadFile,
  120. newfile,
  121. orderSelect,
  122. dictionariesSelect
  123. },
  124. data() {
  125. return {
  126. usercodeSearch:uni.getStorageSync("userCode"),
  127. bloodList: [],
  128. dataOrderType: [],
  129. identification: '', // 工单标识
  130. getFontSizeValue: '1rem',
  131. showSearch: true,
  132. 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',
  133. isShowIsEnd: false,
  134. readonly: false,
  135. disabledButton: false,
  136. // 校验表单数据
  137. valiFormData: {
  138. WorkOrderCategory: '', //工单类别
  139. ApplicationDept: '', //申请部门
  140. Applicant: '', //申请人
  141. ApplicantName: '',
  142. Phone: '', //联系电话
  143. Location: '', // 科室位置
  144. DeptPhone: '',
  145. ToPlace: '', // 送达地点
  146. Content: '', // 工单内容
  147. DealDept: '', // 维修部门
  148. DealMan: '', // 维修人
  149. File: '', // 文件
  150. opt: 2,
  151. EmergencyTypes: '',
  152. },
  153. F_IsBorrowTypesList: [{
  154. text: '借',
  155. value: '1'
  156. }, {
  157. text: '还',
  158. value: '2'
  159. }],
  160. EmergencyTypesList: [{
  161. text: '一般',
  162. value: '一般'
  163. }, {
  164. text: '紧急',
  165. value: '紧急'
  166. }],
  167. changeindex: "",
  168. changedept: "",
  169. departId: 0,
  170. redPrescriptionNum: 0, // 红处方数量
  171. workorderid: '',
  172. stepData: pageData.stepData,
  173. departMain: '',
  174. imgUrlList: [], // 附件数据
  175. imgIdList: [], //上传附件id
  176. clickImgState: 0, // 图片回显的状态
  177. departList: [],
  178. deptDataTree: [], // 科室-部门数据
  179. ApplicantData: [], // 获取人员数据
  180. assignedDepartData: [], //指派部门数据
  181. MaintenancerData: [], //指派人数据
  182. orderApplicantData: [], // 用户人员信息
  183. userListSelect: [],
  184. typeid: 0,
  185. candidates: [],
  186. // 标本信息(BBXX),设备信息(SBXX),物资信息(WZXX),病床信息(BCXX),药品信息(YPXX)
  187. flagid: ["2001", "2002", "2003", "2006", "2005", "9014", "9129", "9130", '2007', "127548", "10617","10789","10790","10806"],
  188. flaginfo: '',
  189. fileLists: [],
  190. flag: {
  191. "2006": 'BBXX',
  192. "2001": 'SBXX',
  193. "2002": 'WZXX',
  194. "2003": 'BCXX',
  195. "2005": 'YPXX',
  196. "9014": 'YPXX',
  197. "9129": 'BBXX',
  198. "9130": 'BBXX',
  199. "2007": 'XYLX',
  200. "127548": 'YQT',
  201. "10617": 'YQT',
  202. "10789":'BCXX',
  203. "10790": 'BCXX',
  204. "10806": 'SBXX'
  205. },
  206. flagName: {
  207. "2001": '设备信息',
  208. "2002": '物资信息',
  209. "2003": '病床信息',
  210. "2006": '标本信息',
  211. "2005": '药品信息',
  212. "9014": '药品信息',
  213. "9129": '标本信息',
  214. "9130": '标本信息',
  215. "2007": '送达科室',
  216. "127548": '设备信息',
  217. "10617": '设备信息',
  218. "10806": '设备信息',
  219. },
  220. dicList: [{
  221. F_DicId: 0,
  222. F_DicName: '',
  223. F_Number: 0,
  224. F_IsBorrow: '',
  225. F_ToDept: '',
  226. }],
  227. // 校验规则
  228. rules: {
  229. WorkOrderCategory: {
  230. rules: [{
  231. required: true,
  232. errorMessage: '请选择工单类别'
  233. }]
  234. },
  235. ApplicationDept: {
  236. rules: [{
  237. required: true,
  238. errorMessage: '请选择申请科室'
  239. }]
  240. },
  241. ApplicantName: {
  242. rules: [{
  243. required: true,
  244. errorMessage: '请选择申请人'
  245. }]
  246. },
  247. Phone: {
  248. rules: [{
  249. required: true,
  250. errorMessage: '清输入联系电话'
  251. }]
  252. },
  253. Location: {
  254. rules: [{
  255. required: true,
  256. errorMessage: '请输入报工位置'
  257. }]
  258. },
  259. // Content: {
  260. // rules: [{
  261. // required: true,
  262. // errorMessage: '清输入工单内容'
  263. // }]
  264. // }
  265. },
  266. }
  267. },
  268. onLoad(option) {
  269. this.getFontSizeValue = uni.getStorageSync('fontSizeValue') + 'rem'
  270. this.workorderid = option.wid
  271. // 添加工单,申请人默认当前登录人
  272. if (uni.getStorageSync("deptId")) {
  273. this.valiFormData.ApplicationDept = uni.getStorageSync("deptId")
  274. this.getDeptLocation(uni.getStorageSync("deptId"))
  275. pageData.getApplicant(uni.getStorageSync("deptId"), (res, data, candidates) => {
  276. this.candidates = candidates
  277. this.ApplicantData = res
  278. this.orderApplicantData = data
  279. if (uni.getStorageSync("userCode")) {
  280. this.valiFormData.Applicant = uni.getStorageSync("userCode")
  281. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, uni
  282. .getStorageSync("userCode"))
  283. const user = this.orderApplicantData.find((o) => {
  284. return o.usercode === this.valiFormData.Applicant.toString()
  285. })
  286. if (user) {
  287. this.valiFormData.Phone = user.usertelphone
  288. }
  289. this.getLocation(this.valiFormData.Applicant)
  290. }
  291. })
  292. }
  293. // 部门数据
  294. pageData.getDet((res, data) => {
  295. console.log(res)
  296. this.departList = data
  297. this.deptDataTree = res
  298. this.assignedDepartData = res
  299. })
  300. if (this.workorderid) {
  301. this.readonly = true
  302. this.getDetail()
  303. }
  304. window.scrollTo(0, 0)
  305. this.getDicValueList()
  306. },
  307. watch: {
  308. 'departList': function() {
  309. this.valiFormData.ApplicationDept = this.$mHelper.findParents(this.departList, this.valiFormData
  310. .ApplicationDept).split('/').length + '_' + this.valiFormData.ApplicationDept
  311. }
  312. },
  313. methods: {
  314. getUserData() {
  315. if (!this.usercodeSearch) {
  316. return;
  317. }
  318. const params = {
  319. usercode: this.usercodeSearch,
  320. };
  321. this.$http.get("UserAccount/GetModel", params).then((response) => {
  322. const datas = response.data
  323. this.valiFormData.ApplicationDept = datas.F_DeptId
  324. this.valiFormData.ApplicationDept = this.$mHelper.findParents(this.departList, this.valiFormData
  325. .ApplicationDept).split('/').length + '_' + this.valiFormData.ApplicationDept
  326. this.getDeptLocation(datas.F_DeptId)
  327. pageData.getApplicant(datas.F_DeptId, (res, data, candidates) => {
  328. this.candidates = candidates
  329. this.ApplicantData = res
  330. this.orderApplicantData = data
  331. if (datas.F_UserCode) {
  332. this.valiFormData.Applicant = datas.F_UserCode
  333. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, datas.F_UserCode)
  334. const user = this.orderApplicantData.find((o) => {
  335. return o.usercode === this.valiFormData.Applicant.toString()
  336. })
  337. if (user) {
  338. this.valiFormData.Phone = user.usertelphone
  339. }
  340. this.getLocation(this.valiFormData.Applicant)
  341. }
  342. })
  343. })
  344. },
  345. getDicValueList() {
  346. const params = {
  347. Flag: 'XYLX',
  348. Name: ''
  349. }
  350. this.$http.get("Dictionary/GetDicValueList", params).then((response) => {
  351. let newData = []
  352. response.rows.forEach((element, index) => {
  353. const obj = {}
  354. obj.value = element.F_DictionaryValueId + ',' + element.F_Name
  355. obj.text = element.F_Name
  356. newData.push(obj)
  357. });
  358. this.bloodList = newData;
  359. // if(this.val) {
  360. // this.id = this.val
  361. // }
  362. })
  363. },
  364. selectitem(val, index) {
  365. var namestr = ''
  366. var idstr = ''
  367. if (val) {
  368. for (var i = 0; i < val.length; i++) {
  369. namestr += val[i].value.split(',')[1] + ','
  370. idstr += val[i].value.split(',')[0] + ','
  371. }
  372. this.dicList[index].F_DicId = idstr.slice(0, namestr.length - 1)
  373. this.dicList[index].F_DicName = namestr.slice(0, namestr.length - 1)
  374. }
  375. },
  376. getBBxx() {
  377. let str
  378. if (this.identification == 'JC') {
  379. str = '急查标本'
  380. }
  381. if (this.identification == 'FJ') {
  382. str = '非急查标本'
  383. }
  384. pageData.getBB(str, (res, data) => {
  385. this.dataOrderType = res
  386. })
  387. },
  388. nodeclickMuter(e, index) {
  389. this.dicList[index].F_DicId = e.value
  390. this.dicList[index].F_DicName = e.text
  391. },
  392. nodeclickDept(e, index) {
  393. if (e.zIndex == 0) {
  394. this.changedept = ""
  395. this.changeindex = ""
  396. this.dicList[index].F_ToDept = ""
  397. } else {
  398. this.changedept = e.value
  399. this.changeindex = index
  400. }
  401. },
  402. popupclosedDeptww() {
  403. if (this.changeindex) {
  404. const index = this.changeindex
  405. this.dicList[index].F_ToDept = this.changedept
  406. }
  407. if (this.changeindex === 0) {
  408. this.dicList = [{
  409. F_DicId: this.dicList[0].F_DicId,
  410. F_DicName: this.dicList[0].F_DicName,
  411. F_Number: this.dicList[0].F_Number,
  412. F_IsBorrow: this.dicList[0].F_IsBorrow,
  413. F_ToDept: this.changedept,
  414. }]
  415. }
  416. },
  417. // 获取科室位置
  418. postSelectDicPlace(res) {
  419. this.valiFormData.ToPlace = res.split(',')[1]
  420. },
  421. // 删除附件
  422. deleteFile(res) {
  423. const num = this.fileLists.findIndex(v => v.url === res.tempFile.path);
  424. this.fileLists.splice(num, 1)
  425. },
  426. /* 附件上传 */
  427. onUpload() {
  428. this.$refs.lFile.upload({
  429. //替换为你的上传接口地址
  430. url: indexConfig.baseUrl + "/FaultRepair/UploadFile",
  431. // 服务端接收附件的key
  432. name: 'file',
  433. //根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
  434. header: {
  435. Authorization: uni.getStorageSync('Admin-Token')
  436. },
  437. })
  438. },
  439. // 附件上传
  440. onSuccess(res) {
  441. if(res.data.state == 'error'){
  442. this.$mHelper.toast(res.data.message)
  443. return
  444. }
  445. res.data.data.forEach(v => {
  446. this.fileLists.push({
  447. url: indexConfig.baseUrl + v.F_FileUrl,
  448. extname: v.F_FileType,
  449. name: v.F_FileName.substring(19),
  450. id: v.F_FileId
  451. })
  452. })
  453. },
  454. postImgData(res) {},
  455. // 工单类别
  456. postSelectData(e, id, type, ident) {
  457. console.log(e, ident)
  458. this.identification = ident
  459. this.flaginfo = String(id)
  460. console.log(this.flaginfo)
  461. this.valiFormData.WorkOrderCategory = e
  462. if (this.flagid.indexOf(this.flaginfo) > -1) {
  463. this.dicList = [{
  464. F_DicId: 0,
  465. F_DicName: '',
  466. F_Number: 0
  467. }]
  468. } else {
  469. this.dicList = 0
  470. }
  471. this.getBBxx()
  472. },
  473. // 综合调度信息
  474. postSelectDic(e, index) {
  475. console.log(e, '888999')
  476. this.dicList[index].F_DicId = e.split(',')[0]
  477. this.dicList[index].F_DicName = e.split(',')[1]
  478. },
  479. plusClck() {
  480. const params = {
  481. F_DicId: 0,
  482. F_DicName: '',
  483. F_Number: 0,
  484. F_ToDept: ""
  485. }
  486. this.dicList.push(params)
  487. },
  488. minusClck() {
  489. this.dicList.splice(this.dicList.length - 1, 1)
  490. },
  491. clearTagAdmin(value) {
  492. this.userListSelect = this.userListSelect.filter(item => item != value);
  493. },
  494. // 申请部门
  495. deptNodeclick(e) {
  496. if (e) {
  497. this.departId = e.value
  498. pageData.getApplicant(e.value.split('_')[1], (res, data, candidates) => {
  499. this.candidates = candidates
  500. console.log(this.candidates)
  501. this.ApplicantData = res
  502. this.orderApplicantData = data
  503. })
  504. this.candidates = []
  505. this.valiFormData.Applicant = ''
  506. this.valiFormData.ApplicantName = ''
  507. this.valiFormData.Phone = ''
  508. this.valiFormData.Location = ''
  509. this.valiFormData.ToPlace = ''
  510. this.valiFormData.DeptPhone = ''
  511. this.getDeptLocation(e.value.split('_')[1])
  512. }
  513. },
  514. departSearchTrue(e) {
  515. this.valiFormData.ApplicationDept = e.value
  516. },
  517. popupclosedDept(e) {
  518. this.valiFormData.ApplicationDept = this.departId
  519. },
  520. // popupclosedDeptww(e){
  521. // if(this.changeindex){
  522. // const index = this.changeindex
  523. // console.log(index,this.changedept)
  524. // this.dicList[index].F_ToDept = this.changedept
  525. // }
  526. // },
  527. //科室位置
  528. getDeptLocation(id) {
  529. this.$http.get("Department/GetModel", {
  530. deptid: id
  531. }).then((response) => {
  532. if (response.state.toLowerCase() === "success") {
  533. // this.valiFormData.Location = response.data.F_Location
  534. this.valiFormData.ToPlace = response.data.F_Location
  535. this.valiFormData.DeptPhone = decrypt(response.data.F_OfficeTelephoneShow)
  536. if(this.valiFormData.DeptPhone == 'undefined'){
  537. this.valiFormData.DeptPhone = ''
  538. }
  539. }
  540. })
  541. },
  542. handleInput(res) {
  543. let e = this.$mHelper.getValueByText(res, this.ApplicantData)
  544. this.valiFormData.Applicant = e
  545. this.valiFormData.ApplicantName = res
  546. const user = this.orderApplicantData.find((o) => {
  547. return o.usercode === e.toString()
  548. })
  549. if (user) {
  550. this.valiFormData.Phone = user.usertelphone
  551. }
  552. this.getLocation(this.valiFormData.Applicant)
  553. },
  554. // 地址
  555. getLocation(user) {
  556. this.$http.get("UserAccount/GetModel", {
  557. usercode: user
  558. }).then((response) => {
  559. if (response.state.toLowerCase() === "success") {
  560. // this.valiFormData.Location = response.data.F_Location
  561. this.valiFormData.ToPlace = response.data.F_Location
  562. }
  563. })
  564. },
  565. // 指派部门
  566. maintenanceNodeclick(e) {
  567. if (e) {
  568. this.departMain = e.value
  569. pageData.getApplicant(e.value, (res) => {
  570. this.MaintenancerData = res
  571. })
  572. }
  573. },
  574. maintenanceclosed() {
  575. this.valiFormData.DealDept = this.departMain
  576. },
  577. //指派人
  578. changeMaintenancer(e) {
  579. this.valiFormData.DealMan = e
  580. },
  581. // 工单提交
  582. submit(ref) {
  583. // console.log(this.valiFormData,this.dicList)
  584. // return
  585. if (this.identification === '2001' || this.identification === '2003' || this.identification === 'YQT' ||
  586. this.identification === 'JC' || this.identification === 'FJ' || this.identification === '2007') {
  587. if (this.dicList.length == 0 || (this.dicList.length > 0 && !this.dicList[0].F_DicName)) {
  588. this.$mHelper.toast('请选择对应物资信息')
  589. return
  590. }
  591. }
  592. if (this.identification === '2001' || this.identification === '2003' || this.identification === 'YQT') {
  593. const index = this.dicList.findIndex((o) => {
  594. return !o.F_IsBorrow || !o.F_DicName || !o.F_Number;
  595. });
  596. if (index >= 0) {
  597. this.$mHelper.toast('请选择对应物资信息')
  598. return;
  599. }
  600. }
  601. if (this.identification === '2007') {
  602. const index = this.dicList.findIndex((o) => {
  603. return !o.F_ToDept || !o.F_DicName || !o.F_Number;
  604. });
  605. if (index >= 0) {
  606. this.$mHelper.toast('请选择对应物资信息')
  607. return;
  608. }
  609. }
  610. if (this.identification === 'JC' || this.identification === 'FJ') {
  611. const index = this.dicList.findIndex((o) => {
  612. return !o.F_DicName || !o.F_Number;
  613. });
  614. if (index >= 0) {
  615. this.$mHelper.toast('请选择对应物资信息')
  616. return;
  617. }
  618. }
  619. if (this.dicList.length == 0 || (this.dicList.length > 0 && !this.dicList[0].F_DicName)) {
  620. this.dicList = null
  621. }
  622. this.imgIdList = []
  623. this.disabledButton = true
  624. this.fileLists.forEach(v => {
  625. this.imgIdList.push(v.id)
  626. })
  627. if(this.identification === '2007'){
  628. for (var i = 0; i < this.dicList.length; i++) {
  629. if (this.dicList[i].F_ToDept) {
  630. this.dicList[i].F_ToDept = this.dicList[i].F_ToDept.split('_')[1]
  631. }
  632. }
  633. }
  634. this.$refs[ref].validate().then(res => {
  635. const params = {
  636. OrderSource: uni.getStorageSync('loginway') || '',
  637. WorkOrderCategory: this.valiFormData.WorkOrderCategory, //工单类别
  638. ApplicationDept: this.valiFormData.ApplicationDept.split('_')[1], //申请部门
  639. Applicant: this.valiFormData.Applicant, //申请人
  640. Phone: this.valiFormData.Phone, //联系电话
  641. Location: this.valiFormData.Location, // 科室位置
  642. DeptPhone: this.valiFormData.DeptPhone,
  643. // ToPlace: this.valiFormData.ToPlace, // 送达地点
  644. Content: this.valiFormData.Content, // 工单内容
  645. DealDept: this.valiFormData.DealDept, // 维修部门
  646. DealMan: this.valiFormData.DealMan, // 维修人
  647. File: this.$mHelper.getImgString(this.imgIdList), // 文件
  648. detailists: this.dicList,
  649. opt: this.valiFormData.opt,
  650. // EmergencyTypes: this.valiFormData.EmergencyTypes,
  651. cfnum: this.redPrescriptionNum
  652. }
  653. if (this.workorderid) {
  654. params.WorkOrderCode = this.workorderid
  655. params.usertype = 1
  656. this.$mHelper.httpPost("Scheduling/UpdateSchedulingWorkOrder", this.serialize(params), 2,
  657. res => this.disabledButton = res)
  658. } else {
  659. this.$mHelper.httpPost("Scheduling/AddSchedulingWorkOrder", this.serialize(params), 1,
  660. res => this.disabledButton = res)
  661. }
  662. }).catch(err => {
  663. this.disabledButton = false
  664. console.log('err', err);
  665. })
  666. },
  667. serialize(obj, prefix) {
  668. const str = []
  669. let p
  670. if (obj.length === 0) {
  671. // str.push(encodeURIComponent(prefix) + '=1')
  672. } else {
  673. for (p in obj) {
  674. if (obj.hasOwnProperty(p)) {
  675. const k = prefix ? prefix + '[' + p + ']' : p
  676. let v = obj[p]
  677. if (v instanceof Date) {
  678. v = parseTime(v)
  679. }
  680. str.push((v !== null && typeof v === 'object') ? this.serialize(v, k) : encodeURIComponent(k) +
  681. '=' + encodeURIComponent(v))
  682. }
  683. }
  684. }
  685. return str.join('&')
  686. },
  687. getDetail() {
  688. const params = {
  689. WorkOrderCode: this.workorderid,
  690. type: 0
  691. }
  692. this.$http.get("Scheduling/GetWorkOrder", params).then((response) => {
  693. if (response.state.toLowerCase() === "success") {
  694. this.valiFormData.WorkOrderCategory = response.data[0].F_WorkOrderCategory // 工单类别
  695. this.valiFormData.Content = response.data[0].F_Content // 工单内容
  696. if (response.data[0].F_ApplicationDept) {
  697. this.valiFormData.ApplicationDept = response.data[0].F_ApplicationDept.trim() // 申请部门
  698. pageData.getApplicant(this.valiFormData.ApplicationDept, (res) => {
  699. this.ApplicantData = res
  700. })
  701. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData,
  702. response.data[0].F_Applicant)
  703. this.valiFormData.Applicant = response.data[0].F_Applicant //申请人
  704. }
  705. this.valiFormData.Phone = response.data[0].F_Phone // 联系电话
  706. console.log(response.data[0].F_DeptPhone)
  707. // this.valiFormData.DeptPhone =response.data[0].F_DeptPhone
  708. this.valiFormData.DeptPhone = decrypt(response.data[0].F_DeptPhoneShow)
  709. this.valiFormData.Location = response.data[0].F_Location
  710. // this.valiFormData.ToPlace = response.data[0].F_ToPlace
  711. this.valiFormData.File = response.data[0].F_File
  712. // this.valiFormData.EmergencyTypes = response.data[0].F_EmergencyTypes
  713. const ps = []
  714. response.data[0].PSInfo.forEach(v => {
  715. ps.push({
  716. F_DicId: v.F_DicId,
  717. F_DicName: v.F_DicName,
  718. F_Number: v.F_Number
  719. })
  720. })
  721. this.dicList = ps
  722. if (response.data[0].FileUrl) {
  723. response.data[0].FileUrl.forEach((v, n) => {
  724. //详情图片回显
  725. this.fileLists.push({
  726. url: v.F_FileUrl,
  727. extname: v.F_FileType,
  728. name: v.F_FileName.substring(19),
  729. id: v.F_FileId
  730. })
  731. })
  732. }
  733. }
  734. }).catch((e) => {
  735. console.log(e);
  736. })
  737. },
  738. // 上传图片
  739. getImgData(data) {
  740. this.clickImgState = 1
  741. this.imgIdList = data
  742. },
  743. }
  744. }
  745. </script>
  746. <style lang="scss" scoped>
  747. @import '@/common/addFormDeep.scss';
  748. .wrapper {
  749. padding: 10px 15px;
  750. background-color: #fff;
  751. .form {
  752. .infoTittle {
  753. align-items: center;
  754. text-align: left;
  755. font-size: 14px;
  756. color: #606266;
  757. height: 36px;
  758. padding: 0 12px 0 0;
  759. vertical-align: middle;
  760. flex-shrink: 0;
  761. // box-sizing: border-box;
  762. margin-right: 10px;
  763. }
  764. .dicSelect {
  765. width: 65%;
  766. display: inline-block;
  767. margin-right: 10px;
  768. margin-bottom: 15px;
  769. }
  770. .dicNum {
  771. width: 30%;
  772. display: inline-block;
  773. }
  774. /deep/.uni-icons[data-v-a2e81f6e] {
  775. vertical-align: middle;
  776. }
  777. .point {
  778. color: #f00;
  779. vertical-align: middle;
  780. margin-right: 2px;
  781. }
  782. }
  783. }
  784. </style>