write.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <div class="hc-layout-box">
  3. <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'" v-if="sbTableKey !== 'weather'">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="stack"/>
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">{{projectInfo['projectAlias']}}</span>
  10. <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
  11. </div>
  12. </div>
  13. <div class="hc-tree-box">
  14. <el-scrollbar>
  15. <WbsTree :autoExpandKeys="treeAutoExpandKeys" :projectId="projectId" :contractId="contractId" @nodeTap="nodeWbsElTreeClick"/>
  16. </el-scrollbar>
  17. </div>
  18. <!--左右拖动-->
  19. <div class="horizontal-drag-line" @mousedown="onmousedown"/>
  20. </div>
  21. <div class="hc-layout-content-box">
  22. <HcTabsSimple :datas="sbTableData" :cur="sbTableKey" @tabClick="sbTableClick">
  23. <template #tab-internal>
  24. <HcCard v-if="sbTableKey === 'internal'">
  25. <template #header>
  26. <div class="w-32">
  27. <el-select v-model="searchInternalForm.taskStatus" placeholder="审批状态" clearable size="large">
  28. <el-option v-for="item in InternalApproval" :key="item.value" :label="item['label']" :value="item['value']"/>
  29. </el-select>
  30. </div>
  31. <div class="w-32 ml-2">
  32. <el-select v-model="searchInternalForm.isEvaluate" placeholder="是否评定" clearable size="large">
  33. <el-option v-for="item in InternalAssess" :key="item.value" :label="item['label']" :value="item['value']"/>
  34. </el-select>
  35. </div>
  36. <div class="w-32 ml-2">
  37. <el-select v-model="searchInternalForm.reportNumber" placeholder="上报批次" clearable size="large">
  38. <el-option v-for="item in InternalReportBatch" :key="item.value" :label="item['label']" :value="item['value']"/>
  39. </el-select>
  40. </div>
  41. <div class="w-32 ml-2">
  42. <el-select v-model="searchInternalForm.isExperiment" placeholder="关联试验" clearable size="large">
  43. <el-option v-for="item in InternalAssociation" :key="item.value" :label="item['label']" :value="item['value']"/>
  44. </el-select>
  45. </div>
  46. <div class="w-60 ml-2">
  47. <el-input v-model="searchInternalForm.queryStr" placeholder="请输入名称关键词检索" size="large" clearable @keyup="searchInternalKeyUp"/>
  48. </div>
  49. <div class="ml-2">
  50. <el-button type="primary" size="large" @click="searchInternalClick">
  51. <HcIcon name="search-2"/>
  52. <span>搜索</span>
  53. </el-button>
  54. </div>
  55. </template>
  56. <template #extra>
  57. <HcTooltip keys="write_industry_download">
  58. <el-button type="primary" hc-btn :disabled="tableInternalKeys.length <= 0">
  59. <HcIcon name="download"/>
  60. <span>下载</span>
  61. </el-button>
  62. </HcTooltip>
  63. <HcTooltip keys="write_industry_print">
  64. <el-button hc-btn :disabled="tableInternalKeys.length <= 0">
  65. <HcIcon name="printer"/>
  66. <span>打印</span>
  67. </el-button>
  68. </HcTooltip>
  69. </template>
  70. <HcTable ref="tableInternalRef" :column="tableInternalColumn" :datas="tableInternalData" :loading="tableInternalLoading" isCheck @selection-change="tableInternalSelection">
  71. <template #taskStatus="{row}">
  72. <el-tag type="success" class="mx-1" effect="dark" v-if="row['taskStatus'] === '已审批'">已审批</el-tag>
  73. <el-tag type="danger" class="mx-1" effect="dark" v-if="row['taskStatus'] === '待审批'">待审批</el-tag>
  74. <el-tag type="warning" class="mx-1" effect="dark" v-if="row['taskStatus'] === '未上报'">未上报</el-tag>
  75. </template>
  76. <template #isEvaluate="{row}">
  77. <el-tag type="success" class="mx-1" effect="dark" v-if="row['isEvaluate']">是</el-tag>
  78. <el-tag type="info" class="mx-1" effect="dark" v-else>否</el-tag>
  79. </template>
  80. <template #isExperiment="{row}">
  81. <el-tag type="success" class="mx-1" effect="dark" v-if="row['isExperiment']">是</el-tag>
  82. <el-tag type="info" class="mx-1" effect="dark" v-else>否</el-tag>
  83. </template>
  84. </HcTable>
  85. <template #action>
  86. <HcPages :pages="searchInternalForm" @change="pageInternalChange"/>
  87. </template>
  88. </HcCard>
  89. </template>
  90. <template #tab-construction>
  91. <HcCard v-if="sbTableKey === 'construction'">
  92. <HcTable :column="tableConstructionColumn" :datas="tableConstructionData" :loading="tableConstructionLoading">
  93. <template #action="{row}">
  94. <HcTooltip keys="write_construction_edit">
  95. <el-button type="primary" plain size="small" @click="tableConstructionEdit(row)">
  96. <HcIcon name="edit"/>
  97. <span>编辑</span>
  98. </el-button>
  99. </HcTooltip>
  100. </template>
  101. </HcTable>
  102. <template #action>
  103. <HcPages :pages="searchConstructionForm" @change="pageConstructionChange"/>
  104. </template>
  105. </HcCard>
  106. </template>
  107. <template #tab-weather>
  108. <HcCard v-if="sbTableKey === 'weather'">
  109. <template #header>
  110. <div class="w-64">
  111. <HcDatePicker :dates="weatherTime" size="large" clearable @change="weatherTimeUpdate"/>
  112. </div>
  113. <div class="ml-2">
  114. <el-button type="primary" size="large" @click="searchWeatherClick">搜索</el-button>
  115. </div>
  116. </template>
  117. <template #extra>
  118. <HcTooltip keys="write_weather_print">
  119. <el-button hc-btn>
  120. <HcIcon name="printer"/>
  121. <span>打印</span>
  122. </el-button>
  123. </HcTooltip>
  124. </template>
  125. <HcTable :column="tableWeatherColumn" :datas="tableWeatherData" :loading="tableWeatherLoading">
  126. <template #tempLow="{row}">{{row['tempLow']}} ~ {{row['tempHigh']}}</template>
  127. <template #action="{row}">
  128. <HcTooltip keys="write_weather_edit">
  129. <el-button type="primary" plain size="small" @click="tableWeatherEdit(row)">
  130. <HcIcon name="edit"/>
  131. <span>编辑</span>
  132. </el-button>
  133. </HcTooltip>
  134. </template>
  135. </HcTable>
  136. <template #action>
  137. <HcPages :pages="searchWeatherForm" @change="pageWeatherChange"/>
  138. </template>
  139. </HcCard>
  140. </template>
  141. </HcTabsSimple>
  142. </div>
  143. <!--编辑施工台账-->
  144. <el-dialog v-model="showConstructionEditModal" title="编辑施工台账" width="38rem" class="hc-modal-border">
  145. <el-form ref="constructionFormRef" :model="constructionFormModel" :rules="constructionFormRules" label-width="auto" size="large">
  146. el-form-item
  147. </el-form>
  148. <!--n-form ref="formRef" :model="formValue" :rules="rules" label-placement="left" label-width="auto" size="large">
  149. <n-form-item label="施工起止日期" path="siteTimeStr">
  150. <n-date-picker class="flex-1" v-model:formatted-value="siteTime" value-format="yyyy-MM-dd" type="daterange" clearable @update:value="siteTimeUpdate"/>
  151. </n-form-item>
  152. <n-form-item label="检测起止日期" path="detectionTimeStr">
  153. <n-date-picker class="flex-1" v-model:formatted-value="detectionTime" value-format="yyyy-MM-dd" type="daterange" clearable @update:value="detectionTimeUpdate"/>
  154. </n-form-item>
  155. <div class="flex">
  156. <n-form-item class="flex-1" label="设计方量">
  157. <n-input v-model:value="formValue.designVolume" placeholder="请输入设计方量"/>
  158. </n-form-item>
  159. <n-form-item class="flex-1" label="实际方量">
  160. <n-input v-model:value="formValue.actualVolume" placeholder="请输入实际方量"/>
  161. </n-form-item>
  162. </div>
  163. </n-form-->
  164. <template #footer>
  165. <div class="dialog-footer">
  166. <el-button size="large" @click="showConstructionEditModal = false">
  167. <HcIcon name="close"/>
  168. <span>取消</span>
  169. </el-button>
  170. <el-button type="primary" hc-btn :loading="saveConstructionLoading" @click="saveConstructionClick">
  171. <HcIcon name="save"/>
  172. <span>提交保存</span>
  173. </el-button>
  174. </div>
  175. </template>
  176. </el-dialog>
  177. <!--编辑天气台账-->
  178. <el-dialog v-model="showWeatherEditModal" title="编辑天气台账" width="38rem" class="hc-modal-border">
  179. <el-form ref="weatherFormRef" :model="weatherFormModel" :rules="weatherFormRules" label-width="auto" size="large">
  180. <el-form-item label="日期">
  181. <el-input v-model="weatherFormModel.recordTime" disabled/>
  182. </el-form-item>
  183. <el-form-item label="天气" prop="weather">
  184. <el-input v-model="weatherFormModel.weather" placeholder="天气"/>
  185. </el-form-item>
  186. <el-form-item label="最低温度" prop="tempLow">
  187. <el-input type="number" v-model="weatherFormModel.tempLow" placeholder="最低温度"/>
  188. </el-form-item>
  189. <el-form-item label="最高温度" prop="tempHigh">
  190. <el-input type="number" v-model="weatherFormModel.tempHigh" placeholder="最高温度"/>
  191. </el-form-item>
  192. <el-form-item label="风力" prop="windLevel">
  193. <el-input v-model="weatherFormModel.windLevel" placeholder="风力"/>
  194. </el-form-item>
  195. </el-form>
  196. <template #footer>
  197. <div class="dialog-footer">
  198. <el-button size="large" @click="showWeatherEditModal = false">
  199. <HcIcon name="close"/>
  200. <span>取消</span>
  201. </el-button>
  202. <el-button type="primary" hc-btn :loading="saveWeatherLoading" @click="saveWeatherClick">
  203. <HcIcon name="save"/>
  204. <span>提交保存</span>
  205. </el-button>
  206. </div>
  207. </template>
  208. </el-dialog>
  209. </div>
  210. </template>
  211. <script setup>
  212. import {onMounted, ref, watch} from 'vue'
  213. import {useAppStore} from "~src/store";
  214. import {useRouter, useRoute} from 'vue-router'
  215. import WbsTree from "./components/WbsTree.vue"
  216. import weatherApi from '~api/ledger/weather';
  217. import internalApi from '~api/ledger/internal';
  218. import constructionApi from '~api/ledger/construction';
  219. import {getStoreData, setStoreData} from '~src/utils/storage'
  220. import {getArrValue, deepClone, formValidate} from "vue-utils-plus"
  221. //变量
  222. const router = useRouter()
  223. const useRoutes = useRoute()
  224. const useAppState = useAppStore()
  225. const projectId = ref(useAppState.getProjectId);
  226. const contractId = ref(useAppState.getContractId);
  227. const projectInfo = ref(useAppState.getProjectInfo);
  228. const isCollapse = ref(useAppState.getCollapse)
  229. //路由参数
  230. const routerQuery = useRoutes?.query;
  231. const dataType = routerQuery?.type || 'weather';
  232. //监听
  233. watch(() => [
  234. useAppState.getCollapse
  235. ], ([Collapse]) => {
  236. isCollapse.value = Collapse
  237. })
  238. //自动展开缓存
  239. const treeAutoExpandKeys = ref([])
  240. //类型处理
  241. const sbTableKey = ref(dataType)
  242. const sbTableData = ref([
  243. {icon: 'bar-chart-box', label: '内业台账', key: 'internal'},
  244. {icon: 'tools', label: '施工台账', key: 'construction'},
  245. {icon: 'sun-cloudy', label: '天气台账', key: 'weather'},
  246. ])
  247. const sbTableClick = (key) => {
  248. sbTableKey.value = key
  249. router.push({
  250. path: useRoutes.path,
  251. query: {type: key}
  252. })
  253. getTypeData(key)
  254. }
  255. //加载完成
  256. onMounted(() => {
  257. getTypeData(dataType)
  258. })
  259. //根据类型获取相关数据
  260. const getTypeData = (key) => {
  261. if (key === 'weather') {
  262. searchWeatherClick()
  263. } else if (key === 'internal' || key === 'construction') {
  264. treeAutoExpandKeys.value = getStoreData('ledgerWriteTreeKeys') || []
  265. setWbsIds()
  266. }
  267. }
  268. //树被点击
  269. const nodeDataInfo = ref({})
  270. const nodeWbsElTreeClick = ({data, keys}) => {
  271. nodeDataInfo.value = data
  272. //缓存节点
  273. setStoreData('ledgerWriteTreeKeys',keys)
  274. treeAutoExpandKeys.value = keys || []
  275. setWbsIds()
  276. }
  277. const setWbsIds = () => {
  278. const key = sbTableKey.value
  279. const data = nodeDataInfo.value
  280. const cid = data?.contractIdRelation || ''
  281. const wbsId = data['contractIdRelation'] ? data['id'] : data['primaryKeyId']
  282. if (wbsId && key === 'internal') {
  283. searchInternalForm.value.contractId = cid ? cid : contractId.value;
  284. searchInternalForm.value.contractIdRelation = data['contractIdRelation']
  285. searchInternalForm.value.wbsIds = [wbsId]
  286. searchInternalClick()
  287. } else if (wbsId && key === 'construction') {
  288. searchConstructionForm.value.contractId = cid ? cid : contractId.value;
  289. searchConstructionForm.value.contractIdRelation = data['contractIdRelation']
  290. searchConstructionForm.value.wbsIds = [wbsId]
  291. searchConstructionClick()
  292. }
  293. }
  294. //--------内业台账---------
  295. //审批状态
  296. const InternalApproval = ref([
  297. {label: "未上报", value: "1"},
  298. {label: "待审批", value: "2"},
  299. {label: "已审批", value: "3"}
  300. ])
  301. //是否评定
  302. const InternalAssess = ref([
  303. {label: "是", value: true},
  304. {label: "否", value: false}
  305. ])
  306. //上报批次
  307. const InternalReportBatch = ref([])
  308. //是否关联试验
  309. const InternalAssociation = ref([
  310. {label: "是", value: true},
  311. {label: "否", value: false}
  312. ])
  313. //搜索表单
  314. const searchInternalForm = ref({
  315. taskStatus: null, isEvaluate: null, reportNumber: null, isExperiment: null,
  316. current: 1, size: 20, total: 0
  317. })
  318. //回车
  319. const searchInternalKeyUp = (e) => {
  320. if (e.key === "Enter") {
  321. searchInternalClick()
  322. }
  323. }
  324. //搜索
  325. const searchInternalClick = () => {
  326. if (searchInternalForm.value?.wbsIds) {
  327. searchInternalForm.value.current = 1;
  328. getTableInternalData()
  329. } else {
  330. window?.$message?.warning('请先选择一个树节点')
  331. }
  332. }
  333. //分页被点击
  334. const pageInternalChange = ({current, size}) => {
  335. searchInternalForm.value.current = current
  336. searchInternalForm.value.size = size
  337. getTableInternalData()
  338. }
  339. //内业台账表头
  340. const tableInternalRef = ref(null)
  341. const tableInternalColumn = ref([
  342. {key:'unitProject', name: '单位工程'},
  343. {key:'partProject', name: '分部工程'},
  344. {key:'partChildProject', name: '子分部工程'},
  345. {key:'subentryProject', name: '分项工程'},
  346. {key:'subentryChildProject', name: '子分项工程'},
  347. {key:'process', name: '工序'},
  348. {key:'taskStatus', name: '审批状态', width: 120, align: 'center'},
  349. {key:'reportNumber', name: '上报批次', width: 100, align: 'center'},
  350. {key:'isEvaluate', name: '是否评定', width: 100, align: 'center'},
  351. {key:'isExperiment', name: '关联试验', width: 100, align: 'center'},
  352. ])
  353. const tableInternalData = ref([])
  354. //获取数据
  355. const tableInternalLoading = ref(false)
  356. const getTableInternalData = async () => {
  357. tableInternalLoading.value = true
  358. const {error, code, data} = await internalApi.queryInternalPage({
  359. ...searchInternalForm.value,
  360. projectId: projectId.value,
  361. })
  362. //判断状态
  363. tableInternalLoading.value = false
  364. if (!error && code === 200) {
  365. tableInternalData.value = getArrValue(data['records'])
  366. searchInternalForm.value.total = data['total'] || 0
  367. } else {
  368. tableInternalData.value = []
  369. searchInternalForm.value.total = 0
  370. }
  371. }
  372. //多选
  373. const tableInternalKeys = ref([]);
  374. const tableInternalSelection = (rows) => {
  375. tableInternalKeys.value = rows.filter((item) => {
  376. return (item??'') !== '';
  377. })
  378. }
  379. //--------内业台账 end---------
  380. //--------施工台账---------
  381. //搜索表单
  382. const searchConstructionForm = ref({current: 1, size: 20, total: 0})
  383. //搜索
  384. const searchConstructionClick = () => {
  385. if (searchConstructionForm.value?.wbsIds) {
  386. searchConstructionForm.value.current = 1;
  387. getTableConstructionData()
  388. } else {
  389. window?.$message?.warning('请先选择一个树节点')
  390. }
  391. }
  392. //分页被点击
  393. const pageConstructionChange = ({current, size}) => {
  394. searchConstructionForm.value.current = current
  395. searchConstructionForm.value.size = size
  396. getTableConstructionData()
  397. }
  398. //施工台账表头
  399. const tableConstructionColumn = ref([
  400. {key:'station', name: '施工桩号'},
  401. {key:'site', name: '施工部位'},
  402. {key:'siteTimeStr', name: '施工起止日期'},
  403. {key:'detectionTimeStr', name: '检测日期'},
  404. {key:'designVolume', name: '设计方量'},
  405. {key:'actualVolume', name: '实际方量'},
  406. {key:'action', name: '操作', width: 100}
  407. ])
  408. const tableConstructionData = ref([])
  409. //获取数据
  410. const tableConstructionLoading = ref(false)
  411. const getTableConstructionData = async () => {
  412. tableConstructionLoading.value = true
  413. const {error, code, data} = await constructionApi.queryConstructionPage({
  414. ...searchConstructionForm.value,
  415. projectId: projectId.value,
  416. })
  417. //判断状态
  418. tableConstructionLoading.value = false
  419. if (!error && code === 200) {
  420. tableConstructionData.value = getArrValue(data['records'])
  421. searchConstructionForm.value.total = data['total'] || 0
  422. } else {
  423. tableConstructionData.value = []
  424. searchConstructionForm.value.total = 0
  425. }
  426. }
  427. //施工台账编辑
  428. const showConstructionEditModal = ref(false)
  429. const tableConstructionEdit = (row) => {
  430. showConstructionEditModal.value = true
  431. }
  432. //施工台账表单
  433. const constructionFormRef = ref(null)
  434. const constructionFormModel = ref({
  435. recordTime: '',
  436. weather: '',
  437. tempLow: null,
  438. tempHigh: null,
  439. windLevel: ''
  440. })
  441. const constructionFormRules = ref({
  442. weather: {
  443. required: true,
  444. trigger: 'blur',
  445. message: "请输入天气"
  446. },
  447. tempLow: {
  448. required: true,
  449. validator: (rule, value, callback) => {
  450. const tempHigh = weatherFormModel.value?.tempHigh ?? ''
  451. const val = Number(value)
  452. const high = Number(tempHigh);
  453. if (!val) {
  454. callback(new Error('请输入最低温度'))
  455. } else if (val > high) {
  456. callback(new Error('最低温度不能高于最高温度'))
  457. } else if (val === high) {
  458. callback(new Error('最低温度和最高温度,不能一致'))
  459. } else {
  460. callback()
  461. }
  462. },
  463. trigger: "blur",
  464. },
  465. })
  466. //提交保存
  467. const saveConstructionLoading = ref(false)
  468. const saveConstructionClick = async () => {
  469. const validate = await formValidate(constructionFormRef.value)
  470. if (validate) {
  471. console.log(validate)
  472. //updateConstructionPage
  473. }
  474. }
  475. //--------施工台账 end---------
  476. //--------天气台账---------
  477. //搜索表单
  478. const searchWeatherForm = ref({recordTime: '', current: 1, size: 20, total: 0})
  479. //日期时间被选择
  480. const weatherTime = ref(null)
  481. const weatherTimeUpdate = ({val,arr}) => {
  482. weatherTime.value = arr
  483. searchWeatherForm.value.recordTime = val['start'] + '~' + val['end']
  484. }
  485. //搜索
  486. const searchWeatherClick = () => {
  487. searchWeatherForm.value.current = 1;
  488. getTableWeatherData()
  489. }
  490. //分页被点击
  491. const pageWeatherChange = ({current, size}) => {
  492. searchWeatherForm.value.current = current
  493. searchWeatherForm.value.size = size
  494. getTableWeatherData()
  495. }
  496. //天气台账表头
  497. const tableWeatherColumn = ref([
  498. {key:'recordTime', name: '日期'},
  499. {key:'weather', name: '天气'},
  500. {key:'tempLow', name: '温度 ℃'},
  501. {key:'airTemp', name: '平均温度 ℃'},
  502. {key:'windLevel', name: '风力'},
  503. {key:'action', name: '操作', width: 100}
  504. ])
  505. const tableWeatherData = ref([])
  506. //获取数据
  507. const tableWeatherLoading = ref(false)
  508. const getTableWeatherData = async () => {
  509. tableWeatherLoading.value = true
  510. const {error, code, data} = await weatherApi.queryWeatherPage({
  511. ...searchWeatherForm.value,
  512. projectId: projectId.value,
  513. contractId: contractId.value
  514. })
  515. //判断状态
  516. tableWeatherLoading.value = false
  517. if (!error && code === 200) {
  518. tableWeatherData.value = getArrValue(data['records'])
  519. searchWeatherForm.value.total = data['total'] || 0
  520. } else {
  521. tableWeatherData.value = []
  522. searchWeatherForm.value.total = 0
  523. }
  524. }
  525. //天气台账编辑
  526. const showWeatherEditModal = ref(false)
  527. const tableWeatherEdit = (row) => {
  528. weatherFormModel.value = deepClone(row)
  529. saveWeatherLoading.value = false
  530. showWeatherEditModal.value = true
  531. }
  532. //天气台账表单
  533. const weatherFormRef = ref(null)
  534. const weatherFormModel = ref({recordTime: '', weather: '', tempLow: null, tempHigh: null, windLevel: ''})
  535. const weatherFormRules = ref({
  536. weather: {
  537. required: true,
  538. trigger: 'blur',
  539. message: "请输入天气"
  540. },
  541. tempLow: {
  542. required: true,
  543. validator: (rule, value, callback) => {
  544. const tempHigh = weatherFormModel.value?.tempHigh ?? ''
  545. const val = Number(value)
  546. const high = Number(tempHigh);
  547. if (!val) {
  548. callback(new Error('请输入最低温度'))
  549. } else if (val > high) {
  550. callback(new Error('最低温度不能高于最高温度'))
  551. } else if (val === high) {
  552. callback(new Error('最低温度和最高温度,不能一致'))
  553. } else {
  554. callback()
  555. }
  556. },
  557. trigger: "blur",
  558. },
  559. tempHigh: {
  560. required: true,
  561. validator: (rule, value, callback) => {
  562. const tempLow = weatherFormModel.value?.tempLow ?? ''
  563. const val = Number(value)
  564. const low = Number(tempLow);
  565. if (!val) {
  566. callback(new Error('请输入最高温度'))
  567. } else if (val < low) {
  568. callback(new Error('最高温度不能低于最低温度'))
  569. } else if (val === low) {
  570. callback(new Error('最高温度和最低温度,不能一致'))
  571. } else {
  572. callback()
  573. }
  574. },
  575. trigger: "blur",
  576. },
  577. windLevel: {
  578. required: true,
  579. trigger: 'blur',
  580. message: "请输入风力"
  581. },
  582. })
  583. //提交保存
  584. const saveWeatherLoading = ref(false)
  585. const saveWeatherClick = async () => {
  586. const validate = await formValidate(weatherFormRef.value)
  587. if (validate) {
  588. //发起请求
  589. saveWeatherLoading.value = true
  590. const {error, code} = await weatherApi.updateWeatherById({
  591. ...weatherFormModel.value,
  592. projectId: projectId.value,
  593. contractId: contractId.value
  594. },false)
  595. //处理数据
  596. saveWeatherLoading.value = false
  597. if (!error && code === 200) {
  598. window?.$message?.success('保存成功')
  599. showWeatherEditModal.value = false;
  600. getTableWeatherData()
  601. } else {
  602. window?.$message?.error('保存失败')
  603. }
  604. }
  605. }
  606. //--------天气台账 end---------
  607. //左右拖动,改变树形结构宽度
  608. const leftWidth = ref(382);
  609. const onmousedown = () => {
  610. const leftNum = isCollapse.value ? 142 : 272
  611. document.onmousemove = (ve) => {
  612. const diffVal = ve.clientX - leftNum;
  613. if(diffVal >= 310 && diffVal <= 900) {
  614. leftWidth.value = diffVal;
  615. }
  616. }
  617. document.onmouseup = () => {
  618. document.onmousemove = null;
  619. document.onmouseup = null;
  620. }
  621. }
  622. </script>
  623. <style lang="scss" scoped>
  624. @import "../../styles/ledger/write.scss";
  625. </style>
  626. <style lang="scss">
  627. .hc-layout-box .hc-layout-content-box .hc-card-box.el-card {
  628. border-radius: 0 var(--el-card-border-radius) var(--el-card-border-radius) var(--el-card-border-radius);
  629. height: calc(100% - 44px);
  630. }
  631. </style>