form.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  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. if (!init) {
  319. form.value.deviceIds = deviceOptions.value.map((item) => item.value);
  320. }
  321. } finally {
  322. deviceLoading.value = false;
  323. }
  324. };
  325. const userOptions = ref([]);
  326. const userLoading = ref(false);
  327. const loadUserOptions = async (init = false) => {
  328. userOptions.value = [];
  329. if (!init) form.value.responsiblePerson = undefined;
  330. if (!form.value.deptIds || form.value.deptIds.length === 0) {
  331. return;
  332. }
  333. userLoading.value = true;
  334. try {
  335. const res = await selectedDeptsEmployee({
  336. deptIds: form.value.deptIds,
  337. });
  338. userOptions.value = res.data.map((item) => ({
  339. text: item.nickname,
  340. value: item.id,
  341. raw: item,
  342. }));
  343. } finally {
  344. userLoading.value = false;
  345. }
  346. };
  347. const loadDetail = async (id) => {
  348. if (!id) return;
  349. const res = await getRuiHenTaskDetail1({ id });
  350. const data = res.data.list[0] || createInitialForm();
  351. Object.assign(form.value, {
  352. id: data.id,
  353. projectId: data.projectId,
  354. wellName: data.wellName,
  355. location: data.location,
  356. technique: Number(data.technique),
  357. workloadDesign: data.workloadDesign,
  358. workloadUnit: Number(data.workloadUnit),
  359. deptIds: data.deptIds || [],
  360. deviceIds: data.deviceIds || [],
  361. responsiblePerson: data.responsiblePerson
  362. ? data.responsiblePerson[0]
  363. : undefined,
  364. remark: data.remark,
  365. });
  366. selectedContractLabel.value = data.contractName || "";
  367. loadDeviceOptions(true);
  368. loadUserOptions(true);
  369. };
  370. watch(
  371. () => props.id,
  372. async (newId) => {
  373. if (props.type !== "create" && newId) {
  374. await loadDetail(newId);
  375. }
  376. },
  377. { immediate: true }
  378. );
  379. watch(
  380. () => form.value.projectId,
  381. (value) => {
  382. if (!value) {
  383. selectedContractLabel.value = "";
  384. contractTempProjectId.value = "";
  385. }
  386. }
  387. );
  388. onMounted(async () => {
  389. await Promise.all([loadDictOptions(), loadDeptOptions()]);
  390. });
  391. defineExpose({
  392. form,
  393. formRef,
  394. validate,
  395. buildSubmitData,
  396. });
  397. </script>
  398. <template>
  399. <view class="content">
  400. <uni-forms
  401. ref="formRef"
  402. labelWidth="auto"
  403. :model="form"
  404. :rules="rules"
  405. validateTrigger="submit"
  406. err-show-type="toast">
  407. <uni-forms-item label="合同" name="projectId" required>
  408. <view class="select-with-button">
  409. <view
  410. class="popup-select-value"
  411. :class="{ 'popup-select-placeholder': !contractDisplayText }"
  412. @click="!isReadonly && openContractPopup()">
  413. {{ contractDisplayText || "请选择合同" }}
  414. </view>
  415. <button
  416. v-if="!isReadonly"
  417. class="popup-button"
  418. type="primary"
  419. size="mini"
  420. @click="openContractPopup">
  421. 选择
  422. </button>
  423. </view>
  424. </uni-forms-item>
  425. <uni-forms-item label="井号" name="wellName" required>
  426. <uni-easyinput
  427. v-bind="defaultProps('井号')"
  428. v-model="form.wellName"
  429. :disabled="isReadonly" />
  430. </uni-forms-item>
  431. <uni-forms-item label="施工地点" name="location" required>
  432. <uni-easyinput
  433. v-bind="defaultProps('施工地点')"
  434. v-model="form.location"
  435. :disabled="isReadonly" />
  436. </uni-forms-item>
  437. <uni-forms-item label="施工工艺" name="technique" required>
  438. <uni-data-select
  439. :clear="true"
  440. align="right"
  441. placeholder="请选择施工工艺"
  442. :localdata="techniqueOptions"
  443. placement="bottom"
  444. hideRight
  445. :disabled="isReadonly"
  446. v-model="form.technique" />
  447. </uni-forms-item>
  448. <uni-forms-item label="设计工作量" name="workloadDesign" required>
  449. <uni-easyinput
  450. type="number"
  451. v-bind="defaultProps('设计工作量')"
  452. v-model.number="form.workloadDesign"
  453. :disabled="isReadonly" />
  454. </uni-forms-item>
  455. <uni-forms-item label="工作量单位" name="workloadUnit" required>
  456. <uni-data-select
  457. :clear="true"
  458. align="right"
  459. placeholder="请选择工作量单位"
  460. :localdata="workloadUnitOptions"
  461. placement="bottom"
  462. hideRight
  463. :disabled="isReadonly"
  464. v-model="form.workloadUnit" />
  465. </uni-forms-item>
  466. <uni-forms-item label="施工队伍" name="deptIds" required>
  467. <view class="select-with-button">
  468. <uni-data-select
  469. :clear="true"
  470. align="right"
  471. placeholder="请选择施工队伍"
  472. :localdata="deptOptions"
  473. placement="bottom"
  474. hideRight
  475. :disabled="true"
  476. multiple
  477. v-model="form.deptIds" />
  478. <button
  479. v-if="!isReadonly"
  480. class="popup-button"
  481. type="primary"
  482. size="mini"
  483. :disabled="deptLoading"
  484. @click="openPopup">
  485. 选择
  486. </button>
  487. </view>
  488. </uni-forms-item>
  489. <uni-forms-item label="施工设备" name="deviceIds" required>
  490. <uni-data-select
  491. :clear="true"
  492. align="right"
  493. placeholder="请选择施工设备"
  494. :localdata="deviceOptions"
  495. placement="top"
  496. hideRight
  497. multiple
  498. :disabled="isReadonly || deviceLoading"
  499. v-model="form.deviceIds">
  500. <template #selected="{ selectedItems }">
  501. <view class="device-selected-box">
  502. <view v-if="selectedItems.length" class="device-selected-list">
  503. <view
  504. v-for="item in selectedItems"
  505. :key="item.value"
  506. class="device-selected-item">
  507. {{ item.text }}
  508. </view>
  509. </view>
  510. <view v-else class="device-selected-placeholder">
  511. 请选择施工设备
  512. </view>
  513. </view>
  514. </template>
  515. </uni-data-select>
  516. </uni-forms-item>
  517. <uni-forms-item label="责任人" name="responsiblePerson" required>
  518. <uni-data-select
  519. :clear="true"
  520. align="right"
  521. placeholder="请选择责任人"
  522. :localdata="userOptions"
  523. placement="bottom"
  524. hideRight
  525. :disabled="isReadonly || userLoading"
  526. v-model="form.responsiblePerson" />
  527. </uni-forms-item>
  528. <uni-forms-item label="备注" name="remark">
  529. <uni-easyinput
  530. type="textarea"
  531. autoHeight
  532. v-bind="defaultProps('备注')"
  533. v-model="form.remark"
  534. :disabled="isReadonly"
  535. :maxlength="1000" />
  536. </uni-forms-item>
  537. </uni-forms>
  538. </view>
  539. <uni-popup
  540. ref="contractPopup"
  541. type="bottom"
  542. :is-mask-click="false"
  543. border-radius="10px 10px 0 0">
  544. <z-paging
  545. ref="contractPaging"
  546. v-model="contractList"
  547. class="contract-popup-paging"
  548. style="top: 140px"
  549. :default-page-size="20"
  550. @query="queryContractList">
  551. <template #top>
  552. <view class="contract-popup-top">
  553. <view class="contract-popup-header">
  554. <text class="contract-popup-action" @click="closeContractPopup">
  555. 取消
  556. </text>
  557. <text class="contract-popup-title">选择合同</text>
  558. <text
  559. class="contract-popup-action primary"
  560. @click="handleContractConfirm">
  561. 确定
  562. </text>
  563. </view>
  564. <view class="contract-search-row">
  565. <uni-easyinput
  566. v-model="contractSearchValue"
  567. :inputBorder="false"
  568. :styles="contractSearchInputStyles"
  569. placeholder="请输入合同名称"
  570. @confirm="searchContractList" />
  571. <button
  572. class="mini-btn contract-search-button"
  573. type="primary"
  574. size="mini"
  575. @click="searchContractList">
  576. 搜索
  577. </button>
  578. </view>
  579. </view>
  580. </template>
  581. <radio-group @change="handleContractRadioChange">
  582. <view class="contract-popup-list">
  583. <view
  584. v-for="item in contractList"
  585. :key="item.id"
  586. class="contract-popup-item"
  587. :class="{ active: String(item.id) === contractTempProjectId }"
  588. @click="handleContractRowClick(item)">
  589. <view class="contract-popup-item-main">
  590. <view class="contract-popup-item-name">
  591. {{ item.contractName || "--" }}
  592. </view>
  593. <!-- <view
  594. v-if="item.projectNo || item.contractCode"
  595. class="contract-popup-item-desc">
  596. {{ item.projectNo || item.contractCode }}
  597. </view> -->
  598. </view>
  599. <radio
  600. :value="String(item.id)"
  601. :checked="String(item.id) === contractTempProjectId"
  602. color="#2979ff" />
  603. </view>
  604. </view>
  605. </radio-group>
  606. </z-paging>
  607. </uni-popup>
  608. <uni-popup ref="popup" type="bottom">
  609. <view class="popup-content">
  610. <view class="tree">
  611. <DaTree
  612. :data="treeData"
  613. labelField="name"
  614. valueField="id"
  615. disabledField="disabled"
  616. defaultExpandAll
  617. checkedDisabled
  618. :defaultCheckedKeys="form.deptIds[0]"
  619. @change="handleTreeChange"></DaTree>
  620. </view>
  621. <button class="mini-btn" type="primary" @click="handleConfirm">
  622. 确定
  623. </button>
  624. </view>
  625. </uni-popup>
  626. </template>
  627. <style lang="scss" scoped>
  628. .content {
  629. background-color: #fff;
  630. padding: 16px;
  631. border-radius: 8px;
  632. box-sizing: border-box;
  633. }
  634. .uni-forms {
  635. margin-top: 10px;
  636. }
  637. :deep(.uni-forms-item) {
  638. display: flex;
  639. align-items: center;
  640. margin-bottom: 6px;
  641. border-bottom: 1px dashed #cacccf;
  642. }
  643. :deep(.uni-forms-item__content) {
  644. text-align: right;
  645. }
  646. :deep(.uni-forms-item__label) {
  647. height: 44px;
  648. font-weight: 500;
  649. font-size: 14px;
  650. color: #333 !important;
  651. width: max-content !important;
  652. }
  653. :deep(.uni-select) {
  654. border: none;
  655. text-align: right;
  656. padding-right: 10px;
  657. }
  658. :deep(.uniui-bottom:before) {
  659. content: "\e6b5" !important;
  660. font-size: 16px !important;
  661. }
  662. :deep(.uni-easyinput__content-textarea) {
  663. min-height: inherit;
  664. margin: 10px;
  665. }
  666. :deep(.uni-textarea-textarea:disabled),
  667. :deep(.uni-input-input:disabled),
  668. :deep(.is-disabled) {
  669. color: #333 !important;
  670. }
  671. :deep(.uni-select--disabled) {
  672. background-color: #fff;
  673. }
  674. .select-with-button {
  675. display: flex;
  676. justify-content: flex-end;
  677. align-items: center;
  678. gap: 10px;
  679. width: 100%;
  680. }
  681. .readonly-input {
  682. flex: 1;
  683. }
  684. .popup-select-value {
  685. flex: 1;
  686. min-height: 32px;
  687. display: flex;
  688. justify-content: flex-end;
  689. align-items: center;
  690. color: #333;
  691. font-size: 14px;
  692. line-height: 1.4;
  693. text-align: right;
  694. word-break: break-all;
  695. }
  696. .popup-select-placeholder {
  697. color: #999;
  698. }
  699. .contract-popup-paging {
  700. background-color: #fff;
  701. border-radius: 10px 10px 0 0;
  702. }
  703. .contract-popup-top {
  704. padding: 16px;
  705. padding-bottom: 10px;
  706. background-color: #fff;
  707. }
  708. .contract-popup-header {
  709. display: flex;
  710. align-items: center;
  711. justify-content: space-between;
  712. margin-bottom: 16px;
  713. font-size: 15px;
  714. }
  715. .contract-popup-title {
  716. font-size: 16px;
  717. font-weight: 600;
  718. color: #333;
  719. }
  720. .contract-popup-action {
  721. color: #666;
  722. }
  723. .contract-popup-action.primary {
  724. color: #2979ff;
  725. }
  726. .contract-search-row {
  727. display: flex;
  728. align-items: center;
  729. gap: 10px;
  730. }
  731. .contract-search-button {
  732. width: 72px;
  733. margin: 0;
  734. flex-shrink: 0;
  735. }
  736. .contract-popup-list {
  737. padding: 0 16px 16px;
  738. background-color: #fff;
  739. }
  740. .contract-popup-item {
  741. display: flex;
  742. align-items: center;
  743. justify-content: space-between;
  744. gap: 12px;
  745. padding: 14px 0;
  746. border-bottom: 1px solid #f0f0f0;
  747. }
  748. .contract-popup-item.active {
  749. color: #2979ff;
  750. }
  751. .contract-popup-item-main {
  752. flex: 1;
  753. min-width: 0;
  754. }
  755. .contract-popup-item-name {
  756. font-size: 14px;
  757. line-height: 1.5;
  758. color: inherit;
  759. word-break: break-all;
  760. }
  761. .contract-popup-item-desc {
  762. margin-top: 4px;
  763. font-size: 12px;
  764. color: #999;
  765. }
  766. .device-selected-box {
  767. width: 100%;
  768. min-height: 24px;
  769. display: flex;
  770. justify-content: flex-end;
  771. align-items: center;
  772. }
  773. .device-selected-list {
  774. width: 100%;
  775. display: flex;
  776. flex-wrap: wrap;
  777. justify-content: flex-end;
  778. gap: 6px;
  779. }
  780. .device-selected-item {
  781. max-width: 100%;
  782. padding: 4px 8px;
  783. border-radius: 4px;
  784. background: #f3f5f9;
  785. color: #333;
  786. font-size: 12px;
  787. line-height: 1.4;
  788. word-break: break-all;
  789. }
  790. .device-selected-placeholder {
  791. color: #999;
  792. font-size: 14px;
  793. }
  794. :deep(.popup-button) {
  795. width: 62px;
  796. margin: 0;
  797. flex-shrink: 0;
  798. }
  799. .popup-content {
  800. display: flex;
  801. flex-direction: column;
  802. justify-content: space-between;
  803. padding: 15px;
  804. height: 500px;
  805. background-color: #fff;
  806. }
  807. .tree {
  808. flex: 1;
  809. max-height: 420px;
  810. }
  811. .popup-content button {
  812. width: 100%;
  813. height: 44px;
  814. }
  815. :deep(.uni-select__selector-item) {
  816. padding: 0;
  817. width: 100%;
  818. overflow-x: auto;
  819. overflow-y: hidden;
  820. white-space: nowrap;
  821. -webkit-overflow-scrolling: touch;
  822. uni-text {
  823. padding: 0 10px;
  824. }
  825. }
  826. :deep(.uni-select__selector-item uni-text),
  827. :deep(.uni-select__selector-item uni-text span) {
  828. display: inline-block;
  829. white-space: nowrap;
  830. min-width: max-content;
  831. }
  832. </style>