form.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943
  1. <script setup>
  2. import {
  3. computed,
  4. nextTick,
  5. onMounted,
  6. ref,
  7. reactive,
  8. defineExpose,
  9. watch,
  10. } from "vue";
  11. import { useDataDictStore } from "@/store/modules/dataDict";
  12. import {
  13. selectedDeptsEmployee,
  14. getRuiHenProjectInfoPage,
  15. getDevicesByDepts,
  16. getRuiHenTaskDetail1,
  17. } from "@/api/ruihen";
  18. import { specifiedSimpleDepts } from "@/api";
  19. import { getDeptId } from "@/utils/auth";
  20. import DaTree from "@/components/da-tree/index.vue";
  21. const props = defineProps({
  22. type: {
  23. type: String,
  24. default: "create",
  25. },
  26. id: {
  27. type: Number,
  28. default: null,
  29. },
  30. });
  31. const dictStore = useDataDictStore();
  32. const isReadonly = computed(() => props.type === "detail");
  33. const createInitialForm = () => ({
  34. id: "",
  35. projectId: undefined,
  36. wellName: "",
  37. location: "",
  38. technique: undefined,
  39. workloadDesign: undefined,
  40. workloadUnit: undefined,
  41. deptIds: [],
  42. deviceIds: [],
  43. responsiblePerson: undefined,
  44. remark: "",
  45. });
  46. const formRef = ref(null);
  47. const form = ref(createInitialForm());
  48. const rules = reactive({
  49. projectId: {
  50. rules: [{ required: true, errorMessage: "请选择合同" }],
  51. },
  52. wellName: {
  53. rules: [{ required: true, errorMessage: "请输入井号" }],
  54. },
  55. location: {
  56. rules: [{ required: true, errorMessage: "请输入施工地点" }],
  57. },
  58. technique: {
  59. rules: [{ required: true, errorMessage: "请选择施工工艺" }],
  60. },
  61. workloadDesign: {
  62. rules: [{ required: true, errorMessage: "请输入设计工作量" }],
  63. },
  64. workloadUnit: {
  65. rules: [{ required: true, errorMessage: "请选择工作量单位" }],
  66. },
  67. deptIds: {
  68. rules: [{ required: true, errorMessage: "请选择施工队伍" }],
  69. },
  70. deviceIds: {
  71. rules: [{ required: true, errorMessage: "请选择施工设备" }],
  72. },
  73. responsiblePerson: {
  74. rules: [{ required: true, errorMessage: "请选择责任人" }],
  75. },
  76. });
  77. const validate = async () => {
  78. return await formRef.value?.validate();
  79. };
  80. const buildSubmitData = () => {
  81. return {
  82. ...(form.value.id ? { id: form.value.id } : {}),
  83. projectId: form.value.projectId,
  84. wellName: form.value.wellName,
  85. location: form.value.location,
  86. technique: form.value.technique,
  87. workloadDesign: form.value.workloadDesign,
  88. workloadUnit: form.value.workloadUnit,
  89. deptIds: form.value.deptIds,
  90. deviceIds: form.value.deviceIds,
  91. responsiblePerson: [form.value.responsiblePerson],
  92. remark: form.value.remark,
  93. platformWell: "0",
  94. };
  95. };
  96. const defaultProps = computed(() => (label) => ({
  97. inputBorder: false,
  98. clearable: false,
  99. placeholder: isReadonly.value ? " " : `请输入${label}`,
  100. style: {
  101. "text-align": "right",
  102. },
  103. styles: {
  104. disableColor: "#fff",
  105. },
  106. }));
  107. const contractPopup = ref(null);
  108. const contractPaging = ref(null);
  109. const contractList = ref([]);
  110. const contractSearchValue = ref("");
  111. const contractTempProjectId = ref("");
  112. const selectedContractLabel = ref("");
  113. const contractSearchInputStyles = reactive({
  114. backgroundColor: "#f5f5f5",
  115. color: "#333",
  116. });
  117. const contractDisplayText = computed(() => {
  118. if (!form.value.projectId) return "";
  119. const currentContract = contractList.value.find(
  120. (item) => String(item.id) === String(form.value.projectId)
  121. );
  122. return selectedContractLabel.value || currentContract?.contractName || "";
  123. });
  124. const syncSelectedContractLabel = (list = []) => {
  125. if (!form.value.projectId) return;
  126. const currentContract = list.find(
  127. (item) => String(item.id) === String(form.value.projectId)
  128. );
  129. if (currentContract?.contractName) {
  130. selectedContractLabel.value = currentContract.contractName;
  131. }
  132. };
  133. const queryContractList = async (pageNo, pageSize) => {
  134. try {
  135. const res = await getRuiHenProjectInfoPage({
  136. deptId: getDeptId(),
  137. pageNo,
  138. pageSize,
  139. ...(contractSearchValue.value
  140. ? { contractName: contractSearchValue.value }
  141. : {}),
  142. });
  143. const list = res?.data?.list || [];
  144. const total = res?.data?.total || 0;
  145. syncSelectedContractLabel(list);
  146. contractPaging.value?.completeByTotal(list, total);
  147. } catch (error) {
  148. contractPaging.value?.complete(false);
  149. }
  150. };
  151. const searchContractList = () => {
  152. contractPaging.value?.reload();
  153. };
  154. const openContractPopup = () => {
  155. contractSearchValue.value = "";
  156. contractTempProjectId.value = form.value.projectId
  157. ? String(form.value.projectId)
  158. : "";
  159. contractPopup.value?.open();
  160. nextTick(() => {
  161. contractPaging.value?.reload();
  162. });
  163. };
  164. const closeContractPopup = () => {
  165. contractPopup.value?.close();
  166. };
  167. const handleContractRadioChange = (event) => {
  168. contractTempProjectId.value = event.detail.value;
  169. };
  170. const handleContractRowClick = (item) => {
  171. contractTempProjectId.value = String(item.id);
  172. };
  173. const handleContractConfirm = () => {
  174. if (!contractTempProjectId.value) {
  175. uni.showToast({
  176. title: "请选择合同",
  177. icon: "none",
  178. });
  179. return;
  180. }
  181. const currentContract = contractList.value.find(
  182. (item) => String(item.id) === contractTempProjectId.value
  183. );
  184. const fallbackProjectId = Number(contractTempProjectId.value);
  185. form.value.projectId =
  186. currentContract?.id ??
  187. (Number.isNaN(fallbackProjectId)
  188. ? contractTempProjectId.value
  189. : fallbackProjectId);
  190. selectedContractLabel.value =
  191. currentContract?.contractName || selectedContractLabel.value;
  192. closeContractPopup();
  193. };
  194. const techniqueOptions = ref([]);
  195. const workloadUnitOptions = ref([]);
  196. const loadDictOptions = async () => {
  197. if (dictStore.dataDict.length <= 0) {
  198. await dictStore.loadDataDictList();
  199. }
  200. techniqueOptions.value = dictStore
  201. .getIntDictOptions("rq_iot_project_technology_rh")
  202. .map((item) => ({
  203. text: item.label,
  204. value: item.value,
  205. }));
  206. workloadUnitOptions.value = dictStore
  207. .getIntDictOptions("rq_iot_project_measure_unit")
  208. .map((item) => ({
  209. text: item.label,
  210. value: item.value,
  211. }));
  212. };
  213. const deptOptions = ref([]);
  214. const treeData = ref([]);
  215. const deptLoading = ref(false);
  216. const handleTree = (data, id, parentId, children) => {
  217. if (!Array.isArray(data)) {
  218. console.warn("data must be an array");
  219. return [];
  220. }
  221. const config = {
  222. id: id || "id",
  223. parentId: parentId || "parentId",
  224. childrenList: children || "children",
  225. };
  226. const childrenListMap = {};
  227. const nodeIds = {};
  228. const tree = [];
  229. for (const d of data) {
  230. const parentId = d[config.parentId];
  231. if (childrenListMap[parentId] == null) {
  232. childrenListMap[parentId] = [];
  233. }
  234. nodeIds[d[config.id]] = d;
  235. childrenListMap[parentId].push(d);
  236. }
  237. for (const d of data) {
  238. const parentId = d[config.parentId];
  239. if (nodeIds[parentId] == null) {
  240. tree.push(d);
  241. }
  242. }
  243. for (const t of tree) {
  244. adaptToChildrenList(t);
  245. }
  246. function adaptToChildrenList(o) {
  247. if (childrenListMap[o[config.id]] !== null) {
  248. o[config.childrenList] = childrenListMap[o[config.id]];
  249. }
  250. if (o[config.childrenList]) {
  251. for (const c of o[config.childrenList]) {
  252. adaptToChildrenList(c);
  253. }
  254. }
  255. }
  256. return tree;
  257. };
  258. async function loadDeptOptions() {
  259. deptLoading.value = true;
  260. try {
  261. function sortTreeBySort(treeNodes) {
  262. if (!treeNodes || !Array.isArray(treeNodes)) return treeNodes;
  263. const sortedNodes = [...treeNodes].sort((a, b) => {
  264. const sortA = a.sort != null ? a.sort : 999999;
  265. const sortB = b.sort != null ? b.sort : 999999;
  266. return sortA - sortB;
  267. });
  268. sortedNodes.forEach((node) => {
  269. node.disabled = node.type !== "3";
  270. if (node.children && Array.isArray(node.children)) {
  271. node.children = sortTreeBySort(node.children);
  272. }
  273. });
  274. return sortedNodes;
  275. }
  276. const depts = await specifiedSimpleDepts(getDeptId());
  277. deptOptions.value = depts.data.map((item) => ({
  278. text: item.name,
  279. value: item.id,
  280. raw: item,
  281. }));
  282. treeData.value = sortTreeBySort(handleTree(depts.data));
  283. } catch (error) {
  284. } finally {
  285. deptLoading.value = false;
  286. }
  287. }
  288. const popup = ref();
  289. const openPopup = () => {
  290. popup.value.open();
  291. };
  292. const selectDeptId = ref("");
  293. function handleTreeChange(values) {
  294. selectDeptId.value = values;
  295. }
  296. function handleConfirm() {
  297. form.value.deptIds = [selectDeptId.value];
  298. popup.value.close();
  299. loadDeviceOptions();
  300. loadUserOptions();
  301. }
  302. const deviceOptions = ref([]);
  303. const deviceLoading = ref(false);
  304. const loadDeviceOptions = async (init = false) => {
  305. deviceOptions.value = [];
  306. if (!init) form.value.deviceIds = [];
  307. if (!form.value.deptIds || form.value.deptIds.length === 0) {
  308. return;
  309. }
  310. deviceLoading.value = true;
  311. try {
  312. const res = await getDevicesByDepts({ deptIds: form.value.deptIds });
  313. deviceOptions.value = res.data.map((item) => ({
  314. text: `${item.deviceCode} ${item.deviceName}`,
  315. value: item.id,
  316. raw: item,
  317. }));
  318. form.value.deviceIds = deviceOptions.value.map((item) => item.value);
  319. } finally {
  320. deviceLoading.value = false;
  321. }
  322. };
  323. const userOptions = ref([]);
  324. const userLoading = ref(false);
  325. const loadUserOptions = async (init = false) => {
  326. userOptions.value = [];
  327. if (!init) form.value.responsiblePerson = undefined;
  328. if (!form.value.deptIds || form.value.deptIds.length === 0) {
  329. return;
  330. }
  331. userLoading.value = true;
  332. try {
  333. const res = await selectedDeptsEmployee({
  334. deptIds: form.value.deptIds,
  335. });
  336. userOptions.value = res.data.map((item) => ({
  337. text: item.nickname,
  338. value: item.id,
  339. raw: item,
  340. }));
  341. } finally {
  342. userLoading.value = false;
  343. }
  344. };
  345. const loadDetail = async (id) => {
  346. if (!id) return;
  347. const res = await getRuiHenTaskDetail1({ id });
  348. const data = res.data.list[0] || createInitialForm();
  349. Object.assign(form.value, {
  350. id: data.id,
  351. projectId: data.projectId,
  352. wellName: data.wellName,
  353. location: data.location,
  354. technique: Number(data.technique),
  355. workloadDesign: data.workloadDesign,
  356. workloadUnit: Number(data.workloadUnit),
  357. deptIds: data.deptIds || [],
  358. deviceIds: data.deviceIds || [],
  359. responsiblePerson: data.responsiblePerson
  360. ? data.responsiblePerson[0]
  361. : undefined,
  362. remark: data.remark,
  363. });
  364. selectedContractLabel.value = data.contractName || "";
  365. loadDeviceOptions(true);
  366. loadUserOptions(true);
  367. };
  368. watch(
  369. () => props.id,
  370. async (newId) => {
  371. if (props.type !== "create" && newId) {
  372. await loadDetail(newId);
  373. }
  374. },
  375. { immediate: true }
  376. );
  377. watch(
  378. () => form.value.projectId,
  379. (value) => {
  380. if (!value) {
  381. selectedContractLabel.value = "";
  382. contractTempProjectId.value = "";
  383. }
  384. }
  385. );
  386. onMounted(async () => {
  387. await Promise.all([loadDictOptions(), loadDeptOptions()]);
  388. });
  389. defineExpose({
  390. form,
  391. formRef,
  392. validate,
  393. buildSubmitData,
  394. });
  395. </script>
  396. <template>
  397. <view class="content">
  398. <uni-forms
  399. ref="formRef"
  400. labelWidth="auto"
  401. :model="form"
  402. :rules="rules"
  403. validateTrigger="submit"
  404. err-show-type="toast">
  405. <uni-forms-item label="合同" name="projectId" required>
  406. <view class="select-with-button">
  407. <view
  408. class="popup-select-value"
  409. :class="{ 'popup-select-placeholder': !contractDisplayText }"
  410. @click="!isReadonly && openContractPopup()">
  411. {{ contractDisplayText || "请选择合同" }}
  412. </view>
  413. <button
  414. v-if="!isReadonly"
  415. class="popup-button"
  416. type="primary"
  417. size="mini"
  418. @click="openContractPopup">
  419. 选择
  420. </button>
  421. </view>
  422. </uni-forms-item>
  423. <uni-forms-item label="井号" name="wellName" required>
  424. <uni-easyinput
  425. v-bind="defaultProps('井号')"
  426. v-model="form.wellName"
  427. :disabled="isReadonly" />
  428. </uni-forms-item>
  429. <uni-forms-item label="施工地点" name="location" required>
  430. <uni-easyinput
  431. v-bind="defaultProps('施工地点')"
  432. v-model="form.location"
  433. :disabled="isReadonly" />
  434. </uni-forms-item>
  435. <uni-forms-item label="施工工艺" name="technique" required>
  436. <uni-data-select
  437. :clear="true"
  438. align="right"
  439. placeholder="请选择施工工艺"
  440. :localdata="techniqueOptions"
  441. placement="bottom"
  442. hideRight
  443. :disabled="isReadonly"
  444. v-model="form.technique" />
  445. </uni-forms-item>
  446. <uni-forms-item label="设计工作量" name="workloadDesign" required>
  447. <uni-easyinput
  448. type="number"
  449. v-bind="defaultProps('设计工作量')"
  450. v-model.number="form.workloadDesign"
  451. :disabled="isReadonly" />
  452. </uni-forms-item>
  453. <uni-forms-item label="工作量单位" name="workloadUnit" required>
  454. <uni-data-select
  455. :clear="true"
  456. align="right"
  457. placeholder="请选择工作量单位"
  458. :localdata="workloadUnitOptions"
  459. placement="bottom"
  460. hideRight
  461. :disabled="isReadonly"
  462. v-model="form.workloadUnit" />
  463. </uni-forms-item>
  464. <uni-forms-item label="施工队伍" name="deptIds" required>
  465. <view class="select-with-button">
  466. <uni-data-select
  467. :clear="true"
  468. align="right"
  469. placeholder="请选择施工队伍"
  470. :localdata="deptOptions"
  471. placement="bottom"
  472. hideRight
  473. :disabled="true"
  474. multiple
  475. v-model="form.deptIds" />
  476. <button
  477. v-if="!isReadonly"
  478. class="popup-button"
  479. type="primary"
  480. size="mini"
  481. :disabled="deptLoading"
  482. @click="openPopup">
  483. 选择
  484. </button>
  485. </view>
  486. </uni-forms-item>
  487. <uni-forms-item label="施工设备" name="deviceIds" required>
  488. <uni-data-select
  489. :clear="true"
  490. align="right"
  491. placeholder="请选择施工设备"
  492. :localdata="deviceOptions"
  493. placement="bottom"
  494. hideRight
  495. multiple
  496. :disabled="isReadonly || deviceLoading"
  497. v-model="form.deviceIds">
  498. <template #selected="{ selectedItems }">
  499. <view class="device-selected-box">
  500. <view v-if="selectedItems.length" class="device-selected-list">
  501. <view
  502. v-for="item in selectedItems"
  503. :key="item.value"
  504. class="device-selected-item">
  505. {{ item.text }}
  506. </view>
  507. </view>
  508. <view v-else class="device-selected-placeholder">
  509. 请选择施工设备
  510. </view>
  511. </view>
  512. </template>
  513. </uni-data-select>
  514. </uni-forms-item>
  515. <uni-forms-item label="责任人" name="responsiblePerson" required>
  516. <uni-data-select
  517. :clear="true"
  518. align="right"
  519. placeholder="请选择责任人"
  520. :localdata="userOptions"
  521. placement="bottom"
  522. hideRight
  523. :disabled="isReadonly || userLoading"
  524. v-model="form.responsiblePerson" />
  525. </uni-forms-item>
  526. <uni-forms-item label="备注" name="remark">
  527. <uni-easyinput
  528. type="textarea"
  529. autoHeight
  530. v-bind="defaultProps('备注')"
  531. v-model="form.remark"
  532. :disabled="isReadonly"
  533. :maxlength="1000" />
  534. </uni-forms-item>
  535. </uni-forms>
  536. </view>
  537. <uni-popup
  538. ref="contractPopup"
  539. type="bottom"
  540. :is-mask-click="false"
  541. border-radius="10px 10px 0 0">
  542. <z-paging
  543. ref="contractPaging"
  544. v-model="contractList"
  545. class="contract-popup-paging"
  546. style="top: 140px"
  547. :default-page-size="20"
  548. @query="queryContractList">
  549. <template #top>
  550. <view class="contract-popup-top">
  551. <view class="contract-popup-header">
  552. <text class="contract-popup-action" @click="closeContractPopup">
  553. 取消
  554. </text>
  555. <text class="contract-popup-title">选择合同</text>
  556. <text
  557. class="contract-popup-action primary"
  558. @click="handleContractConfirm">
  559. 确定
  560. </text>
  561. </view>
  562. <view class="contract-search-row">
  563. <uni-easyinput
  564. v-model="contractSearchValue"
  565. :inputBorder="false"
  566. :styles="contractSearchInputStyles"
  567. placeholder="请输入合同名称"
  568. @confirm="searchContractList" />
  569. <button
  570. class="mini-btn contract-search-button"
  571. type="primary"
  572. size="mini"
  573. @click="searchContractList">
  574. 搜索
  575. </button>
  576. </view>
  577. </view>
  578. </template>
  579. <radio-group @change="handleContractRadioChange">
  580. <view class="contract-popup-list">
  581. <view
  582. v-for="item in contractList"
  583. :key="item.id"
  584. class="contract-popup-item"
  585. :class="{ active: String(item.id) === contractTempProjectId }"
  586. @click="handleContractRowClick(item)">
  587. <view class="contract-popup-item-main">
  588. <view class="contract-popup-item-name">
  589. {{ item.contractName || "--" }}
  590. </view>
  591. <!-- <view
  592. v-if="item.projectNo || item.contractCode"
  593. class="contract-popup-item-desc">
  594. {{ item.projectNo || item.contractCode }}
  595. </view> -->
  596. </view>
  597. <radio
  598. :value="String(item.id)"
  599. :checked="String(item.id) === contractTempProjectId"
  600. color="#2979ff" />
  601. </view>
  602. </view>
  603. </radio-group>
  604. </z-paging>
  605. </uni-popup>
  606. <uni-popup ref="popup" type="bottom">
  607. <view class="popup-content">
  608. <view class="tree">
  609. <DaTree
  610. :data="treeData"
  611. labelField="name"
  612. valueField="id"
  613. disabledField="disabled"
  614. defaultExpandAll
  615. checkedDisabled
  616. :defaultCheckedKeys="form.deptIds[0]"
  617. @change="handleTreeChange"></DaTree>
  618. </view>
  619. <button class="mini-btn" type="primary" @click="handleConfirm">
  620. 确定
  621. </button>
  622. </view>
  623. </uni-popup>
  624. </template>
  625. <style lang="scss" scoped>
  626. .content {
  627. background-color: #fff;
  628. padding: 16px;
  629. border-radius: 8px;
  630. box-sizing: border-box;
  631. }
  632. .uni-forms {
  633. margin-top: 10px;
  634. }
  635. :deep(.uni-forms-item) {
  636. display: flex;
  637. align-items: center;
  638. margin-bottom: 6px;
  639. border-bottom: 1px dashed #cacccf;
  640. }
  641. :deep(.uni-forms-item__content) {
  642. text-align: right;
  643. }
  644. :deep(.uni-forms-item__label) {
  645. height: 44px;
  646. font-weight: 500;
  647. font-size: 14px;
  648. color: #333 !important;
  649. width: max-content !important;
  650. }
  651. :deep(.uni-select) {
  652. border: none;
  653. text-align: right;
  654. padding-right: 10px;
  655. }
  656. :deep(.uniui-bottom:before) {
  657. content: "\e6b5" !important;
  658. font-size: 16px !important;
  659. }
  660. :deep(.uni-easyinput__content-textarea) {
  661. min-height: inherit;
  662. margin: 10px;
  663. }
  664. :deep(.uni-textarea-textarea:disabled),
  665. :deep(.uni-input-input:disabled),
  666. :deep(.is-disabled) {
  667. color: #333 !important;
  668. }
  669. :deep(.uni-select--disabled) {
  670. background-color: #fff;
  671. }
  672. .select-with-button {
  673. display: flex;
  674. justify-content: flex-end;
  675. align-items: center;
  676. gap: 10px;
  677. width: 100%;
  678. }
  679. .readonly-input {
  680. flex: 1;
  681. }
  682. .popup-select-value {
  683. flex: 1;
  684. min-height: 32px;
  685. display: flex;
  686. justify-content: flex-end;
  687. align-items: center;
  688. color: #333;
  689. font-size: 14px;
  690. line-height: 1.4;
  691. text-align: right;
  692. word-break: break-all;
  693. }
  694. .popup-select-placeholder {
  695. color: #999;
  696. }
  697. .contract-popup-paging {
  698. background-color: #fff;
  699. border-radius: 10px 10px 0 0;
  700. }
  701. .contract-popup-top {
  702. padding: 16px;
  703. padding-bottom: 10px;
  704. background-color: #fff;
  705. }
  706. .contract-popup-header {
  707. display: flex;
  708. align-items: center;
  709. justify-content: space-between;
  710. margin-bottom: 16px;
  711. font-size: 15px;
  712. }
  713. .contract-popup-title {
  714. font-size: 16px;
  715. font-weight: 600;
  716. color: #333;
  717. }
  718. .contract-popup-action {
  719. color: #666;
  720. }
  721. .contract-popup-action.primary {
  722. color: #2979ff;
  723. }
  724. .contract-search-row {
  725. display: flex;
  726. align-items: center;
  727. gap: 10px;
  728. }
  729. .contract-search-button {
  730. width: 72px;
  731. margin: 0;
  732. flex-shrink: 0;
  733. }
  734. .contract-popup-list {
  735. padding: 0 16px 16px;
  736. background-color: #fff;
  737. }
  738. .contract-popup-item {
  739. display: flex;
  740. align-items: center;
  741. justify-content: space-between;
  742. gap: 12px;
  743. padding: 14px 0;
  744. border-bottom: 1px solid #f0f0f0;
  745. }
  746. .contract-popup-item.active {
  747. color: #2979ff;
  748. }
  749. .contract-popup-item-main {
  750. flex: 1;
  751. min-width: 0;
  752. }
  753. .contract-popup-item-name {
  754. font-size: 14px;
  755. line-height: 1.5;
  756. color: inherit;
  757. word-break: break-all;
  758. }
  759. .contract-popup-item-desc {
  760. margin-top: 4px;
  761. font-size: 12px;
  762. color: #999;
  763. }
  764. .device-selected-box {
  765. width: 100%;
  766. min-height: 24px;
  767. display: flex;
  768. justify-content: flex-end;
  769. align-items: center;
  770. }
  771. .device-selected-list {
  772. width: 100%;
  773. display: flex;
  774. flex-wrap: wrap;
  775. justify-content: flex-end;
  776. gap: 6px;
  777. }
  778. .device-selected-item {
  779. max-width: 100%;
  780. padding: 4px 8px;
  781. border-radius: 4px;
  782. background: #f3f5f9;
  783. color: #333;
  784. font-size: 12px;
  785. line-height: 1.4;
  786. word-break: break-all;
  787. }
  788. .device-selected-placeholder {
  789. color: #999;
  790. font-size: 14px;
  791. }
  792. :deep(.popup-button) {
  793. width: 62px;
  794. margin: 0;
  795. flex-shrink: 0;
  796. }
  797. .popup-content {
  798. display: flex;
  799. flex-direction: column;
  800. justify-content: space-between;
  801. padding: 15px;
  802. height: 500px;
  803. background-color: #fff;
  804. }
  805. .tree {
  806. flex: 1;
  807. max-height: 420px;
  808. }
  809. .popup-content button {
  810. width: 100%;
  811. height: 44px;
  812. }
  813. :deep(.uni-select__selector-item) {
  814. padding: 0;
  815. width: 100%;
  816. overflow-x: auto;
  817. overflow-y: hidden;
  818. white-space: nowrap;
  819. -webkit-overflow-scrolling: touch;
  820. uni-text {
  821. padding: 0 10px;
  822. }
  823. }
  824. :deep(.uni-select__selector-item uni-text),
  825. :deep(.uni-select__selector-item uni-text span) {
  826. display: inline-block;
  827. white-space: nowrap;
  828. min-width: max-content;
  829. }
  830. </style>