| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- <template>
- <el-dialog
- :title="title"
- :visible.sync="dialogVisible"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="60%"
- class="dialog enrolled-dialog"
- top="6vh"
- @close="closeDialog"
- @open="getShiftHandoverData"
- >
- <el-form
- ref="ruleForm"
- :model="ruleForm"
- :rules="rules"
- label-width="110px"
- class="demo-ruleForm"
- >
- <!-- 主表选择 -->
- <el-row :gutter="30">
- <el-col :span="8">
- <el-form-item label="部门" prop="deng_ji_bu_men_">
- <ibps-user-selector
- v-model="ruleForm.deng_ji_bu_men_"
- type="position"
- readonly-text="text"
- :disabled="!editPermissions"
- :multiple="false"
- /> </el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item label="岗位" prop="gang_wei_">
- <!-- <el-input v-model="ruleForm.gang_wei_" type="text" :disabled="!editPermissions" /> -->
- <el-select
- v-model="ruleForm.gang_wei_"
- placeholder="请选择"
- size="mini"
- style="width: 100%"
- :disabled="!editPermissions"
- >
- <el-option
- v-for="item in filterData"
- :key="item.positionId"
- :label="item.positionName"
- :value="item.positionName"
- />
- </el-select>
- </el-form-item>
- <!-- <ibps-link-data
- v-model="ruleForm.gang_wei_"
- style="width:80%"
- size="mini"
- template-key="jcgwxz"
- :multiple="false"
- :temp-search="true"
- /> -->
- </el-col>
- <el-col :span="8">
- <el-form-item label="日期" prop="deng_ji_shi_jian_">
- <el-date-picker
- v-model="ruleForm.deng_ji_shi_jian_"
- type="date"
- placeholder="选择日期"
- style="width: 100%"
- :disabled="!editPermissions"
- /> </el-form-item
- ></el-col>
- </el-row>
- <el-form-item label=" 班次" prop="ban_ci_">
- <span v-if="editPermissions">早班</span>
- <span v-else>{{
- parentData.zhuang_tai_ === '已早交班'
- ? '午班'
- : parentData.zhuang_tai_ === '已午交班'
- ? '晚班'
- : ''
- }}</span>
- <!-- <span v-else>{{ ruleForm.ban_ci_ }}</span> -->
- </el-form-item>
- <el-row :gutter="30">
- <el-col :span="8"
- ><div class="grid-content bg-purple-dark">
- <el-form-item label="交班标本(例)" prop="jiao_ban_biao_ben">
- <el-input
- v-model.number="ruleForm.jiao_ban_biao_ben"
- style="width: 100%"
- /> </el-form-item></div
- ></el-col>
- <el-col :span="8"
- ><div class="grid-content bg-purple-dark">
- <el-form-item label="未处理标本(例)" prop="wei_chu_li_biao_b">
- <el-input
- v-model.number="ruleForm.wei_chu_li_biao_b"
- style="width: 100%"
- /> </el-form-item></div
- ></el-col>
- <el-col :span="8"
- ><div class="grid-content bg-purple-dark">
- <el-form-item label="未发报告(例)" prop="wei_fa_bao_gao_">
- <el-input
- v-model.number="ruleForm.wei_fa_bao_gao_"
- style="width: 100%"
- /> </el-form-item></div
- ></el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="8">
- <div class="grid-content bg-purple-dark">
- <el-form-item label="是否查漏" prop="shi_fou_cha_lou_" required>
- <el-radio-group v-model="ruleForm.shi_fou_cha_lou_">
- <el-radio label="是" />
- <el-radio label="否" />
- </el-radio-group>
- </el-form-item>
- </div>
- </el-col>
- <el-col v-show="ruleForm.shi_fou_cha_lou_ == '是'" :span="8"
- ><div class="grid-content bg-purple-dark">
- <el-form-item label="漏发漏检(例)" prop="lou_fa_lou_jian_">
- <el-input
- v-model.number="ruleForm.lou_fa_lou_jian_"
- style="width: 100%"
- /> </el-form-item></div
- ></el-col>
- </el-row>
- <el-form-item label="其他异常情况" prop="qi_ta_qing_kuang_">
- <el-input v-model="ruleForm.qi_ta_qing_kuang_" type="textarea" />
- </el-form-item>
- <el-row :gutter="30">
- <el-col :span="8">
- <div class="grid-content bg-purple-dark">
- <el-form-item label="接班人:" prop="jie_ban_ren_">
- <ibps-user-selector
- v-model="ruleForm.jie_ban_ren_"
- type="user"
- readonly-text="text"
- :disabled="false"
- :multiple="true"
- :temp-search="true"
- :filter="filter"
- filterable
- />
- </el-form-item>
- </div>
- </el-col>
- <el-col :span="8">
- <div class="grid-content bg-purple-dark">
- <el-form-item label="交班人:" prop="jiao_ban_ren_">
- <!-- const roleList = ['xtgljs']
- const { isSuper, role, userId, userList = [] } = this.$store.getters || {}
- this.userId = userId
- this.userList = userList
- this.hasRole = isSuper || role.some(r => roleList.includes(r.alias)) -->
- <ibps-user-selector
- v-model="ruleForm.jiao_ban_ren_"
- type="user"
- readonly-text="text"
- :disabled="!hasRole"
- :multiple="false"
- :filter="filter"
- filterable
- />
- </el-form-item>
- </div>
- </el-col>
- </el-row>
- <!-- <el-form-item class="footer-btn">
- <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
- <el-button @click="dialogVisible=false">取消</el-button>
- </el-form-item> -->
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
- <el-button @click="dialogVisible = false">取消</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import log from '@/plugins/log'
- import ibpsUserSelector from '@/business/platform/org/selector'
- import IbpsLinkData from '@/business/platform/data/templaterender/link-data'
- import getDate from '@/utils/common'
- import { getSetting } from '@/utils/query'
- export default {
- components: {
- ibpsUserSelector,
- IbpsLinkData,
- IbpsCustomDialog: () =>
- import('@/business/platform/data/templaterender/custom-dialog')
- },
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- parentData: {
- type: [Object, Array],
- default: () => {}
- }
- },
- data() {
- const { userId, setting } = this.$store.getters || {}
- return {
- filter: [
- {
- descVal: '2',
- includeSub: true,
- old: 'position',
- partyId: this.$store.getters.userInfo.employee.positions,
- partyName: '',
- scriptContent: '',
- type: 'user',
- userType: 'position'
- }
- ],
- enrolledSum: false,
- userId: userId,
- editPermissions: false,
- isDisabled: false,
- title: '交接班',
- dialogVisible: this.visible,
- ruleForm: {
- deng_ji_bu_men_: '',
- gang_wei_: '',
- deng_ji_shi_jian_: this.dataShow(new Date()),
- shi_jian_: '',
- ban_ci_: '',
- jiao_ban_biao_ben: 0,
- wei_chu_li_biao_b: 0,
- wei_fa_bao_gao_: 0,
- shi_fou_cha_lou_: '是',
- lou_fa_lou_jian_: 0,
- qi_ta_qing_kuang_: '',
- jie_ban_ren_: '',
- jiao_ban_ren_: ''
- },
- rules: {
- ban_ci_: [{ required: false, message: this.$t('validate.required') }],
- deng_ji_bu_men_: [
- { required: true, message: this.$t('validate.required') }
- ],
- gang_wei_: [{ required: true, message: this.$t('validate.required') }],
- deng_ji_shi_jian_: [
- { required: true, message: this.$t('validate.required') }
- ],
- jiao_ban_biao_ben: [
- { required: true, message: this.$t('validate.required') },
- {
- validator: (rule, value, callback) => {
- if (value === '') {
- callback()
- } else if (Number.isInteger(value) && value >= 0) {
- callback()
- } else {
- callback(new Error(this.$t('请输入数字')))
- }
- },
- trigger: ['change', 'blur']
- }
- ],
- wei_chu_li_biao_b: [
- { required: true, message: this.$t('validate.required') },
- {
- validator: (rule, value, callback) => {
- if (value === '') {
- callback()
- } else if (Number.isInteger(value) && value >= 0) {
- callback()
- } else {
- callback(new Error(this.$t('请输入数字')))
- }
- },
- trigger: ['change', 'blur']
- }
- ],
- wei_fa_bao_gao_: [
- { required: true, message: this.$t('validate.required') },
- {
- validator: (rule, value, callback) => {
- if (value === '') {
- callback()
- } else if (Number.isInteger(value) && value >= 0) {
- callback()
- } else {
- callback(new Error(this.$t('请输入数字')))
- }
- },
- trigger: ['change', 'blur']
- }
- ],
- shi_fou_cha_lou_: [
- { required: true, message: this.$t('validate.required') }
- ],
- lou_fa_lou_jian_: [
- { required: true, message: this.$t('validate.required') },
- {
- validator: (rule, value, callback) => {
- if (value === '') {
- callback()
- } else if (Number.isInteger(value) && value >= 0) {
- callback()
- } else {
- callback(new Error(this.$t('请输入数字')))
- }
- },
- trigger: ['change', 'blur']
- }
- ],
- jie_ban_ren_: [
- { required: true, message: this.$t('validate.required') }
- ],
- jiao_ban_ren_: [
- { required: true, message: this.$t('validate.required') }
- ]
- },
- jianCeGangWeiList: [],
- filterData: [],
- masterReport: ['已早交班', '已午交班', '已晚交班', '已完成'],
- subReport: ['早班', '午班', '晚班'],
- config: setting?.postJob?.allocation || false
- }
- },
- computed: {
- hasRole() {
- const roleList = ['xtgljs']
- const { isSuper, role } = this.$store.getters || {}
- return isSuper || role.some((r) => roleList.includes(r.alias))
- }
- },
- watch: {
- visible: {
- handler: function (val, oldVal) {
- this.dialogVisible = this.visible
- }
- // immediate: true
- },
- 'ruleForm.deng_ji_bu_men_': {
- handler(val) {
- console.log(val)
- this.filterData = this.jianCeGangWeiList.filter((i) => i.dept === val)
- },
- deep: true
- },
- 'ruleForm.wei_chu_li_biao_b': {
- handler(val) {
- if (this.enrolledSum) {
- this.ruleForm.jiao_ban_biao_ben = this.ruleForm.wei_fa_bao_gao_ + val
- }
- },
- deep: true
- },
- 'ruleForm.wei_fa_bao_gao_': {
- handler(val) {
- if (this.enrolledSum) {
- this.ruleForm.jiao_ban_biao_ben =
- this.ruleForm.wei_chu_li_biao_b + val
- }
- },
- deep: true
- }
- },
- mounted() {
- this.loadSelectorData()
- },
- async created() {
- const res = await getSetting()
- const enrolledSum = res.enrolledSum || false
- this.enrolledSum = enrolledSum
- if (this.parentData) {
- if (this.parentData.id_) {
- this.ruleForm.deng_ji_bu_men_ = this.parentData.deng_ji_bu_men_
- this.ruleForm.deng_ji_shi_jian_ = this.parentData.deng_ji_shi_jian_
- this.ruleForm.gang_wei_ = this.parentData.gang_wei_
- this.ruleForm.jiao_ban_ren_ = this.userId
- this.editPermissions = false
- // this.ruleForm.ban_ci_ = this.parentData.zhuang_tai_ === '已早交班' ? '早班' : this.parentData.zhuang_tai_ === '已午交班' ? '午班' : '晚班'
- } else {
- this.ruleForm.jiao_ban_ren_ = this.userId
- this.editPermissions = true
- }
- } else {
- this.ruleForm.jiao_ban_ren_ = this.userId
- this.editPermissions = true
- }
- },
- methods: {
- // 修改
- loadSelectorData() {
- const { first, second } = this.$store.getters.level || {}
- // const sql = `select * from t_sbwhgwpzb where di_dian_='${second || first}'`
- this.$common
- .request('query', {
- key: this.config ? 'gwzzzha' : 'getPositionList',
- params: [second || first]
- })
- .then((res) => {
- const { data = [] } = res.variables || {}
- this.jianCeGangWeiList = data
- })
- },
- closeDialog() {
- this.$emit('close', false)
- },
- getShiftHandoverData() {
- this.submitForm()
- },
- dataShow(times) {
- const timeDate = new Date(times)
- const year = timeDate.getFullYear()
- const month = ('0' + (timeDate.getMonth() + 1)).slice(-2) // 月份从0开始,所以加1
- const day = ('0' + timeDate.getDate()).slice(-2)
- return `${year}-${month}-${day}`
- },
- addDatebase(dataBaseName, data) {
- const params = {
- tableName: dataBaseName,
- paramWhere: [data]
- }
- return this.$common
- .request('add', params)
- .then((res) => {
- return res
- })
- .catch((err) => {
- console.log(err)
- throw err
- })
- },
- submitForm(formName) {
- const masterTableData = {
- deng_ji_bu_men_: this.ruleForm.deng_ji_bu_men_,
- gang_wei_: this.ruleForm.gang_wei_,
- deng_ji_shi_jian_: this.dataShow(this.ruleForm.deng_ji_shi_jian_),
- zhuang_tai_: this.masterReport[0],
- jie_ban_ren_: this.ruleForm.jie_ban_ren_
- }
- const subtablesData = {
- parent_id_: '',
- ban_ci_: this.ruleForm.ban_ci_,
- jiao_ban_biao_ben: this.ruleForm.jiao_ban_biao_ben,
- jie_ban_ren_: this.ruleForm.jie_ban_ren_,
- jiao_ban_ren_: this.ruleForm.jiao_ban_ren_,
- wei_chu_li_biao_b: this.ruleForm.wei_chu_li_biao_b,
- wei_fa_bao_gao_: this.ruleForm.wei_fa_bao_gao_,
- shi_fou_cha_lou_: this.ruleForm.shi_fou_cha_lou_,
- lou_fa_lou_jian_: this.ruleForm.lou_fa_lou_jian_,
- qi_ta_qing_kuang_: this.ruleForm.qi_ta_qing_kuang_
- }
- this.$refs[formName]?.validate((valid) => {
- if (valid) {
- if (this.editPermissions) {
- // 主表和子表一起添加一条数据
- this.addDatebase('t_jjbdjb', masterTableData).then(() => {
- // const sql = 'select * from t_jjbdjb order by create_time_ desc limit 1'
- subtablesData.parent_id_ = ''
- this.$common
- .request('query', {
- key: 'getJjbLatestRecord',
- params: [null]
- })
- .then((res) => {
- subtablesData.parent_id_ = res.variables.data[0].id_
- subtablesData.ban_ci_ = this.subReport[0]
- if (subtablesData.parent_id_) {
- this.addDatebase('t_jjbjlb', subtablesData).then(() => {
- this.dialogVisible = false
- this.remind(subtablesData.jie_ban_ren_.split(','))
- })
- }
- })
- .catch((err) => {
- console.log(err)
- })
- })
- } else {
- // 子表添加一条数据
- // const sql = 'select* from t_jjbjlb WHERE parent_id_=' + this.parentData.id_
- this.$common
- .request('query', {
- key: 'getJjbByParentId',
- params: [this.parentData.id_]
- })
- .then((res) => {
- const count = res.variables.data.length
- subtablesData.parent_id_ = this.parentData.id_
- switch (count) {
- case 1:
- subtablesData.ban_ci_ = this.subReport[count]
- console.log(this.subReport[count])
- this.addDatebase('t_jjbjlb', subtablesData).then(() => {
- const params = {
- zhuang_tai_: this.masterReport[count],
- jie_ban_ren_: subtablesData.jie_ban_ren_
- }
- this.updataMaster('t_jjbdjb', this.parentData.id_, params)
- this.dialogVisible = false
- this.remind(subtablesData.jie_ban_ren_.split(','))
- })
- break
- case 2:
- subtablesData.ban_ci_ = this.subReport[count]
- this.addDatebase('t_jjbjlb', subtablesData).then(() => {
- this.createSnapshoot(this.parentData.id_).then((res) => {
- const params = {
- zhuang_tai_: this.masterReport[count + 1],
- jie_ban_ren_: subtablesData.jie_ban_ren_,
- kuai_zhao_: res
- }
- this.updataMaster(
- 't_jjbdjb',
- this.parentData.id_,
- params
- )
- this.dialogVisible = false
- })
- })
- break
- default:
- }
- })
- }
- } else {
- return false
- }
- })
- },
- updataMaster(masterName, id_, params) {
- return new Promise((resolve, reject) => {
- const updateParamsRecord = {
- tableName: masterName,
- updList: [
- {
- where: {
- id_: id_
- },
- param: params
- }
- ]
- }
- this.$common
- .request('update', updateParamsRecord)
- .then((res) => {
- this.$message({
- message: '添加成功',
- type: 'success'
- })
- resolve()
- })
- .catch((err) => {
- console.log(err)
- })
- })
- },
- createSnapshoot(id) {
- const { first = '' } = this.$store.getters.level
- const url = this.$getReportFile(
- '/人员/检验科交接班登记表.rpx',
- `id_=${id}&org_=${first}`
- )
- return new Promise((resolve, reject) => {
- this.$common
- .snapshoot({
- url: url,
- name: '交接班登记表' + this.dataShow(new Date()),
- type: 'pdf'
- })
- .then((res) => {
- resolve(res.data.id)
- })
- .catch((error) => {
- reject(error)
- })
- })
- },
- remind(list) {
- list.forEach((item) => {
- console.log(item)
- const msg = {
- subject: '事务催办提醒',
- content: `您的交接班还未完成,请尽快处理!`,
- receiverId: item,
- canreplay: '0'
- }
- this.$common.sendMsg(msg)
- })
- this.$message.success('催办成功!')
- }
- }
- }
- </script>
- <style scoped lang="less">
- .demo-ruleForm {
- padding: 1% 5% 1% 5%;
- .el-form-item {
- padding: 1% 0;
- }
- .footer-btn {
- text-align: center;
- }
- }
- /* 使标签文本左对齐 */
- /deep/ .el-form-item__label {
- text-align: left;
- position: relative; /* 使星号能够相对于标签定位 */
- padding-left: 1em; /* 为星号预留一些空间 */
- }
- /* 使用绝对定位让星号不占据空间,并且显示在标签的右侧 */
- /deep/ .el-form-item__label::before {
- content: '*';
- color: #f56c6c; /* 星号颜色 */
- position: absolute;
- left: 0; /* 星号靠右 */
- top: 50%; /* 垂直居中 */
- transform: translateY(-50%); /* 垂直居中修正 */
- margin: 0;
- }
- /* 只有当标签是必填项时才显示星号 */
- /deep/ .el-form-item__label:not(.is-required)::before {
- content: '';
- }
- /deep/ .el-form-item__content {
- margin: 0;
- }
- /deep/ .el-dialog__footer {
- display: flex;
- justify-content: center;
- }
- </style>
|