华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1974 lines
77 KiB

  1. <template>
  2. <div class="flex " :class="getFlexClass()">
  3. <div class="flex" :class="getFlexClass()">
  4. <el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
  5. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" @blur="onBlur"
  6. :placeholder="getPlaceholder()" v-model="inputValue" @input="onInputChange" @change="onInputChange" />
  7. <el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
  8. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" type="textarea" show-word-limit
  9. resize="none" @blur="onBlur" :rows="item.rows || 3" :placeholder="getPlaceholder()" v-model="inputValue"
  10. @input="onInputChange" @change="onInputChange" />
  11. <DecimalInput v-else-if="type === 'inputNumber'" @blur="onCommonHandleSaveRecord"
  12. :maxlength="item.maxlength || 10" class="flex1" :disabled="getDisabled()"
  13. :controls="item.controls || false" :min="item.min || 0" :prepend="item.prepend"
  14. :decimalDigits="getDecimalDigits()" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
  15. :placeholder="getPlaceholder()" v-model="inputValue" @input="onInputChange" @change="onInputChange" />
  16. <el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple"
  17. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
  18. :disabled="getDisabled()" :placeholder="getPlaceholder()" @remove-tag="onRemoveTag"
  19. @visible-change="onSelectBlur" @change="onInputChange" filterable>
  20. <el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value">
  21. </el-option>
  22. </el-select>
  23. <el-checkbox v-else-if="type === 'checkbox'" class="flex1" :multiple="item.multiple"
  24. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
  25. :disabled="getDisabled()" :placeholder="getPlaceholder()" @change="onItemCheckboxChange">
  26. {{ item.checkboxLabel }}
  27. </el-checkbox>
  28. <el-radio-group v-else-if="type === 'radio'" v-model="inputValue"
  29. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" :disabled="getDisabled()"
  30. @change="onItemCheckboxChange">
  31. <el-radio v-for="option in item.options" :key="option.value" :label="option.value"
  32. :disabled="getDisabled()">
  33. {{ option.label }}
  34. </el-radio>
  35. </el-radio-group>
  36. <div v-else-if="type === 'checkboxList'" class="flex1 checkbox-list-container"
  37. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
  38. <el-checkbox-group v-model="checkboxListValue.checkboxValues" @change="onCheckboxListChange">
  39. <div v-for="option in item.options" :key="option.value" class="checkbox-item">
  40. <el-checkbox :label="option.value" :disabled="getDisabled()">
  41. {{ option.label }}
  42. </el-checkbox>
  43. <div v-if="isShowCheckboxListOther(option)">
  44. <el-input v-model="checkboxListValue.otherValues[option.otherCode]"
  45. :class="{ 'error-border': isOtherInputError(option.otherCode) }"
  46. :placeholder="option.otherPlaceholder || '请输入'" @blur="onCheckboxListOtherBlur($event, option.otherCode)"/>
  47. </div>
  48. </div>
  49. </el-checkbox-group>
  50. </div>
  51. <div v-else-if="type === 'checkboxTree'" class="flex1 checkbox-list-container"
  52. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
  53. <div v-for="group in item.options" :key="group.value" class="checkbox-tree-group">
  54. <el-checkbox
  55. :label="group.value"
  56. :disabled="getDisabled()"
  57. :checked="isCheckboxTreeChecked(group.value)"
  58. @change="onCheckboxTreeChange(group.value, $event)">
  59. {{ group.label }}
  60. </el-checkbox>
  61. <div v-if="group.children && group.children.length > 0" class="checkbox-tree-children">
  62. <div v-for="child in group.children" :key="child.value" class="checkbox-tree-item">
  63. <el-checkbox
  64. :label="child.value"
  65. :disabled="getDisabled()"
  66. :checked="isCheckboxTreeChecked(child.value)"
  67. @change="onCheckboxTreeChange(child.value, $event)">
  68. {{ child.label }}
  69. </el-checkbox>
  70. <div v-if="(child.value === '样品信息' || child.value === '其他') && isCheckboxTreeChecked(child.value)" class="checkbox-tree-input-container">
  71. <el-input
  72. v-model="checkboxTreeValue.otherValues[child.value]"
  73. :class="{ 'error-border': isCheckboxTreeOtherInputError(child.value) }"
  74. placeholder="请输入"
  75. @blur="onCheckboxTreeOtherBlur(child.value, $event)"/>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <el-date-picker v-else-if="type === 'dateTime'" type="datetime" class="flex1"
  82. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
  83. :disabled="getDisabled()" format="yyyy/MM/dd HH:mm:ss" :placeholder="getPlaceholder()"
  84. @change="(val) => onDateChange(val, 'yyyy/MM/DD HH:mm:ss')">
  85. </el-date-picker>
  86. <el-date-picker v-else-if="type === 'datePicker'" class="flex1"
  87. :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
  88. :disabled="getDisabled()" format="yyyy/MM/dd" :placeholder="getPlaceholder()"
  89. @change="(val) => onDateChange(val, 'yyyy/MM/DD')">
  90. </el-date-picker>
  91. <el-button v-else-if="type === 'button'" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
  92. :disabled="getDisabled()" type="primary" @click="handleClickButton(item)">
  93. {{ $t(item.buttonName) }}
  94. <input type="hidden" v-model="inputValue">
  95. </el-button>
  96. <div class="clickable"
  97. :class="getFillTypeStyle() + (getDisabled() ? ' disabled' : '') + (orangeBg ? ' orange-bg' : '')"
  98. v-else-if="item.type === 'clickable'" @click="handleClickable(item, $event)">
  99. <span v-if="inputValue">{{ inputValue }}</span>
  100. <span v-else class="default-placeholder-text">{{ getPlaceholder() }}</span>
  101. </div>
  102. <div class="clickable"
  103. :class="getFillTypeStyle() + (getDisabled() ? ' disabled' : '') + (orangeBg ? ' orange-bg' : '')"
  104. v-else-if="regentType.includes(item.type)" @click="onCommonHandleRegent(item, item.type)">
  105. <span v-if="inputValue">{{ inputValue }}</span>
  106. <span v-else class="default-placeholder-text">{{ getPlaceholder() }}</span>
  107. </div>
  108. <template v-else-if="type === 'attachment'">
  109. <el-upload ref="uploadRef" class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview"
  110. :headers="headers" :before-remove="beforeRemove" :on-remove="handleRemove" multiple :limit="10"
  111. :on-success="handleSuccess" :on-change="handleChange" :on-exceed="handleExceed"
  112. :file-list="fileList" :auto-upload="false">
  113. <el-button :disabled="getDisabled()" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
  114. size="small" type="primary">点击上传</el-button>
  115. <span v-if="error" class="atta-tips">请上传附件</span>
  116. <div slot="tip" class="el-upload__tip">支持扩展名.rar .zip .doc .docx .pdf .jpg文件大小不超过2MB</div>
  117. </el-upload>
  118. </template>
  119. <div v-else-if="type === 'checkboxTag'" class="flex1 checkbox-tag-wrapper" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
  120. <div v-for="(tag, tagIndex) in checkboxTagList" :key="tagIndex" class="checkbox-tag-container">
  121. <div class="checkbox-tag-item">
  122. <el-checkbox v-model="tag.checked" :disabled="getDisabled()"
  123. @change="onCheckboxTagChange(tagIndex, $event)"></el-checkbox>
  124. <div class="tag-content blue-border">
  125. <el-input v-if="templateFillType === 'preFill'" v-model="tag.tagValue"
  126. :ref="'tagInput_' + tagIndex" :maxlength="item.maxlength || 20"
  127. @blur="onTagBlur(tagIndex)" @keyup.enter.native="onTagBlur(tagIndex)"
  128. placeholder="请输入" size="mini" class="tag-input" />
  129. <el-tag v-else :type="'info'" class="tag-display" :closable="false">
  130. {{ tag.tagValue }}
  131. </el-tag>
  132. <el-popconfirm confirm-button-text='确认' cancel-button-text='取消' icon="el-icon-info"
  133. icon-color="red" title="确认删除当前编号?" @confirm="onDeleteTag(tagIndex)">
  134. <i slot="reference" v-if="templateFillType === 'preFill'"
  135. class="el-icon-close delete-icon"></i>
  136. </el-popconfirm>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <div v-else-if="type === 'fqyq'" :class="getFillTypeStyle()">
  142. <el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'mainRadio')">
  143. <div class="item-center mb-10">
  144. <el-radio label="是"></el-radio>
  145. <div class="item-center" v-if="fqyqValue.mainRadio === '是'">
  146. <el-input class="fqyq-input" maxlength="100" v-model="fqyqValue.inputValue" :disabled="getDisabled()" placeholder="请输入" @blur="onFqyqInputBlur" ></el-input>
  147. <div class="fs-14 mr-10">是否在规定时间完成</div>
  148. <el-radio-group v-model="fqyqValue.subRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'subRadio')">
  149. <el-radio label="是"></el-radio>
  150. <el-radio label="否"></el-radio>
  151. </el-radio-group>
  152. </div>
  153. </div>
  154. <el-radio label="否"></el-radio>
  155. </el-radio-group>
  156. </div>
  157. </div>
  158. <div class="handle-row" v-if="isShowHandle()">
  159. <el-checkbox v-model="checkboxValue" v-if="getIsShowCheckboxIcon()" :disabled="getCheckboxDisabled()"
  160. class="mr-5" @change="onCheckboxChange"></el-checkbox>
  161. <div class="handle-icon" v-if="getIsShowQuestionIcon()" @click="onClickQuestion"
  162. @mouseenter="(e) => onMouseEnter('replyRecord', e)" @mouseleave="onMouseLeave">
  163. <Question :class="getQuestionColor()" />
  164. </div>
  165. <img v-if="getIsShowCopyIcon()" @click="onCopy" src="@/assets/images/copy-icon.svg" class="handle-icon"
  166. alt="" />
  167. <img v-if="getIsShowRecordIcon()" @mouseenter="(e) => onMouseEnter('fieldChanged', e)"
  168. @mouseleave="onMouseLeave" src="@/assets/images/record-icon.svg" class="handle-icon" alt="" />
  169. </div>
  170. <!-- 修改记录模态框 -->
  171. <div v-if="showModal && modificationRecords.length > 0" ref="modalRef"
  172. :class="['modification-modal', { 'show': showModal }]" @mouseenter="onModalEnter"
  173. @mouseleave="onModalLeave">
  174. <div class="modal-content">
  175. <div class="records-list">
  176. <div v-for="(record, index) in modificationRecords" :key="index" class="record-item">
  177. <!-- 字段修改记录 -->
  178. <div class="record-row" v-if="currentRecordType === 'fieldChanged'">
  179. <div>
  180. <span>{{ index + 1 }}.</span>
  181. <span> {{ getUserName(record) }} </span>
  182. <span>{{ record.time }} </span>
  183. <span>{{ modificationRecords.length - 1 == index ? "提交" : "修改" }}</span>
  184. </div>
  185. <div v-if="modificationRecords.length - 1 !== index">
  186. <div>原值{{ record.oldValue }}</div>
  187. <div>修改值{{ record.value }}</div>
  188. <div v-if="record.reason">备注{{ record.reason }}</div>
  189. </div>
  190. </div>
  191. <!-- 回复记录 -->
  192. <div class="record-row" v-if="currentRecordType === 'replyRecord'">
  193. <div>
  194. <span> {{ getUserName(record) }} </span>
  195. <span>{{ record.time }} </span>
  196. </div>
  197. <div>
  198. <div v-if="record.content">复核意见{{ record.content }}</div>
  199. <div v-if="record.reply">回复意见{{ record.reply }}</div>
  200. </div>
  201. </div>
  202. <hr v-if="index < modificationRecords.length - 1">
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <el-dialog :close-on-click-modal="false" append-to-body :title="templateFillType == 'actFill' ? '回复意见' : '复核意见'"
  208. :visible.sync="visible" width="30%">
  209. <el-input v-model="replyContent" type="textarea" show-word-limit resize="none" rows="8" placeholder="输入内容"
  210. maxlength="500" />
  211. <span slot="footer" class="dialog-footer">
  212. <el-button @click="visible = false"> </el-button>
  213. <el-button type="primary" @click="onReplyConfirm"> </el-button>
  214. </span>
  215. </el-dialog>
  216. </div>
  217. </template>
  218. <script>
  219. import Question from "./icons/Question.vue";
  220. import DecimalInput from "./DecimalInput.vue";
  221. import { EventBus } from "@/utils/eventBus";
  222. import moment from "moment";
  223. import { deepClone } from "@/utils/index";
  224. import { getuuid } from "@/utils/index.js";
  225. import { getToken } from "@/utils/auth"
  226. import { isValueEmpty } from '@/utils/index.js';
  227. export default {
  228. inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
  229. components: {
  230. Question,
  231. DecimalInput,
  232. },
  233. props: {
  234. type: {//form类型 input/select等
  235. type: String,
  236. default: "input"
  237. },
  238. item: {
  239. type: Object,
  240. default: () => {
  241. return {
  242. placeholder: "",
  243. maxlength: 30,
  244. label: "",
  245. disabled: false,
  246. }
  247. }
  248. },
  249. // v-model 值
  250. value: {
  251. type: [String, Number, Array, Boolean, Object],
  252. default: ''
  253. },
  254. // 错误状态
  255. error: {
  256. type: Boolean,
  257. default: false
  258. },
  259. // 橙色背景状态
  260. orangeBg: {
  261. type: Boolean,
  262. default: false
  263. },
  264. fieldKey: {
  265. type: String,
  266. default: ""
  267. },
  268. fieldItemLabel: {
  269. type: String,
  270. default: "",
  271. },
  272. //是否记录修改
  273. isFieldsRecord: {
  274. type: Boolean,
  275. default: true,
  276. },
  277. sourceFrom: {
  278. type: String,
  279. default: ""
  280. },
  281. },
  282. data() {
  283. let initialValue = this.value;
  284. let initialOtherValues = {}, checkboxTagList = [];
  285. if(this.type === 'checkboxList' && !this.value) {
  286. initialValue = {
  287. checkboxValues: [],
  288. otherValues: {}
  289. };
  290. } else if (this.type === 'checkboxTag' && Array.isArray(this.value)) {
  291. // checkboxTag类型,value是数组格式
  292. checkboxTagList = this.value.map(tag => ({
  293. checked: tag.checked,
  294. tagValue: tag.tagValue || ''
  295. }));
  296. } else if (this.type === 'fqyq' && !this.value) {
  297. initialValue = {mainRadio: '', subRadio: '',inputValue:""};
  298. }
  299. return {
  300. inputValue: initialValue,
  301. oldValue: initialValue, // 记录上一次的值
  302. showModal: false, // 控制模态框显示
  303. modificationRecords: [], // 存储修改记录
  304. modalTimer: null, // 用于延迟隐藏模态框
  305. isHoveringModal: false, // 是否悬停在模态框上
  306. isHoveringMain: false, // 是否悬停在主元素上(这个实际上不需要,因为我们有事件处理)
  307. currentRecordType: '', // 当前悬停的记录类型(replyRecord 或 modifyRecord)
  308. replyContent: '', // 回复内容
  309. visible: false,//是否显示弹窗
  310. checkboxValue: this.getChecked(),//是否选中
  311. checkboxTagList: checkboxTagList, // checkboxTag类型的列表数据
  312. oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // 记录上一次的checkboxTagList
  313. fqyqValue: initialValue, // fqyq类型的值
  314. oldFqyqValue: {...initialValue}, // 记录上一次的fqyq值
  315. checkboxListValue: initialValue, // checkboxList类型的值
  316. oldCheckboxListValue: JSON.parse(JSON.stringify(initialValue)), // 记录上一次的checkboxList值
  317. checkboxTreeValue: this.type === 'checkboxTree' ? (this.value || { checkedValues: [], otherValues: {} }) : {}, // checkboxTree类型的值
  318. oldCheckboxTreeValue: this.type === 'checkboxTree' ? JSON.parse(JSON.stringify(this.value || { checkedValues: [], otherValues: {} })) : {}, // 记录上一次的checkboxTree值
  319. checkboxTreeFirstCheck: this.type === 'checkboxTree' ? {} : {}, // 记录第一次勾选的状态
  320. uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配
  321. regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型
  322. selectRegentInfo: {},//选择的试剂/仪器/供试品等信息
  323. fileList: [],//上传的文件列表
  324. uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload",
  325. headers: {
  326. Authorization: "Bearer " + getToken(),
  327. },
  328. pendingUploadFile: null, // 用于存储待上传的文件
  329. pendingRemoveFile: null, // 用于存储待删除的文件
  330. currentTagIndex:-1,//当前选中的checkboxTag索引
  331. currentHandleType:'',//当前操作的类型
  332. currentOtherCode:'',//当前操作的otherCode
  333. currentCheckboxTreeValue: '',//当前操作的checkboxTree值
  334. }
  335. },
  336. watch: {
  337. value(newVal) {
  338. if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') {
  339. this.checkboxListValue = JSON.parse(JSON.stringify(newVal));
  340. } else if (this.type === 'checkboxTag' && Array.isArray(newVal)) {
  341. // checkboxTag类型,value是数组格式
  342. this.checkboxTagList = newVal.map(tag => ({
  343. checked: tag.checked,
  344. tagValue: tag.tagValue || ''
  345. }));
  346. } else if (this.type === 'fqyq' && newVal && typeof newVal === 'object') {
  347. // fqyq类型
  348. this.fqyqValue = {
  349. mainRadio: newVal.mainRadio || '',
  350. inputValue: newVal.inputValue || '',
  351. subRadio: newVal.subRadio || ''
  352. };
  353. } else if (this.type === 'checkboxTree' && newVal && typeof newVal === 'object') {
  354. // checkboxTree类型
  355. this.checkboxTreeValue = JSON.parse(JSON.stringify(newVal));
  356. this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(newVal));
  357. } else {
  358. this.inputValue = newVal;
  359. }
  360. }
  361. },
  362. filters: {
  363. },
  364. mounted() {
  365. if (this.item.type === 'attachment') {
  366. try {
  367. this.fileList = JSON.parse(this.value);
  368. } catch (e) {
  369. this.fileList = [];
  370. }
  371. }
  372. EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate);
  373. EventBus.$on('onEditSignCancel', this.handleEditSignCancel);
  374. EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
  375. //试剂
  376. EventBus.$on("onReagentSubmit", this.onReagentSubmit)
  377. //仪器
  378. EventBus.$on("onInstrumentSubmit", this.onMixReagentSubmit)
  379. //供试品/试剂/给药制剂等
  380. EventBus.$on("onMixReagentSubmit", this.onMixReagentSubmit)
  381. },
  382. unmounted() {
  383. EventBus.$off('onExternalFieldUpdate', this.handleExternalFieldUpdate);
  384. EventBus.$off('onEditSignCancel', this.handleEditSignCancel);
  385. EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
  386. EventBus.$off("onReagentSubmit", this.onReagentSubmit)
  387. EventBus.$off("onInstrumentSubmit", this.onMixReagentSubmit)
  388. EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit)
  389. },
  390. methods: {
  391. getFlexClass() {
  392. const noFlexArr = ["radio", "checkboxTag","fqyq"]
  393. return noFlexArr.includes(this.type) ? '' : 'flex1'
  394. },
  395. getDecimalDigits() {
  396. const { precision } = this.item;
  397. if (!isNaN(precision)) {
  398. return precision
  399. }
  400. return 6
  401. },
  402. onInstrumentSubmit(data) {
  403. if (data.uuid !== this.uuid) return;
  404. this.selectRegentInfo = data;
  405. },
  406. // 文件状态改变时的钩子,添加文件、上传成功、上传失败时都会被调用
  407. handleChange(file, fileList) {
  408. // 如果是新添加的文件(status为ready),进行验证
  409. if (file.status === 'ready') {
  410. const isAllowedType = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf',
  411. 'application/x-rar-compressed', 'application/zip',
  412. 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'].includes(file.raw.type)
  413. const isLt2M = file.size / 1024 / 1024 < 2
  414. if (!isAllowedType) {
  415. this.$message.error(`文件 ${file.name} 格式不支持!只能上传 JPG/PNG/GIF/PDF/RAR/ZIP/DOC/DOCX 格式的文件`)
  416. // 从fileList中移除该文件
  417. const index = fileList.indexOf(file);
  418. if (index > -1) {
  419. fileList.splice(index, 1);
  420. }
  421. this.fileList = [...fileList];
  422. return
  423. }
  424. if (!isLt2M) {
  425. this.$message.error(`文件 ${file.name} 大小超过2MB!`)
  426. // 从fileList中移除该文件
  427. const index = fileList.indexOf(file);
  428. if (index > -1) {
  429. fileList.splice(index, 1);
  430. }
  431. this.fileList = [...fileList];
  432. return
  433. }
  434. // 如果已经有文件在列表中(不包括当前新添加的),需要验证电子签名
  435. const existingFiles = fileList.filter(f => f !== file && f.status === 'success');
  436. if (existingFiles.length > 0) {
  437. // 保存待上传的文件信息
  438. this.pendingUploadFile = file;
  439. // 从fileList中暂时移除新文件,等待签名验证
  440. const index = fileList.indexOf(file);
  441. if (index > -1) {
  442. fileList.splice(index, 1);
  443. }
  444. this.fileList = [...fileList];
  445. // 触发电子签名弹窗
  446. EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
  447. return;
  448. }
  449. // 没有现有文件或验证通过,手动提交上传
  450. this.$nextTick(() => {
  451. // 找到对应的upload组件并提交
  452. const uploadComponent = this.$refs.uploadRef;
  453. if (uploadComponent) {
  454. uploadComponent.submit();
  455. }
  456. });
  457. }
  458. // 更新fileList
  459. this.fileList = fileList;
  460. },
  461. handleSuccess(res, file, fileList) {
  462. if (res.code == 200) {
  463. this.fileList = fileList;
  464. // 更新inputValue为文件路径列表,方便后续保存
  465. this.inputValue = JSON.stringify(this.getFileList(fileList));
  466. this.$emit("change", this.inputValue)
  467. this.onCommonHandleSaveRecord();
  468. this.$message.success('文件上传成功');
  469. } else {
  470. this.$message.error(res.message || '文件上传失败');
  471. // 上传失败,从列表中移除
  472. const index = fileList.indexOf(file);
  473. if (index > -1) {
  474. fileList.splice(index, 1);
  475. this.fileList = [...fileList];
  476. }
  477. }
  478. },
  479. getFileList(fileList) {
  480. const list = [];
  481. fileList.forEach(item => {
  482. const o = { name: item.name };
  483. if (item.url) {//回填的数据
  484. o.url = item.url
  485. } else {//新上传的
  486. o.url = item.response.data.url
  487. }
  488. list.push(o)
  489. })
  490. return list;
  491. },
  492. // 删除前验证电子签名
  493. beforeRemove(file) {
  494. // 所有删除操作都需要验证电子签名
  495. // 保存待删除的文件信息
  496. this.pendingRemoveFile = { file, fileList: this.fileList };
  497. // 触发电子签名弹窗
  498. EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
  499. // 返回false阻止默认删除行为,等待签名验证通过后再删除
  500. return false;
  501. },
  502. handleRemove(file, fileList) {
  503. // on-remove事件在before-remove返回false时不会触发
  504. // 这个方法在签名验证通过后通过executeRemove调用
  505. // 这里不需要额外处理,因为executeRemove已经处理了删除逻辑
  506. },
  507. // 执行实际的文件删除操作
  508. executeRemove(file, fileList) {
  509. // 从el-upload的内部uploadFiles中移除文件
  510. const uploadComponent = this.$refs.uploadRef;
  511. if (uploadComponent && uploadComponent.uploadFiles) {
  512. const uploadFileIndex = uploadComponent.uploadFiles.indexOf(file);
  513. if (uploadFileIndex > -1) {
  514. uploadComponent.uploadFiles.splice(uploadFileIndex, 1);
  515. }
  516. }
  517. // 从fileList中移除文件
  518. const index = fileList.indexOf(file);
  519. if (index > -1) {
  520. fileList.splice(index, 1);
  521. }
  522. // 更新fileList
  523. this.fileList = [...fileList];
  524. // 更新inputValue为剩余文件路径列表
  525. this.inputValue = JSON.stringify(this.getFileList(fileList));
  526. this.$emit("change", this.inputValue);
  527. // 触发保存记录
  528. this.onCommonHandleSaveRecord();
  529. this.$message.success(`文件 ${file.name} 已移除`);
  530. },
  531. handlePreview(file) {
  532. console.log(file)
  533. const url = file.url || file.response?.data?.url;
  534. if (url) {
  535. window.open(process.env.VUE_APP_FILE_DOMAIN + url, '_blank');
  536. }
  537. },
  538. handleExceed(files, fileList) {
  539. this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
  540. },
  541. //试剂弹窗提交
  542. onMixReagentSubmit(data) {
  543. if (data.uuid !== this.uuid) return;
  544. // 创建一个验证控制器,用于收集各级验证结果
  545. const validationController = {
  546. isPrevented: false,
  547. errorMsg: '',
  548. prevent(msg) {
  549. this.isPrevented = true;
  550. if (msg) this.errorMsg = msg;
  551. }
  552. };
  553. // 触发自定义验证事件,让父组件判断是否满足需求
  554. // 父组件可以通过validationController.prevent(msg)来阻止提交
  555. this.$emit('beforeReagentSubmit', data, validationController);
  556. // 检查是否被阻止
  557. if (validationController.isPrevented) {
  558. // 验证不通过,显示错误信息
  559. if (validationController.errorMsg) {
  560. this.$message.error(validationController.errorMsg);
  561. }
  562. return;
  563. }
  564. // 验证通过,继续执行
  565. this.executeReagentSubmit(data);
  566. },
  567. // 执行试剂提交的共同逻辑
  568. executeReagentSubmit(data) {
  569. this.inputValue = data.selectedId;
  570. const { filledCodes = [] } = this.item;
  571. console.log(filledCodes, "filledCodes")
  572. const { selectInfo, row } = data;
  573. if (filledCodes.length > 0) {
  574. this.inputValue = row[filledCodes[0]] + "(" + row[filledCodes[1]] + ")";
  575. }
  576. this.selectRegentInfo = data;
  577. EventBus.$emit("hideSelectMixReagentDialog");
  578. this.onCommonHandleSaveRecord(this.inputValue);
  579. },
  580. //统一处理试剂/供试品等弹窗
  581. onCommonHandleRegent(item, type) {
  582. if (this.templateFillType !== 'actFill') {
  583. return
  584. }
  585. let params = {
  586. studyFormId: this.templateData.id,
  587. uuid: this.uuid,
  588. sourceFrom: this.sourceFrom,
  589. }
  590. let eventName = "showSelectMixReagentDialog";
  591. if (type === "yq") {
  592. eventName = "showSelectInstrumentDialog";
  593. } else {
  594. const sjType = {
  595. sj: "1",//试剂
  596. gsp: "7",//供试品
  597. mix: "1",//试剂/供试品/试剂
  598. gyzj: "3",//给药制剂
  599. mjy: "5",//麻精药
  600. xj: "9",//细菌
  601. xb: "11",//细胞
  602. jcb: "13",//检测板
  603. qxbd: "15",//前序表单
  604. }
  605. params = {
  606. ...params,
  607. type: sjType[type]
  608. };
  609. if (type === "mix") {
  610. params.mixType = true;
  611. }else if(item.qxbdType){
  612. params.qxbdType = item.qxbdType;
  613. }
  614. }
  615. EventBus.$emit(eventName, params)
  616. // this.$emit('regent', item,type);
  617. },
  618. // 点击按钮
  619. handleClickButton(item) {
  620. this.inputValue = `button-${new Date().getTime()}`;
  621. this.onCommonHandleSaveRecord(this.inputValue);
  622. },
  623. onDateChange(val, format) {
  624. this.inputValue = moment(val).format(format);
  625. this.onCommonHandleSaveRecord(this.inputValue);
  626. },
  627. getUserName(record) {
  628. const locale = this.$i18n.locale;
  629. if (locale === 'zh_CN') {
  630. return record.userNameCn;
  631. }
  632. return record.userNameEn;
  633. },
  634. // 处理电子签名取消事件
  635. handleEditSignCancel(data) {
  636. if (data.uuid === this.uuid) {
  637. // 如果有待上传的文件,清空它
  638. if (this.pendingUploadFile) {
  639. this.pendingUploadFile = null;
  640. this.$message.info('已取消文件上传');
  641. } else if (this.pendingRemoveFile) {
  642. // 如果有待删除的文件,清空它
  643. this.pendingRemoveFile = null;
  644. this.$message.info('已取消文件删除');
  645. } else {
  646. this.resetRecord();
  647. }
  648. }
  649. },
  650. // 处理电子签名确认回调事件
  651. handleEditSignCallback(data) {
  652. if (data.uuid === this.uuid) {
  653. this.onEditSignSave(data.data);
  654. }
  655. },
  656. onEditSignSave(data) {
  657. // 检查是否有待上传的文件
  658. if (this.pendingUploadFile) {
  659. // 签名验证通过,将文件添加到列表并上传
  660. const file = this.pendingUploadFile;
  661. // 将文件添加到 fileList
  662. this.fileList.push(file);
  663. // 清空待上传文件标记
  664. this.pendingUploadFile = null;
  665. // 手动触发上传
  666. this.$nextTick(() => {
  667. const uploadComponent = this.$refs.uploadRef;
  668. if (uploadComponent) {
  669. uploadComponent.submit();
  670. }
  671. });
  672. } else if (this.pendingRemoveFile) {
  673. // 签名验证通过,执行文件删除
  674. const { file, fileList } = this.pendingRemoveFile;
  675. // 清空待删除文件标记
  676. this.pendingRemoveFile = null;
  677. // 执行删除操作
  678. this.executeRemove(file, fileList);
  679. } else {
  680. // 没有待上传/删除文件,执行正常的记录更新
  681. this.handleUpdateRecord(data);
  682. }
  683. },
  684. getChecked() {
  685. return !!this.getFieldCheckObj()[this.fieldKey]?.checked;
  686. },
  687. getFillTypeStyle(type) {
  688. const { fillType } = this.item;
  689. const filterType = ["attachment","checkboxTag","fqyq","checkboxTree"]
  690. const typeObj = {
  691. actFill: "orange-border",//实际填写的边框颜色
  692. green: "green-border",
  693. preFill: "blue-border",//预填写的边框颜色
  694. }
  695. // 如果有错误状态,返回红色边框样式,覆盖原有的边框颜色
  696. if (this.error && !filterType.includes(this.type)) {
  697. return "error-border";
  698. }
  699. return typeObj[fillType] || ""
  700. },
  701. //确认回复
  702. onReplyConfirm() {
  703. if (!this.replyContent) {
  704. this.$message({
  705. message: '请输入内容',
  706. type: 'error'
  707. });
  708. return;
  709. }
  710. const baseInfo = this.getCommonRecordInfo();
  711. const record = {
  712. ...baseInfo,
  713. title: this.templateFillType == 'actFill' ? "回复意见" : "复核意见",
  714. time: moment().format("YYYY-MM-DD HH:mm:ss"),
  715. }
  716. if (this.templateFillType == 'actFill') {
  717. record.reply = this.replyContent;
  718. const deepList = deepClone(this.getFhyjjl());//实际填报应该是修改指定的字段
  719. const item = deepList.find(o => o.key == record.key);
  720. if (item) {
  721. item.reply = this.replyContent;
  722. }
  723. this.replaceFhyjjl(deepList);//实际填报应该是修改指定的字段
  724. } else {
  725. const records = this.getReplyRecords();
  726. record.content = this.replyContent;
  727. if (records.length > 0) {
  728. const o = records[0];
  729. if (o.reply && o.content) {//如果填报人员已回复,那么就产生一条新的记录。
  730. this.updateFhyjjl(record);//qc直接插入数据源
  731. } else {//如果填报人员未填报,只更新当条记录的复核内容
  732. const deepList = deepClone(this.getFhyjjl());
  733. const item = deepList.find(it => it.key == record.key);
  734. if (item) {
  735. item.content = this.replyContent;
  736. }
  737. this.replaceFhyjjl(deepList);
  738. }
  739. } else {
  740. this.updateFhyjjl(record);//qc直接插入数据源
  741. }
  742. }
  743. const params = {
  744. //reply:回复,content:复核
  745. type: this.templateFillType == 'actFill' ? "reply" : "content",
  746. newRecord: [record],
  747. resourceList: this.getFhyjjl(),
  748. }
  749. // 触发回复记录事件
  750. EventBus.$emit('onModifyRecord', params);
  751. // 清空回复内容
  752. this.replyContent = '';
  753. // 隐藏弹窗
  754. this.visible = false;
  755. },
  756. //获取question图标颜色
  757. getQuestionColor() {
  758. const records = this.getReplyRecords();
  759. if (records.length > 0) {
  760. const o = records[0];
  761. if (o.reply && o.content) {//有回复意见和复核意见
  762. return "green"
  763. } else if (o.content && !o.reply) {//只有复核意见
  764. return "orange"
  765. } else {
  766. return "gray"
  767. }
  768. } else {//没有回复记录
  769. return "gray"
  770. }
  771. },
  772. // 复选框变化处理
  773. onCheckboxChange(val) {
  774. //有提出意见就不能勾选
  775. if (this.templateFillType == 'qc' && this.getQuestionColor() === "orange") {
  776. this.checkboxValue = false;
  777. this.$message({
  778. message: '该表单还有质疑项未处理,无法勾选',
  779. type: 'error'
  780. });
  781. return;
  782. }
  783. this.checkboxValue = val;
  784. // 触发修改记录事件
  785. EventBus.$emit('onModifyRecord', {
  786. type: "checkbox",
  787. fieldCheckObj: JSON.stringify({ ...this.getFieldCheckObj(), [this.fieldKey]: { checked: val } }),//复选框状态对象
  788. });
  789. this.updateFieldCheckObj({ [this.fieldKey]: { checked: val } });
  790. // this.$emit('input', val);
  791. // this.$emit('change', val);
  792. },
  793. onRemoveTag(e) {
  794. this.onCommonHandleSaveRecord(this.inputValue);
  795. },
  796. onItemCheckboxChange() {
  797. this.onCommonHandleSaveRecord(this.inputValue);
  798. },
  799. // 下拉框失去焦点处理
  800. onSelectBlur(visible) {
  801. if (!visible) {
  802. this.onCommonHandleSaveRecord(this.inputValue);
  803. }
  804. },
  805. // 统一处理输入变化
  806. onInputChange(val) {
  807. let value = val !== undefined ? val : this.inputValue;
  808. this.$emit('input', value);
  809. this.$emit('change', value);
  810. // 根据输入值判断是否显示错误状态
  811. const isEmpty = isValueEmpty(value);
  812. if (this.error && !isEmpty) {
  813. this.$emit('update:error', false);
  814. } else if (!this.error && isEmpty) {
  815. this.$emit('update:error', true);
  816. }
  817. },
  818. // checkboxTag的checkbox变化处理
  819. onCheckboxTagChange(tagIndex, e) {
  820. this.currentTagIndex = tagIndex;
  821. this.checkboxTagList[tagIndex].checked = e;
  822. this.emitCheckboxTagValue();
  823. this.onCommonHandleSaveRecord();
  824. },
  825. // 检查是否显示显示checkboxList的其他输入框
  826. isShowCheckboxListOther(option) {
  827. const {checkboxValues } = this.checkboxListValue
  828. if (!checkboxValues) {
  829. return false;
  830. }
  831. return option.otherCode && checkboxValues.includes(option.value);
  832. },
  833. // checkboxList的checkbox变化处理
  834. onCheckboxListChange(val) {
  835. this.currentHandleType = 'checkboxListValue';
  836. this.checkboxListValue.checkboxValues = val;
  837. this.onCommonHandleSaveRecord();
  838. },
  839. // tag输入框失去焦点
  840. onTagBlur(tagIndex) {
  841. this.currentTagIndex = tagIndex;
  842. const value = this.checkboxTagList[tagIndex].tagValue;
  843. this.emitCheckboxTagValue();
  844. this.onCommonHandleSaveRecord(value);
  845. },
  846. // 删除tag
  847. onDeleteTag(tagIndex) {
  848. this.currentTagIndex = tagIndex;
  849. // 从列表中删除指定索引的tag
  850. this.emitCheckboxTagValue();
  851. this.$emit("deleteTag", tagIndex);
  852. },
  853. // 发送checkboxTag的值
  854. emitCheckboxTagValue() {
  855. // 发送整个数组
  856. this.$emit('input', [...this.checkboxTagList]);
  857. this.$emit('change', [...this.checkboxTagList]);
  858. },
  859. // fqyq 主radio变化处理
  860. onFqyqRadioChange(val, radioType) {
  861. this.fqyqValue[radioType] = val;
  862. this.currentHandleType = radioType;
  863. this.onCommonHandleSaveRecord();
  864. },
  865. // fqyq 输入框失去焦点
  866. onFqyqInputBlur(e) {
  867. this.fqyqValue.inputValue = e.target.value;
  868. this.currentHandleType = 'inputValue';
  869. this.onCommonHandleSaveRecord(this.fqyqValue.inputValue);
  870. },
  871. // 统一处理失去焦点事件
  872. onBlur(e) {
  873. this.onCommonHandleSaveRecord(e.target.value);
  874. },
  875. // checkboxList的其他输入框失去焦点处理
  876. onCheckboxListOtherBlur(e, otherCode) {
  877. this.currentHandleType = "checkboxListOther";
  878. this.currentOtherCode = otherCode;
  879. this.checkboxListValue.otherValues[otherCode] = e.target.value;
  880. this.onCommonHandleSaveRecord(e.target.value);
  881. },
  882. // 检查checkboxTree的某个值是否被选中
  883. isCheckboxTreeChecked(value) {
  884. return this.checkboxTreeValue.checkedValues && this.checkboxTreeValue.checkedValues.includes(value);
  885. },
  886. // 检查checkboxTree的其他输入框是否有错误
  887. isCheckboxTreeOtherInputError(value) {
  888. if (!this.error) {
  889. return false;
  890. }
  891. return isValueEmpty(this.checkboxTreeValue.otherValues[value]);
  892. },
  893. // checkboxTree的复选框变化处理
  894. onCheckboxTreeChange(value, checked) {
  895. this.currentHandleType = 'checkboxTree';
  896. this.currentCheckboxTreeValue = value;
  897. // 初始化checkedValues数组
  898. if (!this.checkboxTreeValue.checkedValues) {
  899. this.checkboxTreeValue.checkedValues = [];
  900. }
  901. // 初始化otherValues对象
  902. if (!this.checkboxTreeValue.otherValues) {
  903. this.checkboxTreeValue.otherValues = {};
  904. }
  905. // 处理选中状态
  906. if (checked) {
  907. if (!this.checkboxTreeValue.checkedValues.includes(value)) {
  908. this.checkboxTreeValue.checkedValues.push(value);
  909. }
  910. } else {
  911. const index = this.checkboxTreeValue.checkedValues.indexOf(value);
  912. if (index > -1) {
  913. this.checkboxTreeValue.checkedValues.splice(index, 1);
  914. // 清除对应的otherValues
  915. delete this.checkboxTreeValue.otherValues[value];
  916. }
  917. }
  918. // 检查是否是第一次勾选
  919. const isFirstCheck = !this.checkboxTreeFirstCheck[value];
  920. if (isFirstCheck) {
  921. this.checkboxTreeFirstCheck[value] = true;
  922. // 第一次勾选不需要验签
  923. this.emitCheckboxTreeValue();
  924. this.updateCheckboxTreeOldValue();
  925. } else {
  926. // 非第一次勾选需要验签
  927. this.onCommonHandleSaveRecord();
  928. }
  929. },
  930. // checkboxTree的其他输入框失去焦点处理
  931. onCheckboxTreeOtherBlur(value, e) {
  932. this.currentHandleType = "checkboxTreeOther";
  933. this.currentCheckboxTreeValue = value;
  934. this.checkboxTreeValue.otherValues[value] = e.target.value;
  935. this.onCommonHandleSaveRecord(e.target.value);
  936. },
  937. // 发送checkboxTree的值
  938. emitCheckboxTreeValue() {
  939. this.$emit('input', JSON.parse(JSON.stringify(this.checkboxTreeValue)));
  940. this.$emit('change', JSON.parse(JSON.stringify(this.checkboxTreeValue)));
  941. },
  942. // 更新checkboxTree的旧值
  943. updateCheckboxTreeOldValue() {
  944. this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(this.checkboxTreeValue));
  945. },
  946. // 点击question图标
  947. onClickQuestion() {
  948. const { templateFillType } = this;
  949. if (templateFillType == 'actFill' || templateFillType == 'qc') {
  950. if (templateFillType == 'qc') {
  951. const field = this.getFieldCheckObj()[this.fieldKey];
  952. if (field && field.checked) {
  953. this.$message({
  954. message: '该字段已勾选复核框,请先取消勾选后再进行提交疑问',
  955. type: 'error'
  956. });
  957. return;
  958. }
  959. }
  960. const records = this.getReplyRecords();
  961. let content = "";
  962. if (records.length > 0) {
  963. const o = records[0];
  964. if (!o.reply && templateFillType == 'qc') {//如果填报人员没有回复,qc点击的时候需要回填上次填报的信息
  965. content = o.content;
  966. } else if (templateFillType == 'actFill') {//如果qc没有复核,填报点击的时候需要回填上次填报的信息
  967. content = o.reply;
  968. }
  969. }
  970. this.replyContent = content;
  971. this.visible = true;
  972. }
  973. },
  974. getCheckboxListInfo(){
  975. const { otherValues,checkboxValues } = this.checkboxListValue;
  976. const { otherValues: oldOtherValues,checkboxValues: oldCheckboxValues } = this.oldCheckboxListValue;
  977. const o = {
  978. "checkboxListValue":{oldValue:oldCheckboxValues,newValue:checkboxValues,des:""},
  979. "checkboxListOther":{oldValue:oldOtherValues[this.currentOtherCode],newValue:otherValues[this.currentOtherCode],des:"样品信息:"},
  980. }
  981. return o[this.currentHandleType];
  982. },
  983. getFqyqInfo(){
  984. const { mainRadio,inputValue,subRadio } = this.fqyqValue;
  985. const { mainRadio: oldMainRadio,inputValue: oldInputValue,subRadio: oldSubRadio } = this.oldFqyqValue;
  986. const o ={
  987. "mainRadio":{oldValue:oldMainRadio,newValue:mainRadio,des:""},
  988. "inputValue":{oldValue:oldInputValue,newValue:inputValue,des:""},
  989. "subRadio":{oldValue:oldSubRadio,newValue:subRadio,des:"是否在规定时间完成:"}
  990. }
  991. return o[this.currentHandleType];
  992. },
  993. async onCommonHandleSaveRecord(val) {
  994. const isEmpty = isValueEmpty(this.inputValue);
  995. if (this.error && !isEmpty) {
  996. this.$emit('update:error', false);
  997. } else if (!this.error && isEmpty) {
  998. this.$emit('update:error', true);
  999. }
  1000. // 创建验证控制器,让父组件可以在保存前进行验证
  1001. const validationController = {
  1002. isPrevented: false,
  1003. errorMsg: '',
  1004. prevent(msg) {
  1005. this.isPrevented = true;
  1006. if (msg) this.errorMsg = msg;
  1007. }
  1008. };
  1009. // 触发beforeSaveRecord事件,让父组件进行验证
  1010. this.$emit('beforeSaveRecord', {
  1011. value: this.inputValue,
  1012. oldValue: this.oldValue,
  1013. fieldKey: this.fieldKey
  1014. }, validationController);
  1015. // 检查是否被阻止
  1016. if (validationController.isPrevented) {
  1017. // 验证不通过,显示错误信息
  1018. if (validationController.errorMsg) {
  1019. this.$message.error(validationController.errorMsg);
  1020. }
  1021. // 回退到旧值
  1022. this.inputValue = this.oldValue;
  1023. this.$emit('input', this.inputValue);
  1024. return;
  1025. }
  1026. if (!this.isFieldsRecord) {//是否需要记录修改记录
  1027. this.$emit("blur", this.inputValue);
  1028. this.$emit('input', this.inputValue);
  1029. this.$emit("change", this.inputValue);
  1030. return;
  1031. }
  1032. // 值发生了变化,需要弹出密码输入框
  1033. let isSame = true, isOldValueEmpty = true;
  1034. const { currentHandleType } = this;
  1035. // 如果是checkboxList类型,需要同时比较otherValues
  1036. if (this.type === 'checkboxList') {
  1037. const current = this.getCheckboxListInfo();
  1038. isSame = this.isEqual(current.oldValue,current.newValue);
  1039. isOldValueEmpty = isValueEmpty(current.oldValue);
  1040. } else if (this.type === "checkboxTag") {
  1041. // checkboxTag类型,只比较当前tagIndex的数据
  1042. const currentTag = this.checkboxTagList[this.currentTagIndex];
  1043. const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {};
  1044. isSame = this.isEqual(oldTag.checked, currentTag.checked);
  1045. isOldValueEmpty = isValueEmpty(oldTag.checked);
  1046. } else if (this.type === "fqyq") {
  1047. const current = this.getFqyqInfo();
  1048. isSame = this.isEqual(current.oldValue,current.newValue);
  1049. isOldValueEmpty = isValueEmpty(current.oldValue);
  1050. } else if (this.type === "checkboxTree") {
  1051. // checkboxTree类型,比较checkedValues
  1052. isSame = this.isEqual(this.oldCheckboxTreeValue.checkedValues, this.checkboxTreeValue.checkedValues);
  1053. isOldValueEmpty = isValueEmpty(this.oldCheckboxTreeValue.checkedValues);
  1054. } else {
  1055. isSame = this.isEqual(this.oldValue, this.inputValue)
  1056. isOldValueEmpty = isValueEmpty(this.oldValue);
  1057. }
  1058. console.log(isSame,isOldValueEmpty,this.fqyqValue,this.oldFqyqValue,"isSame")
  1059. if (isSame) {
  1060. return;
  1061. }
  1062. if (!isOldValueEmpty && !(isSame) && this.templateFillType === "actFill") {
  1063. // 通过EventBus触发电子签名弹窗
  1064. EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
  1065. } else {//如果是第一次填写,不需要密码验证
  1066. this.handleUpdateRecord()
  1067. }
  1068. },
  1069. //如果用户取消,那么回退到上一次的值
  1070. resetRecord() {
  1071. // 用户点击取消,还原数据
  1072. let oldValue = this.oldValue;
  1073. if (this.type === 'checkboxList') {
  1074. oldValue = {
  1075. checkboxValues: this.oldCheckboxListValue.checkboxValues,
  1076. otherValues: this.oldCheckboxListValue.otherValues
  1077. };
  1078. } else if (this.type === "checkboxTag") {
  1079. // checkboxTag类型,只回退当前tagIndex的数据
  1080. if (this.currentTagIndex >= 0 && this.currentTagIndex < this.oldCheckboxTagList.length) {
  1081. const oldTag = this.oldCheckboxTagList[this.currentTagIndex];
  1082. this.checkboxTagList[this.currentTagIndex] = { ...oldTag };
  1083. oldValue = [...this.checkboxTagList];
  1084. } else {
  1085. // 如果没有指定tagIndex,回退整个数组
  1086. this.checkboxTagList = JSON.parse(JSON.stringify(this.oldCheckboxTagList));
  1087. oldValue = [...this.checkboxTagList];
  1088. }
  1089. } else if (this.type === "fqyq") {
  1090. // 如果没有指定字段,回退整个对象
  1091. this.fqyqValue = JSON.parse(JSON.stringify(this.oldFqyqValue));
  1092. oldValue = { ...this.fqyqValue };
  1093. } else if (this.type === "checkboxTree") {
  1094. // checkboxTree类型,回退整个对象
  1095. this.checkboxTreeValue = JSON.parse(JSON.stringify(this.oldCheckboxTreeValue));
  1096. oldValue = JSON.parse(JSON.stringify(this.oldCheckboxTreeValue));
  1097. }
  1098. this.inputValue = this.oldValue;
  1099. this.$emit('input', oldValue); // 触发 v-model 更新
  1100. // this.$emit("blur", this.oldValue);
  1101. this.$emit("change", oldValue, "cancel");
  1102. if (this.item.type === "clickable") {
  1103. this.$emit("resetRecord");
  1104. }
  1105. },
  1106. //处理更新记录
  1107. handleUpdateRecord(data, recordData) {
  1108. const baseInfo = this.getCommonRecordInfo();
  1109. if (!this.oldValue && !this.inputValue) {
  1110. return
  1111. }
  1112. if (recordData) {
  1113. this.oldValue = recordData.oldValue;
  1114. this.inputValue = recordData.inputValue;
  1115. }
  1116. let recordOldVlaue = this.oldValue, recordValue = this.inputValue, isModify = !!this.oldValue;
  1117. if (this.type === "checkboxTag") {
  1118. // checkboxTag类型,只记录当前tagIndex的数据变化
  1119. const oldTag = this.oldCheckboxTagList[this.currentTagIndex] || {};
  1120. const currentTag = this.checkboxTagList[this.currentTagIndex] || {};
  1121. recordOldVlaue = `${oldTag.tagValue || ''}:${oldTag.checked ? '勾选' : '未勾选'}`;
  1122. recordValue = `${currentTag.tagValue || ''}:${currentTag.checked ? '勾选' : '未勾选'}`;
  1123. isModify = oldTag.checked !== undefined;
  1124. } else if (this.type === "fqyq") {
  1125. const current = this.getFqyqInfo();
  1126. recordOldVlaue = `${current.des+current.oldValue}`;
  1127. recordValue = `${current.des+current.newValue}`;
  1128. isModify = !!this.oldFqyqValue.mainRadio
  1129. }else if(this.type === "checkboxList"){
  1130. const current = this.getCheckboxListInfo();
  1131. recordOldVlaue = `${current.des+(current.oldValue || '')}`;
  1132. recordValue = `${current.des+(current.newValue || '')}`;
  1133. isModify = !!current.oldValue;
  1134. } else if (this.type === "checkboxTree") {
  1135. // checkboxTree类型,记录当前操作的值变化
  1136. const value = this.currentCheckboxTreeValue;
  1137. const oldChecked = this.oldCheckboxTreeValue.checkedValues && this.oldCheckboxTreeValue.checkedValues.includes(value);
  1138. const currentChecked = this.checkboxTreeValue.checkedValues && this.checkboxTreeValue.checkedValues.includes(value);
  1139. recordOldVlaue = `${value}:${oldChecked ? '勾选' : '未勾选'}`;
  1140. recordValue = `${value}:${currentChecked ? '勾选' : '未勾选'}`;
  1141. isModify = oldChecked !== undefined;
  1142. }
  1143. const record = {
  1144. ...baseInfo,
  1145. oldValue: recordOldVlaue,
  1146. value: recordValue,
  1147. title: isModify ? "修改" : "提交",
  1148. time: moment().format("YYYY-MM-DD HH:mm:ss"),
  1149. }
  1150. if (data) {
  1151. record.reason = data.remark
  1152. }
  1153. const params = {
  1154. type: "fieldChanged",
  1155. newRecord: [record],
  1156. resourceList: this.getZdxgjl(),
  1157. }
  1158. // 更新oldValue和oldOtherValues
  1159. if (this.type === 'checkboxList') {
  1160. this.oldCheckboxListValue = JSON.parse(JSON.stringify(this.checkboxListValue));
  1161. } else if (this.type === "checkboxTag") {
  1162. // checkboxTag类型,只更新当前tagIndex的数据
  1163. if (this.currentTagIndex >= 0 && this.currentTagIndex < this.checkboxTagList.length) {
  1164. this.oldCheckboxTagList[this.currentTagIndex] = { ...this.checkboxTagList[this.currentTagIndex] };
  1165. } else {
  1166. // 如果没有指定tagIndex,更新整个数组
  1167. this.oldCheckboxTagList = JSON.parse(JSON.stringify(this.checkboxTagList));
  1168. }
  1169. } else if (this.type === "fqyq") {
  1170. // 如果没有指定字段,更新整个对象
  1171. this.oldFqyqValue = JSON.parse(JSON.stringify(this.fqyqValue));
  1172. } else if (this.type === "checkboxTree") {
  1173. // checkboxTree类型,更新整个对象
  1174. this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(this.checkboxTreeValue));
  1175. }
  1176. let value = this.inputValue;
  1177. if (this.type === 'checkboxList') {
  1178. value = {
  1179. checkboxValues: this.checkboxListValue.checkboxValues,
  1180. otherValues: this.checkboxListValue.otherValues
  1181. };
  1182. } else if (this.type === "checkboxTag") {
  1183. value = [...this.checkboxTagList];
  1184. } else if (this.type === "fqyq") {
  1185. value = { ...this.fqyqValue };
  1186. } else if (this.type === "checkboxTree") {
  1187. value = JSON.parse(JSON.stringify(this.checkboxTreeValue));
  1188. }
  1189. if (this.type === "button") {
  1190. this.$emit('clickButton', this.item, this.inputValue, data);
  1191. if (this.templateFillType === "preFill") {
  1192. return;
  1193. }
  1194. }
  1195. //用户输入密码并点击确定,保存修改
  1196. this.oldValue = value; // 更新旧值
  1197. this.$emit("blur", value);
  1198. this.$emit('input', value);
  1199. this.$emit("change", value, data ? "save" : "");
  1200. if (this.item.type === "clickable") {//clickable的丢给父级去处理
  1201. return;
  1202. }
  1203. if (this.templateFillType === "actFill") {//只有实际填报的时候才记录修改记录
  1204. this.updateZdxgjl(record);
  1205. }
  1206. this.$nextTick(() => {
  1207. EventBus.$emit('onModifyRecord', params,)
  1208. console.log(params, "onModifyRecord")
  1209. if (this.regentType.includes(this.item.type)) {
  1210. this.$emit("onRegentSubmit", this.selectRegentInfo, this.inputValue);
  1211. }
  1212. })
  1213. },
  1214. //判断两个值是否相等
  1215. isEqual(oldValue, nowValue) {
  1216. if (oldValue === null || nowValue === null) {
  1217. return oldValue === nowValue;
  1218. }
  1219. if (typeof oldValue === 'object' && typeof nowValue === 'object') {
  1220. return JSON.stringify(oldValue) === JSON.stringify(nowValue);
  1221. }
  1222. return oldValue === nowValue;
  1223. },
  1224. //获取公共记录信息
  1225. getCommonRecordInfo() {
  1226. const { nickName, name } = this.$store.getters;
  1227. //locale:zh-CN 中文 en-US 英文
  1228. const { label, parentLabel } = this.item;
  1229. let fieldLabelCn = this.$i18n.t(label, "zh_CN"), fieldLabelEn = this.$i18n.t(label, "en_US");
  1230. if (label === "template.common.other") {
  1231. fieldLabelCn = this.$i18n.t(parentLabel, "zh_CN") + this.$i18n.t("template.common.otherInfo", "zh_CN");
  1232. fieldLabelEn = this.$i18n.t(parentLabel, "en_US") + this.$i18n.t("template.common.otherInfo", "en_US");
  1233. } else if (!label && parentLabel == "template.common.remark") {
  1234. fieldLabelCn = this.$i18n.t(parentLabel, "zh_CN") + this.$i18n.t("template.common.unit", "zh_CN");
  1235. fieldLabelEn = this.$i18n.t(parentLabel, "en_US") + this.$i18n.t("template.common.unit", "en_US");
  1236. }
  1237. const commonInfo = {
  1238. userNameCn: nickName,
  1239. userNameEn: name,
  1240. key: this.fieldKey,
  1241. fieldCn: `${this.$i18n.t(this.fieldItemLabel, "zh_CN")}` + (fieldLabelCn ? ("-" + fieldLabelCn) : ""),
  1242. fieldEn: `${this.$i18n.t(this.fieldItemLabel, "en_US")}` + (fieldLabelEn ? ("-" + fieldLabelEn) : ""),
  1243. }
  1244. return commonInfo;
  1245. },
  1246. // 判断值是否为空
  1247. isValueEmpty(value) {
  1248. if (value === null || value === undefined || value === '') {
  1249. return true;
  1250. }
  1251. if (typeof value === 'string' && value.trim() === '') {
  1252. return true;
  1253. }
  1254. if (Array.isArray(value) && value.length === 0) {
  1255. return true;
  1256. }
  1257. if (Object.keys(value).length === 0) {
  1258. return true;
  1259. }
  1260. return false;
  1261. },
  1262. // 判断checkboxList中特定otherCode输入框是否有错误
  1263. isOtherInputError(otherCode) {
  1264. if (!this.error) {
  1265. return false;
  1266. }
  1267. // 检查该otherCode对应的输入框是否为空
  1268. return isValueEmpty(this.otherValues[otherCode]);
  1269. },
  1270. handleClickable(item, event) {
  1271. if (this.templateFillType !== 'actFill') {
  1272. return
  1273. }
  1274. this.$emit("clickable", item)
  1275. },
  1276. //判断是否禁用复选框
  1277. getCheckboxDisabled() {
  1278. //只有qc能操作checkbox,其他都只能看。
  1279. return this.templateFillType !== 'qc'
  1280. },
  1281. //判断是否显示复选框图标
  1282. getIsShowCheckboxIcon() {
  1283. if (this.templateFillType === 'qc') {
  1284. return true;
  1285. }
  1286. return this.getChecked();
  1287. },
  1288. //判断是否显示复制按钮
  1289. getIsShowCopyIcon() {
  1290. const { copyFrom } = this.item;
  1291. return copyFrom && this.templateFillType === "actFill";
  1292. },
  1293. //判断是否显示操作按钮
  1294. isShowHandle() {
  1295. const { fillType } = this.item;
  1296. //只有当模板状态不是预填时,才显示操作按钮
  1297. return this.templateFillType !== "preFill" && fillType === "actFill" && this.type !== "button"
  1298. },
  1299. //判断是否禁用
  1300. getDisabled() {
  1301. const { item } = this;
  1302. const { fillType } = item;
  1303. if (item.hasOwnProperty("disabled")) {
  1304. return item.disabled
  1305. } else {
  1306. if (fillType === "actFill") {//当模板状态是实际填写时,只有当fillType是actFill时才能填写
  1307. return this.templateFillType !== "actFill"
  1308. } else if (fillType === "preFill") {//当模板状态是预填写时,只有当fillType是preFill才能填写
  1309. return this.templateFillType !== "preFill"
  1310. } else {
  1311. return true
  1312. }
  1313. }
  1314. },
  1315. getPlaceholder() {
  1316. const { placeholder, label } = this.item;
  1317. const { type } = this;
  1318. if (this.getDisabled()) {
  1319. return ""
  1320. }
  1321. if (this.regentType.includes(type) || type === "clickable" || type === "fqyq") {
  1322. return this.$t("template.common.pleaseSelect")
  1323. }
  1324. let prex = "template.common.pleaseFillIn"
  1325. if (type === "select" || type === "dateTime") {
  1326. prex = "template.common.pleaseSelect"
  1327. }
  1328. return placeholder ? this.$t(placeholder) : (this.$t(prex) + this.$t(label))
  1329. },
  1330. async onCopy() {
  1331. // 触发复制事件
  1332. this.$emit("copy");
  1333. // 等待复制操作完成后,调用保存记录方法
  1334. this.$nextTick(async () => {
  1335. await this.onCommonHandleSaveRecord(this.inputValue);
  1336. });
  1337. },
  1338. //判断是否显示问题图标
  1339. getIsShowQuestionIcon() {
  1340. if (this.templateFillType === "qc") {//qc可以直接查看
  1341. return true;
  1342. }
  1343. return this.getReplyRecords().length > 0;
  1344. },
  1345. //判断是否显示修改记录图标
  1346. getIsShowRecordIcon() {
  1347. return this.getModifyRecords().length > 0
  1348. },
  1349. //获取回复记录
  1350. getReplyRecords() {
  1351. const { fieldKey, getFhyjjl } = this;
  1352. const records = getFhyjjl()?.filter(item => item.key === fieldKey) || [];
  1353. return records;
  1354. },
  1355. //获取字段修改记录
  1356. getModifyRecords() {
  1357. const { fieldKey, getZdxgjl } = this;
  1358. const records = getZdxgjl().filter(item => item.key === fieldKey);
  1359. return records;
  1360. },
  1361. // 鼠标进入主容器
  1362. async onMouseEnter(type, event) {
  1363. this.currentRecordType = type;
  1364. clearTimeout(this.modalTimer);
  1365. let record = [];
  1366. if (type === "fieldChanged") {
  1367. record = this.getModifyRecords();
  1368. } else if (type === "replyRecord") {
  1369. record = this.getReplyRecords();
  1370. }
  1371. this.modificationRecords = record;
  1372. // 先计算模态框位置,避免闪烁
  1373. this.showModal = true;
  1374. this.$nextTick(() => {
  1375. if (this.$refs.modalRef) {
  1376. const elementRect = event.target.getBoundingClientRect();
  1377. const modalEl = this.$refs.modalRef;
  1378. // 获取模态框的宽度和高度
  1379. const modalWidth = modalEl.offsetWidth || 250; // 默认宽度
  1380. const modalHeight = modalEl.offsetHeight || 300; // 默认高度
  1381. const viewportWidth = window.innerWidth;
  1382. const viewportHeight = window.innerHeight;
  1383. // 计算模态框位置
  1384. let leftPos, topPos;
  1385. // 检查右侧空间是否足够
  1386. if (elementRect.right + modalWidth + 5 <= viewportWidth) {
  1387. // 右侧空间充足,显示在右侧
  1388. leftPos = elementRect.right + 5 + 'px';
  1389. } else if (elementRect.left - modalWidth - 5 >= 0) {
  1390. // 左侧空间充足,显示在左侧
  1391. leftPos = elementRect.left - modalWidth - 5 + 'px';
  1392. } else {
  1393. // 两侧空间都不足,选择空间更大的一边
  1394. if (elementRect.left > viewportWidth - elementRect.right) {
  1395. // 左侧空间更大,显示在左侧
  1396. leftPos = Math.max(5, elementRect.left - modalWidth - 5) + 'px';
  1397. } else {
  1398. // 右侧空间更大,显示在右侧(可能会超出屏幕,但尽量靠近边缘)
  1399. leftPos = Math.min(elementRect.right + 5, viewportWidth - 5) + 'px';
  1400. }
  1401. }
  1402. // 计算顶部位置,确保不超出屏幕上下边界
  1403. topPos = Math.max(5, Math.min(elementRect.top, viewportHeight - modalHeight - 5)) + 'px';
  1404. // 设置模态框位置
  1405. modalEl.style.left = leftPos;
  1406. modalEl.style.top = topPos;
  1407. }
  1408. });
  1409. },
  1410. // 鼠标离开主容器
  1411. onMouseLeave() {
  1412. // this.currentRecordType = '';
  1413. // this.modificationRecords = [];//清空数据源
  1414. // 延迟隐藏模态框,让用户有机会移动到模态框上
  1415. this.modalTimer = setTimeout(() => {
  1416. if (!this.isHoveringModal) {
  1417. this.showModal = false;
  1418. }
  1419. }, 100);
  1420. },
  1421. // 鼠标进入模态框
  1422. onModalEnter() {
  1423. this.isHoveringModal = true;
  1424. clearTimeout(this.modalTimer);
  1425. },
  1426. // 鼠标离开模态框
  1427. onModalLeave() {
  1428. this.isHoveringModal = false;
  1429. this.currentRecordType = "";
  1430. this.modificationRecords = [];//清空数据源
  1431. this.modalTimer = setTimeout(() => {
  1432. this.showModal = false;
  1433. }, 100);
  1434. },
  1435. },
  1436. }
  1437. </script>
  1438. <style lang="scss">
  1439. .flex {
  1440. display: flex;
  1441. align-items: center;
  1442. }
  1443. .flex1 {
  1444. flex: 1;
  1445. }
  1446. .handle-row {
  1447. margin-left: 5px;
  1448. display: flex;
  1449. align-items: center;
  1450. cursor: pointer;
  1451. }
  1452. .w-100 {
  1453. width: 100%;
  1454. }
  1455. .handle-icon {
  1456. width: 18px;
  1457. height: 18px;
  1458. &:not(:last-child) {
  1459. margin-right: 5px;
  1460. }
  1461. }
  1462. .mr-5 {
  1463. margin-right: 5px !important;
  1464. }
  1465. .orange {
  1466. color: #f9c588;
  1467. }
  1468. .green {
  1469. color: green;
  1470. }
  1471. .gray {
  1472. color: #b2b2b2;
  1473. }
  1474. .orange-border {
  1475. .el-input-group__prepend,
  1476. input,
  1477. textarea {
  1478. border-color: #f9c588;
  1479. &:focus {
  1480. border-color: #f9c588;
  1481. }
  1482. &:hover {
  1483. border-color: #f9c588;
  1484. }
  1485. &:disabled {
  1486. border-color: #f9c588 !important;
  1487. }
  1488. }
  1489. .el-checkbox__inner {
  1490. border-color: #f9c588 !important;
  1491. }
  1492. }
  1493. .el-button--primary {
  1494. &.orange-border {
  1495. background-color: #f79b31 !important;
  1496. border-color: #f79b31 !important;
  1497. &:hover {
  1498. background-color: #f79b31 !important;
  1499. }
  1500. &:disabled {
  1501. background-color: rgba(#f79b31, .8) !important;
  1502. border-color: rgba(#f79b31, .8) !important;
  1503. }
  1504. &:active {
  1505. background-color: rgba(#f79b31, .8) !important;
  1506. border-color: rgba(#f79b31, .8) !important;
  1507. }
  1508. }
  1509. &.blue-border {
  1510. background-color: #4ea2ff !important;
  1511. border-color: #4ea2ff !important;
  1512. &:hover {
  1513. background-color: #4ea2ff !important;
  1514. }
  1515. &:disabled {
  1516. background-color: rgba(#4ea2ff, .8) !important;
  1517. border-color: rgba(#4ea2ff, .8) !important;
  1518. }
  1519. &:active {
  1520. background-color: rgba(#4ea2ff, .8) !important;
  1521. border-color: rgba(#4ea2ff, .8) !important;
  1522. }
  1523. }
  1524. }
  1525. .green-border {
  1526. .el-input-group__prepend,
  1527. input,
  1528. textarea {
  1529. border-color: green;
  1530. &:focus {
  1531. border-color: green;
  1532. }
  1533. &:hover {
  1534. border-color: green;
  1535. }
  1536. &:disabled {
  1537. border-color: green !important;
  1538. }
  1539. }
  1540. }
  1541. .blue-border {
  1542. .el-input-group__prepend,
  1543. input,
  1544. .el-checkbox__inner,
  1545. textarea {
  1546. border-color: #4ea2ff;
  1547. &:focus {
  1548. border-color: #4ea2ff;
  1549. }
  1550. &:hover {
  1551. border-color: #4ea2ff;
  1552. }
  1553. &:disabled {
  1554. border-color: #4ea2ff !important;
  1555. }
  1556. }
  1557. }
  1558. .error-border {
  1559. .el-input-group__prepend,
  1560. input,
  1561. textarea,
  1562. .el-select,
  1563. .clickable,
  1564. .el-date-editor {
  1565. border-color: #ff5d5d;
  1566. box-shadow: 0 0 6px #ffc3c3 !important;
  1567. &:focus {
  1568. border-color: #ff5d5d;
  1569. box-shadow: 0 0 6px #ffc3c3 !important;
  1570. }
  1571. &:hover {
  1572. border-color: #ff5d5d;
  1573. box-shadow: 0 0 6px #ffc3c3 !important;
  1574. }
  1575. }
  1576. // 为 el-select 和 el-date-picker 添加错误边框样式
  1577. .el-select .el-input__inner,
  1578. .el-date-editor .el-input__inner .el-checkbox__inner {
  1579. border-color: #ff5d5d;
  1580. box-shadow: 0 0 6px #ffc3c3 !important;
  1581. }
  1582. // 处理 DecimalInput 组件的错误边框样式
  1583. :deep(.el-input-number) {
  1584. .el-input__inner {
  1585. border-color: #ff5d5d;
  1586. box-shadow: 0 0 6px #ffc3c3 !important;
  1587. }
  1588. }
  1589. // 为点击式表单项添加错误边框样式
  1590. .clickable {
  1591. border-color: #ff5d5d;
  1592. box-shadow: 0 0 6px #ffc3c3 !important;
  1593. }
  1594. }
  1595. .orange-bg {
  1596. background-color: #FFF1F1 !important; // 橙色背景,透明度适中
  1597. input,
  1598. textarea,
  1599. .el-input__inner,
  1600. .el-textarea__inner {
  1601. background-color: #FFF1F1 !important;
  1602. }
  1603. }
  1604. .modification-modal {
  1605. position: fixed;
  1606. z-index: 9999;
  1607. background-color: rgba(0, 0, 0, 0.7);
  1608. border-radius: 4px;
  1609. padding: 10px;
  1610. color: white;
  1611. max-height: 300px;
  1612. min-width: 250px;
  1613. overflow: hidden;
  1614. pointer-events: auto;
  1615. opacity: 0;
  1616. transform: scale(0.9);
  1617. transition: opacity 0.2s ease, transform 0.2s ease;
  1618. }
  1619. .modification-modal.show {
  1620. opacity: 1;
  1621. transform: scale(1);
  1622. }
  1623. .modification-modal .modal-content {
  1624. max-height: 280px;
  1625. overflow-y: auto;
  1626. padding-right: 5px;
  1627. }
  1628. .modification-modal .modal-content h4 {
  1629. margin: 0 0 10px 0;
  1630. font-size: 14px;
  1631. border-bottom: 1px solid #ccc;
  1632. padding-bottom: 5px;
  1633. }
  1634. .modification-modal .records-list {
  1635. font-size: 12px;
  1636. }
  1637. .modification-modal .record-item p {
  1638. margin: 5px 0;
  1639. word-break: break-all;
  1640. }
  1641. .modification-modal .record-item hr {
  1642. border: 0;
  1643. border-top: 1px solid #555;
  1644. margin: 8px 0;
  1645. }
  1646. .modification-modal .no-records {
  1647. text-align: center;
  1648. color: #aaa;
  1649. font-style: italic;
  1650. }
  1651. .clickable {
  1652. cursor: pointer;
  1653. width: auto;
  1654. // margin-left: 10px;
  1655. min-height: 28px;
  1656. line-height: 28px;
  1657. word-break: break-all;
  1658. border-radius: 4px;
  1659. border: 1px solid #4ea2ff;
  1660. display: flex;
  1661. align-items: center;
  1662. padding: 0 15px;
  1663. font-size: 14px;
  1664. font-weight: normal;
  1665. color: #606266;
  1666. flex: 1;
  1667. &.disabled {
  1668. cursor: not-allowed;
  1669. color: #c0c4cc;
  1670. background-color: #f5f7fa;
  1671. }
  1672. &.error-border {
  1673. border-color: #ff5d5d !important;
  1674. box-shadow: 0 0 6px #ffc3c3 !important;
  1675. }
  1676. }
  1677. .dialog-footer {
  1678. display: flex;
  1679. justify-content: flex-end;
  1680. }
  1681. .atta-tips {
  1682. color: #ff5d5d;
  1683. font-size: 12px;
  1684. margin-left: 5px;
  1685. }
  1686. .checkbox-list-container {
  1687. padding: 12px;
  1688. border: 1px solid #dcdfe6;
  1689. border-radius: 4px;
  1690. transition: all 0.3s;
  1691. &.error-border {
  1692. border-color: #ff5d5d !important;
  1693. box-shadow: 0 0 6px #ffc3c3 !important;
  1694. }
  1695. .checkbox-item {
  1696. margin-right: 16px;
  1697. display: flex;
  1698. align-items: center;
  1699. &:not(:last-child) {
  1700. margin-bottom: 10px;
  1701. }
  1702. // display: inline-block;
  1703. .el-input {
  1704. width: 200px;
  1705. margin-left: 10px;
  1706. &.error-border {
  1707. .el-input__inner {
  1708. border-color: #ff5d5d !important;
  1709. box-shadow: 0 0 6px #ffc3c3 !important;
  1710. }
  1711. }
  1712. }
  1713. }
  1714. }
  1715. .orange-border {
  1716. .checkbox-list-container {
  1717. border-color: #f9c588;
  1718. &:hover {
  1719. border-color: #f79b31;
  1720. }
  1721. }
  1722. .el-checkbox {
  1723. &.is-checked {
  1724. .el-checkbox__label {
  1725. color: #606266;
  1726. }
  1727. .el-checkbox__inner {
  1728. background-color: #f9c588;
  1729. border-color: #f9c588;
  1730. }
  1731. }
  1732. }
  1733. .el-radio {
  1734. &.is-checked {
  1735. .el-radio__label {
  1736. color: #606266;
  1737. }
  1738. .el-radio__inner {
  1739. background-color: #f9c588;
  1740. border-color: #f9c588;
  1741. }
  1742. }
  1743. .el-radio__inner {
  1744. border-color: #f9c588;
  1745. }
  1746. }
  1747. }
  1748. .orange-bg {
  1749. .checkbox-list-container {
  1750. background-color: #FFF1F1 !important;
  1751. border-color: #f9c588;
  1752. }
  1753. }
  1754. // checkboxTag样式
  1755. .checkbox-tag-wrapper {
  1756. display: flex;
  1757. flex-wrap: wrap;
  1758. gap: 10px;
  1759. padding: 8px;
  1760. }
  1761. .checkbox-tag-container {
  1762. border-radius: 4px;
  1763. .checkbox-tag-item {
  1764. display: flex;
  1765. align-items: center;
  1766. gap: 8px;
  1767. .tag-content {
  1768. cursor: pointer;
  1769. position: relative;
  1770. .tag-input {
  1771. width: 100px;
  1772. }
  1773. .tag-display {
  1774. cursor: pointer;
  1775. user-select: none;
  1776. }
  1777. }
  1778. .delete-icon {
  1779. cursor: pointer;
  1780. color: #909399;
  1781. font-size: 12px;
  1782. padding: 2px;
  1783. border-radius: 50%;
  1784. position: absolute;
  1785. top: 6px;
  1786. right: 5px;
  1787. color: red;
  1788. background-color: #f5f5f5;
  1789. }
  1790. }
  1791. }
  1792. .fqyq-input{
  1793. width: 500px;
  1794. margin-right:10px;
  1795. }
  1796. .mb-10{
  1797. margin-bottom: 10px;
  1798. }
  1799. .fs-14{
  1800. font-size: 14px;
  1801. }
  1802. .mr-10{
  1803. margin-right: 10px;
  1804. }
  1805. .checkbox-tree-children{
  1806. margin-left: 30px;
  1807. padding:16px 0;
  1808. gap: 16px;
  1809. display: grid;
  1810. grid-template-columns: repeat(4, 1fr);
  1811. }
  1812. .checkbox-tree-item{
  1813. box-sizing: border-box;
  1814. }
  1815. </style>