人民医院前端

addComDispatch.vue 24KB

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