|  | @@ -1,180 +1,140 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  | -  <xc-table-v3 :data="tempYzData"
 | 
	
		
			
				|  |  | -               :height="400"
 | 
	
		
			
				|  |  | -               :click-to-select="false"
 | 
	
		
			
				|  |  | -               :columns="header"
 | 
	
		
			
				|  |  | -               :row-class-name="rowClassName"
 | 
	
		
			
				|  |  | -               @row-click="rowClick"/>
 | 
	
		
			
				|  |  | +  <xc-table-v2 :data="tempYzData"
 | 
	
		
			
				|  |  | +               :rowStyle="rowStyle"
 | 
	
		
			
				|  |  | +               @rowClick="rowClick"
 | 
	
		
			
				|  |  | +               :height="getWindowSize.h / 1.7"
 | 
	
		
			
				|  |  | +               @dbRowClick="setDefaultStopTime"
 | 
	
		
			
				|  |  | +               :columns="header"/>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -<script setup name='YzTableV2' lang="tsx">
 | 
	
		
			
				|  |  | -import XcTableV3 from "@/components/xiao-chan/xc-table-v3/XcTableV3.vue";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script setup name='Test' lang="tsx">
 | 
	
		
			
				|  |  | +import {ref} from 'vue'
 | 
	
		
			
				|  |  | +import XcTableV2 from "@/components/xiao-chan/xc-table-v2/XcTableV2.vue";
 | 
	
		
			
				|  |  | +import {stringIsBlank} from "@/utils/blank-utils";
 | 
	
		
			
				|  |  | +import {getFormatDatetime} from "@/utils/date";
 | 
	
		
			
				|  |  | +import {getServerDateApi} from '@/api/public-api'
 | 
	
		
			
				|  |  | +import {getWindowSize} from "@/utils/window-size";
 | 
	
		
			
				|  |  |  import {
 | 
	
		
			
				|  |  |    selectedData,
 | 
	
		
			
				|  |  |    tempYzData,
 | 
	
		
			
				|  |  |    yiZhuData,
 | 
	
		
			
				|  |  |    associateOrders,
 | 
	
		
			
				|  |  |    clearAssociate,
 | 
	
		
			
				|  |  | -  drugManual
 | 
	
		
			
				|  |  | +  drugManual,
 | 
	
		
			
				|  |  | +  yzData
 | 
	
		
			
				|  |  |  } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 | 
	
		
			
				|  |  | -import {XcColumn} from "@/components/xiao-chan/xc-table-v3/XcColumn";
 | 
	
		
			
				|  |  | -import {stringIsBlank} from '@/utils/blank-utils'
 | 
	
		
			
				|  |  | -import {defineEmits, defineProps, h} from 'vue'
 | 
	
		
			
				|  |  | -import {getFormatDatetime} from "@/utils/date";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -const props = defineProps({
 | 
	
		
			
				|  |  | -  voidOrders: Function
 | 
	
		
			
				|  |  | -})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const emits = defineEmits(['rowClick', 'clickAssociate'])
 | 
	
		
			
				|  |  | +const emits = defineEmits(['rowClick'])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const header: XcColumn<any>[] = [
 | 
	
		
			
				|  |  | +const header = [
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    type: 'selection',
 | 
	
		
			
				|  |  | -    title: '',
 | 
	
		
			
				|  |  | -    width: 20
 | 
	
		
			
				|  |  | +    width: 20, name: '#',
 | 
	
		
			
				|  |  | +    cellRenderer: ({data}) => (
 | 
	
		
			
				|  |  | +        <input type="checkbox"
 | 
	
		
			
				|  |  | +               checked={data.tempCheckbox}
 | 
	
		
			
				|  |  | +               onClick={(event) => clickSelected(data)}/>
 | 
	
		
			
				|  |  | +    ),
 | 
	
		
			
				|  |  | +    headerFunc: () => {
 | 
	
		
			
				|  |  | +      console.log(123)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    type: 'index',
 | 
	
		
			
				|  |  | -    title: '序号',
 | 
	
		
			
				|  |  | -    width: 40
 | 
	
		
			
				|  |  | +    width: 30, name: '排序',
 | 
	
		
			
				|  |  | +    cellRenderer: ({index}) => (
 | 
	
		
			
				|  |  | +        <span>{index + 1}</span>
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  {width: 20, code: 'orderGroup', name: '组'},
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    title: '组',
 | 
	
		
			
				|  |  | -    key: 'orderGroup',
 | 
	
		
			
				|  |  | -    cellRenderer: ({cellData}) => (
 | 
	
		
			
				|  |  | -        <span style="color:red">{cellData}</span>
 | 
	
		
			
				|  |  | -    ),
 | 
	
		
			
				|  |  | -    width: 20
 | 
	
		
			
				|  |  | +    width: 20, code: 'statusFlag', cellRenderer: ({cellData}) => {
 | 
	
		
			
				|  |  | +      return getYiZhuFlag(cellData)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    title: '状态',
 | 
	
		
			
				|  |  | -    key: 'statusFlag',
 | 
	
		
			
				|  |  | -    cellRenderer: ({row, cellData}) => (
 | 
	
		
			
				|  |  | -        getYiZhuFlag(cellData)
 | 
	
		
			
				|  |  | -    ),
 | 
	
		
			
				|  |  | -    width: 40
 | 
	
		
			
				|  |  | +    width: 70, code: 'actOrderNo', name: '医嘱号', cellRenderer: ({data}) => {
 | 
	
		
			
				|  |  | +      if (data.error) {
 | 
	
		
			
				|  |  | +        return (<span style="color: red" class={data.newOrderFlag > 0 ? 'new_order' : ''}>{nu(data.actOrderNo)}</span>)
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        return (<span class={data.newOrderFlag > 0 ? 'new_order' : ''}>{nu(data.actOrderNo)}</span>)
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  {width: 225, code: 'orderName', name: '医嘱名称'},
 | 
	
		
			
				|  |  | +  {
 | 
	
		
			
				|  |  | +    code: 'dose', name: '剂量', width: 75, cellRenderer: ({data}) => {
 | 
	
		
			
				|  |  | +      return <span>{nu(data.dose) + ' ' + nu(data.doseUnitName)}</span>
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  {code: 'frequCode', name: '频率', width: 75},
 | 
	
		
			
				|  |  | +  {code: 'supplyCodeName', name: '给药方式', width: 60},
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    key: 'actOrderNo',
 | 
	
		
			
				|  |  | -    title: '医嘱号',
 | 
	
		
			
				|  |  | -    width: 100
 | 
	
		
			
				|  |  | +    code: 'startTime', name: '开始时间', width: 95, cellRenderer: ({data}) => {
 | 
	
		
			
				|  |  | +      return (<span>{timeFomat(data.startTime)}</span>)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    key: 'orderName',
 | 
	
		
			
				|  |  | -    title: '医嘱号',
 | 
	
		
			
				|  |  | -    width: 250
 | 
	
		
			
				|  |  | +    // 出院时间的大小不能改
 | 
	
		
			
				|  |  | +    code: 'endTime', name: '结束时间', width: 160, cellRenderer: ({data}) => {
 | 
	
		
			
				|  |  | +      if (stringIsBlank(data.endTime) && stringIsBlank(data.parentNo) && data.frequCode !== 'ONCE') {
 | 
	
		
			
				|  |  | +        return <input type="datetime-local"
 | 
	
		
			
				|  |  | +                      style={endDateStyle(data)}
 | 
	
		
			
				|  |  | +                      value={data.endTimeTemp}
 | 
	
		
			
				|  |  | +                      oncontextmenu={(event) => {
 | 
	
		
			
				|  |  | +                        event.preventDefault();
 | 
	
		
			
				|  |  | +                        cancelStopTime(data)
 | 
	
		
			
				|  |  | +                      }}
 | 
	
		
			
				|  |  | +        />
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return <span>{timeFomat(data.endTime)}</span>
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    key: 'dose',
 | 
	
		
			
				|  |  | -    title: '剂量',
 | 
	
		
			
				|  |  | -    width: 40,
 | 
	
		
			
				|  |  | -    cellRenderer: ({row}) => (
 | 
	
		
			
				|  |  | -        <span>{row.dose} {row.doseUnitName}</span>
 | 
	
		
			
				|  |  | -    )
 | 
	
		
			
				|  |  | +    code: 'emergencyFlag', name: '紧急', cellRenderer: ({cellData}) => {
 | 
	
		
			
				|  |  | +      return <span>{cellData === '1' ? '√' : ''}</span>
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    width: 30
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    key: 'frequCode',
 | 
	
		
			
				|  |  | -    title: '频率',
 | 
	
		
			
				|  |  | -    width: 120
 | 
	
		
			
				|  |  | +    code: 'ybSelfFlag', name: '自费', cellRenderer: ({cellData}) => {
 | 
	
		
			
				|  |  | +      return <span>{cellData === '1' ? '√' : ''}</span>
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    width: 30
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  {code: 'physicianName', name: '医生', width: 65},
 | 
	
		
			
				|  |  | +  {code: 'selfBuyName', name: '费用标志', width: 60},
 | 
	
		
			
				|  |  | +  {code: 'execUnitName', name: '执行科室', width: 80},
 | 
	
		
			
				|  |  |    {
 | 
	
		
			
				|  |  | -    key: 'supplyCodeName',
 | 
	
		
			
				|  |  | -    title: '给药方式',
 | 
	
		
			
				|  |  | -    width: 60
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'startTime',
 | 
	
		
			
				|  |  | -    title: '开始时间',
 | 
	
		
			
				|  |  | -    width: 120,
 | 
	
		
			
				|  |  | -    cellRenderer: ({cellData}) => (
 | 
	
		
			
				|  |  | -        timeFomat(cellData)
 | 
	
		
			
				|  |  | -    )
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'endTime',
 | 
	
		
			
				|  |  | -    title: '结束时间',
 | 
	
		
			
				|  |  | -    width: 120,
 | 
	
		
			
				|  |  | -    cellRenderer: ({cellData}) => (
 | 
	
		
			
				|  |  | -        timeFomat(cellData)
 | 
	
		
			
				|  |  | -    )
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'emergencyFlag',
 | 
	
		
			
				|  |  | -    title: '紧急',
 | 
	
		
			
				|  |  | -    width: 40,
 | 
	
		
			
				|  |  | -    cellRenderer: ({cellData}) => (
 | 
	
		
			
				|  |  | -        <span>{cellData === '1' ? '√' : ''}</span>
 | 
	
		
			
				|  |  | -    )
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'ybSelfFlag',
 | 
	
		
			
				|  |  | -    title: '自费',
 | 
	
		
			
				|  |  | -    width: 40,
 | 
	
		
			
				|  |  | -    cellRenderer: ({cellData}) => (
 | 
	
		
			
				|  |  | -        <span>{cellData === '1' ? '√' : ''}</span>
 | 
	
		
			
				|  |  | -    )
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'physicianName',
 | 
	
		
			
				|  |  | -    title: '医生',
 | 
	
		
			
				|  |  | -    width: 40,
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'selfBuyName',
 | 
	
		
			
				|  |  | -    title: '标志',
 | 
	
		
			
				|  |  | -    width: 60,
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'execUnitName',
 | 
	
		
			
				|  |  | -    title: '执行',
 | 
	
		
			
				|  |  | -    width: 60,
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'drugQuan',
 | 
	
		
			
				|  |  | -    title: '领量',
 | 
	
		
			
				|  |  | -    width: 40,
 | 
	
		
			
				|  |  | -    cellRenderer: ({row}) => (
 | 
	
		
			
				|  |  | -        <span>{row.drugQuan} {row.drugQuanName}</span>
 | 
	
		
			
				|  |  | +    code: 'drugQuan', name: '领量', cellRenderer: ({data}) => {
 | 
	
		
			
				|  |  | +      return <span>{nu(data.drugQuan) + nu(data.drugQuanName)}</span>
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    width: 30
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  {code: 'groupNoName', name: '药房', width: 91},
 | 
	
		
			
				|  |  | +  {code: 'serial', name: '序号', width: 35},
 | 
	
		
			
				|  |  | +  {code: 'instruction', name: '嘱托', width: 150},
 | 
	
		
			
				|  |  | +  {
 | 
	
		
			
				|  |  | +    name: '操作', width: 53, cellRenderer: ({data}) => (
 | 
	
		
			
				|  |  | +        <button onclick={(e) => {
 | 
	
		
			
				|  |  | +          e.preventDefault();
 | 
	
		
			
				|  |  | +          e.stopImmediatePropagation();
 | 
	
		
			
				|  |  | +          console.log(data)
 | 
	
		
			
				|  |  | +        }}>作废</button>
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'groupNoName',
 | 
	
		
			
				|  |  | -    title: '药房',
 | 
	
		
			
				|  |  | -    width: 90,
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'serial',
 | 
	
		
			
				|  |  | -    title: '序号',
 | 
	
		
			
				|  |  | -    width: 20,
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'instruction',
 | 
	
		
			
				|  |  | -    title: '嘱托',
 | 
	
		
			
				|  |  | -    width: 120
 | 
	
		
			
				|  |  | -  }, {
 | 
	
		
			
				|  |  | -    key: 'instruction',
 | 
	
		
			
				|  |  | -    title: '操作',
 | 
	
		
			
				|  |  | -    width: 70,
 | 
	
		
			
				|  |  | -    fixed: 'left',
 | 
	
		
			
				|  |  | -    cellRenderer: ({row}) => {
 | 
	
		
			
				|  |  | -      return h('button',
 | 
	
		
			
				|  |  | -          {
 | 
	
		
			
				|  |  | -            onClick: (e: Event) => {
 | 
	
		
			
				|  |  | -              e.stopPropagation()
 | 
	
		
			
				|  |  | -              props.voidOrders(row)
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -          },
 | 
	
		
			
				|  |  | -          '作废')
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -]
 | 
	
		
			
				|  |  | +];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const rowClassName = (row) => {
 | 
	
		
			
				|  |  | -  if (row.actOrderNo === yiZhuData.value.actOrderNo) {
 | 
	
		
			
				|  |  | -    return 'selected_order'
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +const clickSelected = (row) => {
 | 
	
		
			
				|  |  | +  row.tempCheckbox = !row.tempCheckbox
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const rowClick = (row) => {
 | 
	
		
			
				|  |  | -  emits('rowClick', row)
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  |  const timeFomat = (val) => {
 | 
	
		
			
				|  |  | -  return <span> {getFormatDatetime(val, 'YY-MM-DD HH:mm')}</span>
 | 
	
		
			
				|  |  | +  return getFormatDatetime(val, 'YY-MM-DD HH:mm')
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function getYiZhuFlag(val) {
 | 
	
		
			
				|  |  |    if (stringIsBlank(val)) {
 | 
	
		
			
				|  |  | -    return (<span> </span>)
 | 
	
		
			
				|  |  | +    return val
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    switch (val) {
 | 
	
		
			
				|  |  |      case '1':
 | 
	
	
		
			
				|  | @@ -187,17 +147,73 @@ function getYiZhuFlag(val) {
 | 
	
		
			
				|  |  |        return (<span style="color:  #ff07f3">Z</span>)
 | 
	
		
			
				|  |  |      case '5':
 | 
	
		
			
				|  |  |        return (<span style="color: red">T</span>)
 | 
	
		
			
				|  |  | -    case '6':
 | 
	
		
			
				|  |  | +    case '-1':
 | 
	
		
			
				|  |  |        return (<span style="color: #00ffe0">D</span>)
 | 
	
		
			
				|  |  |      default:
 | 
	
		
			
				|  |  | -      return (<span style="color: #00ffe0">val</span>)
 | 
	
		
			
				|  |  | +      return 'warning'
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -</script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -<style lang="scss">
 | 
	
		
			
				|  |  | -.selected_order {
 | 
	
		
			
				|  |  | -  background: rgba(0, 58, 241, 0.68) !important;
 | 
	
		
			
				|  |  | -  color: #000;
 | 
	
		
			
				|  |  | +const endDateStyle = (item) => {
 | 
	
		
			
				|  |  | +  if (item.endTimeTemp && item.tempCheckbox) {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      width: '140px',
 | 
	
		
			
				|  |  | +      color: 'white',
 | 
	
		
			
				|  |  | +      backgroundColor: 'red',
 | 
	
		
			
				|  |  | +      border: 0,
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      width: '140px',
 | 
	
		
			
				|  |  | +      border: 0,
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const rowClick = (data) => {
 | 
	
		
			
				|  |  | +  emits('rowClick', data)
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const rowStyle = (data) => {
 | 
	
		
			
				|  |  | +  if (data.actOrderNo === yiZhuData.value.actOrderNo) {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      background: 'rgba(0, 58, 241, 0.68)',
 | 
	
		
			
				|  |  | +      color: '#fff'
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const setDefaultStopTime = async (item) => {
 | 
	
		
			
				|  |  | +  if (item.parentNo) return
 | 
	
		
			
				|  |  | +  item.endTimeTemp = getFormatDatetime(await getServerDateApi(), 'yyyy-MM-DD HH:mm')
 | 
	
		
			
				|  |  | +  if (!item.tempCheckbox) {
 | 
	
		
			
				|  |  | +    clickSelected(item)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const cancelStopTime = (val) => {
 | 
	
		
			
				|  |  | +  if (val.parentNo) return
 | 
	
		
			
				|  |  | +  val.endTimeTemp = ''
 | 
	
		
			
				|  |  | +  if (val.tempCheckbox) {
 | 
	
		
			
				|  |  | +    clickSelected(val)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const nu = (val) => {
 | 
	
		
			
				|  |  | +  if (val === null) {
 | 
	
		
			
				|  |  | +    return ''
 | 
	
		
			
				|  |  | +  } else if (typeof val === 'undefined') {
 | 
	
		
			
				|  |  | +    return ''
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    return val
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style lang="scss" scoped>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </style>
 | 
	
		
			
				|  |  | +
 |