earlyHandover.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. <template>
  2. <el-dialog
  3. v-loading="loading"
  4. :title="title"
  5. :visible.sync="dialogVisible"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. :show-close="false"
  9. append-to-body
  10. fullscreen
  11. class="dialog paper-detail-dialog"
  12. top="0"
  13. >
  14. <div slot="title" class="dialog-title">
  15. <span class="dialogtitle">{{ title }}</span>
  16. <div>
  17. <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
  18. </div>
  19. </div>
  20. <div class="container">
  21. <div class="left" :style="{width:initWidth}">
  22. <el-form ref="form" inline :model="form" label-width="120px" :rules="rules">
  23. <el-row>
  24. <el-col>
  25. <el-alert type="success" :closable="false" title="交班内容" class="title" />
  26. </el-col>
  27. </el-row>
  28. <el-row>
  29. <el-col :span="8">
  30. <el-form-item label="夜班交接人:" prop="ye_ban_jiao_ban_r">
  31. <ibps-user-selector
  32. v-model="form.ye_ban_jiao_ban_r"
  33. type="user"
  34. readonly-text="text"
  35. :disabled="readonly"
  36. :multiple="false"
  37. size="mini"
  38. style="width:200px"
  39. :filter="filter"
  40. filtrate
  41. />
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="8">
  45. <el-form-item label="交班时间:" prop="jiao_ban_shi_jian">
  46. <el-date-picker
  47. v-model="form.jiao_ban_shi_jian"
  48. type="date"
  49. placeholder="选择日期"
  50. :readonly="isEdit"
  51. value-format="yyyy-MM-dd"
  52. size="mini"
  53. class="item"
  54. />
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. <el-row>
  59. <el-col>
  60. <el-alert type="success" :closable="false" title="夜班标本处理情况" class="title" />
  61. </el-col>
  62. </el-row>
  63. <el-row>
  64. <el-col :span="8" style="display:flex;">
  65. <el-form-item label="交班标本:" prop="jiao_ban_biao_ben">
  66. <el-input
  67. v-model="form.jiao_ban_biao_ben"
  68. size="mini"
  69. type="number"
  70. oninput="value=value.replace(/[^\d]/g,'')"
  71. :readonly="readonly"
  72. />
  73. </el-form-item>
  74. <span style="margin-top:8px">例</span>
  75. </el-col>
  76. <el-col :span="8" style="display:flex;">
  77. <el-form-item label="未处理标本:" prop="wei_chu_li_biao_b">
  78. <el-input
  79. v-model="form.wei_chu_li_biao_b"
  80. size="mini"
  81. type="number"
  82. oninput="value=value.replace(/[^\d]/g,'')"
  83. :readonly="readonly"
  84. />
  85. </el-form-item>
  86. <span style="margin-top:8px">例</span>
  87. </el-col>
  88. <el-col :span="8" style="display:flex;">
  89. <el-form-item label="未发报告:" prop="wei_fa_bao_gao_">
  90. <el-input
  91. v-model="form.wei_fa_bao_gao_"
  92. size="mini"
  93. type="number"
  94. oninput="value=value.replace(/[^\d]/g,'')"
  95. :readonly="readonly"
  96. />
  97. </el-form-item>
  98. <span style="margin-top:8px">例</span>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col>
  103. <el-alert type="success" :closable="false" title="危急值报告" class="title" />
  104. </el-col>
  105. </el-row>
  106. <el-row>
  107. <el-col :span="8" style="display:flex;">
  108. <el-form-item label="共:" prop="wei_ji_zhi_bao_ga">
  109. <el-input
  110. v-model="form.wei_ji_zhi_bao_ga"
  111. size="mini"
  112. type="number"
  113. oninput="value=value.replace(/[^\d]/g,'')"
  114. :readonly="readonly"
  115. />
  116. </el-form-item>
  117. <span style="margin-top:8px">例</span>
  118. </el-col>
  119. <el-col :span="8" style="display:flex;">
  120. <el-form-item label="确认:" prop="bao_gao_que_ren_">
  121. <el-input
  122. v-model="form.bao_gao_que_ren_"
  123. size="mini"
  124. type="number"
  125. oninput="value=value.replace(/[^\d]/g,'')"
  126. :readonly="readonly"
  127. />
  128. </el-form-item>
  129. <span style="margin-top:8px">例</span>
  130. </el-col>
  131. <el-col :span="8">
  132. <el-form-item label="未确认科室:" prop="wei_que_ren_ke_sh">
  133. <el-input v-model="form.wei_que_ren_ke_sh" size="mini" :readonly="readonly" />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="8" style="display:flex;">
  139. <el-form-item label="末梢血采集数量:" prop="mo_shao_xie_cai_j">
  140. <el-input
  141. v-model="form.mo_shao_xie_cai_j"
  142. size="mini"
  143. type="number"
  144. oninput="value=value.replace(/[^\d]/g,'')"
  145. :readonly="readonly"
  146. />
  147. </el-form-item>
  148. <span style="margin-top:8px">例</span>
  149. </el-col>
  150. </el-row>
  151. <el-row>
  152. <el-col>
  153. <el-alert type="success" :closable="false" title="标本漏检漏发查询" class="title" />
  154. </el-col>
  155. </el-row>
  156. <el-row>
  157. <el-col :span="8">
  158. <el-form-item label="是否查漏:" prop="biao_ben_cha_lou_">
  159. <el-radio v-model="form.biao_ben_cha_lou_" label="是" size="mini" :disabled="readonly">是</el-radio>
  160. <el-radio v-model="form.biao_ben_cha_lou_" label="否" size="mini" :disabled="readonly">否</el-radio>
  161. </el-form-item>
  162. </el-col>
  163. <!-- <el-col :span="8">
  164. <el-form-item label="是否有漏发漏检:">
  165. <el-radio v-model="form.lou_fa_lou_jian_" label="无" size="mini">无</el-radio>
  166. <el-radio v-model="form.lou_fa_lou_jian_" label="有" size="mini">有</el-radio>
  167. </el-form-item>
  168. </el-col> -->
  169. <el-col v-if="form.biao_ben_cha_lou_==='是'" :span="8" style="display:flex;">
  170. <el-form-item label="漏发漏检共:" prop="yi_lou_shu_liang_">
  171. <el-input
  172. v-model="form.yi_lou_shu_liang_"
  173. size="mini"
  174. type="number"
  175. oninput="value=value.replace(/[^\d]/g,'')"
  176. :readonly="readonly"
  177. />
  178. </el-form-item>
  179. <span style="margin-top:8px">例</span>
  180. </el-col>
  181. </el-row>
  182. <el-row>
  183. <el-col>
  184. <el-alert type="success" :closable="false" title="夜班安全巡查有无特殊情况" class="title" />
  185. </el-col>
  186. </el-row>
  187. <el-row>
  188. <el-col :span="8">
  189. <el-form-item label="有无特殊情况:" prop="xun_cha_qing_kuan">
  190. <el-radio v-model="form.xun_cha_qing_kuan" label="无" size="mini" :disabled="readonly">无</el-radio>
  191. <el-radio v-model="form.xun_cha_qing_kuan" label="有" size="mini" :disabled="readonly">有</el-radio>
  192. </el-form-item>
  193. </el-col>
  194. <el-col v-if="form.xun_cha_qing_kuan==='有'" :span="16">
  195. <el-form-item label="情况描述:" prop="xun_cha_miao_shu_">
  196. <el-input v-model="form.xun_cha_miao_shu_" size="mini" type="textarea" :rows="1" style="width:570px" :readonly="readonly" />
  197. </el-form-item>
  198. </el-col>
  199. </el-row>
  200. <el-row>
  201. <el-col>
  202. <el-alert type="success" :closable="false" title="特殊结果或临床沟通" class="title" />
  203. </el-col>
  204. </el-row>
  205. <el-row>
  206. <el-col :span="8">
  207. <el-form-item label="临床科室:" prop="lin_chuang_ke_shi">
  208. <el-input v-model="form.lin_chuang_ke_shi" size="mini" :readonly="readonly" />
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="8">
  212. <el-form-item label="病例号:" prop="bing_li_hao_">
  213. <el-input v-model="form.bing_li_hao_" size="mini" :readonly="readonly" />
  214. </el-form-item>
  215. </el-col>
  216. <el-col :span="8">
  217. <el-form-item label="检验项目及结果:" prop="jian_ce_jie_guo_">
  218. <el-input v-model="form.jian_ce_jie_guo_" size="mini" :readonly="readonly" />
  219. </el-form-item>
  220. </el-col>
  221. </el-row>
  222. <el-row>
  223. <el-col :span="16">
  224. <el-form-item label="沟通内容及结果:" prop="gou_tong_jie_guo_">
  225. <el-input v-model="form.gou_tong_jie_guo_" size="mini" type="textarea" :rows="1" style="width:112%" :readonly="readonly" />
  226. </el-form-item>
  227. </el-col>
  228. </el-row>
  229. <el-row>
  230. <el-col :span="24">
  231. <el-form-item label="其他异常情况:" prop="qi_ta_qing_kuang_">
  232. <el-input v-model="form.qi_ta_qing_kuang_" size="mini" type="textarea" :rows="1" style="width:1000px" placeholder="人员是否按时到岗、有无试剂短缺、LIS系统是否有问题、设备有无故障等" :readonly="readonly" />
  233. </el-form-item>
  234. </el-col>
  235. </el-row>
  236. <el-alert v-if="!isEdit" type="success" :closable="false" class="title">表单填写完成并保存后会开启早会签到</el-alert>
  237. <el-row>
  238. <el-col :span="24">
  239. <el-form-item label="早会内容:" prop="zao_hui_nei_rong_">
  240. <el-input v-model="form.zao_hui_nei_rong_" size="mini" type="textarea" :rows="1" style="width:1000px" :readonly="readonly" />
  241. </el-form-item>
  242. </el-col>
  243. </el-row>
  244. <el-row v-if="isEdit">
  245. <el-col :span="24">
  246. <el-form-item label="手动签到:" prop="shou_dong_qian_da">
  247. <ibps-user-selector
  248. v-model="form.shou_dong_qian_da"
  249. type="user"
  250. readonly-text="text"
  251. :disabled="readonly"
  252. :multiple="true"
  253. size="mini"
  254. style="width:1000px"
  255. :filter="filter"
  256. filtrate
  257. />
  258. </el-form-item>
  259. </el-col>
  260. </el-row>
  261. <el-row v-if="isFinished">
  262. <el-col :span="24">
  263. <el-form-item label="实际签到人员:" prop="shi_ji_qian_dao_r">
  264. <ibps-user-selector
  265. v-model="form.shi_ji_qian_dao_r"
  266. type="user"
  267. readonly-text="text"
  268. :disabled="true"
  269. :multiple="true"
  270. size="mini"
  271. style="width:1000px"
  272. />
  273. </el-form-item>
  274. </el-col>
  275. </el-row>
  276. </el-form>
  277. </div>
  278. </div>
  279. <QrcodeedDialog v-if="QrcodeedDialogShow" :visible="true" :code-id="codeId" />
  280. <BarcodeDialog v-if="BarcodeDialogShow" :visible="true" :func="(value) => getBarcodeData(value, form.id_)" />
  281. <RegisterInfo
  282. v-if="RegisterInfoShow"
  283. :params="{addPeople:form.shou_dong_qian_da,tableName:'t_jykzjbdjb',
  284. guan_lian_id_:form.id_}"
  285. />
  286. <!-- <div slot="footer" class="el-dialog--center">
  287. <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
  288. </div> -->
  289. </el-dialog>
  290. </template>
  291. <script>
  292. import dayjs from 'dayjs'
  293. import ibpsUserSelector from '@/business/platform/org/selector'
  294. import QrcodeedDialog from '@/views/component/qrcodeedDialog.vue' // 扫码
  295. import BarcodeDialog from '@/views/component/trainingManage/barcodeDialog.vue' // 扫码枪签到组件
  296. import RegisterInfo from '@/views/component/trainingManage/registerInfoDialog.vue' // 新版签到信息
  297. export default {
  298. components: {
  299. ibpsUserSelector,
  300. QrcodeedDialog,
  301. BarcodeDialog,
  302. RegisterInfo
  303. },
  304. props: {
  305. params: {
  306. type: Object,
  307. default: function () {
  308. return {}
  309. }
  310. }
  311. },
  312. data () {
  313. const { userId, position, level } = this.$store.getters
  314. return {
  315. filter: [{
  316. descVal: '1',
  317. includeSub: true,
  318. old: 'position',
  319. partyId: this.$store.getters.userInfo.employee.positions,
  320. partyName: '',
  321. scriptContent: '',
  322. type: 'user',
  323. userType: 'position'
  324. }],
  325. codeId: '', // 扫码签到
  326. RegisterInfoShow: false,
  327. QrcodeedDialogShow: false,
  328. BarcodeDialogShow: false,
  329. rules: {
  330. ye_ban_jiao_ban_r: [
  331. { required: true, trigger: 'blur', message: '请填写必填项' }
  332. ],
  333. jiao_ban_shi_jian: [
  334. { required: true, trigger: 'blur', message: '请填写必填项' }
  335. ],
  336. jiao_ban_biao_ben: [
  337. { required: true, trigger: 'blur', message: '请填写必填项' }
  338. ],
  339. wei_chu_li_biao_b: [
  340. { required: true, trigger: 'blur', message: '请填写必填项' }
  341. ],
  342. wei_fa_bao_gao_: [
  343. { required: true, trigger: 'blur', message: '请填写必填项' }
  344. ],
  345. wei_ji_zhi_bao_ga: [
  346. { required: true, trigger: 'blur', message: '请填写必填项' }
  347. ],
  348. bao_gao_que_ren_: [
  349. { required: true, trigger: 'blur', message: '请填写必填项' }
  350. ],
  351. wei_que_ren_ke_sh: [
  352. { required: true, trigger: 'blur', message: '请填写必填项' }
  353. ],
  354. mo_shao_xie_cai_j: [
  355. { required: true, trigger: 'blur', message: '请填写必填项' }
  356. ],
  357. biao_ben_cha_lou_: [
  358. { required: true, trigger: 'blur', message: '请填写必填项' }
  359. ],
  360. xun_cha_qing_kuan: [
  361. { required: true, trigger: 'blur', message: '请填写必填项' }
  362. ]
  363. },
  364. dialogVisible: true,
  365. isFirst: true,
  366. userId: userId,
  367. position: position,
  368. level: level.second || level.first,
  369. loading: false,
  370. title: '检验科早交班登记表',
  371. toolbars: [
  372. { key: 'save', label: '保存', hidden: () => { return this.isFinished } },
  373. { key: 'scanRegister', label: '二维码签到', hidden: () => { return !this.isEdit || this.isFinished } },
  374. { key: 'gunRegister', label: '扫码枪签到', hidden: () => { return !this.isEdit || this.isFinished } },
  375. { key: 'registerInfo', label: '签到信息', hidden: () => { return !this.isEdit } },
  376. { key: 'submit', label: '提交', icon: 'el-icon-finished', hidden: () => { return !this.isEdit || this.isFinished } },
  377. { key: 'cancel', label: '退出', type: 'danger', icon: 'ibps-icon-close' }
  378. ],
  379. initWidth: '1280px',
  380. isEdit: false,
  381. isFinished: false,
  382. readonly: false,
  383. preParams: {},
  384. Ids: [],
  385. form: {
  386. ye_ban_jiao_ban_r: '',
  387. jiao_ban_shi_jian: '',
  388. jiao_ban_biao_ben: '',
  389. wei_chu_li_biao_b: '',
  390. wei_fa_bao_gao_: '',
  391. wei_ji_zhi_bao_ga: '',
  392. bao_gao_que_ren_: '',
  393. wei_que_ren_ke_sh: '',
  394. mo_shao_xie_cai_j: '',
  395. biao_ben_cha_lou_: '',
  396. // lou_fa_lou_jian_: '',
  397. yi_lou_shu_liang_: '',
  398. xun_cha_qing_kuan: '',
  399. xun_cha_miao_shu_: '',
  400. lin_chuang_ke_shi: '',
  401. bing_li_hao_: '',
  402. jian_ce_jie_guo_: '',
  403. gou_tong_jie_guo_: '',
  404. qi_ta_qing_kuang_: '',
  405. zao_hui_nei_rong_: '',
  406. shou_dong_qian_da: ''
  407. }
  408. }
  409. },
  410. watch: {
  411. 'form.biao_ben_cha_lou_': {
  412. handler (val) {
  413. if (val === '否') {
  414. this.form.yi_lou_shu_liang_ = ''
  415. }
  416. }
  417. },
  418. 'form.xun_cha_qing_kuan': {
  419. handler (val) {
  420. if (val === '无') {
  421. this.form.xun_cha_miao_shu_ = ''
  422. }
  423. }
  424. }
  425. },
  426. mounted () {
  427. this.init()
  428. },
  429. methods: {
  430. handleActionEvent ({ key }) {
  431. switch (key) {
  432. case 'cancel':
  433. this.closeDialog(true)
  434. break
  435. case 'save':
  436. this.goSave('close')
  437. break
  438. case 'registerInfo':
  439. this.goRegisterInfo()
  440. break
  441. case 'gunRegister':
  442. this.goGunRegister()
  443. break
  444. case 'scanRegister':
  445. this.goScanRegister()
  446. break
  447. case 'submit':
  448. this.goSubmit()
  449. break
  450. default:
  451. break
  452. }
  453. },
  454. goRegisterInfo () {
  455. if (this.RegisterInfoShow) {
  456. this.RegisterInfoShow = false
  457. }
  458. this.$nextTick(() => {
  459. this.RegisterInfoShow = true
  460. })
  461. },
  462. async goGunRegister () {
  463. try {
  464. await this.getIsFinish()
  465. if (this.BarcodeDialogShow) {
  466. this.BarcodeDialogShow = false
  467. } else {
  468. this.BarcodeDialogShow = true
  469. }
  470. } catch (error) {
  471. this.$message.warning(error.message)
  472. }
  473. },
  474. async goScanRegister () {
  475. try {
  476. await this.getIsFinish()
  477. if (this.QrcodeedDialogShow) {
  478. this.QrcodeedDialogShow = false
  479. }
  480. // const sql = `select * FROM t_qrcodeb WHERE guan_lian_id_ = '${this.params.id_}'`
  481. this.$common.request('query', {
  482. key: 'getQrcodeByBizKey',
  483. params: [this.params.id_]
  484. }).then(res => {
  485. const cont = res.variables.data
  486. if (cont.length === 0) {
  487. const arr = []
  488. arr.push({ 'label': '早会内容', 'value': this.form.zao_hui_nei_rong_, 'key': 'zaoHuiNeiRong' })
  489. // 字段需要继续添加
  490. const addParams = {
  491. tableName: 't_qrcodeb',
  492. paramWhere: [{
  493. guan_lian_id_: this.params.id_,
  494. biao_ming_: 't_jykzjbdjb',
  495. zhuang_tai_: '生效',
  496. xiang_xi_xin_xi_: JSON.stringify(arr)
  497. }]
  498. }
  499. this.$common.request('add', addParams).then(res => {
  500. const conts = res.variables.cont
  501. this.codeId = conts[0].id_
  502. this.QrcodeedDialogShow = true
  503. })
  504. } else {
  505. this.codeId = cont[0].id_
  506. this.QrcodeedDialogShow = true
  507. }
  508. })
  509. } catch (error) {
  510. this.$message.warning(error.message)
  511. }
  512. },
  513. // 扫码枪签到返回的数据
  514. async getBarcodeData (value, variable) {
  515. if (!variable) {
  516. variable = this.form.id_
  517. }
  518. var jsonString = value
  519. var jsonObject = JSON.parse(jsonString)
  520. var idValue = jsonObject.id
  521. const { userList = [] } = this.$store.getters || {}
  522. // 根据工号查人员姓名,查得到
  523. // 插入数据,签到成功 第一次插入,插入重复
  524. // 查不到,请扫描正确的二维码
  525. const user = userList.find(i => i.userId === idValue)
  526. if (!user) {
  527. this.$message.warning('当前二维码无效,请使用正确的二维码进行扫描!')
  528. return
  529. }
  530. // const sql = `select * FROM t_qdxxb WHERE guan_lian_id_='${variable}'`
  531. this.$common.request('query', {
  532. key: 'getSignInfoByBizKey',
  533. params: [variable]
  534. }).then(response => {
  535. const { data = [] } = response.variables || {}
  536. const isExist = data.some(i => i.ren_yuan_id_ === idValue)
  537. if (isExist) {
  538. this.$message.warning('该人员已签到,请勿重复扫码!')
  539. return
  540. }
  541. // 数据存在
  542. // 插入数据,签到成功 第一次插入,插入重复
  543. const addParams = {
  544. tableName: 't_qdxxb',
  545. paramWhere: [{
  546. guan_lian_id_: variable,
  547. ren_yuan_id_: idValue,
  548. qian_dao_shi_jian: this.$common.getDateNow(19),
  549. ye_wu_biao_ming_: 't_jykzjbdjb'
  550. }]
  551. }
  552. this.$common.request('add', addParams).then(() => {
  553. console.log('添加签到数据成功')
  554. this.$message.success('亲爱的 [' + user.userName + '],签到成功!感谢您的参与,希望您今天充满活力,工作顺利,心情愉快!')
  555. })
  556. })
  557. },
  558. // 获取人员部门
  559. getPersonPosition (id) {
  560. const userList = this.$store.getters.userList
  561. const bianzhiUserid = userList.find(i => i.userId === id)
  562. if (bianzhiUserid) {
  563. return bianzhiUserid.positionId
  564. }
  565. },
  566. checkRequired (flag) {
  567. // 新增的时候需要验证交班时间不早于当前
  568. if (flag) {
  569. // 获取今天零点的时间戳
  570. const today = new Date().setHours(0, 0, 0, 0)
  571. const selectedTime = new Date(this.form.jiao_ban_shi_jian).getTime()
  572. if (selectedTime < today) {
  573. this.$message.warning('交班时间不能早于当前时间!')
  574. return false
  575. }
  576. }
  577. if (this.form.biao_ben_cha_lou_ === '是' && !this.form.yi_lou_shu_liang_) {
  578. this.$message.warning('请填写漏发漏检数量!')
  579. return false
  580. }
  581. if (this.form.xun_cha_qing_kuan === '有' && !this.form.xun_cha_miao_shu_) {
  582. this.$message.warning('请填写情况描述!')
  583. return false
  584. }
  585. if (+this.form.bao_gao_que_ren_ > +this.form.wei_ji_zhi_bao_ga) {
  586. this.$message.warning('危急值报告确认数不能大于总数!')
  587. return false
  588. }
  589. return true
  590. },
  591. // 快照URL
  592. getReportParams (path, selection, data) {
  593. const { level } = this.$store.getters
  594. const str = `org_=${level.first}&second_=${level.second}&id_=`
  595. const arr = path.split('&')
  596. if (arr.length === 2) {
  597. const fieldArr = arr[1].split('=')
  598. return str + `${data[fieldArr[1]]}`
  599. } else {
  600. // 如果是没有传参,还是原报表路径
  601. return str + `${selection}`
  602. }
  603. },
  604. // 判断状态是否已结束
  605. async getIsFinish () {
  606. // const sql = `select * from t_jykzjbdjb where id_ = '${this.form.id_}'`
  607. const { variables: { data }} = await this.$common.request('query', {
  608. key: 'getEarlyHandoverState',
  609. params: [this.form.id_]
  610. })
  611. if (data[0]?.shi_fou_guo_shen_ === '已完成') {
  612. throw new Error('已完成,无法操作!')
  613. }
  614. },
  615. async goSubmit () {
  616. try {
  617. this.$refs.form.validate((valid) => {
  618. if (valid) {
  619. if (!this.checkRequired()) return
  620. this.$confirm('提交后数据不可更改,是否确认保存并提交?', '提示', {
  621. confirmButtonText: '确定',
  622. cancelButtonText: '取消',
  623. type: 'warning'
  624. }).then(async () => {
  625. // 提交自动保存
  626. await this.goEdit()
  627. // 1.确定最终签到人员
  628. // const sql3 = `select * from t_qdxxb where guan_lian_id_='${this.params.id_}'`
  629. const { variables: { data: data3 }} = await this.$common.request('query', {
  630. key: 'getSignInfoByBizKey',
  631. params: [this.params.id_]
  632. })
  633. const peopleList = [...new Set(data3.map(item => item.ren_yuan_id_))]
  634. const shi_ji_qian_dao_r = peopleList.join(',') || ''
  635. if (!shi_ji_qian_dao_r) {
  636. return false
  637. }
  638. const formName = '人员/检验科早交班登记表.rpx'
  639. const res = await this.$common.snapshoot({
  640. url: this.$getReportFile(formName, this.getReportParams(formName, this.params.id_, {
  641. ...this.preParams,
  642. shi_ji_qian_dao_r,
  643. shi_fou_guo_shen_: '已完成'
  644. })),
  645. name: this.params.id_,
  646. type: 'pdf'
  647. })
  648. // 3.更新
  649. const updateParamsRecord = {
  650. tableName: 't_jykzjbdjb',
  651. updList: [{
  652. where: {
  653. id_: this.form.id_
  654. },
  655. param: {
  656. shi_fou_guo_shen_: '已完成',
  657. shi_ji_qian_dao_r,
  658. kuai_zhao_: res.data.id
  659. }
  660. }]
  661. }
  662. await this.$common.request('update', updateParamsRecord)
  663. this.closeDialog(true)
  664. this.$message.success('提交成功')
  665. }).catch(() => {
  666. })
  667. } else {
  668. console.log('error submit!!')
  669. return false
  670. }
  671. })
  672. } catch (error) {
  673. this.$message.warning(error.message)
  674. }
  675. },
  676. async goAdd () {
  677. try {
  678. const addParamsRecord = {
  679. tableName: 't_jykzjbdjb',
  680. paramWhere: [{
  681. ...this.form,
  682. shi_fou_guo_shen_: '签到中'
  683. }]
  684. }
  685. const { variables: { cont }} = await this.$common.request('add', addParamsRecord)
  686. if (cont.length) {
  687. this.$message.success('添加成功')
  688. this.closeDialog(true)
  689. }
  690. } catch (error) {
  691. console.log(error)
  692. this.$message.warning('添加失败')
  693. }
  694. },
  695. async goEdit (flag) {
  696. try {
  697. // 首先判断状态是否结束
  698. await this.getIsFinish()
  699. // 1.确定最终签到人员
  700. // const sql3 = `select * from t_qdxxb where guan_lian_id_='${this.params.id_}'`
  701. const { variables: { data: data3 }} = await this.$common.request('query', {
  702. key: 'getSignInfoByBizKey',
  703. params: [this.params.id_]
  704. })
  705. const tempPeople = this.form.shou_dong_qian_da?.split(',') || []
  706. const autoSigners = data3.filter(item => item.qian_dao_lei_xing !== '手动').map(item => item.ren_yuan_id_)
  707. const peopleList = [...new Set([...tempPeople, ...autoSigners])]
  708. const shi_ji_qian_dao_r = peopleList.length ? peopleList.join(',') : ''
  709. // 2.更新主表展示内容
  710. const updateParamsRecord = {
  711. tableName: 't_jykzjbdjb',
  712. updList: [{
  713. where: {
  714. id_: this.form.id_
  715. },
  716. param: {
  717. ...this.form,
  718. shi_ji_qian_dao_r
  719. }
  720. }]
  721. }
  722. await this.$common.request('update', updateParamsRecord)
  723. // 3.更新签到人员
  724. const curIds = this.form.shou_dong_qian_da?.split(',') || [];
  725. // 计算需要增加的id
  726. const addedIds = curIds.filter(id => !this.Ids.includes(id))
  727. // 计算需要更新的id
  728. const updatedIds = curIds.filter(id => this.Ids.includes(id))
  729. // 计算需要删除的id
  730. const deletedIds = this.Ids.filter(id => !updatedIds.includes(id))
  731. console.log(addedIds, updatedIds, deletedIds)
  732. if (addedIds.length > 0) {
  733. const params = {
  734. tableName: 't_qdxxb',
  735. paramWhere: addedIds.map(id => ({
  736. guan_lian_id_: this.params.id_,
  737. ren_yuan_id_: id,
  738. qian_dao_shi_jian: this.$common.getDateNow(19),
  739. qian_dao_lei_xing: '手动',
  740. ye_wu_biao_ming_: 't_jykzjbdjb'
  741. }))
  742. }
  743. await this.$common.request('add', params).then(res => {
  744. console.log('签到数据增加成功')
  745. })
  746. }
  747. if (deletedIds.length > 0) {
  748. const deleteItem = data3.filter(item => deletedIds.includes(item.ren_yuan_id_) && item.qian_dao_lei_xing === '手动').map(item => item.id_)
  749. if (!deleteItem || !deleteItem.length) {
  750. return
  751. }
  752. const params = {
  753. tableName: 't_qdxxb',
  754. paramWhere: {
  755. id_: deleteItem.join(',')
  756. }
  757. }
  758. await this.$common.request('delete', params).then(res => {
  759. console.log('签到数据删除成功')
  760. })
  761. }
  762. if (flag === 'close') {
  763. this.closeDialog(true)
  764. this.$message.success('修改成功')
  765. } else {
  766. this.init()
  767. }
  768. } catch (error) {
  769. this.$message.warning(error.message)
  770. throw new Error(error.message)
  771. }
  772. },
  773. goSave (flag) {
  774. this.$refs.form.validate((valid) => {
  775. if (valid) {
  776. if (!this.checkRequired(this.isEdit ? null : true)) return
  777. if (this.isEdit) {
  778. this.goEdit(flag)
  779. } else {
  780. this.goAdd()
  781. }
  782. } else {
  783. console.log('error submit!!')
  784. return false
  785. }
  786. })
  787. },
  788. // 刷新
  789. async goRefresh () {
  790. },
  791. // 关闭当前窗口
  792. closeDialog (needRefresh) {
  793. this.dialogVisible = false
  794. if (needRefresh) {
  795. this.$emit('close')
  796. }
  797. },
  798. async init () {
  799. this.isEdit = !!(this.params && this.params.id_)
  800. if (this.isEdit) {
  801. if (this.params.shou_dong_qian_da) {
  802. this.Ids = this.params.shou_dong_qian_da.split(',')
  803. } else {
  804. this.Ids = []
  805. }
  806. this.preParams = JSON.parse(JSON.stringify(this.params))
  807. this.form = this.params
  808. this.isFinished = this.params && this.params.shi_fou_guo_shen_ === '已完成'
  809. this.readonly = this.isFinished
  810. } else {
  811. this.form.ye_ban_jiao_ban_r = this.userId
  812. this.form.jiao_ban_shi_jian = dayjs().format('YYYY-MM-DD')
  813. this.form.di_dian_ = this.level
  814. this.form.bian_zhi_bu_men_ = this.position
  815. this.form.bian_zhi_ren_ = this.userId
  816. this.form.bian_zhi_shi_jian = dayjs().format('YYYY-MM-DD HH:mm:ss')
  817. this.form.biao_ben_cha_lou_ = '是'
  818. this.form.xun_cha_qing_kuan = '无'
  819. }
  820. }
  821. }
  822. }
  823. </script>
  824. <style lang="scss" scoped>
  825. .paper-detail-dialog {
  826. ::v-deep {
  827. .el-dialog__header {
  828. text-align: center;
  829. }
  830. }
  831. .dialog-title{
  832. display: flex;
  833. align-items: center;
  834. justify-content: center;
  835. div{
  836. z-index: 99999999;
  837. position: absolute;
  838. right:8vw;
  839. }
  840. .dialogtitle{
  841. font-size: 22px;
  842. font-family: SimHei;
  843. font-weight: bold;
  844. color: #222;
  845. }
  846. }
  847. .container {
  848. display: flex;
  849. width: 100%;
  850. justify-content: center;
  851. .left{
  852. height: calc(100vh - 100px);
  853. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  854. padding:20px 10px 0 40px;
  855. overflow-y: auto;
  856. .item{
  857. width: 100%;
  858. }
  859. .title{
  860. margin: 16px 0 6px -16px;
  861. }
  862. }
  863. .right{
  864. height: calc(100vh - 100px);
  865. flex: 1;
  866. padding:20px 10px 0 10px;
  867. .text{
  868. line-height: 1.5;
  869. }
  870. overflow-y: auto;
  871. }
  872. }
  873. }
  874. ::v-deep {
  875. .el-form-item__label{
  876. text-align: left
  877. }
  878. }
  879. </style>