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.

347 lines
10 KiB

3 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()" >刷新</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 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. //刷新表格
  221. this.searchTable();
  222. this.cutSearch();
  223. },
  224. searchTable(){
  225. searchBMCncDetail(this.searchData).then(({data}) => {
  226. if(data.rows.length>0){
  227. this.dataForm = data.rows[0];
  228. }else {
  229. this.dataForm.site=this.searchData.site
  230. this.dataForm.codeNo=this.searchData.codeNo
  231. }
  232. });
  233. },
  234. saveData(){
  235. this.$confirm("是否保存信息?", '保存提示', {
  236. confirmButtonText: '确定',
  237. cancelButtonText: '取消',
  238. }).then(() => {
  239. updateBMCncDetail(this.dataForm).then(({data}) => {
  240. if (data && data.code === 0) {
  241. this.$message.success( '操作成功')
  242. } else {
  243. this.$message.error(data.msg)
  244. }
  245. })
  246. }).catch(() => {
  247. return
  248. })
  249. },
  250. newCut(){
  251. if(this.searchData.codeNo==''){
  252. this.$message.success('数据错误,请关闭页面重试!')
  253. return false;
  254. }
  255. let number=1;
  256. for (let i = 0; i <this.cutTable.length ; i++) {
  257. if(number<=this.cutTable[i].order){
  258. number=Number(this.cutTable[i].order)+1
  259. }
  260. }
  261. this.cutData={
  262. id:0,
  263. site: this.searchData.site,
  264. codeNo:this.searchData.codeNo,
  265. order:number,
  266. cuttingMachine:'',
  267. programName:'',
  268. cuttingSpeed:'',
  269. spec:'',
  270. p2c:'',
  271. c2c:'',
  272. remarks:'',
  273. updateBy:'',
  274. updateDate:'',
  275. }
  276. this.cutFlag=true;
  277. },
  278. updateCut(row){
  279. this.cutData=JSON.parse(JSON.stringify(row))
  280. this.cutFlag=true;
  281. },
  282. cutSearch(){
  283. searchBMCncCut(this.searchData).then(({data}) => {
  284. this.cutTable = data.rows
  285. });
  286. },
  287. cutSave(){
  288. this.$confirm("是否保存信息?", '保存提示', {
  289. confirmButtonText: '确定',
  290. cancelButtonText: '取消',
  291. }).then(() => {
  292. saveBMCncCut(this.cutData).then(({data}) => {
  293. if (data && data.code === 0) {
  294. this.cutSearch();
  295. this.cutFlag=false
  296. this.$message.success( '操作成功')
  297. } else {
  298. this.$message.error(data.msg)
  299. }
  300. })
  301. }).catch(() => {
  302. })
  303. },
  304. deleteCut(row){
  305. this.$confirm(`是否删除这条信息?`, '提示', {
  306. confirmButtonText: '确定',
  307. cancelButtonText: '取消',
  308. type: 'warning'
  309. }).then(() => {
  310. deleteBMCncCut(row).then(({data}) => {
  311. if (data && data.code === 0) {
  312. this.cutSearch();
  313. this.$message({
  314. message: '操作成功',
  315. type: 'success',
  316. duration: 1500,
  317. onClose: () => {}
  318. })
  319. } else {
  320. this.$alert(data.msg, '错误', {
  321. confirmButtonText: '确定'
  322. })
  323. }
  324. })
  325. }).catch(() => {
  326. })
  327. },
  328. },
  329. }
  330. </script>
  331. <style scoped>
  332. </style>