index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-if="showSearch" label-width="68px" @submit.native.prevent>
  4. <el-form-item label-width="130px" label="名称" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label-width="130px" label="详细通讯地址" prop="address">
  14. <el-input
  15. v-model="queryParams.address"
  16. placeholder="请输入详细通讯地址"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <!--<el-form-item label-width="auto" label="注册登记机关" prop="registrationAuthority">-->
  23. <!--<el-input-->
  24. <!--v-model="queryParams.registrationAuthority"-->
  25. <!--placeholder="请输入注册登记机关"-->
  26. <!--clearable-->
  27. <!--size="small"-->
  28. <!--@keyup.enter.native="handleQuery"-->
  29. <!--/>-->
  30. <!--</el-form-item>-->
  31. <!--<el-form-item label-width="auto" label="注册时间" prop="registerDate">
  32. <el-date-picker clearable size="small"
  33. v-model="queryParams.registerDate"
  34. type="date"
  35. value-format="yyyy-MM-dd"
  36. placeholder="选择注册时间">
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item label-width="auto" label="注册资金" prop="registerCapital">
  40. <el-input
  41. v-model="queryParams.registerCapital"
  42. placeholder="请输入注册资金"
  43. clearable
  44. size="small"
  45. @keyup.enter.native="handleQuery"
  46. />
  47. </el-form-item>
  48. <el-form-item label-width="auto" label="法人姓名" prop="legalPerson">
  49. <el-input
  50. v-model="queryParams.legalPerson"
  51. placeholder="请输入法人姓名"
  52. clearable
  53. size="small"
  54. @keyup.enter.native="handleQuery"
  55. />
  56. </el-form-item>
  57. <el-form-item label-width="auto" label="联系电话" prop="phone">
  58. <el-input
  59. v-model="queryParams.phone"
  60. placeholder="请输入联系电话"
  61. clearable
  62. size="small"
  63. @keyup.enter.native="handleQuery"
  64. />
  65. </el-form-item>
  66. <el-form-item label-width="auto" label="经费来源" prop="landUseMode">
  67. <el-input
  68. v-model="queryParams.landUseMode"
  69. placeholder="请输入经费来源"
  70. clearable
  71. size="small"
  72. @keyup.enter.native="handleQuery"
  73. />
  74. </el-form-item>
  75. <el-form-item label-width="auto" label="举办单位" prop="leaseTerm">
  76. <el-input
  77. v-model="queryParams.leaseTerm"
  78. placeholder="请输入举办单位"
  79. clearable
  80. size="small"
  81. @keyup.enter.native="handleQuery"
  82. />
  83. </el-form-item>
  84. <el-form-item label-width="auto" label="从业人数" prop="membersNum">
  85. <el-input
  86. v-model="queryParams.membersNum"
  87. placeholder="请输入从业人数"
  88. clearable
  89. size="small"
  90. @keyup.enter.native="handleQuery"
  91. />
  92. </el-form-item>-->
  93. <el-form-item>
  94. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  95. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  96. </el-form-item>
  97. </el-form>
  98. <el-row :gutter="10" class="mb8">
  99. <el-col :span="1.5">
  100. <el-button
  101. type="primary"
  102. plain
  103. icon="el-icon-plus"
  104. size="mini"
  105. @click="handleAdd"
  106. v-hasPermi="['botany_protect_info:BotanyProtectInfo:add']"
  107. >新增
  108. </el-button>
  109. </el-col>
  110. <el-col :span="1.5">
  111. <el-button
  112. type="success"
  113. plain
  114. icon="el-icon-edit"
  115. size="mini"
  116. :disabled="single"
  117. @click="handleUpdate"
  118. v-hasPermi="['botany_protect_info:BotanyProtectInfo:edit']"
  119. >修改
  120. </el-button>
  121. </el-col>
  122. <el-col :span="1.5">
  123. <el-button
  124. type="danger"
  125. plain
  126. icon="el-icon-delete"
  127. size="mini"
  128. :disabled="multiple"
  129. @click="handleDelete"
  130. v-hasPermi="['botany_protect_info:BotanyProtectInfo:remove']"
  131. >删除</el-button>
  132. </el-col>
  133. <!--<el-col :span="1.5">-->
  134. <!--<el-button-->
  135. <!--type="info"-->
  136. <!--plain-->
  137. <!--icon="el-icon-upload2"-->
  138. <!--size="mini"-->
  139. <!--@click="handleImport"-->
  140. <!--v-hasPermi="['botany_protect_info:BotanyProtectInfo:import']"-->
  141. <!--&gt;导入-->
  142. <!--</el-button>-->
  143. <!--</el-col>-->
  144. <el-col :span="1.5">
  145. <el-button
  146. type="warning"
  147. plain
  148. icon="el-icon-download"
  149. size="mini"
  150. @click="handleExport"
  151. v-hasPermi="['botany_protect_info:BotanyProtectInfo:export']"
  152. >导出
  153. </el-button>
  154. </el-col>
  155. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  156. </el-row>
  157. <el-table v-loading="loading" :data="BotanyProtectInfoList" @selection-change="handleSelectionChange">
  158. <el-table-column type="selection" width="55" align="center"/>
  159. <!--<el-table-column label="${comment}" align="center" prop="id" />-->
  160. <el-table-column label="名称" align="center" prop="name"/>
  161. <el-table-column label="详细通讯地址" align="center" prop="address" />
  162. <!--<el-table-column label="注册登记机关" align="center" prop="registrationAuthority" />-->
  163. <!--<el-table-column label="注册时间" align="center" prop="registerDate" width="180">-->
  164. <!--<template slot-scope="scope">-->
  165. <!--<span>{{ parseTime(scope.row.registerDate, '{y}-{m}-{d}') }}</span>-->
  166. <!--</template>-->
  167. <!--</el-table-column>-->
  168. <!--<el-table-column label="注册资金" align="center" prop="registerCapital" />-->
  169. <el-table-column label="法人姓名" align="center" prop="legalPerson"/>
  170. <el-table-column label="联系电话" align="center" prop="phone"/>
  171. <!--<el-table-column label="经费来源" align="center" prop="landUseMode" />-->
  172. <!--<el-table-column label="举办单位" align="center" prop="leaseTerm" />-->
  173. <!--<el-table-column label="从业人数" align="center" prop="membersNum" />-->
  174. <!--<el-table-column label="创建时间" align="center" prop="createDate" width="180">
  175. <template slot-scope="scope">
  176. <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="修改时间" align="center" prop="updateDate" width="180">
  180. <template slot-scope="scope">
  181. <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d}') }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="备注" align="center" prop="remarks" />-->
  185. <el-table-column label="所属部门" align="center" prop="deptName"/>
  186. <el-table-column label="创建人" align="center" prop="createName" />
  187. <el-table-column label="创建时间" align="center" prop="createTime" />
  188. <el-table-column label="修改人" align="center" prop="updateName" />
  189. <el-table-column label="修改时间" align="center" prop="updateTime" />
  190. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  191. <template slot-scope="scope">
  192. <el-button
  193. size="mini"
  194. type="text"
  195. icon="el-icon-edit"
  196. @click="handleUpdate(scope.row)"
  197. v-hasPermi="['botany_protect_info:BotanyProtectInfo:edit']"
  198. >修改
  199. </el-button>
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-delete"
  204. @click="handleDelete(scope.row)"
  205. v-hasPermi="['botany_protect_info:BotanyProtectInfo:remove']"
  206. >删除
  207. </el-button>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <pagination
  212. v-show="total>0"
  213. :total="total"
  214. :page.sync="queryParams.pageNum"
  215. :limit.sync="queryParams.pageSize"
  216. @pagination="getList"
  217. />
  218. <!-- 添加或修改农业技术推广总站信息对话框 -->
  219. <el-dialog :title="title" :visible.sync="open" width="1000px" class="form-style">
  220. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  221. <el-row :gutter="20">
  222. <el-col :span="12">
  223. <el-form-item label="名称" prop="name">
  224. <el-input v-model="form.name" placeholder="请输入名称" maxlength="20"/>
  225. </el-form-item>
  226. <el-form-item label="详细通讯地址" prop="address">
  227. <el-input v-model="form.address" placeholder="请输入详细通讯地址" maxlength="20"/>
  228. </el-form-item>
  229. <el-form-item label="注册登记机关" prop="registrationAuthority">
  230. <el-input v-model="form.registrationAuthority" placeholder="请输入注册登记机关" maxlength="20"/>
  231. </el-form-item>
  232. <el-form-item label="注册时间" prop="registerDate">
  233. <el-date-picker clearable size="small"
  234. v-model="form.registerDate"
  235. type="date"
  236. value-format="yyyy-MM-dd"
  237. placeholder="选择注册时间">
  238. </el-date-picker>
  239. </el-form-item>
  240. <el-form-item label="注册资金(万元)" prop="registerCapital">
  241. <el-input v-model="form.registerCapital" placeholder="请输入注册资金" maxlength="20"/>
  242. </el-form-item>
  243. <el-form-item label="经度" prop="longitude" @dblclick.native="showMap">
  244. <el-input v-model="form.longitude" placeholder="鼠标双击此处以选择经纬度" />
  245. </el-form-item>
  246. <el-form-item label="绑定设备" prop="deviceList">
  247. <el-select v-model="form.deviceList" filterable placeholder="请选择设备" multiple>
  248. <el-option
  249. v-for="dict in cameraList"
  250. :key="dict.id"
  251. :label="dict.cameraName"
  252. :value="dict.id"
  253. ></el-option>
  254. </el-select>
  255. </el-form-item>
  256. </el-col>
  257. <el-col :span="12">
  258. <el-form-item label="法人姓名" prop="legalPerson">
  259. <el-input v-model="form.legalPerson" placeholder="请输入法人姓名" maxlength="20"/>
  260. </el-form-item>
  261. <el-form-item label="联系电话" prop="phone">
  262. <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="13"/>
  263. </el-form-item>
  264. <el-form-item label="经费来源" prop="landUseMode">
  265. <el-input v-model="form.landUseMode" placeholder="请输入经费来源" maxlength="20"/>
  266. </el-form-item>
  267. <el-form-item label="举办单位" prop="leaseTerm">
  268. <el-input v-model="form.leaseTerm" placeholder="请输入举办单位" maxlength="20"/>
  269. </el-form-item>
  270. <el-form-item label="从业人数" prop="membersNum">
  271. <el-input v-model="form.membersNum" placeholder="请输入从业人数" maxlength="20"/>
  272. </el-form-item>
  273. <el-form-item label="纬度" prop="latitude" @dblclick.native="showMap">
  274. <el-input v-model="form.latitude" placeholder="鼠标双击此处以选择经纬度" />
  275. </el-form-item>
  276. <el-form-item label="所属部门" prop="deptId">
  277. <!-- <Deptselector :setValue=setDataDeptId :dataDeptId="form.deptId"/>-->
  278. <treeselect v-model="form.deptId" :options="deptOptions" multiple:false :show-count="true" :noResultsText="'空'" :noOptionsText="'空'"
  279. placeholder="请选择部门" @select="hx"/>
  280. </el-form-item>
  281. <!--<el-form-item label-width="auto" label="备注" prop="remarks">-->
  282. <!--<el-input v-model="form.remarks" placeholder="请输入备注" />-->
  283. <!--</el-form-item>-->
  284. </el-col>
  285. </el-row>
  286. <el-row>
  287. <el-col :span="24">
  288. <el-form-item label="展示图片" prop="attachPaths">
  289. <DataImageUpload ref="ImageUpload" :fileType="['png', 'jpg', 'jpeg']" :value="form.attachPaths"
  290. @input="getUrl"></DataImageUpload>
  291. </el-form-item>
  292. </el-col>
  293. </el-row>
  294. </el-form>
  295. <div slot="footer" class="dialog-footer">
  296. <el-button type="primary" @click="submitForm">确 定</el-button>
  297. <el-button @click="cancel">取 消</el-button>
  298. </div>
  299. </el-dialog>
  300. <!-- 导入对话框 -->
  301. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  302. <el-upload
  303. ref="upload"
  304. :limit="1"
  305. accept=".xlsx, .xls"
  306. :headers="upload.headers"
  307. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  308. :disabled="upload.isUploading"
  309. :on-progress="handleFileUploadProgress"
  310. :on-success="handleFileSuccess"
  311. :auto-upload="false"
  312. drag
  313. >
  314. <i class="el-icon-upload"></i>
  315. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  316. <div class="el-upload__tip text-center" slot="tip">
  317. <div class="el-upload__tip" slot="tip">
  318. <el-checkbox v-model="upload.updateSupport"/>
  319. 是否更新已经存在的数据
  320. </div>
  321. <span>仅允许导入xls、xlsx格式文件。</span>
  322. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
  323. @click="importTemplate">下载模板
  324. </el-link>
  325. </div>
  326. </el-upload>
  327. <div slot="footer" class="dialog-footer">
  328. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  329. <el-button @click="upload.open = false">取 消</el-button>
  330. </div>
  331. </el-dialog>
  332. <!-- <el-dialog :title="titleLongitude" :visible.sync="showLongitude" append-to-body>-->
  333. <!--经度-->
  334. <!--<el-input v-model="form.longitude"></el-input>-->
  335. <!--纬度-->
  336. <!--<el-input v-model="form.latitude"></el-input>-->
  337. <!-- <supermap style="width: 100%;height: 500px;" :mapDiv="'botanyProtectMap'" :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false" :showLatLng="showLatLng"></supermap>-->
  338. <!-- <el-button type="primary" @click="showLongitude=false">确定</el-button>-->
  339. <!-- </el-dialog>-->
  340. <ISuperMap ref="ISuperMap" v-if="ISuperMapvisible" @send="send"/>
  341. </div>
  342. </template>
  343. <script>
  344. import {checkPositiveDecimal, checkNonnegativeInteger, validPhoneMobile,checkLat,checkLon} from "@/api/rules/rules";
  345. import {
  346. listBotanyProtectInfo,
  347. getBotanyProtectInfo,
  348. delBotanyProtectInfo,
  349. addBotanyProtectInfo,
  350. updateBotanyProtectInfo
  351. } from "@/api/data/digitalagriculture/botany_protect_info/BotanyProtectInfo";
  352. import Deptselector from '@/views/components/deptselector'
  353. import { getToken } from '@/utils/auth'
  354. import Treeselect from '@riophae/vue-treeselect'
  355. import supermap from '@/views/components/supermap'
  356. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  357. import {format_date} from "@/views/data/common/dateExport";
  358. import {selectCenterMonitorlList} from "@/api/data/digitalforest/animal/animal";
  359. import request from "@/utils/request";
  360. import ISuperMap from "@/views/data/common/ISuperMap.vue";
  361. import DataImageUpload from "@/components/ImageUpload/dataUpload.vue";
  362. export default {
  363. name: "BotanyProtectInfo",
  364. components: {
  365. ISuperMap,
  366. Deptselector,
  367. Treeselect,
  368. supermap,
  369. DataImageUpload
  370. },
  371. data() {
  372. return {
  373. ISuperMapvisible: false,
  374. sign: 1,
  375. cameraList: [],//设备集合
  376. // 遮罩层
  377. loading: true,
  378. // 选中数组
  379. ids: [],
  380. // 非单个禁用
  381. single: true,
  382. // 非多个禁用
  383. multiple: true,
  384. // 显示搜索条件
  385. showSearch: true,
  386. // 显示超图经纬度
  387. showLongitude: false,
  388. // 显示超图弹层标题
  389. titleLongitude: '经纬度',
  390. // 总条数
  391. total: 0,
  392. // 弹出层宽度
  393. labelWidth: '150px',
  394. // 文本框宽度
  395. inputStyle: 'width: 310px',
  396. // 农业技术推广总站信息表格数据
  397. BotanyProtectInfoList: [],
  398. // 弹出层标题
  399. title: "",
  400. // 是否显示弹出层
  401. open: false,
  402. // 部门名称
  403. deptName: undefined,
  404. // 部门树选项
  405. deptOptions: undefined,
  406. // 导入参数
  407. upload: {
  408. // 是否显示导入弹出层
  409. open: false,
  410. // 导入弹出层标题
  411. title: '',
  412. // 是否禁用上传
  413. isUploading: false,
  414. // 是否更新已经存在的数据
  415. updateSupport: 0,
  416. // 设置上传的请求头部
  417. headers: { Authorization: 'Bearer ' + getToken() },
  418. // 上传的地址
  419. url: process.env.VUE_APP_BASE_API + '/center-data/BotanyProtectInfo/import/importData'
  420. },
  421. // 查询参数
  422. queryParams: {
  423. pageNum: 1,
  424. pageSize: 10,
  425. name: null,
  426. address: null,
  427. registrationAuthority: null,
  428. registerDate: null,
  429. registerCapital: null,
  430. legalPerson: null,
  431. phone: null,
  432. landUseMode: null,
  433. leaseTerm: null,
  434. membersNum: null,
  435. createDate: null,
  436. updateDate: null,
  437. remarks: null,
  438. },
  439. // 表单参数
  440. form: {},
  441. // 正整数校验
  442. checkNonnegativeInteger: checkNonnegativeInteger,
  443. validPhoneMobile: validPhoneMobile,
  444. checkPositiveDecimal: checkPositiveDecimal,
  445. // 表单校验
  446. rules: {
  447. // legalPerson: [
  448. // {required: true, message: "法人姓名不能为空", trigger: "blur"},
  449. // ],
  450. name: [
  451. {required: true, message: "名称不能为空", trigger: "blur"},
  452. {min: 2, max: 20, message: '名称长度必须介于 2 和 20 之间', trigger: 'blur'}
  453. ],
  454. membersNum: [
  455. {required: true, message: "从业人数不能为空", trigger: "blur"},
  456. {validator: checkNonnegativeInteger, trigger: 'blur'}
  457. ],
  458. registerCapital: [
  459. {required: true, message: "注册资金不能为空", trigger: "blur"},
  460. {validator: checkPositiveDecimal, trigger: 'blur'}
  461. ],
  462. phone: [
  463. {required: true, message: "联系电话不能为空", trigger: "blur"},
  464. {validator: validPhoneMobile, trigger: 'blur'}
  465. ],
  466. longitude: [
  467. { required: true, message: "经度不能为空", trigger: "change" },
  468. {validator: checkLon, trigger: 'blur'}
  469. ],
  470. latitude: [
  471. { required: true, message: "纬度不能为空", trigger: "change" },
  472. {validator: checkLat, trigger: 'blur'}
  473. ],
  474. createDate: [
  475. {required: true, message: "创建时间不能为空", trigger: "blur"}
  476. ],
  477. deptId: [
  478. { required: true, message: "所属部门不能为空", trigger: "change" },
  479. ],
  480. }
  481. };
  482. },
  483. created() {
  484. this.getList();
  485. this.getTreeselect();
  486. },
  487. methods: {
  488. getUrl(url) {
  489. //获取图片全路径 例:http://{{ ip }}:{{ port }}/group1/M00/00/07/wKgKEGVxMCiAZbvVAAJE9SGvagw915.jpg
  490. this.form.attachPaths = url
  491. //获取图片路径 例:group1/M00/00/07/wKgKEGVxL6eACFv2AAJE9SGvagw622.jpg
  492. // this.form.attachPaths = this.$refs.ImageUpload.dialogName
  493. },
  494. setDataDeptId(e) {
  495. this.form.deptId = e.deptId;
  496. this.form.deptName = e.deptName;
  497. },
  498. showMap() {
  499. this.ISuperMapvisible = true;
  500. this.$nextTick(() => {
  501. this.$refs.ISuperMap.init(this.sign, {
  502. id: this.form.id,
  503. longitude: this.form.longitude,
  504. latitude: this.form.latitude,
  505. xiantude: this.form.longitude
  506. })
  507. })
  508. },
  509. send(val) {
  510. if (val===true){
  511. this.ISuperMapvisible = false;
  512. return;
  513. }
  514. if (this.sign === 1) {
  515. this.form.longitude = val.longitude;
  516. this.form.latitude = val.latitude;
  517. }
  518. if (this.sign === 2 || this.sign === 3) this.form.longitude = val.xiantude;
  519. this.ISuperMapvisible = false
  520. },
  521. showLatLng: function(lat, lng) {
  522. this.form.latitude = lat
  523. this.form.longitude = lng
  524. },
  525. /** 查询部门下拉树结构 */
  526. getTreeselect() {
  527. request({
  528. url: '/system/dept/treeselect',
  529. method: 'get'
  530. }).then(response => {
  531. this.deptOptions = response.data;
  532. });
  533. },
  534. hx(node) {
  535. this.form.dataDeptId = node.id
  536. this.form.deptId = node.id
  537. this.form.deptName = node.label
  538. this.$refs.form.validateField("deptId")
  539. },
  540. // 筛选节点
  541. filterNode(value, data) {
  542. if (!value) return true
  543. return data.label.indexOf(value) !== -1
  544. },
  545. // 节点单击事件
  546. handleNodeClick(data) {
  547. this.queryParams.deptId = data.id
  548. this.handleQuery()
  549. },
  550. /** 查询农业技术推广总站信息列表 */
  551. getList() {
  552. this.loading = true;
  553. listBotanyProtectInfo(this.queryParams).then(response => {
  554. this.BotanyProtectInfoList = response.rows;
  555. this.total = response.total;
  556. this.loading = false;
  557. });
  558. },
  559. // 取消按钮
  560. cancel() {
  561. this.open = false;
  562. this.reset();
  563. },
  564. // 表单重置
  565. reset() {
  566. this.form = {
  567. deptId: null,
  568. id: null,
  569. name: null,
  570. address: null,
  571. longitude: null,
  572. latitude: null,
  573. registrationAuthority: null,
  574. registerDate: null,
  575. registerCapital: null,
  576. legalPerson: null,
  577. phone: null,
  578. landUseMode: null,
  579. leaseTerm: null,
  580. membersNum: null,
  581. createBy: null,
  582. createDate: null,
  583. updateBy: null,
  584. updateDate: null,
  585. remarks: null,
  586. delFlag: null
  587. };
  588. this.resetForm("form");
  589. },
  590. /** 搜索按钮操作 */
  591. handleQuery() {
  592. this.queryParams.pageNum = 1;
  593. this.getList();
  594. },
  595. /** 重置按钮操作 */
  596. resetQuery() {
  597. this.resetForm("queryForm");
  598. this.handleQuery();
  599. },
  600. // 多选框选中数据
  601. handleSelectionChange(selection) {
  602. this.ids = selection.map(item => item.id)
  603. this.single = selection.length !== 1
  604. this.multiple = !selection.length
  605. },
  606. /** 新增按钮操作 */
  607. handleAdd() {
  608. this.reset();
  609. selectCenterMonitorlList(this.queryParams).then(response => {
  610. this.cameraList = response.data;
  611. });
  612. this.open = true;
  613. this.title = "添加农业技术推广总站信息";
  614. },
  615. /** 修改按钮操作 */
  616. handleUpdate(row) {
  617. this.reset();
  618. let _this = this;
  619. const id = row.id || this.ids
  620. selectCenterMonitorlList(this.queryParams).then(response => {
  621. this.cameraList = response.data;
  622. });
  623. getBotanyProtectInfo(id).then(response => {
  624. this.form = response.data;
  625. this.title = "修改农业技术推广总站信息";
  626. this.open = true;
  627. });
  628. },
  629. /** 提交按钮 */
  630. submitForm() {
  631. this.$refs["form"].validate(valid => {
  632. if (valid) {
  633. if (this.form.id != null) {
  634. updateBotanyProtectInfo(this.form).then(response => {
  635. this.$modal.msgSuccess("修改成功");
  636. this.open = false;
  637. this.getList();
  638. });
  639. } else {
  640. addBotanyProtectInfo(this.form).then(response => {
  641. this.$modal.msgSuccess("新增成功");
  642. this.open = false;
  643. this.getList();
  644. });
  645. }
  646. }
  647. });
  648. },
  649. /** 删除按钮操作 */
  650. handleDelete(row) {
  651. const ids = row.id || this.ids;
  652. this.$modal.confirm('是否删除选中的数据?').then(function () {
  653. return delBotanyProtectInfo(ids);
  654. }).then(() => {
  655. this.getList();
  656. this.$modal.msgSuccess("删除成功");
  657. }).catch(() => {
  658. });
  659. },
  660. /** 导入按钮操作 */
  661. handleImport() {
  662. this.upload.title = '导入'
  663. this.upload.open = true
  664. },
  665. /** 下载模板操作 */
  666. importTemplate() {
  667. this.download('/center-data/BotanyProtectInfo/importTemplate', {}, `BotanyProtectInfo_template_${new Date().getTime()}.xlsx`)
  668. },
  669. // 文件上传中处理
  670. handleFileUploadProgress(event, file, fileList) {
  671. this.upload.isUploading = true
  672. },
  673. // 文件上传成功处理
  674. handleFileSuccess(response, file, fileList) {
  675. this.upload.open = false
  676. this.upload.isUploading = false
  677. this.$refs.upload.clearFiles()
  678. this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
  679. this.getList()
  680. },
  681. // 提交上传文件
  682. submitFileForm() {
  683. this.$refs.upload.submit()
  684. },
  685. /** 导出按钮操作 */
  686. handleExport() {
  687. this.download('/center-data/BotanyProtectInfo/export', {
  688. ...this.queryParams
  689. }, `农业技术推广总站信息_${format_date(new Date())}.xlsx`)
  690. }
  691. }
  692. };
  693. </script>