人民医院前端

addComDispatch.vue 25KB

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