index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div class="app-container">
  3. <headerdiv ref="headerDiv" :currentindexP = currentindexNew></headerdiv>
  4. <div class="divtitle">
  5. <img src="~@/assets/images/icon.png" style="width:1.8rem;height:1.8rem;margin-top:0.3rem"/>
  6. <div style="font-size:1.6rem;font-family: Adobe Heiti Std;font-weight: normal;color: #DFEEF3;margin-left:1rem">{{divtitle}}</div>
  7. </div>
  8. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="6.8rem" style="margin-top:1rem">
  9. <el-form-item label="巡更人员" prop="nickName">
  10. <el-select v-model="queryParams.nickName" placeholder="请选择人员" style="width:25rem">
  11. <el-option
  12. v-for="obj in userList"
  13. :key="obj.userId"
  14. :label="obj.nickName"
  15. :value="obj.userId"
  16. ></el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="开始时间" prop="startDate">
  20. <el-date-picker
  21. v-model="queryParams.startDate"
  22. type="date"
  23. placeholder="选择日期"
  24. style="width:15rem"
  25. value-format="yyyy-MM-dd">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item label="结束时间" prop="endDate">
  29. <el-date-picker
  30. v-model="queryParams.endDate"
  31. type="date"
  32. placeholder="选择日期"
  33. style="width:15rem"
  34. value-format="yyyy-MM-dd">
  35. </el-date-picker>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  39. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <!-- <el-row :gutter="10" class="mb8">
  43. <el-col :span="1.5">
  44. <el-button
  45. style="width:8rem;height:3.2rem;"
  46. type="primary"
  47. plain
  48. icon="el-icon-plus"
  49. @click="handleAdd"
  50. v-hasPermi="['qdtl:location:add']"
  51. >新增</el-button>
  52. </el-col>
  53. <el-col :span="1.5">
  54. <el-button
  55. style="width:8rem;height:3.2rem;"
  56. type="primary"
  57. plain
  58. icon="el-icon-edit"
  59. :disabled="single"
  60. @click="handleUpdate"
  61. v-hasPermi="['qdtl:location:edit']"
  62. >修改</el-button>
  63. </el-col>
  64. <el-col :span="1.5">
  65. <el-button
  66. style="width:8rem;height:3.2rem;"
  67. type="primary"
  68. plain
  69. icon="el-icon-delete"
  70. :disabled="multiple"
  71. @click="handleDelete"
  72. v-hasPermi="['qdtl:location:remove']"
  73. >删除</el-button>
  74. </el-col>
  75. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  76. </el-row> -->
  77. <el-table v-loading="loading" :data="scheduleList" @selection-change="handleSelectionChange" stripe
  78. class="my_table"
  79. :row-class-name="tableRowClassName"
  80. :header-cell-style="{background:'#24A3B3 50%',color: '#C5D0D4'}">
  81. <el-table-column label="生效日期" align="center" prop="effectDate" width='250'/>
  82. <el-table-column label="巡更点" align="center" prop="locationName" width='200'>
  83. <template slot-scope="scope">
  84. <div v-for="item of scope.row.locations">
  85. <span> {{item}} </span>
  86. </br>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="巡更时间" align="center" prop="detail" width='150' >
  91. <template slot-scope="scope">
  92. <div v-for="item of scope.row.timeUnit">
  93. <span> {{item}} </span>
  94. </br>
  95. </div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column :label="dateRange" align="center">
  99. <el-table-column
  100. prop="name"
  101. label="姓名"
  102. align="center"
  103. >
  104. </el-table-column>
  105. </el-table-column>
  106. </el-table>
  107. <pagination
  108. v-show="total>0"
  109. :total="total"
  110. :page.sync="queryParams.pageNum"
  111. :limit.sync="queryParams.pageSize"
  112. @pagination="getList"
  113. />
  114. </div>
  115. </template>
  116. <script>
  117. import { getSchedule } from "@/api/qdtl/data";
  118. import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
  119. import headerdiv from '@/components/HeaderDiv/index.vue'
  120. import mapdiv from "@/components/map/index.vue"
  121. export default {
  122. name: "Location",
  123. data() {
  124. return {
  125. // 遮罩层
  126. loading: true,
  127. divtitle:'排班管理',
  128. // 选中数组
  129. ids: [],
  130. // 非单个禁用
  131. single: true,
  132. // 非多个禁用
  133. multiple: true,
  134. // 显示搜索条件
  135. showSearch: true,
  136. // 总条数
  137. total: 0,
  138. // 巡检点管理表格数据
  139. locationList: [],
  140. // 弹出层标题
  141. title: "",
  142. // 是否显示弹出层
  143. open: false,
  144. isEdit:'true',
  145. selectUser:[],
  146. userList:[],
  147. dateRange:'',
  148. // 查询参数
  149. queryParams: {
  150. pageNum: 1,
  151. pageSize: 10,
  152. },
  153. // 表单参数
  154. form: {},
  155. pointArry:{
  156. locations:'',
  157. type:''
  158. },
  159. scheduleList:[],
  160. // 表单校验
  161. rules: {
  162. }
  163. };
  164. },
  165. components:{
  166. mapdiv,
  167. headerdiv
  168. },
  169. created() {
  170. this.getList();
  171. this.getUserList();
  172. // this.getAreaList();
  173. },
  174. methods: {
  175. getUserList(){
  176. listUser().then(response =>{
  177. this.userList = response.rows
  178. console.log(this.userList);
  179. // console.log(response.rows);
  180. })
  181. },
  182. /** 查询巡检点管理列表 */
  183. getList() {
  184. this.loading = true;
  185. getSchedule().then(response =>{
  186. console.log(response);
  187. this.scheduleList = response.data
  188. this.loading = false
  189. })
  190. },
  191. // 取消按钮
  192. cancel() {
  193. this.open = false;
  194. this.reset();
  195. },
  196. // 表单重置
  197. reset() {
  198. this.form = {
  199. id: null,
  200. locationCode: null,
  201. locationName: null,
  202. detail: null,
  203. deviceIds: null,
  204. areaId: null,
  205. lnglat: null,
  206. remark: null,
  207. delFlag: null,
  208. createBy: null,
  209. createTime: null,
  210. updateBy: null,
  211. updateTime: null
  212. };
  213. this.resetForm("form");
  214. },
  215. /** 搜索按钮操作 */
  216. handleQuery() {
  217. this.queryParams.pageNum = 1;
  218. console.log(this.queryParams);
  219. this.dateRange = this.queryParams.startDate + '至' +this.queryParams.endDate
  220. console.log(this.dateRange);
  221. this.getList();
  222. },
  223. /** 重置按钮操作 */
  224. resetQuery() {
  225. this.resetForm("queryForm");
  226. this.handleQuery();
  227. },
  228. // 多选框选中数据
  229. handleSelectionChange(selection) {
  230. this.ids = selection.map(item => item.id)
  231. this.single = selection.length!==1
  232. this.multiple = !selection.length
  233. },
  234. /** 新增按钮操作 */
  235. handleAdd() {
  236. this.reset();
  237. this.open = true;
  238. this.title = "添加巡检点管理";
  239. },
  240. /** 修改按钮操作 */
  241. handleUpdate(row) {
  242. this.reset();
  243. const id = row.id || this.ids
  244. getLocation(id).then(response => {
  245. this.form = response.data;
  246. this.open = true;
  247. this.title = "修改巡检点管理";
  248. this.openMap();
  249. });
  250. },
  251. /** 提交按钮 */
  252. submitForm() {
  253. this.$refs["form"].validate(valid => {
  254. if (valid) {
  255. if (this.form.id != null) {
  256. if(this.$refs.mapv.locations.length > 0){
  257. this.form.lnglat = this.$refs.mapv.locations.join(',');
  258. }
  259. updateLocation(this.form).then(response => {
  260. this.$modal.msgSuccess("修改成功");
  261. this.open = false;
  262. this.getList();
  263. });
  264. } else {
  265. this.form.lnglat = this.$refs.mapv.locations.join(',');
  266. addLocation(this.form).then(response => {
  267. this.$modal.msgSuccess("新增成功");
  268. this.open = false;
  269. this.getList();
  270. });
  271. }
  272. }
  273. });
  274. },
  275. /** 删除按钮操作 */
  276. handleDelete(row) {
  277. const ids = row.id || this.ids;
  278. this.$modal.confirm('是否确认删除巡检点管理编号为"' + ids + '"的数据项?').then(function() {
  279. return delLocation(ids);
  280. }).then(() => {
  281. this.getList();
  282. this.$modal.msgSuccess("删除成功");
  283. }).catch(() => {});
  284. },
  285. /** 导出按钮操作 */
  286. handleExport() {
  287. this.download('qdtl/location/export', {
  288. ...this.queryParams
  289. }, `location_${new Date().getTime()}.xlsx`)
  290. },
  291. tableRowClassName({ row, rowIndex }) {
  292. if ((rowIndex + 1) % 2 === 0) {
  293. return "warning-row";
  294. } else {
  295. return "success-row";
  296. }
  297. },
  298. deleteLocation(){
  299. // this.$refs.mapv.draw.set
  300. this.$refs.mapv.vector.getSource().clear()
  301. }
  302. }
  303. };
  304. </script>
  305. <style>
  306. .divtitle{
  307. background: url("~@/assets/images/title2@2x.png") no-repeat;
  308. background-size: 100% 100%;
  309. width:100%;
  310. height:3.9rem;
  311. padding-top:0.8rem;
  312. padding-left:3rem;
  313. display: inline-flex;
  314. }
  315. </style>