人民医院前端

addComDispatch.vue 23KB

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