index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="100px"
  10. @submit.native.prevent
  11. >
  12. <el-row>
  13. <el-form-item label="电机名称" prop="motorName">
  14. <el-input
  15. v-model="queryParams.motorName"
  16. placeholder="请输入电机名称"
  17. clearable
  18. @keyup.enter.native="handleQuery"
  19. />
  20. </el-form-item>
  21. <el-form-item style="margin-left: 20px">
  22. <el-button v-no-more-click
  23. type="primary"
  24. icon="el-icon-search"
  25. size="mini"
  26. @click="handleQuery"
  27. >搜索
  28. </el-button>
  29. <el-button v-no-more-click icon="el-icon-refresh" size="mini" @click="resetQuery"
  30. >重置
  31. </el-button>
  32. </el-form-item>
  33. </el-row>
  34. </el-form>
  35. <el-row :gutter="10" class="mb8">
  36. <el-col :span="1.5">
  37. <el-button v-no-more-click
  38. type="primary"
  39. plain
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd"
  43. v-hasPermi="['iscs:motor:add']"
  44. >新增
  45. </el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button v-no-more-click
  49. type="danger"
  50. plain
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. v-hasPermi="['iscs:motor:remove']"
  56. >批量删除
  57. </el-button>
  58. </el-col>
  59. <right-toolbar
  60. :showSearch.sync="showSearch"
  61. @queryTable="getList"
  62. ></right-toolbar>
  63. </el-row>
  64. <el-table
  65. v-loading="loading"
  66. :data="repairList"
  67. @selection-change="handleSelectionChange"
  68. >
  69. <el-table-column type="selection" width="55" align="center" />
  70. <el-table-column
  71. label="电机名称"
  72. align="center"
  73. prop="motorName"
  74. />
  75. <el-table-column label="隔离点绑定" align="center" prop="pointName" />
  76. <el-table-column
  77. label="操作"
  78. align="center"
  79. class-name="small-padding fixed-width"
  80. fixed="right"
  81. >
  82. <template slot-scope="scope">
  83. <el-button v-no-more-click
  84. size="mini"
  85. type="text"
  86. icon="el-icon-edit"
  87. @click="handleUpdate(scope.row)"
  88. v-hasPermi="['iscs:motor:edit','iscs:motor:query']"
  89. >修改
  90. </el-button>
  91. <el-button v-no-more-click
  92. size="mini"
  93. type="text"
  94. icon="el-icon-delete"
  95. @click="handleDelete(scope.row)"
  96. v-hasPermi="['iscs:motor:remove']"
  97. >删除
  98. </el-button>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <pagination
  103. v-show="total > 0"
  104. :total="total"
  105. :page.sync="queryParams.current"
  106. :limit.sync="queryParams.size"
  107. @pagination="getList"
  108. />
  109. <!-- 添加或修改设备维修单对话框 -->
  110. <el-dialog :title="title" :visible.sync="open" width="450px" append-to-body>
  111. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  112. <el-form-item label="电机名称" prop="motorName">
  113. <el-input v-model="form.motorName" placeholder="请输入电机名称" />
  114. </el-form-item>
  115. <el-form-item label="隔离点绑定" prop="pointId">
  116. <el-select style="width:290px" v-model="form.pointId" placeholder="隔离点绑定">
  117. <el-option v-for="item in this.isolationPointOptions" :key="item.pointId" :label="item.pointName" :value="item.pointId">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. </el-form>
  122. <div slot="footer" class="dialog-footer">
  123. <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>
  124. <el-button v-no-more-click @click="cancel">取 消</el-button>
  125. </div>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import {
  131. getIsMotorPage,
  132. selectIsMotorById,
  133. addMotor,
  134. updateMotor,
  135. delMotor
  136. } from "@/api/mes/motor/index";
  137. import Treeselect from "@riophae/vue-treeselect";
  138. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  139. import { listMarsDept } from '@/api/system/marsdept'
  140. import { listTechnology } from '@/api/system/machinery'
  141. import { listHardware } from '@/api/mes/hw/hardwareinfo'
  142. import { getIsIsolationPointPage } from '@/api/mes/spm/segregationPoint'
  143. export default {
  144. name: "lock",
  145. dicts: ["hardware_status"],
  146. components: { Treeselect },
  147. data() {
  148. return {
  149. autoGenFlag: false,
  150. optType: undefined,
  151. // 遮罩层
  152. loading: true,
  153. // 选中数组
  154. ids: [],
  155. codes: [],
  156. // 非单个禁用
  157. single: true,
  158. // 非多个禁用
  159. multiple: true,
  160. // 显示搜索条件
  161. showSearch: true,
  162. // mars树选项
  163. marsOptions: [],
  164. // 总条数
  165. total: 0,
  166. // 设备维修单表格数据
  167. repairList: [],
  168. // 弹出层标题
  169. title: "",
  170. // 是否显示弹出层
  171. open: false,
  172. // 查询参数
  173. createTime: "",
  174. queryParams: {
  175. current: 1,
  176. size: 10,
  177. motorName: null,
  178. motorId:null,
  179. },
  180. // 表单参数
  181. form: {
  182. },
  183. // 隔离点名称 下拉
  184. isolationPointOptions: null,
  185. hardWareList:[],//所属硬件
  186. // 表单校验
  187. rules: {
  188. motorName: [
  189. { required: true, message: "布局编码不能为空", trigger: "blur" },
  190. ],
  191. // pointId: [
  192. // { required: true, message: "隔离点不能为空", trigger: "blur" },
  193. // ],
  194. mapId:[
  195. { required: true, message: "地图名称不能为空", trigger: "blur" },
  196. ]
  197. },
  198. // 日期选择
  199. pickerOptions: {
  200. shortcuts: [
  201. {
  202. text: "最近一周",
  203. onClick(picker) {
  204. const end = new Date();
  205. const start = new Date();
  206. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  207. picker.$emit("pick", [start, end]);
  208. },
  209. },
  210. {
  211. text: "最近一个月",
  212. onClick(picker) {
  213. const end = new Date();
  214. const start = new Date();
  215. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  216. picker.$emit("pick", [start, end]);
  217. },
  218. },
  219. {
  220. text: "最近三个月",
  221. onClick(picker) {
  222. const end = new Date();
  223. const start = new Date();
  224. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  225. picker.$emit("pick", [start, end]);
  226. },
  227. },
  228. ],
  229. },
  230. EditId: 0, //修改判断
  231. machinerytypeOptions: [], //锁具机构类型
  232. machineryOptions:[],//查询 设备工艺数据
  233. };
  234. },
  235. created() {
  236. this.getList();
  237. this.getOtherList()
  238. },
  239. methods: {
  240. /** 查询设备维修单列表 */
  241. getList() {
  242. this.loading = true;
  243. // 布局数据
  244. getIsMotorPage(this.queryParams).then((response) => {
  245. console.log(response,'布局')
  246. this.repairList = response.data.records;
  247. this.total = response.data.total;
  248. this.loading = false;
  249. });
  250. },
  251. getOtherList(){
  252. const data={
  253. current:1,
  254. size:-1
  255. }
  256. // 获取地图类型 布局or地图
  257. getIsIsolationPointPage(data).then(response => {
  258. const dataValue = {
  259. pointName: '空',
  260. pointId: null,
  261. }
  262. this.isolationPointOptions = response.data.records
  263. this.isolationPointOptions = [...this.isolationPointOptions, dataValue]
  264. })
  265. },
  266. // 取消按钮
  267. cancel() {
  268. this.open = false;
  269. this.reset();
  270. },
  271. // 表单重置
  272. reset() {
  273. this.form = {
  274. lotoName: null,
  275. workstationId: null,
  276. orderNum: null,
  277. map:null,
  278. lotoSerialNumber: null,
  279. };
  280. this.autoGenFlag = false;
  281. this.resetForm("form");
  282. },
  283. /** 搜索按钮操作 */
  284. handleQuery() {
  285. this.queryParams.current = 1;
  286. this.getList();
  287. },
  288. /** 重置按钮操作 */
  289. resetQuery() {
  290. this.queryParams.motorName = "";
  291. this.resetForm("queryForm");
  292. this.handleQuery();
  293. },
  294. // 多选框选中数据
  295. handleSelectionChange(selection) {
  296. this.ids = selection.map((item) => item.motorId);
  297. this.codes = selection.map((item) => item.motorName);
  298. this.single = selection.length !== 1;
  299. this.multiple = !selection.length;
  300. },
  301. /** 新增按钮操作 */
  302. handleAdd() {
  303. this.reset();
  304. this.open = true;
  305. this.EditId = null;
  306. this.title = "新增电机信息";
  307. },
  308. /** 修改按钮操作 */
  309. handleUpdate(row) {
  310. this.reset();
  311. this.EditId = row.motorId || this.ids;
  312. selectIsMotorById(this.EditId).then((response) => {
  313. this.form = response.data;
  314. this.open = true;
  315. this.title = "修改电机信息";
  316. });
  317. },
  318. /** 提交按钮 */
  319. submitForm() {
  320. this.$refs["form"].validate((valid) => {
  321. if (valid) {
  322. if (this.EditId != null) {
  323. updateMotor(this.form).then((response) => {
  324. this.$modal.msgSuccess("修改成功");
  325. this.open = false;
  326. this.getList();
  327. });
  328. } else {
  329. // console.log(this.form, "form");
  330. addMotor(this.form).then((response) => {
  331. this.$modal.msgSuccess("新增成功");
  332. this.open = false;
  333. this.EditId = null;
  334. this.getList();
  335. });
  336. }
  337. }
  338. });
  339. },
  340. /** 删除按钮操作 */
  341. handleDelete(row) {
  342. const repairIds = row.motorId || this.ids;
  343. const repairCodes = row.motorName || this.codes;
  344. this.$modal
  345. .confirm('是否确认删除所选数据项?')
  346. .then(function () {
  347. return delMotor(repairIds);
  348. })
  349. .then(() => {
  350. this.getList();
  351. this.$modal.msgSuccess("删除成功");
  352. })
  353. .catch(() => {});
  354. },
  355. },
  356. };
  357. </script>
  358. <style scoped>
  359. .imgstatus {
  360. position: relative;
  361. top: 1px;
  362. left: 0px;
  363. }
  364. /deep/ .el-radio__inner {
  365. border-radius: 2px;
  366. }
  367. /deep/ .el-radio__input.is-checked .el-radio__inner::after {
  368. content: "";
  369. width: 8px;
  370. height: 3px;
  371. border: 1px solid white;
  372. border-top: transparent;
  373. border-right: transparent;
  374. text-align: center;
  375. display: block;
  376. position: absolute;
  377. top: 3px;
  378. left: 2px;
  379. transform: rotate(-45deg);
  380. border-radius: 0pc;
  381. background: none;
  382. }
  383. </style>