earlyHandover.vue 39 KB

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