maintenance.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item>
  7. <el-button type="text" @click="backToDetection" icon="el-icon-back" class="back">返回</el-button>
  8. </el-form-item>
  9. <el-form-item class="divLine"></el-form-item>
  10. <el-form-item>
  11. {{mouldName}}
  12. </el-form-item>
  13. <el-form-item style="float:right;">
  14. 保养提醒:
  15. <el-switch v-model="prompt" active-color="#ff4949"></el-switch>
  16. </el-form-item>
  17. <el-form-item style="float: right">
  18. 当前保养状态:
  19. <span style="color: #ff4949; margin-right: 16px;">需要</span>
  20. <el-button size="small" type="primary" v-if="requirement" @click="showMaintenance">立即处理</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </el-col>
  24. <!--列表-->
  25. <el-table
  26. :data="records"
  27. highlight-current-row
  28. :height="tableHeight"
  29. v-loading="listLoading"
  30. style="width: 100%;"
  31. >
  32. <el-table-column type="index" width="60"></el-table-column>
  33. <el-table-column prop="maintainUserName" label="保养人" width="100" sortable></el-table-column>
  34. <el-table-column prop="maintainType" label="保养方案" sortable></el-table-column>
  35. <el-table-column prop="fileName" label="保养照片" width="200" sortable></el-table-column>
  36. <el-table-column prop="indate" label="关闭时间" width="200" sortable></el-table-column>
  37. </el-table>
  38. <!--工具条-->
  39. <el-col :span="24" class="toolbar">
  40. <el-pagination
  41. @size-change="handleSizeChange"
  42. @current-change="handleCurrentChange"
  43. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  44. :page-size="20"
  45. layout="total, sizes, prev, pager, next"
  46. :total="total"
  47. style="float:right;"
  48. ></el-pagination>
  49. </el-col>
  50. <!--新增界面-->
  51. <el-dialog
  52. title="处理保养"
  53. v-if="maintenanceFormVisible"
  54. :visible.sync="maintenanceFormVisible"
  55. :close-on-click-modal="false"
  56. customClass="customWidth"
  57. >
  58. <el-form
  59. :model="maintenanceForm"
  60. label-width="100px"
  61. :rules="formRules"
  62. ref="addForm"
  63. :inline="true"
  64. class="demo-form-inline"
  65. >
  66. <el-form-item label="保养类型" prop="type">
  67. <!-- 保养类型选择 -->
  68. <el-select v-model="type.value" filterable placeholder="请选择保养类型" style="width:202px">
  69. <el-option
  70. v-for="item in type"
  71. :key="item.value"
  72. :label="item.label"
  73. :value="item.value"
  74. ></el-option>
  75. </el-select>
  76. </el-form-item>
  77. <!-- 保养类型为1时 选择易损件ID -->
  78. <el-form-item v-if="type.value == 1" label="选择易损件" prop="action">
  79. <el-select
  80. v-model="action.value"
  81. clearable
  82. filterable
  83. placeholder="请选择易损件"
  84. style="width:202px"
  85. >
  86. <el-option
  87. v-for="item in vulnerable"
  88. :key="item.value"
  89. :label="item.label"
  90. :value="item.value"
  91. ></el-option>
  92. </el-select>
  93. </el-form-item>
  94. <!-- 保养类型为0时 选择保养动作 -->
  95. <el-form-item v-else label="选择动作" prop="action">
  96. <el-select
  97. v-model="maintenanceForm.action"
  98. filterable
  99. placeholder="请选择动作"
  100. style="width:202px"
  101. >
  102. <el-option
  103. v-for="item in action"
  104. :key="item.value"
  105. :label="item.label"
  106. :value="item.value"
  107. ></el-option>
  108. </el-select>
  109. </el-form-item>
  110. </el-form>
  111. <div slot="footer" class="dialog-footer">
  112. <el-button @click.native="maintenanceFormVisible = false">取消</el-button>
  113. <el-button type="primary" @click.native="maintain" :loading="maintenanceLoading">立即处理</el-button>
  114. </div>
  115. </el-dialog>
  116. </section>
  117. </template>
  118. <script>
  119. import util from "../../common/js/util";
  120. export default {
  121. data() {
  122. return {
  123. //本页模具ID
  124. mouldId: null,
  125. //模具名字
  126. mouldName: null,
  127. options: [{ value: "aaa", label: "123" }, { value: "bbb", label: "456" }],
  128. //记录
  129. records: [],
  130. //标题栏过滤器
  131. filters: {
  132. name: "",
  133. value: ""
  134. },
  135. listLoading: false,
  136. page: 1,
  137. size: 20,
  138. total: 0,
  139. tableHeight: 0,
  140. formRules: {},
  141. //保养界面 种类
  142. type: [{ label: "动作", value: 0 }, { label: "易损件", value: 1 }],
  143. //保养界面 动作
  144. action: [{ label: "喷漆", value: 0 }, { label: "检查", value: 1 }],
  145. //易损件
  146. vulnerable: [
  147. { label: "易损件1", value: 0 },
  148. { label: "易损件12450", value: 1 },
  149. { label: "易损件114514", value: 2 }
  150. ],
  151. //是否需要保养 提示
  152. requirement: true,
  153. prompt: true,
  154. //保养详情界面显示
  155. maintenanceFormVisible: false,
  156. maintenanceLoading: false,
  157. //保养详情界面数据
  158. maintenanceForm: {
  159. username: "",
  160. account: "",
  161. mobile: "",
  162. teamName: "",
  163. companyId: "",
  164. roleType: "",
  165. flag: 0
  166. }
  167. };
  168. },
  169. methods: {
  170. //分页
  171. handleCurrentChange(val) {
  172. this.page = val;
  173. this.getList();
  174. },
  175. handleSizeChange(val) {
  176. this.size = val;
  177. this.getList();
  178. },
  179. selsChange: function(sels) {
  180. this.sels = sels;
  181. },
  182. backToDetection() {
  183. this.$router.go(-1);
  184. },
  185. //显示新增界面
  186. showMaintenance: function() {
  187. this.maintenanceFormVisible = true;
  188. },
  189. //获取记录
  190. getList() {
  191. this.listLoading = true;
  192. this.http.post(
  193. this.port.mold.moldMaintainList,
  194. { mouldId: this.mouldId, pageSize: this.size, pageNum: this.page },
  195. res => {
  196. this.listLoading = false;
  197. if (res.code == "ok") {
  198. this.records = res.data.list;
  199. } else {
  200. this.$message({
  201. message: res.msg,
  202. type: "error"
  203. });
  204. }
  205. },
  206. error => {
  207. this.listLoading = false;
  208. this.$message({
  209. message: error,
  210. type: "error"
  211. });
  212. }
  213. );
  214. },
  215. //模具详情 获取模具名字用的
  216. getDetail() {
  217. this.http.post(
  218. this.port.mold.moldDetail,
  219. {
  220. id: this.mouldId
  221. },
  222. res => {
  223. if (res.code == "ok") {
  224. this.mouldName = res.data.vo.modelName;
  225. } else {
  226. this.$message({
  227. message: res.msg,
  228. type: "error"
  229. });
  230. }
  231. },
  232. error => {
  233. this.$message({
  234. message: error,
  235. type: "error"
  236. });
  237. }
  238. );
  239. },
  240. //模具保养 N/A
  241. maintain() {
  242. var param = {
  243. mouldId: this.mouldId,
  244. maintainType: this.type.value,
  245. ways: null
  246. };
  247. if (param.maintainType == 0) {
  248. param.ways = this.action.value;
  249. } else {
  250. param.ways = null; //后面应该换成易损件的ID
  251. }
  252. this.http.post(
  253. this.port.mold.moldMaintain,
  254. param,
  255. res => {
  256. if (res.code == "ok") {
  257. this.$message({
  258. message: "保养完成",
  259. type: "success"
  260. });
  261. } else {
  262. this.$message({
  263. message: res.msg,
  264. type: "error"
  265. });
  266. }
  267. },
  268. error => {
  269. this.listLoading = false;
  270. this.$message({
  271. message: error,
  272. type: "error"
  273. });
  274. }
  275. );
  276. }
  277. },
  278. created() {
  279. let height = window.innerHeight;
  280. this.tableHeight = height - 260;
  281. },
  282. mounted() {
  283. this.mouldId = this.$route.params.id; //传到当前页面的模具编号
  284. // this.getList();
  285. this.getDetail();
  286. }
  287. };
  288. </script>
  289. <style scoped>
  290. .toolbar .el-form-item {
  291. font-size: 14px;
  292. vertical-align: middle;
  293. }
  294. .back {
  295. font-size: 16px;
  296. }
  297. .divLine {
  298. width: 2px;
  299. background: #c3c3c3;
  300. height: 100%;
  301. }
  302. .projectTitle {
  303. font-size: 18px;
  304. color: #333;
  305. }
  306. </style>