moldList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true" :model="filters">
  6. <el-col :span="3">
  7. <el-form-item>
  8. <el-select v-model="filters.projectId" clearable placeholder="请选择项目">
  9. <el-option
  10. v-for="item in projects"
  11. :key="item.id"
  12. :label="item.projectName"
  13. :value="item.id"
  14. ></el-option>
  15. </el-select>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="3">
  19. <el-form-item>
  20. <el-select v-model="filters.serchType" placeholder="请选择查询条件">
  21. <el-option label="编号" value="0"></el-option>
  22. <el-option label="名称" value="1"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-col>
  26. <el-form-item>
  27. <el-input v-model="filters.keyName" placeholder="请输入编号或名称进行搜索"></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="primary" @click="getMoldList">查询</el-button>
  31. </el-form-item>
  32. <el-form-item style="float: right" v-if="user.parentId == 1">
  33. <el-button type="primary" @click="showAdd">新建</el-button>
  34. </el-form-item>
  35. </el-form>
  36. </el-col>
  37. <!--列表-->
  38. <el-table
  39. :data="molds"
  40. :height="tableHeight"
  41. highlight-current-row
  42. v-loading="listLoading"
  43. style="width: 100%;"
  44. >
  45. <el-table-column type="index" width="40"></el-table-column>
  46. <el-table-column prop="modelName" label="模具名称" width="180" sortable>
  47. <template slot-scope="scope">
  48. <el-link
  49. :underline="false"
  50. type="primary"
  51. @click="toDetail(scope.row)"
  52. >{{scope.row.modelName}}</el-link>
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="modelNo" label="模具编号" width="150" sortable></el-table-column>
  56. <el-table-column prop="equipmentNo" label="云模盒编号" width="150" sortable></el-table-column>
  57. <el-table-column prop="hillNumber" label="电量" align="center" width="100" sortable></el-table-column>
  58. <el-table-column prop="projectName" label="所属项目" width="180" sortable></el-table-column>
  59. <el-table-column label="所属资产方" width="200" sortable></el-table-column>
  60. <el-table-column label="所属生产方" width="200" sortable></el-table-column>
  61. <el-table-column prop="settingLife" label="模次寿命" width="100" align="center" sortable></el-table-column>
  62. <el-table-column prop="initialModulus" label="初始模次" width="100" align="center" sortable></el-table-column>
  63. <el-table-column prop="initial" label="穴数" width="100" align="center" sortable></el-table-column>
  64. <el-table-column prop="rfid" label="对应RFID码" width="120" align="center" sortable></el-table-column>
  65. <el-table-column label="模具文档" width="100" align="center" sortable>
  66. <template slot-scope="scope">
  67. <span v-if="scope.row.mouldFile == 1">已上传</span>
  68. <span v-else>未上传</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="零件文档" width="100" align="center" sortable>
  72. <template slot-scope="scope">
  73. <span v-if="scope.row.compFile == 1">已上传</span>
  74. <span v-else>未上传</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="保养方案" width="100" align="center" sortable>
  78. <template slot-scope="scope">
  79. <span v-if="scope.row.maintianPlan == 1">已上传</span>
  80. <span v-else>未上传</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="状态" width="100" align="center" sortable>
  84. <template slot-scope="scope">
  85. <span v-if="scope.row.state == 1" style="color:#00CD66;">运行</span>
  86. <span v-else style="color:#CD2626;">禁止</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. label="操作"
  91. width="150"
  92. align="center"
  93. fixed="right"
  94. sortable
  95. v-if="user.parentId == 1"
  96. >
  97. <el-button size="small" type="danger">删除</el-button>
  98. </el-table-column>
  99. </el-table>
  100. <!--工具条-->
  101. <el-col :span="24" class="toolbar">
  102. <el-pagination
  103. @size-change="handleSizeChange"
  104. @current-change="handleCurrentChange"
  105. :page-sizes="[20 , 50 , 80 , 100]"
  106. :page-size="20"
  107. layout="total, sizes, prev, pager, next"
  108. :total="total"
  109. style="float:right;"
  110. ></el-pagination>
  111. </el-col>
  112. <!--新增界面-->
  113. <el-dialog
  114. title="新建模具"
  115. v-if="addFormVisible"
  116. :visible.sync="addFormVisible"
  117. :close-on-click-modal="false"
  118. customClass="customWidth"
  119. >
  120. <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
  121. <el-form-item label="模具编号" prop="modelNo">
  122. <el-input v-model="addForm.modelNo" autocomplete="off" placeholder="请输入模具编号"></el-input>
  123. </el-form-item>
  124. <el-form-item label="模具名称" prop="modelName">
  125. <el-input v-model="addForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
  126. </el-form-item>
  127. <el-form-item label="云模盒编号" prop="equipmentId">
  128. <el-select
  129. v-model="addForm.equipmentId"
  130. clearable
  131. filterable
  132. placeholder="请选择云模盒编号"
  133. style="width:533px"
  134. >
  135. <el-option
  136. v-for="item in boxes"
  137. :key="item.id"
  138. :label="item.equipmentNo"
  139. :value="item.id"
  140. ></el-option>
  141. </el-select>
  142. </el-form-item>
  143. </el-form>
  144. <div slot="footer" class="dialog-footer">
  145. <el-button @click.native="addFormVisible = false">取消</el-button>
  146. <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
  147. </div>
  148. </el-dialog>
  149. </section>
  150. </template>
  151. <script>
  152. import util from "../../common/js/util";
  153. export default {
  154. data() {
  155. return {
  156. user: JSON.parse(sessionStorage.getItem("user")),
  157. molds: [],
  158. filters: {
  159. keyName: "",
  160. serchType: "编号",
  161. projectId: ""
  162. },
  163. formRules: {
  164. modelNo: [
  165. { required: true, message: "请输入模具编号", trigger: "blur" }
  166. ],
  167. modelName: [
  168. { required: true, message: "请输入模具名称", trigger: "blur" }
  169. ],
  170. equipmentId: [
  171. {
  172. required: true,
  173. message: "请选择云模盒编号",
  174. trigger: ["blur", "change"]
  175. }
  176. ]
  177. },
  178. listLoading: false,
  179. total: 0,
  180. tableHeight: 0,
  181. boxes: [],
  182. projects: [],
  183. addLoading: false,
  184. addFormVisible: false,
  185. addForm: {
  186. modelNo: "",
  187. modelName: "",
  188. equipmentId: ""
  189. }
  190. };
  191. },
  192. methods: {
  193. getMsg() {
  194. this.http.post(
  195. this.port.base.moulds,
  196. {
  197. belongCompanyId: this.user.companyId
  198. },
  199. res => {
  200. if (res.code == "ok") {
  201. this.boxes = res.data;
  202. } else {
  203. this.$message({
  204. message: res.msg,
  205. type: "error"
  206. });
  207. }
  208. },
  209. error => {
  210. this.listLoading = false;
  211. this.$message({
  212. message: error,
  213. type: "error"
  214. });
  215. }
  216. );
  217. this.http.post(
  218. this.port.project.projects,
  219. {},
  220. res => {
  221. if (res.code == "ok") {
  222. this.projects = res.data;
  223. } else {
  224. this.$message({
  225. message: res.msg,
  226. type: "error"
  227. });
  228. }
  229. },
  230. error => {
  231. this.listLoading = false;
  232. this.$message({
  233. message: error,
  234. type: "error"
  235. });
  236. }
  237. );
  238. },
  239. //分页
  240. handleCurrentChange(val) {
  241. this.page = val;
  242. this.getMoldList();
  243. },
  244. handleSizeChange(val) {
  245. this.size = val;
  246. this.getMoldList();
  247. },
  248. //获取模具列表
  249. getMoldList() {
  250. this.listLoading = true;
  251. this.http.post(
  252. this.port.mold.molds,
  253. {
  254. keyName: this.filters.keyName,
  255. pageNum: this.page,
  256. pageSize: this.size,
  257. projectId: this.filters.projectId == "" ? -1 : this.filters.projectId,
  258. serchType: this.filters.serchType
  259. },
  260. res => {
  261. this.listLoading = false;
  262. if (res.code == "ok") {
  263. this.molds = res.data.list;
  264. this.total = res.data.total;
  265. } else {
  266. this.$message({
  267. message: res.msg,
  268. type: "error"
  269. });
  270. }
  271. },
  272. error => {
  273. this.listLoading = false;
  274. this.$message({
  275. message: error,
  276. type: "error"
  277. });
  278. }
  279. );
  280. },
  281. //详情
  282. toDetail(row) {
  283. this.$router.push("/moldList/" + row.id);
  284. },
  285. //添加界面
  286. showAdd() {
  287. this.addFormVisible = true;
  288. this.addForm = {
  289. modelNo: "",
  290. modelName: "",
  291. equipmentId: ""
  292. };
  293. },
  294. addSubmit() {
  295. this.$refs.addForm.validate(valid => {
  296. if (valid) {
  297. this.addLoading = true;
  298. this.http.post(
  299. this.port.mold.addMold,
  300. this.addForm,
  301. res => {
  302. this.addLoading = false;
  303. this.addFormVisible = false;
  304. if (res.code == "ok") {
  305. this.$message({
  306. message: "创建成功",
  307. type: "success"
  308. });
  309. this.getMoldList();
  310. } else {
  311. this.$message({
  312. message: res.msg,
  313. type: "error"
  314. });
  315. }
  316. },
  317. error => {
  318. this.addLoading = false;
  319. this.addFormVisible = false;
  320. this.$message({
  321. message: error,
  322. type: "error"
  323. });
  324. }
  325. );
  326. }
  327. });
  328. }
  329. },
  330. created() {
  331. let height = window.innerHeight;
  332. this.tableHeight = height - 210;
  333. const that = this;
  334. window.onresize = function temp() {
  335. that.tableHeight = window.innerHeight - 210;
  336. };
  337. },
  338. mounted() {
  339. this.getMsg();
  340. this.getMoldList();
  341. }
  342. };
  343. </script>
  344. <style scoped>
  345. </style>