plm前端
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.

353 lines
10 KiB

2 years ago
11 months ago
2 years ago
10 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
11 months ago
2 years ago
11 months ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" >
  4. <el-form-item >
  5. <el-button type="primary" @click="cutSearch(true)" >刷新</el-button>
  6. <el-button type="primary" @click="newCut()" v-if="!ifDisableFlag">新增</el-button>
  7. </el-form-item>
  8. <el-table
  9. height="200"
  10. :data="cutTable"
  11. border
  12. style="width: 100%">
  13. <el-table-column
  14. prop=""
  15. header-align="center"
  16. align="center"
  17. min-width="30"
  18. v-if="!ifDisableFlag"
  19. label="操作">
  20. <template slot-scope="scope">
  21. <a type="text" size="small" @click="updateCut(scope.row)">编辑</a>
  22. <a type="text" size="small" @click="deleteCut(scope.row)">删除</a>
  23. </template>
  24. </el-table-column>
  25. <el-table-column
  26. v-for="(item,index) in columnList" :key="index"
  27. :prop="item.columnProp"
  28. header-align="center"
  29. :align="item.align"
  30. :min-width="item.columnWidth"
  31. :label="item.columnLabel">
  32. </el-table-column>
  33. </el-table>
  34. <el-row :gutter="20" >
  35. <el-col :span="24"><div class="grid-content bg-purple">
  36. <el-form-item :label="'Action'">
  37. <el-input
  38. type="textarea"
  39. v-model="dataForm.action "
  40. :rows="3"
  41. resize='none'
  42. maxlength="120"
  43. show-word-limit
  44. :disabled="ifDisableFlag"
  45. style="height: 60px" >
  46. </el-input>
  47. </el-form-item>
  48. </div></el-col>
  49. </el-row>
  50. </el-form>
  51. <el-form label-position="top" style="margin-top:60px; margin-left: 0px;text-align:center">
  52. <el-button type="primary" @click="saveData()" >保存数据</el-button>
  53. </el-form>
  54. <el-dialog append-to-body title="编辑信息" :close-on-click-modal="false" v-drag :visible.sync="cutFlag" width="600px">
  55. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  56. <el-form-item :label="'次序'">
  57. <el-input v-model="cutData.order" type="number" style="width: 130px" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" ></el-input>
  58. </el-form-item>
  59. <el-form-item :label="'机器类别'">
  60. <el-input v-model="cutData.cuttingMachine" style="width: 130px" ></el-input>
  61. </el-form-item>
  62. <el-form-item :label="'程序名称和路径'">
  63. <el-input v-model="cutData.programName" style="width: 130px" ></el-input>
  64. </el-form-item>
  65. <el-form-item :label="'刀的进给速度及转速'">
  66. <el-input v-model="cutData.cuttingSpeed" style="width: 130px" ></el-input>
  67. </el-form-item>
  68. </el-form>
  69. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  70. <el-form-item :label="'刀模参数'">
  71. <el-input v-model="cutData.spec" style="width: 130px" ></el-input>
  72. </el-form-item>
  73. <el-form-item :label="'P2P公差'">
  74. <el-input v-model="cutData.p2c" style="width: 130px" ></el-input>
  75. </el-form-item>
  76. <el-form-item :label="'C2C公差'" >
  77. <el-input v-model="cutData.c2c" style="width: 130px" ></el-input>
  78. </el-form-item>
  79. </el-form>
  80. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;" >
  81. <el-form-item :label="'备注'">
  82. <el-input v-model="cutData.remarks" style="width: 570px" ></el-input>
  83. </el-form-item>
  84. </el-form>
  85. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  86. <el-button type="primary" @click="cutSave()">保存</el-button>
  87. <el-button type="primary" @click="cutFlag = false">取消</el-button>
  88. </el-footer>
  89. </el-dialog>
  90. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  91. </div>
  92. </template>
  93. <script>
  94. import {
  95. searchBMCncDetail,
  96. updateBMCncDetail,
  97. searchBMCncCut,
  98. saveBMCncCut,
  99. deleteBMCncCut,
  100. } from "@/api/sampleManagement/technicalSpecificationList.js"
  101. import Chooselist from '@/views/modules/common/Chooselist'
  102. export default {
  103. components: {
  104. Chooselist
  105. },
  106. data() {
  107. return {
  108. searchData: {
  109. site: '',
  110. username: this.$store.state.user.name,
  111. codeNo: '',
  112. buNo:'',
  113. },
  114. ifDisableFlag:false,
  115. dataForm:{
  116. site: '',
  117. codeNo:'',
  118. action:'',
  119. },
  120. cutTable:[],
  121. cutData:{
  122. id:'',
  123. site: '',
  124. codeNo:'',
  125. order:'',
  126. cuttingMachine:'',
  127. programName:'',
  128. cuttingSpeed:'',
  129. spec:'',
  130. p2c:'',
  131. c2c:'',
  132. remarks:'',
  133. updateBy:'',
  134. updateDate:'',
  135. },
  136. columnList:[
  137. {
  138. columnProp: "order",
  139. align: "right",
  140. columnLabel: "次序",
  141. columnWidth: 30
  142. },
  143. {
  144. columnProp: "cuttingMachine",
  145. align: "left",
  146. columnLabel: "机器类别",
  147. columnWidth: 60
  148. },
  149. {
  150. columnProp: "programName",
  151. align: "left",
  152. columnLabel: "程序名称和路径",
  153. columnWidth: 60
  154. },
  155. {
  156. columnProp: "cuttingSpeed",
  157. align: "left",
  158. columnLabel: "刀的进给速度及转速",
  159. columnWidth: 60
  160. },
  161. {
  162. columnProp: "spec",
  163. align: "left",
  164. columnLabel: "刀模参数",
  165. columnWidth: 60
  166. },
  167. {
  168. columnProp: "p2c",
  169. align: "left",
  170. columnLabel: "P2P公差",
  171. columnWidth: 60
  172. },
  173. {
  174. columnProp: "c2c",
  175. align: "left",
  176. columnLabel: "C2C公差",
  177. columnWidth: 60
  178. },
  179. {
  180. columnProp: "remarks",
  181. align: "left",
  182. columnLabel: "备注",
  183. columnWidth: 60
  184. },
  185. ],
  186. cutFlag:false,
  187. }
  188. },
  189. methods: {
  190. // 获取基础数据列表S
  191. getBaseList (val, type) {
  192. this.tagNo = val
  193. this.tagNo1 = type
  194. this.$nextTick(() => {
  195. let strVal = ''
  196. if (val === 1013) {
  197. if(type==1) {
  198. strVal = this.dataForm.partType
  199. }
  200. }
  201. this.$refs.baseList.init(val, strVal)
  202. })
  203. },
  204. /* 列表方法的回调 */
  205. getBaseData (val) {
  206. if (this.tagNo === 1013) {
  207. if(this.tagNo1==1) {
  208. this.dataForm.partType = val.Base_id
  209. this.dataForm.partTypeDesc = val.Base_desc
  210. }
  211. }
  212. },
  213. //初始化组件的参数
  214. init(inData) {
  215. if(this.dataForm.codeNo!=null&&this.dataForm.codeNo!=''){
  216. return false;
  217. }
  218. //初始化参数
  219. this.searchData = JSON.parse(JSON.stringify(inData));
  220. if(this.searchData.ifDisableFlag){
  221. this.ifDisableFlag=true
  222. }
  223. //刷新表格
  224. this.searchTable();
  225. this.cutSearch();
  226. },
  227. searchTable(type){
  228. searchBMCncDetail(this.searchData).then(({data}) => {
  229. if(data.rows.length>0){
  230. this.dataForm = data.rows[0];
  231. if(type){
  232. this.$message.success( '操作成功')
  233. }
  234. }else {
  235. this.dataForm.site=this.searchData.site
  236. this.dataForm.codeNo=this.searchData.codeNo
  237. }
  238. });
  239. },
  240. saveData(){
  241. this.$confirm("是否保存信息?", '保存提示', {
  242. confirmButtonText: '确定',
  243. cancelButtonText: '取消',
  244. }).then(() => {
  245. updateBMCncDetail(this.dataForm).then(({data}) => {
  246. if (data && data.code === 0) {
  247. this.$message.success( '操作成功')
  248. } else {
  249. this.$message.error(data.msg)
  250. }
  251. })
  252. }).catch(() => {
  253. return
  254. })
  255. },
  256. newCut(){
  257. if(this.searchData.codeNo==''){
  258. this.$message.success('数据错误,请关闭页面重试!')
  259. return false;
  260. }
  261. let number=1;
  262. for (let i = 0; i <this.cutTable.length ; i++) {
  263. if(number<=this.cutTable[i].order){
  264. number=Number(this.cutTable[i].order)+1
  265. }
  266. }
  267. this.cutData={
  268. id:0,
  269. site: this.searchData.site,
  270. codeNo:this.searchData.codeNo,
  271. order:number,
  272. cuttingMachine:'',
  273. programName:'',
  274. cuttingSpeed:'',
  275. spec:'',
  276. p2c:'',
  277. c2c:'',
  278. remarks:'',
  279. updateBy:'',
  280. updateDate:'',
  281. }
  282. this.cutFlag=true;
  283. },
  284. updateCut(row){
  285. this.cutData=JSON.parse(JSON.stringify(row))
  286. this.cutFlag=true;
  287. },
  288. cutSearch(){
  289. searchBMCncCut(this.searchData).then(({data}) => {
  290. this.cutTable = data.rows
  291. });
  292. },
  293. cutSave(){
  294. this.$confirm("是否保存信息?", '保存提示', {
  295. confirmButtonText: '确定',
  296. cancelButtonText: '取消',
  297. }).then(() => {
  298. saveBMCncCut(this.cutData).then(({data}) => {
  299. if (data && data.code === 0) {
  300. this.cutSearch();
  301. this.cutFlag=false
  302. this.$message.success( '操作成功')
  303. } else {
  304. this.$message.error(data.msg)
  305. }
  306. })
  307. }).catch(() => {
  308. })
  309. },
  310. deleteCut(row){
  311. this.$confirm(`是否删除这条信息?`, '提示', {
  312. confirmButtonText: '确定',
  313. cancelButtonText: '取消',
  314. type: 'warning'
  315. }).then(() => {
  316. deleteBMCncCut(row).then(({data}) => {
  317. if (data && data.code === 0) {
  318. this.cutSearch();
  319. this.$message({
  320. message: '操作成功',
  321. type: 'success',
  322. duration: 1500,
  323. onClose: () => {}
  324. })
  325. } else {
  326. this.$alert(data.msg, '错误', {
  327. confirmButtonText: '确定'
  328. })
  329. }
  330. })
  331. }).catch(() => {
  332. })
  333. },
  334. },
  335. }
  336. </script>
  337. <style scoped>
  338. </style>