人民医院前端

addComDispatch.vue 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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" @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. departId:0,
  152. redPrescriptionNum: 0, // 红处方数量
  153. workorderid: '',
  154. stepData: pageData.stepData,
  155. departMain: '',
  156. imgUrlList: [], // 附件数据
  157. imgIdList: [], //上传附件id
  158. clickImgState: 0, // 图片回显的状态
  159. departList: [],
  160. deptDataTree: [], // 科室-部门数据
  161. ApplicantData: [], // 获取人员数据
  162. assignedDepartData: [], //指派部门数据
  163. MaintenancerData: [], //指派人数据
  164. orderApplicantData: [], // 用户人员信息
  165. userListSelect: [],
  166. typeid: 0,
  167. candidates: [],
  168. // 标本信息(BBXX),设备信息(SBXX),物资信息(WZXX),病床信息(BCXX),药品信息(YPXX)
  169. flagid: ["2001","2002","2003","2006","2005","9014","9129","9130",'2007',"127548","10617"],
  170. flaginfo: '',
  171. fileLists: [],
  172. flag: {
  173. "2006": 'BBXX',
  174. "2001": 'SBXX',
  175. "2002": 'WZXX',
  176. "2003": 'BCXX',
  177. "2005": 'YPXX',
  178. "9014": 'YPXX',
  179. "9129": 'BBXX',
  180. "9130": 'BBXX',
  181. "2007": 'XYLX',
  182. "127548": 'YQT',
  183. "10617": 'YQT',
  184. },
  185. flagName: {
  186. "2001": '设备信息',
  187. "2002": '物资信息',
  188. "2003": '病床信息',
  189. "2006": '标本信息',
  190. "2005": '药品信息',
  191. "9014": '药品信息',
  192. "9129": '标本信息',
  193. "9130": '标本信息',
  194. "2007": '送达科室',
  195. "127548": '设备信息',
  196. "10617": '设备信息',
  197. },
  198. dicList: [{
  199. F_DicId: 0,
  200. F_DicName: '',
  201. F_Number: 0,
  202. F_IsBorrow: '',
  203. F_ToDept: '',
  204. }],
  205. // 校验规则
  206. rules: {
  207. WorkOrderCategory: {
  208. rules: [{
  209. required: true,
  210. errorMessage: '请选择工单类别'
  211. }]
  212. },
  213. ApplicationDept: {
  214. rules: [{
  215. required: true,
  216. errorMessage: '请选择申请科室'
  217. }]
  218. },
  219. ApplicantName: {
  220. rules: [{
  221. required: true,
  222. errorMessage: '请选择申请人'
  223. }]
  224. },
  225. Phone: {
  226. rules: [{
  227. required: true,
  228. errorMessage: '清输入联系电话'
  229. }]
  230. },
  231. // Content: {
  232. // rules: [{
  233. // required: true,
  234. // errorMessage: '清输入工单内容'
  235. // }]
  236. // }
  237. },
  238. }
  239. },
  240. onLoad(option) {
  241. this.getFontSizeValue = uni.getStorageSync('fontSizeValue')+'rem'
  242. this.workorderid = option.wid
  243. // 添加工单,申请人默认当前登录人
  244. if(uni.getStorageSync("deptId")){
  245. this.valiFormData.ApplicationDept = uni.getStorageSync("deptId")
  246. this.getDeptLocation(uni.getStorageSync("deptId"))
  247. pageData.getApplicant(uni.getStorageSync("deptId"), (res, data, candidates) => {
  248. this.candidates = candidates
  249. this.ApplicantData = res
  250. this.orderApplicantData = data
  251. if(uni.getStorageSync("userCode")) {
  252. this.valiFormData.Applicant = uni.getStorageSync("userCode")
  253. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, uni.getStorageSync("userCode"))
  254. const user = this.orderApplicantData.find((o) => {
  255. return o.usercode === this.valiFormData.Applicant.toString()
  256. })
  257. if (user) {
  258. this.valiFormData.Phone = user.usertelphone
  259. }
  260. this.getLocation(this.valiFormData.Applicant)
  261. }
  262. })
  263. }
  264. // 部门数据
  265. pageData.getDet((res, data) => {
  266. console.log(res)
  267. this.departList = data
  268. this.deptDataTree = res
  269. this.assignedDepartData = res
  270. })
  271. if(this.workorderid) {
  272. this.readonly = true
  273. this.getDetail()
  274. }
  275. window.scrollTo(0,0)
  276. this.getDicValueList()
  277. },
  278. watch: {
  279. 'departList': function() {
  280. this.valiFormData.ApplicationDept = this.$mHelper.findParents(this.departList,this.valiFormData.ApplicationDept).split('/').length + '_'+ this.valiFormData.ApplicationDept
  281. }
  282. },
  283. methods: {
  284. getDicValueList() {
  285. const params = {
  286. Flag: 'XYLX',
  287. Name: ''
  288. }
  289. this.$http.get("Dictionary/GetDicValueList",params).then((response)=>{
  290. let newData = []
  291. response.rows.forEach((element, index) => {
  292. const obj = {}
  293. obj.value = element.F_DictionaryValueId + ',' + element.F_Name
  294. obj.text = element.F_Name
  295. newData.push(obj)
  296. });
  297. this.bloodList = newData;
  298. // if(this.val) {
  299. // this.id = this.val
  300. // }
  301. })
  302. },
  303. selectitem(val,index) {
  304. var namestr = ''
  305. var idstr = ''
  306. if (val) {
  307. for(var i=0;i<val.length;i++){
  308. namestr += val[i].value.split(',')[1]+','
  309. idstr += val[i].value.split(',')[0]+','
  310. }
  311. this.dicList[index].F_DicId = idstr.slice(0,namestr.length-1)
  312. this.dicList[index].F_DicName = namestr.slice(0,namestr.length-1)
  313. }
  314. },
  315. getBBxx(){
  316. let str
  317. if(this.identification == 'JC'){
  318. str = '急查标本'
  319. }
  320. if(this.identification == 'FJ'){
  321. str = '非急查标本'
  322. }
  323. pageData.getBB(str,(res, data) => {
  324. this.dataOrderType = res
  325. })
  326. },
  327. nodeclickMuter(e,index){
  328. this.dicList[index].F_DicId = e.value
  329. this.dicList[index].F_DicName = e.text
  330. },
  331. nodeclickDept(e,index){
  332. console.log(e,'555555')
  333. this.dicList[index].F_ToDept = e.value
  334. // this.dicList[index].F_ToDeptValue = e.value
  335. },
  336. // 获取科室位置
  337. postSelectDicPlace(res) {
  338. this.valiFormData.ToPlace = res.split(',')[1]
  339. },
  340. // 删除附件
  341. deleteFile(res) {
  342. const num = this.fileLists.findIndex(v => v.url === res.tempFile.path);
  343. this.fileLists.splice(num, 1)
  344. },
  345. /* 附件上传 */
  346. onUpload() {
  347. this.$refs.lFile.upload({
  348. //替换为你的上传接口地址
  349. url: indexConfig.baseUrl + "/FaultRepair/UploadFile",
  350. // 服务端接收附件的key
  351. name: 'file',
  352. //根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
  353. header: {
  354. Authorization: uni.getStorageSync('Admin-Token')
  355. },
  356. })
  357. },
  358. // 附件上传
  359. onSuccess(res) {
  360. res.data.data.forEach(v => {
  361. this.fileLists.push({
  362. url: indexConfig.baseUrl + v.F_FileUrl,
  363. extname: v.F_FileType,
  364. name: v.F_FileName.substring(19),
  365. id: v.F_FileId
  366. })
  367. })
  368. },
  369. postImgData(res) {
  370. },
  371. // 工单类别
  372. postSelectData(e,id,type,ident) {
  373. console.log(e,ident)
  374. this.identification = ident
  375. this.flaginfo = String(id)
  376. this.valiFormData.WorkOrderCategory = e
  377. if(this.flagid.indexOf(this.flaginfo) > -1) {
  378. this.dicList = [{
  379. F_DicId: 0,
  380. F_DicName: '',
  381. F_Number: 0
  382. }]
  383. }else{
  384. this.dicList = 0
  385. }
  386. this.getBBxx()
  387. },
  388. // 综合调度信息
  389. postSelectDic(e, index) {
  390. console.log(e,'888999')
  391. this.dicList[index].F_DicId = e.split(',')[0]
  392. this.dicList[index].F_DicName = e.split(',')[1]
  393. },
  394. plusClck() {
  395. const params = {
  396. F_DicId: 0,
  397. F_DicName: '',
  398. F_Number: 0
  399. }
  400. this.dicList.push(params)
  401. },
  402. minusClck() {
  403. this.dicList.splice(this.dicList.length - 1, 1)
  404. },
  405. clearTagAdmin(value){
  406. this.userListSelect = this.userListSelect.filter(item => item != value);
  407. },
  408. // 申请部门
  409. deptNodeclick(e) {
  410. if (e) {
  411. this.departId = e.value
  412. pageData.getApplicant(e.value.split('_')[1], (res, data, candidates) => {
  413. this.candidates = candidates
  414. console.log(this.candidates)
  415. this.ApplicantData = res
  416. this.orderApplicantData = data
  417. })
  418. this.candidates = []
  419. this.valiFormData.Applicant = ''
  420. this.valiFormData.ApplicantName = ''
  421. this.valiFormData.Phone = ''
  422. this.valiFormData.Location = ''
  423. this.valiFormData.ToPlace = ''
  424. this.valiFormData.DeptPhone = ''
  425. this.getDeptLocation(e.value.split('_')[1])
  426. }
  427. },
  428. departSearchTrue(e){
  429. this.valiFormData.ApplicationDept = e.value
  430. },
  431. popupclosedDept(e) {
  432. this.valiFormData.ApplicationDept = this.departId
  433. },
  434. //科室位置
  435. getDeptLocation(id){
  436. this.$http.get("Department/GetModel", {deptid:id}).then((response) => {
  437. if (response.state.toLowerCase() === "success") {
  438. this.valiFormData.Location = response.data.F_Location
  439. this.valiFormData.ToPlace = response.data.F_Location
  440. this.valiFormData.DeptPhone = response.data.F_OfficeTelephone
  441. }
  442. })
  443. },
  444. handleInput(res) {
  445. let e = this.$mHelper.getValueByText(res,this.ApplicantData)
  446. this.valiFormData.Applicant = e
  447. this.valiFormData.ApplicantName = res
  448. const user = this.orderApplicantData.find((o) => {
  449. return o.usercode === e.toString()
  450. })
  451. if (user) {
  452. this.valiFormData.Phone = user.usertelphone
  453. }
  454. this.getLocation(this.valiFormData.Applicant)
  455. },
  456. // 地址
  457. getLocation(user) {
  458. this.$http.get("UserAccount/GetModel", {usercode: user}).then((response) => {
  459. if (response.state.toLowerCase() === "success") {
  460. this.valiFormData.Location = response.data.F_Location
  461. this.valiFormData.ToPlace = response.data.F_Location
  462. }
  463. })
  464. },
  465. // 指派部门
  466. maintenanceNodeclick(e) {
  467. if(e) {
  468. this.departMain = e.value
  469. pageData.getApplicant(e.value, (res) => {
  470. this.MaintenancerData = res
  471. })
  472. }
  473. },
  474. maintenanceclosed() {
  475. this.valiFormData.DealDept = this.departMain
  476. },
  477. //指派人
  478. changeMaintenancer(e) {
  479. this.valiFormData.DealMan = e
  480. },
  481. // 工单提交
  482. submit(ref) {
  483. // console.log(this.dicList)
  484. // return
  485. for(var i=0;i<this.dicList.length;i++){
  486. if(this.dicList[i].F_ToDept){
  487. this.dicList[i].F_ToDept = this.dicList[i].F_ToDept.split('_')[1]
  488. }
  489. }
  490. if(this.identification === '2001' || this.identification === '2003' || this.identification === 'YQT'|| this.identification === 'JC' || this.identification === 'FJ' || this.identification === '2007'){
  491. if(this.dicList.length == 0 || (this.dicList.length>0 && !this.dicList[0].F_DicName)){
  492. this.$mHelper.toast('请选择对应物资信息')
  493. return
  494. }
  495. }
  496. if(this.identification === '2001' || this.identification === '2003'|| this.identification === 'YQT'){
  497. const index = this.dicList.findIndex((o) => {
  498. return !o.F_IsBorrow || !o.F_DicName || !o.F_Number;
  499. });
  500. if (index >= 0) {
  501. this.$mHelper.toast('请选择对应物资信息')
  502. return;
  503. }
  504. // if(this.dicList.length > 0 && !this.dicList[0].F_IsBorrow){
  505. // this.$mHelper.toast('请选择对应物资信息')
  506. // return
  507. // }
  508. }
  509. if(this.identification === '2007'){
  510. const index = this.dicList.findIndex((o) => {
  511. return !o.F_ToDept || !o.F_DicName || !o.F_Number;
  512. });
  513. if (index >= 0) {
  514. this.$mHelper.toast('请选择对应物资信息')
  515. return;
  516. }
  517. // if(this.dicList.length > 0 && !this.dicList[0].F_ToDept){
  518. // this.$mHelper.toast('请选择对应物资信息')
  519. // return
  520. // }
  521. }
  522. if(this.identification === 'JC'||this.identification === 'FJ'){
  523. const index = this.dicList.findIndex((o) => {
  524. return !o.F_DicName || !o.F_Number;
  525. });
  526. if (index >= 0) {
  527. this.$mHelper.toast('请选择对应物资信息')
  528. return;
  529. }
  530. // if(this.dicList.length > 0 && !this.dicList[0].F_ToDept){
  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. console.log(this.valiFormData.ApplicationDept)
  544. this.$refs[ref].validate().then(res => {
  545. const params = {
  546. WorkOrderCategory: this.valiFormData.WorkOrderCategory, //工单类别
  547. ApplicationDept: this.valiFormData.ApplicationDept.split('_')[1], //申请部门
  548. Applicant: this.valiFormData.Applicant, //申请人
  549. Phone: this.valiFormData.Phone, //联系电话
  550. Location: this.valiFormData.Location, // 科室位置
  551. DeptPhone:this.valiFormData.DeptPhone,
  552. // ToPlace: this.valiFormData.ToPlace, // 送达地点
  553. Content: this.valiFormData.Content, // 工单内容
  554. DealDept: this.valiFormData.DealDept, // 维修部门
  555. DealMan: this.valiFormData.DealMan, // 维修人
  556. File: this.$mHelper.getImgString(this.imgIdList), // 文件
  557. detailists: this.dicList,
  558. opt: this.valiFormData.opt,
  559. // EmergencyTypes: this.valiFormData.EmergencyTypes,
  560. cfnum: this.redPrescriptionNum
  561. }
  562. if(this.workorderid) {
  563. params.WorkOrderCode = this.workorderid
  564. params.usertype = 1
  565. this.$mHelper.httpPost("Scheduling/UpdateSchedulingWorkOrder", this.serialize(params), 1, res => this.disabledButton = res)
  566. }else{
  567. this.$mHelper.httpPost("Scheduling/AddSchedulingWorkOrder", this.serialize(params), 1, res => this.disabledButton = res)
  568. }
  569. }).catch(err => {
  570. this.disabledButton = false
  571. console.log('err', err);
  572. })
  573. },
  574. serialize(obj, prefix) {
  575. const str = []
  576. let p
  577. if (obj.length === 0) {
  578. // str.push(encodeURIComponent(prefix) + '=1')
  579. } else {
  580. for (p in obj) {
  581. if (obj.hasOwnProperty(p)) {
  582. const k = prefix ? prefix + '[' + p + ']' : p
  583. let v = obj[p]
  584. if (v instanceof Date) {
  585. v = parseTime(v)
  586. }
  587. str.push((v !== null && typeof v === 'object') ? this.serialize(v, k) : encodeURIComponent(k) +'=' + encodeURIComponent(v))
  588. }
  589. }
  590. }
  591. return str.join('&')
  592. },
  593. getDetail() {
  594. const params = {
  595. WorkOrderCode: this.workorderid,
  596. type: 0
  597. }
  598. this.$http.get("Scheduling/GetWorkOrder", params).then((response) => {
  599. if (response.state.toLowerCase() === "success") {
  600. this.valiFormData.WorkOrderCategory = response.data[0].F_WorkOrderCategory // 工单类别
  601. this.valiFormData.Content = response.data[0].F_Content // 工单内容
  602. if(response.data[0].F_ApplicationDept) {
  603. this.valiFormData.ApplicationDept = response.data[0].F_ApplicationDept.trim() // 申请部门
  604. pageData.getApplicant(this.valiFormData.ApplicationDept, (res) => {
  605. this.ApplicantData = res
  606. })
  607. this.valiFormData.ApplicantName = this.$mHelper.findUserName(this.ApplicantData, response.data[0].F_Applicant)
  608. this.valiFormData.Applicant = response.data[0].F_Applicant //申请人
  609. }
  610. this.valiFormData.Phone = response.data[0].F_Phone // 联系电话
  611. this.valiFormData.DeptPhone = response.data[0].F_DeptPhone
  612. this.valiFormData.Location = response.data[0].F_Location
  613. // this.valiFormData.ToPlace = response.data[0].F_ToPlace
  614. this.valiFormData.File = response.data[0].F_File
  615. // this.valiFormData.EmergencyTypes = response.data[0].F_EmergencyTypes
  616. const ps = []
  617. response.data[0].PSInfo.forEach(v => {
  618. ps.push({
  619. F_DicId: v.F_DicId,
  620. F_DicName: v.F_DicName,
  621. F_Number: v.F_Number
  622. })
  623. })
  624. this.dicList = ps
  625. if (response.data[0].FileUrl) {
  626. response.data[0].FileUrl.forEach((v, n) => {
  627. //详情图片回显
  628. this.fileLists.push({
  629. url: v.F_FileUrl,
  630. extname: v.F_FileType,
  631. name: v.F_FileName.substring(19),
  632. id:v.F_FileId
  633. })
  634. })
  635. }
  636. }
  637. }).catch((e) => {
  638. console.log(e);
  639. })
  640. },
  641. // 上传图片
  642. getImgData(data) {
  643. this.clickImgState = 1
  644. this.imgIdList = data
  645. },
  646. }
  647. }
  648. </script>
  649. <style lang="scss" scoped>
  650. @import '@/common/addFormDeep.scss';
  651. .wrapper {
  652. padding: 10px 15px;
  653. background-color: #fff;
  654. .form {
  655. .infoTittle {
  656. align-items: center;
  657. text-align: left;
  658. font-size: 14px;
  659. color: #606266;
  660. height: 36px;
  661. padding: 0 12px 0 0;
  662. vertical-align: middle;
  663. flex-shrink: 0;
  664. // box-sizing: border-box;
  665. margin-right: 10px;
  666. }
  667. .dicSelect {
  668. width: 65%;
  669. display: inline-block;
  670. margin-right: 10px;
  671. margin-bottom: 15px;
  672. }
  673. .dicNum {
  674. width: 30%;
  675. display: inline-block;
  676. }
  677. /deep/.uni-icons[data-v-a2e81f6e] {
  678. vertical-align: middle;
  679. }
  680. .point {
  681. color: #f00;
  682. vertical-align: middle;
  683. margin-right: 2px;
  684. }
  685. }
  686. }
  687. </style>