You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

417 lines
14 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="340px" style="height: 520px;" class="customer-dialog">
  4. <el-form :inline="true" label-position="top" label-width="80px" :model="pageData" :rules="rules">
  5. <el-row>
  6. <el-col :span="12">
  7. <el-form-item class="customer-item" label="设备编码:" prop="objectID" :rules="rules.objectIdType">
  8. <el-input v-model="pageData.objectID" :disabled="readOnlyFlag" style="width: 120px;" >
  9. </el-input>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="12">
  13. <el-form-item class="customer-item" label="设备名称" prop="objectDesc" :rules="rules.objectDescType">
  14. <el-input v-model="pageData.objectDesc" style="width: 120px;"></el-input>
  15. </el-form-item>
  16. </el-col>
  17. </el-row>
  18. <el-row>
  19. <el-col :span="12">
  20. <el-form-item class="customer-item" label="在用" prop="active" :rules="rules.activeType">
  21. <el-select v-model="pageData.active" style="width: 120px;">
  22. <el-option label="是" value="Y"></el-option>
  23. <el-option label="否" value="N"></el-option>
  24. </el-select >
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="12">
  28. <el-form-item class="customer-item" prop="locationName" :rules="rules.locationType">
  29. <span slot="label" style="" @click="getBaseList(1026)"><a herf="#">区域:</a></span>
  30. <el-input v-model="pageData.locationName" style="width: 120px;"></el-input >
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. <el-row>
  35. <el-col :span="12">
  36. <el-form-item class="customer-item" prop="familyDesc" :rules="rules.familyType">
  37. <span slot="label" style="" @click="getBaseList(1027)"><a herf="#">分类:</a></span>
  38. <el-input v-model="pageData.familyDesc" style="width: 120px;" ></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="12">
  42. <el-form-item class="customer-item" prop="groupDesc" :rules="rules.groupType">
  43. <span slot="label" style="" @click="getBaseList(1028)"><a herf="#">分组:</a></span>
  44. <el-input v-model="pageData.groupDesc" style="width: 120px;" ></el-input>
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. <el-row>
  49. <el-col :span="12">
  50. <el-form-item class="customer-item">
  51. <span slot="label" style="" @click="getBaseList(1029)"><a herf="#">供应商:</a></span>
  52. <el-input v-model="pageData.supplierName" style="width: 120px;" >
  53. </el-input >
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="12">
  57. <el-form-item class="customer-item" >
  58. <span slot="label" style="" @click="getBaseList(1030)"><a herf="#">制造商:</a></span>
  59. <el-input v-model="pageData.manufacturerName" style="width: 120px;" ></el-input>
  60. </el-form-item>
  61. </el-col>
  62. </el-row>
  63. <el-row>
  64. <el-col :span="12">
  65. <el-form-item class="customer-item" label="序列号:">
  66. <el-input v-model="pageData.seqNo" style="width: 120px;"></el-input>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :span="12">
  70. <el-form-item class="customer-item" label="购入日期:">
  71. <el-date-picker class="el-time-width" style="width: 120px;" v-model="pageData.purchessDate" value-format="yyyy-MM-dd hh:mm:ss">
  72. </el-date-picker>
  73. </el-form-item>
  74. </el-col>
  75. </el-row>
  76. <el-row>
  77. <el-col :span="12">
  78. <el-form-item class="customer-item" prop="resourceDesc">
  79. <span slot="label" style="" @click="getBaseList(203)"><a herf="#">机台编号:</a></span>
  80. <el-input v-model="pageData.resourceDesc" style="width: 120px;" ></el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="12">
  84. <el-form-item class="customer-item" prop="deptID" :rules="rules.deptType">
  85. <span slot="label" style="" @click="getBaseList(204)"><a herf="#">所属部门:</a></span>
  86. <el-input v-model="pageData.deptName" style="width: 120px"></el-input>
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. <el-row>
  91. <el-col :span="12">
  92. <el-form-item class="customer-item" label="资产编号:" >
  93. <el-input v-model="pageData.assetNo" style="width: 120px;" ></el-input>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :span="12">
  97. <el-form-item class="customer-item" label="备注:" >
  98. <el-input v-model="pageData.assetRemark" style="width: 120px;" ></el-input>
  99. </el-form-item>
  100. </el-col>
  101. </el-row>
  102. </el-form>
  103. <span slot="footer" class="dialog-footer">
  104. <el-button type="primary" @click="saveEamObject()">保存</el-button>
  105. <el-button type="primary" @click="closeDialog">关闭</el-button>
  106. </span>
  107. </el-dialog>
  108. <!--列表的组件-->
  109. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  110. </div>
  111. </template>
  112. <script>
  113. import {
  114. insertEamObject,
  115. updateEamObject,
  116. } from '@/api/eam/com_eam_object_add_update.js';
  117. /* 引入组件 */
  118. import Chooselist from '@/views/modules/common/Chooselist_eam';/* 列表组件 */
  119. var functionId = 'C10000001';
  120. export default {
  121. data() {
  122. return {
  123. titleCon: '设备清单维护',
  124. visible: false,
  125. userId: this.$store.state.user.name,
  126. pageData: {
  127. site: '',
  128. username: this.$store.state.user.name,
  129. objectID: '',
  130. objectDesc: '',
  131. locationID: '',
  132. locationName: '',
  133. familyID: '',
  134. familyDesc: '',
  135. groupID: '',
  136. groupDesc: '',
  137. supplierID: '',
  138. supplierName: '',
  139. manufacturerID: '',
  140. manufacturerName: '',
  141. resourceID: '',
  142. resourceDesc: '',
  143. seqNo: '',
  144. purchessDate: '',
  145. active: 'Y',
  146. addFlag: 'Y',
  147. checkFlag: 'Y',
  148. updateBy:'',
  149. deptID: '',
  150. deptName: '',
  151. assetNo: '',
  152. assetRemark: '',
  153. },
  154. readOnlyFlag: false,
  155. dataListLoading: false,
  156. rules:{
  157. objectIdType:[
  158. {
  159. required: true,
  160. message: ' ',
  161. trigger: 'change'
  162. }
  163. ],
  164. objectDescType:[
  165. {
  166. required: true,
  167. message: ' ',
  168. trigger: 'change'
  169. }
  170. ],
  171. locationType:[
  172. {
  173. required: true,
  174. message: ' ',
  175. trigger: 'change'
  176. }
  177. ],
  178. familyType:[
  179. {
  180. required: true,
  181. message: ' ',
  182. trigger: 'change'
  183. }
  184. ],
  185. groupType:[
  186. {
  187. required: true,
  188. message: ' ',
  189. trigger: 'change'
  190. }
  191. ],
  192. deptType:[
  193. {
  194. required: true,
  195. message: ' ',
  196. trigger: 'change'
  197. }
  198. ],
  199. activeType:[
  200. {
  201. required: true,
  202. message: ' ',
  203. trigger: 'change'
  204. }
  205. ],
  206. }
  207. }
  208. },
  209. methods: {
  210. //初始化组件的参数
  211. init(currentRow) {
  212. //初始化参数
  213. this.pageData = JSON.parse(JSON.stringify(currentRow));
  214. //打开页面
  215. this.visible = true;
  216. //判断是否是新增
  217. if(this.pageData.addFlag === 'Y'){
  218. this.readOnlyFlag = false;
  219. }else{
  220. this.readOnlyFlag = true;
  221. }
  222. //重置人员信息
  223. this.pageData.username = this.userId;
  224. //重置标题
  225. this.titleCon = this.labels.titleCon;
  226. },
  227. /*保存标签自定义的信息*/
  228. saveEamObject(){
  229. //判断标签内容是否为空
  230. // let objectID = this.pageData.objectID.trim();
  231. // let locationID = this.pageData.locationID.trim();
  232. // let familyID = this.pageData.familyID.trim();
  233. // let groupID = this.pageData.groupID.trim();
  234. // let supplierID = this.pageData.supplierID.trim();
  235. // let manufacturerID = this.pageData.manufacturerID.trim();
  236. // let resourceID = this.pageData.resourceID.trim();
  237. // let deptID = this.pageData.deptID.trim();
  238. if(this.pageData.active == null || this.pageData.active === ''){
  239. this.$message.success("请选择是否在用!");
  240. return false;
  241. }
  242. if(this.pageData.objectID == null || this.pageData.objectID === ''){
  243. this.$message.success("设备编码不能为空!");
  244. return false;
  245. }
  246. if(this.pageData.objectDesc == null || this.pageData.objectDesc === ''){
  247. this.$message.success("设备名称不能为空!");
  248. return false;
  249. }
  250. if(this.pageData.locationID == null || this.pageData.locationID === ''){
  251. this.$message.success("区域不能为空!");
  252. return false;
  253. }
  254. if(this.pageData.groupID == null || this.pageData.groupID === ''){
  255. this.$message.success("分组不能为空!");
  256. return false;
  257. }
  258. if(this.pageData.familyID == null || this.pageData.familyID === ''){
  259. this.$message.success("分类不能为空!");
  260. return false;
  261. }
  262. // if(this.pageData.resourceID == null || this.pageData.resourceID === ''){
  263. // this.$message.success("机台不能为空!");
  264. // return false;
  265. // }
  266. if(this.pageData.deptID == null || this.pageData.deptID === ''){
  267. this.$message.success("所属部门不能为空!");
  268. return false;
  269. }
  270. //判断是否是新增标签自定义
  271. if(this.pageData.addFlag === 'Y'){
  272. this.insertEamObjectData();
  273. }else{
  274. this.updateEamObjectData();
  275. }
  276. },
  277. /*数量失去焦点的事件*/
  278. insertEamObjectData(){
  279. if (this.pageData.site == '软标/RFID'){
  280. this.pageData.site = '2'
  281. }
  282. if (this.pageData.site == '硬标'){
  283. this.pageData.site = '3'
  284. }
  285. if (this.pageData.site == '通用设备'){
  286. this.pageData.site = '4'
  287. }
  288. insertEamObject(this.pageData).then(({data}) => {
  289. if(data.code == 200){
  290. this.$message.success(data.msg);
  291. setTimeout(this.closeDialog(), 2000);
  292. }else{
  293. this.$message.error(data.msg);
  294. }
  295. })
  296. },
  297. /*验证时长的参数*/
  298. updateEamObjectData(){
  299. if (this.pageData.site == '软标/RFID'){
  300. this.pageData.site = '2'
  301. }
  302. if (this.pageData.site == '硬标'){
  303. this.pageData.site = '3'
  304. }
  305. if (this.pageData.site == '通用设备'){
  306. this.pageData.site = '4'
  307. }
  308. updateEamObject(this.pageData).then(({data}) => {
  309. if(data.code == 200){
  310. this.$message.success(data.msg);
  311. setTimeout(this.closeDialog(), 2000);
  312. }else{
  313. this.$message.error(data.msg);
  314. }
  315. })
  316. },
  317. /*关闭modal*/
  318. closeDialog(){
  319. //刷新报工的页面
  320. this.$emit('refreshPageTables');
  321. //关闭当前的页面
  322. this.visible = false;
  323. },
  324. /* 列表方法的回调 */
  325. getBaseData(val) {
  326. if (this.tagNo === 1026) {
  327. //设置参数
  328. this.pageData.locationID = val.LocationID;
  329. this.$set(this.pageData,'locationName',val.LocationName);
  330. }else if (this.tagNo === 1027) {
  331. //设置参数
  332. this.pageData.familyID = val.FamilyID;
  333. this.$set(this.pageData,'familyDesc',val.FamilyDesc);
  334. }else if (this.tagNo === 1028) {
  335. //设置参数
  336. this.pageData.groupID = val.GroupID;
  337. this.$set(this.pageData,'groupDesc',val.GroupDesc);
  338. }else if (this.tagNo === 1029) {
  339. //设置参数
  340. this.pageData.supplierID = val.SupplierID;
  341. this.$set(this.pageData,'supplierName',val.SupplierName);
  342. }else if (this.tagNo === 1030) {
  343. //设置参数
  344. this.pageData.manufacturerID = val.ManufacturerID;
  345. this.$set(this.pageData,'manufacturerName',val.ManufacturerName);
  346. }else if (this.tagNo === 203) {
  347. //设置参数
  348. this.pageData.resourceID = val.Resource_id;
  349. this.$set(this.pageData,'resourceDesc',val.Resource_desc);
  350. }else if (this.tagNo === 204) {
  351. //设置参数
  352. this.pageData.deptID = val.department_id;
  353. this.$set(this.pageData,'deptName',val.department_name);
  354. }
  355. },
  356. // 获取基础数据列表
  357. getBaseList(val) {
  358. this.tagNo = val
  359. this.$nextTick(() => {
  360. let strVal = ''
  361. if (val === 1026) {
  362. strVal = this.pageData.locationID;
  363. }else if (val === 1027) {
  364. strVal = this.pageData.familyID;
  365. }else if (val === 1028) {
  366. strVal = this.pageData.groupID;
  367. }else if (val === 1029) {
  368. strVal = this.pageData.supplierID;
  369. }else if (val === 1030) {
  370. strVal = this.pageData.manufacturerID;
  371. }else if (val === 203) {
  372. strVal = this.pageData.resourceID;
  373. }else if (val === 204) {
  374. strVal = this.pageData.deptID;
  375. }
  376. this.$refs.baseList.init(val, strVal)
  377. })
  378. },
  379. },
  380. components: {
  381. Chooselist, /* 选择的组件 */
  382. },
  383. watch: {
  384. pageData: {
  385. deep: true,
  386. handler: function (newV, oldV) {
  387. this.pageData.objectID = this.pageData.objectID.toUpperCase();
  388. this.pageData.locationID = this.pageData.locationID.toUpperCase();
  389. this.pageData.familyID = this.pageData.familyID.toUpperCase();
  390. this.pageData.groupID = this.pageData.groupID.toUpperCase();
  391. this.pageData.supplierID = this.pageData.supplierID.toUpperCase();
  392. this.pageData.manufacturerID = this.pageData.manufacturerID.toUpperCase();
  393. }
  394. },
  395. },
  396. created() {
  397. // this.factoryList()
  398. // this.getLanguageList()
  399. }
  400. }
  401. </script>
  402. <style scoped lang="scss">
  403. </style>