draught.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. <template>
  2. <div class="global-variable" v-loading="loading">
  3. <div class="condition">
  4. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  5. <el-form-item label="风机名称:">
  6. <el-input
  7. v-model="formInline.engineName"
  8. placeholder="请输入风机名称"
  9. size="small"
  10. ></el-input>
  11. </el-form-item>
  12. <el-form-item label="选择日期:" size="small">
  13. <el-date-picker
  14. v-model="formInline.timeQuantum"
  15. type="daterange"
  16. range-separator="至"
  17. start-placeholder="开始日期"
  18. end-placeholder="结束日期"
  19. @change="onDateChange"
  20. >
  21. </el-date-picker>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" @click="onSubmit" size="small"
  25. >查询</el-button
  26. >
  27. <el-button @click="reset" size="small">重置</el-button>
  28. </el-form-item>
  29. </el-form>
  30. </div>
  31. <div class="list-page">
  32. <div class="newly">
  33. <el-button @click="upfile" size="small">导入</el-button>
  34. <el-button type="primary" @click="newnuedialog" size="small"
  35. >新增</el-button
  36. >
  37. </div>
  38. <el-table
  39. class="center-align-table"
  40. :data="tableData"
  41. border
  42. :cell-style="rowStyle"
  43. >
  44. <el-table-column
  45. align="center"
  46. fixed
  47. prop="engineCode"
  48. label="系统编号"
  49. >
  50. <template slot-scope="scope">
  51. <el-button
  52. @click="particulars(scope.row)"
  53. type="text"
  54. size="small"
  55. >{{ scope.row.engineCode }}</el-button
  56. >
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="engineName" align="center" label="风机名称">
  60. </el-table-column>
  61. <el-table-column prop="fieldName" align="center" label="关联风场">
  62. </el-table-column>
  63. <el-table-column
  64. prop="longitude"
  65. align="center"
  66. label="经度"
  67. min-width="100"
  68. >
  69. </el-table-column>
  70. <el-table-column
  71. prop="latitude"
  72. align="center"
  73. label="纬度"
  74. min-width="100"
  75. >
  76. </el-table-column>
  77. <el-table-column
  78. prop="elevationHeight"
  79. align="center"
  80. label="海拔高度/米"
  81. min-width="100"
  82. >
  83. </el-table-column>
  84. <el-table-column
  85. prop="sightcing"
  86. align="center"
  87. label="是否标杆"
  88. min-width="80"
  89. >
  90. <template slot-scope="{ row }">
  91. {{ row.sightcing == 1 ? "是" : "否" }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. prop="state"
  96. align="center"
  97. label="状态"
  98. min-width="80"
  99. >
  100. <template slot-scope="{ row }">
  101. {{ row.state == 1 ? "启用" : "停用" }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. prop="createTime"
  106. align="center"
  107. label="创建时间"
  108. min-width="140"
  109. >
  110. </el-table-column>
  111. <el-table-column
  112. prop="transition"
  113. align="center"
  114. fixed="right"
  115. label="操作"
  116. min-width="160"
  117. >
  118. <template slot-scope="scope">
  119. <el-button @click="compile(scope.row)" type="text" size="small"
  120. >编辑</el-button
  121. >
  122. <el-button
  123. v-if="scope.row.state == 0"
  124. @click="start(scope.row, 1)"
  125. type="text"
  126. size="small"
  127. >启用</el-button
  128. >
  129. <el-button
  130. v-else
  131. style="color: #666"
  132. @click="start(scope.row, 0)"
  133. type="text"
  134. size="small"
  135. >停用</el-button
  136. >
  137. <el-button
  138. style="color: #f00"
  139. @click="deleted(scope.row)"
  140. type="text"
  141. size="small"
  142. >删除</el-button
  143. >
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. <div class="pagination-container">
  148. <el-pagination
  149. @current-change="handleCurrentChange"
  150. :current-page.sync="formInline.pageNum"
  151. layout="total, prev, pager, next"
  152. :page-size="formInline.pageSize"
  153. :total="formInline.totalSize"
  154. >
  155. </el-pagination>
  156. </div>
  157. </div>
  158. <!-- 弹出层 -->
  159. <!-- 导入 -->
  160. <el-dialog
  161. title="导入文件"
  162. :visible.sync="tolead"
  163. width="400px"
  164. @close="handleClose"
  165. >
  166. <el-alert title="请点击模板下载文件附件" type="success" :closable="false">
  167. </el-alert>
  168. <p class="model-center" @click="download">模板下载</p>
  169. <div class="UPcondition">
  170. <p>所属风场:</p>
  171. <el-select
  172. v-model="subordinate"
  173. placeholder="请选择"
  174. value-key="fieldCode"
  175. >
  176. <el-option
  177. v-for="item in subordinatedata"
  178. :key="item.fieldCode"
  179. :label="item.fieldName"
  180. :value="item.fieldCode"
  181. >
  182. </el-option>
  183. </el-select>
  184. </div>
  185. <el-upload
  186. class="upload-demo"
  187. :file-list="fileList"
  188. drag
  189. action
  190. :multiple="false"
  191. :before-upload="beforeUpload"
  192. :limit="1"
  193. :auto-upload="false"
  194. :on-change="handleOnChange"
  195. accept=".xlsx"
  196. >
  197. <i class="el-icon-upload"></i>
  198. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  199. <div class="el-upload__tip" slot="tip">
  200. 只能上传xlsx文件,且不超过5MB
  201. </div>
  202. </el-upload>
  203. <span slot="footer" class="dialog-footer">
  204. <el-button @click="handleClose" size="small">取 消</el-button>
  205. <el-button type="primary" @click="UPsubmit" size="small"
  206. >提交</el-button
  207. >
  208. </span>
  209. </el-dialog>
  210. <!-- 新增 -->
  211. <el-dialog
  212. :title="title"
  213. :visible.sync="nuedialog"
  214. width="1000px"
  215. @close="resetForm('ruleForm')"
  216. >
  217. <el-form
  218. :model="ruleForm"
  219. :rules="rules"
  220. ref="ruleForm"
  221. label-width="100px"
  222. class="demo-ruleForm"
  223. >
  224. <div class="form-row">
  225. <el-form-item label="风机名称:" prop="engineName">
  226. <el-input v-model="ruleForm.engineName" size="small"></el-input>
  227. </el-form-item>
  228. <el-form-item label="关联风场:" prop="fieldCode">
  229. <el-select
  230. v-model="ruleForm.fieldCode"
  231. filterable
  232. placeholder="请选择"
  233. size="small"
  234. >
  235. <el-option
  236. v-for="item in fieldCodeOptions"
  237. :key="item.fieldCode"
  238. :label="item.fieldName"
  239. :value="item.fieldCode"
  240. >
  241. </el-option>
  242. </el-select>
  243. </el-form-item>
  244. </div>
  245. <div class="form-row">
  246. <el-form-item label="机型编号:" prop="millTypeCode">
  247. <el-select
  248. v-model="ruleForm.millTypeCode"
  249. placeholder="请选择"
  250. size="small"
  251. >
  252. <el-option
  253. v-for="item in millTypeCodeOptions"
  254. :key="item.millTypeCode"
  255. :label="item.machineTypeCode"
  256. :value="item.millTypeCode"
  257. >
  258. </el-option>
  259. </el-select>
  260. </el-form-item>
  261. <el-form-item label="额定容量:" prop="ratedCapacity">
  262. <el-input v-model="ruleForm.ratedCapacity" size="small"></el-input>
  263. </el-form-item>
  264. </div>
  265. <div class="form-row">
  266. <el-form-item label="海拔高度:" prop="elevationHeight">
  267. <el-input
  268. v-model="ruleForm.elevationHeight"
  269. size="small"
  270. ></el-input>
  271. </el-form-item>
  272. <el-form-item label="经度:" prop="longitude">
  273. <el-input v-model="ruleForm.longitude" size="small"></el-input>
  274. </el-form-item>
  275. </div>
  276. <div class="form-row">
  277. <el-form-item label="纬度:" prop="latitude">
  278. <el-input v-model="ruleForm.latitude" size="small"></el-input>
  279. </el-form-item>
  280. <el-form-item label="轮毂高度:" prop="hubHeight">
  281. <el-input v-model="ruleForm.hubHeight" size="small"></el-input>
  282. </el-form-item>
  283. </div>
  284. <div class="form-row">
  285. <el-form-item label="是否标杆:" prop="sightcing">
  286. <el-select
  287. v-model="ruleForm.sightcing"
  288. placeholder="请选择"
  289. size="small"
  290. >
  291. <el-option
  292. v-for="item in sightcingOptions"
  293. :key="item.value"
  294. :label="item.label"
  295. :value="item.value"
  296. >
  297. </el-option>
  298. </el-select>
  299. </el-form-item>
  300. </div>
  301. </el-form>
  302. <div class="form-buttons">
  303. <el-button type="primary" @click="submitForm('ruleForm')"
  304. >确定</el-button
  305. >
  306. <el-button @click="resetForm('ruleForm')">取消</el-button>
  307. </div>
  308. </el-dialog>
  309. <!-- 风机详情 -->
  310. <el-dialog title="风机详情" :visible.sync="unusualdialog" width="800px">
  311. <div class="general">
  312. <div class="condition">
  313. <p>关联风场:</p>
  314. <span>{{ particularsdata.fieldCode }}</span>
  315. </div>
  316. <div class="condition">
  317. <p>风机名称:</p>
  318. <span>{{ particularsdata.engineCode }}</span>
  319. </div>
  320. <div class="condition">
  321. <p>风机名称:</p>
  322. <span>{{ particularsdata.engineName }}</span>
  323. </div>
  324. <div class="condition">
  325. <p>机型编号:</p>
  326. <span>{{ particularsdata.millTypeCode }}</span>
  327. </div>
  328. <div class="condition">
  329. <p>额定容量:</p>
  330. <span>{{ particularsdata.ratedCapacity }}</span> <span>(kW)</span>
  331. </div>
  332. <div class="condition">
  333. <p>海拔高度:</p>
  334. <span>{{ particularsdata.elevationHeight }}</span> <span>(米)</span>
  335. </div>
  336. <div class="condition">
  337. <p>经度:</p>
  338. <span>{{ particularsdata.longitude }}°</span>
  339. </div>
  340. <div class="condition">
  341. <p>纬度:</p>
  342. <span>{{ particularsdata.latitude }}°</span>
  343. </div>
  344. <div class="condition">
  345. <p>轮毂高度:</p>
  346. <span>{{ particularsdata.hubHeight }}</span> <span>(米)</span>
  347. </div>
  348. <div class="condition">
  349. <p>是否标杆:</p>
  350. <span>{{ particularsdata.sightcing == 1 ? "是" : "否" }}</span>
  351. </div>
  352. <div class="condition">
  353. <p>状态:</p>
  354. <span>{{ particularsdata.state == 1 ? "启用" : "停用" }}</span>
  355. </div>
  356. </div>
  357. </el-dialog>
  358. </div>
  359. </template>
  360. <script>
  361. import {
  362. createWindEngineGroup,
  363. delWindEngineGroup,
  364. getWindEngineGroup,
  365. getWindEngineMillList,
  366. getWindFieldNames,
  367. updateStateWindEngineGroup,
  368. updateWindEngineGroup,
  369. windEngineGrouPage,
  370. getAllTemplate,
  371. windEngineGroupImportData,
  372. } from "@/api/ledger.js";
  373. export default {
  374. data() {
  375. return {
  376. loading: false,
  377. formInline: {
  378. fieldCode: "",
  379. timeQuantum: [],
  380. pageNum: 1,
  381. pageSize: 10,
  382. totalSize: 0,
  383. },
  384. startDate: "",
  385. endDate: "",
  386. tableData: [],
  387. particularsdata: [],
  388. ruleForm: {
  389. fieldCode: "",
  390. engineName: "",
  391. airdensity: "",
  392. millTypeCode: "",
  393. ratedCapacity: "",
  394. elevationHeight: "",
  395. longitude: "",
  396. latitude: "",
  397. hubHeight: "",
  398. sightcing: "",
  399. },
  400. fieldCodeOptions: [],
  401. millTypeCodeOptions: [],
  402. sightcingOptions: [
  403. {
  404. value: 1,
  405. label: "是",
  406. },
  407. {
  408. value: 2,
  409. label: "否",
  410. },
  411. ],
  412. rules: {
  413. fieldCode: [
  414. { required: true, message: "请选择关联风场", trigger: "change" },
  415. ],
  416. engineName: [
  417. { required: true, message: "请输入风机名称", trigger: "blur" },
  418. ],
  419. millTypeCode: [
  420. { required: true, message: "请输入机型编号", trigger: "blur" },
  421. ],
  422. ratedCapacity: [
  423. { required: true, message: "请输入额定容量(kW)", trigger: "blur" },
  424. ],
  425. longitude: [
  426. { required: true, message: "请输入经度", trigger: "blur" },
  427. { validator: this.validateNumber, trigger: "blur" },
  428. ],
  429. latitude: [
  430. { required: true, message: "请输入纬度", trigger: "blur" },
  431. { validator: this.validateNumber, trigger: "blur" },
  432. ],
  433. hubHeight: [
  434. { required: true, message: "请输入轮毂高度", trigger: "blur" },
  435. { validator: this.validateNumbertwo, trigger: "blur" },
  436. ],
  437. elevationHeight: [
  438. { required: true, message: "请输入海拔高度", trigger: "blur" },
  439. { validator: this.validateNumbertwo, trigger: "blur" },
  440. ],
  441. sightcing: [
  442. { required: true, message: "请选择是否标杆", trigger: "change" },
  443. ],
  444. },
  445. subordinatedata: [],
  446. subordinate: "",
  447. AllTemplateurl: "",
  448. // 新增信息
  449. engineName: "",
  450. airdensity: "",
  451. fieldCode: "",
  452. millTypeCode: "",
  453. sheng: "",
  454. shengOptions: [],
  455. shi: "",
  456. shiOptions: [],
  457. elevationHeight: "",
  458. latitude: "",
  459. sightcing: "",
  460. fileList: [],
  461. globalFileList: [],
  462. nuedialog: false,
  463. unusualdialog: false,
  464. tolead: false,
  465. isEdit: false,
  466. title: "",
  467. };
  468. },
  469. created() {
  470. this.onSubmit();
  471. this.windsite();
  472. this.relevancy();
  473. this.getAllTemplate();
  474. },
  475. methods: {
  476. rowStyle() {
  477. return "text-align:center";
  478. },
  479. onDateChange(date) {
  480. if (Array.isArray(date)) {
  481. this.startDate = this.$formatDate(date[0]);
  482. this.endDate = this.$formatDate(date[1]);
  483. if (this.endDate < this.startDate) {
  484. this.endDate = this.startDate;
  485. }
  486. } else {
  487. this.startDate = null;
  488. this.endDate = null;
  489. }
  490. },
  491. //获取模板
  492. getAllTemplate() {
  493. getAllTemplate().then((res) => {
  494. this.AllTemplateurl = res.data.draught;
  495. });
  496. },
  497. // 下载模板
  498. download() {
  499. if (this.AllTemplateurl) {
  500. const link = document.createElement("a");
  501. link.href = this.AllTemplateurl;
  502. link.download = ""; // 可以设置默认下载文件名
  503. link.target = "_blank"; // 新窗口打开
  504. document.body.appendChild(link);
  505. link.click();
  506. document.body.removeChild(link);
  507. } else {
  508. console.error("URL is not set");
  509. }
  510. },
  511. // 数字验证
  512. validateNumber(rule, value, callback) {
  513. const numberRegex = /^\d{1,3}(\.\d{1,8})?$/; // 匹配不超过四位数且小数点后不超过二位数的数字
  514. if (!value) {
  515. callback(new Error("该项不能为空"));
  516. } else if (!numberRegex.test(value)) {
  517. callback(
  518. new Error("该项必须为不超过三位数且小数点后不超过八位数的数字")
  519. );
  520. } else {
  521. callback();
  522. }
  523. },
  524. validateNumbertwo(rule, value, callback) {
  525. const numberRegex = /^\d{1,4}(\.\d{1,2})?$/; // 匹配不超过四位数且小数点后不超过二位数的数字
  526. if (!value) {
  527. callback(new Error("该项不能为空"));
  528. } else if (!numberRegex.test(value)) {
  529. callback(
  530. new Error("该项必须为不超过四位数且小数点后不超过两位数的数字")
  531. );
  532. } else {
  533. callback();
  534. }
  535. },
  536. // 查询
  537. onSubmit() {
  538. let paramsData = {
  539. engineName: this.formInline.engineName || undefined,
  540. beginTime: this.startDate || undefined,
  541. endTime: this.endDate || undefined,
  542. pageNum: this.formInline.pageNum || 1,
  543. pageSize: 10,
  544. };
  545. this.loading = true;
  546. windEngineGrouPage(paramsData)
  547. .then((res) => {
  548. this.tableData = res.data.list;
  549. this.formInline.totalSize = res.data.totalSize;
  550. this.loading = false;
  551. })
  552. .catch((error) => {
  553. console.error(error);
  554. });
  555. },
  556. // 停用
  557. start(row, type) {
  558. let objectval = {
  559. engineCode: row.engineCode,
  560. state: type === 0 ? 0 : 1,
  561. };
  562. updateStateWindEngineGroup(objectval).then((res) => {
  563. this.$message({
  564. message: "状态已更新成功",
  565. type: "success",
  566. });
  567. // this.$message(`${type === 1 ? '状态已更新成功' : '状态已更新成功'}`);
  568. row.state = type === 1 ? 0 : 1;
  569. this.onSubmit();
  570. });
  571. },
  572. //详情
  573. particulars(row) {
  574. this.unusualdialog = true;
  575. getWindEngineGroup({ engineCode: row.engineCode }).then((res) => {
  576. this.particularsdata = res.data;
  577. });
  578. },
  579. // 确认
  580. submitForm(formName) {
  581. this.$refs[formName].validate((valid) => {
  582. const objData = {
  583. fieldCode: this.ruleForm.fieldCode,
  584. engineName: this.ruleForm.engineName,
  585. millTypeCode: this.ruleForm.millTypeCode,
  586. ratedCapacity: this.ruleForm.ratedCapacity,
  587. elevationHeight: this.ruleForm.elevationHeight,
  588. longitude: this.ruleForm.longitude,
  589. latitude: this.ruleForm.latitude,
  590. hubHeight: this.ruleForm.hubHeight,
  591. sightcing: this.ruleForm.sightcing,
  592. };
  593. if (valid) {
  594. const API = this.isEdit
  595. ? updateWindEngineGroup(objData)
  596. : createWindEngineGroup(objData);
  597. API.then((res) => {
  598. if (res.code === -1) {
  599. this.$message({
  600. message: "操作成功 操作失败",
  601. type: " error",
  602. });
  603. } else {
  604. this.$message({
  605. message: "操作成功",
  606. type: "success",
  607. });
  608. }
  609. this.nuedialog = false;
  610. this.onSubmit();
  611. }).catch((error) => {});
  612. } else {
  613. console.log("表单验证失败");
  614. return false;
  615. }
  616. });
  617. },
  618. // 取消
  619. resetForm(formName) {
  620. this.$refs[formName].resetFields();
  621. this.nuedialog = false;
  622. },
  623. // 获取风场
  624. windsite() {
  625. // debugger;
  626. getWindFieldNames().then((res) => {
  627. this.fieldCodeOptions = res.data;
  628. this.subordinatedata = res.data;
  629. });
  630. },
  631. // 获取机型
  632. async relevancy() {
  633. try {
  634. const res = await getWindEngineMillList();
  635. this.millTypeCodeOptions = res.data;
  636. } catch (error) {
  637. console.error("Error fetching wind engine mill list:", error);
  638. }
  639. },
  640. //分页数据切换
  641. handleCurrentChange(val) {
  642. this.formInline.pageNum = val;
  643. this.onSubmit();
  644. },
  645. // 重置
  646. reset() {
  647. this.formInline.engineName = "";
  648. this.formInline.timeQuantum = "";
  649. this.onSubmit();
  650. },
  651. //导入提交
  652. UPsubmit() {
  653. let filedata = {
  654. fieldCode: this.subordinate,
  655. file: this.globalFileList,
  656. };
  657. if (filedata.file == "") {
  658. this.$message({
  659. message: "请先提交附件",
  660. type: "warning",
  661. });
  662. } else {
  663. windEngineGroupImportData(filedata)
  664. .then((res) => {
  665. console.log(res);
  666. this.uploadingPOP = false;
  667. if (res.code === -1) {
  668. this.$message({
  669. message: "上传失败",
  670. type: "error",
  671. });
  672. } else {
  673. this.tolead = false;
  674. this.$message({
  675. message: "上传成功",
  676. type: "success",
  677. });
  678. this.onSubmit();
  679. this.handleClose();
  680. }
  681. })
  682. .catch((error) => {});
  683. }
  684. console.log(filedata);
  685. // this.tolead = false
  686. },
  687. // 新增
  688. newly() {
  689. this.nuedialog = false;
  690. },
  691. // 编辑
  692. compile(row) {
  693. getWindEngineGroup({ engineCode: row.engineCode }).then((res) => {
  694. const item = JSON.parse(JSON.stringify(res.data));
  695. this.detail = item;
  696. Object.keys(this.ruleForm).forEach((key) => {
  697. this.ruleForm[key] = item[key];
  698. });
  699. });
  700. this.nuedialog = true;
  701. this.title = "编辑";
  702. this.isEdit = true;
  703. },
  704. // 删除
  705. deleted(row) {
  706. console.log(row, "row");
  707. if (row.state == "1") {
  708. this.$message({
  709. type: "error",
  710. message: "该项处于启用状态,无法删除!",
  711. });
  712. return;
  713. }
  714. this.$confirm("此操作将永久删除该文件,是否继续?", "提示", {
  715. confirmButtonText: "确定",
  716. cancelButtonText: "取消",
  717. type: "warning",
  718. })
  719. .then(() => {
  720. delWindEngineGroup({ engineCode: row.engineCode }).then((res) => {
  721. this.onSubmit();
  722. // 执行删除操作
  723. this.$message({
  724. type: "success",
  725. message: "删除成功!",
  726. });
  727. });
  728. })
  729. .catch(() => {
  730. // 取消删除
  731. this.$message({
  732. type: "info",
  733. message: "已取消删除",
  734. });
  735. });
  736. },
  737. // 导入
  738. upfile() {
  739. this.tolead = true;
  740. },
  741. // 新增
  742. newnuedialog() {
  743. this.nuedialog = true;
  744. this.title = "新增";
  745. },
  746. // 附件验证
  747. beforeUpload(fileList) {
  748. const isXLSX =
  749. fileList.type ===
  750. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  751. if (!isXLSX) {
  752. this.$message.error("只能上传xlsx文件");
  753. }
  754. const isLt5MB = fileList.size / 1024 / 1024 < 5;
  755. if (!isLt5MB) {
  756. this.$message.error("文件大小不能超过5MB");
  757. }
  758. console.log(fileList, "fileList");
  759. return isXLSX && isLt5MB;
  760. },
  761. handleOnChange(fileList) {
  762. console.log(fileList);
  763. this.globalFileList = fileList.raw;
  764. },
  765. handleClose() {
  766. this.subordinate = "";
  767. this.fileList = [];
  768. this.tolead = false;
  769. },
  770. },
  771. };
  772. </script>
  773. <style lang="scss" scoped>
  774. .general {
  775. display: flex;
  776. flex-wrap: wrap;
  777. .condition {
  778. width: 50%;
  779. display: flex;
  780. p {
  781. width: 100px;
  782. text-align: right;
  783. line-height: 40px;
  784. margin-right: 10px;
  785. }
  786. span {
  787. line-height: 40px;
  788. }
  789. .el-select {
  790. width: 260px;
  791. }
  792. .el-input {
  793. width: 260px;
  794. }
  795. }
  796. }
  797. .UPcondition {
  798. display: flex;
  799. margin-bottom: 10px;
  800. p {
  801. width: 74px;
  802. text-align: right;
  803. line-height: 40px;
  804. }
  805. .el-select {
  806. width: 260px;
  807. }
  808. .el-input {
  809. width: 260px;
  810. }
  811. }
  812. .attachment {
  813. display: flex;
  814. padding-top: 10px;
  815. p {
  816. margin-right: 20px;
  817. color: #409eff;
  818. }
  819. }
  820. .model-center {
  821. color: #666;
  822. line-height: 40px;
  823. height: 40px;
  824. font-size: 14px;
  825. }
  826. .demo-ruleForm {
  827. .el-select {
  828. width: 260px;
  829. }
  830. .el-input {
  831. width: 260px;
  832. }
  833. .el-form-item {
  834. margin-bottom: 20px;
  835. }
  836. .form-row {
  837. display: flex;
  838. justify-content: space-between;
  839. }
  840. .el-form-item {
  841. width: 48%;
  842. }
  843. }
  844. .form-buttons {
  845. display: flex;
  846. justify-content: center;
  847. width: 100%;
  848. margin-top: 20px;
  849. /* optional: adds some space above the buttons */
  850. }
  851. .model-center {
  852. color: #409eff;
  853. cursor: pointer;
  854. line-height: 40px;
  855. height: 40px;
  856. font-size: 14px;
  857. }
  858. </style>