人民医院前端

addComDispatch.vue 25KB

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