工单小程序2024-11-20
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.

302 lines
6.1 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="page">
  3. <navbar :title="title" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="info">
  5. <view class="Work-List">
  6. <view class="label">
  7. 中试作业员
  8. </view>
  9. <view class="text">
  10. <input type="text" v-model="StepOne.operator"/>
  11. </view>
  12. </view>
  13. <view class="Work-List">
  14. <view class="label">
  15. 气缸料号1
  16. </view>
  17. <view class="text">
  18. <input type="text" v-model="StepOne.cylinder1"/>
  19. </view>
  20. </view>
  21. <view class="Work-List">
  22. <view class="label">
  23. 气缸料号2
  24. </view>
  25. <view class="text">
  26. <input type="text" v-model="StepOne.cylinder2"/>
  27. </view>
  28. </view>
  29. <view class="Work-List">
  30. <view class="label">
  31. 活塞料号1
  32. </view>
  33. <view class="text">
  34. <input type="text" v-model="StepOne.piston1"/>
  35. </view>
  36. </view>
  37. <view class="Work-List">
  38. <view class="label">
  39. 活塞料号2
  40. </view>
  41. <view class="text">
  42. <input type="text" v-model="StepOne.piston2"/>
  43. </view>
  44. </view>
  45. <view class="Work-List">
  46. <view class="label">
  47. 滑片料号1
  48. </view>
  49. <view class="text">
  50. <input type="text" v-model="StepOne.scribing1"/>
  51. </view>
  52. </view>
  53. <view class="Work-List">
  54. <view class="label">
  55. 滑片料号2
  56. </view>
  57. <view class="text">
  58. <input type="text" v-model="StepOne.scribing2"/>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="list">
  63. <view class="item-box"
  64. :key="stepIndex"
  65. v-for="(step, stepIndex) in stepList">
  66. <view class="title">
  67. {{ step.name }}
  68. </view>
  69. <view class="list-box"
  70. :key="cIndex"
  71. v-for="(c, cIndex) in step.workorderItemCheckList">
  72. <view class="title">
  73. {{ c.name }}
  74. </view>
  75. <view class="item-input"
  76. :key="wi"
  77. v-for="(w, wi) in c.workorderParamSteponeList"
  78. >
  79. <view class="Work-List"
  80. :key="xi"
  81. v-for="(x, xi) in 20"
  82. >
  83. <view class="label">
  84. 规格{{ xi + 1 }}
  85. </view>
  86. <view class="text">
  87. <input type="text"
  88. v-model="w['param' + (xi + 1)]"/>
  89. </view>
  90. <view class="text"
  91. v-if="w.specs"
  92. style="margin-left: 20rpx;">
  93. {{ w.specs}}
  94. </view>
  95. </view>
  96. <view class="Work-List"
  97. >
  98. <view class="label">
  99. 备注
  100. </view>
  101. <view class="text">
  102. <input type="text"
  103. style="width: 450rpx;"
  104. v-model="w.remark"/>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="uni-color-btn"
  112. @click="submit">
  113. 保存
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. id: 0,
  122. StepOne: {},
  123. stepList : [],
  124. index : 0,
  125. title : '',
  126. }
  127. },
  128. onLoad(arg) {
  129. this.id = arg.id
  130. this.index = arg.index || 0
  131. this.title = arg.name
  132. this.queryStepOne()
  133. this.queryTemplateById()
  134. },
  135. methods: {
  136. queryStepOne() {
  137. this.$api('queryStepOne', {
  138. templateId: this.id
  139. }, res => {
  140. if (res.code == 200) {
  141. this.StepOne = res.result.workorderGeneralStepone
  142. }
  143. })
  144. },
  145. // 根据id获取工单详情
  146. queryTemplateById(){
  147. this.$api('queryTemplateById', {
  148. templateId : this.id
  149. }, res =>{
  150. if(res.code == 200){
  151. let p = res.result.workorderStepList[this.index]
  152. this.stepList = p.workorderProcessList
  153. for(let i = 0;i < this.stepList.length;i++){
  154. let step = this.stepList[i]
  155. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  156. let check = step.workorderItemCheckList[j]
  157. if(check.workorderParamSteponeList.length == 0){
  158. check.workorderParamSteponeList.push({
  159. processId : check.id,
  160. templateId : this.id,
  161. })
  162. }
  163. }
  164. }
  165. }
  166. })
  167. },
  168. //工单信息-修改工序参数-工序卡1(选配)
  169. updateParamStepOne(item){
  170. return new Promise((success, error) => {
  171. let data = JSON.parse(JSON.stringify(item))
  172. delete data.updateBy
  173. delete data.updateTime
  174. delete data.createBy
  175. delete data.createTime
  176. for (let k in data) {
  177. if(!data[k] || data[k] == 'null'){
  178. data[k] = ''
  179. }
  180. }
  181. this.$api('updateParamStepOne', data, res => {
  182. if(res.code == 200){
  183. success(res)
  184. }else{
  185. error(res)
  186. }
  187. })
  188. })
  189. },
  190. async submit(){
  191. console.log(this.stepList);
  192. let StepOne = JSON.parse(JSON.stringify(this.StepOne))
  193. delete StepOne.updateBy
  194. delete StepOne.updateTime
  195. delete StepOne.createBy
  196. delete StepOne.createTime
  197. // 修改常规参数
  198. this.$api('updateGeneralStepOne', StepOne, res => {
  199. })
  200. uni.showLoading({
  201. title: '保存中...',
  202. })
  203. // 任务列表
  204. let tasks = []
  205. for(let i = 0;i < this.stepList.length;i++){
  206. let step = this.stepList[i]
  207. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  208. let check = step.workorderItemCheckList[j]
  209. for(let k = 0;k < check.workorderParamSteponeList.length;k++){
  210. let params = check.workorderParamSteponeList[k]
  211. // 将请求添加到任务
  212. tasks.push(this.updateParamStepOne(params))
  213. }
  214. }
  215. }
  216. // 等待任务所有完成
  217. await Promise.all(tasks)
  218. uni.showToast({
  219. title: '保存成功',
  220. icon: 'none'
  221. })
  222. setTimeout(uni.navigateBack, 1000, -1)
  223. },
  224. }
  225. }
  226. </script>
  227. <style scoped lang="scss">
  228. .page{
  229. padding-bottom: 200rpx;
  230. .Work-List{
  231. display: flex;
  232. padding: 16rpx 0rpx;
  233. align-items: center;
  234. .label{
  235. width: 200rpx;
  236. flex-shrink: 0;
  237. }
  238. .text{
  239. input{
  240. background-color: #eee;
  241. padding: 10rpx 20rpx;
  242. border-radius: 20rpx;
  243. }
  244. }
  245. }
  246. .info{
  247. padding: 30rpx;
  248. input{
  249. width: 430rpx;
  250. }
  251. }
  252. .list{
  253. padding: 0 30rpx;
  254. .list-box{
  255. padding: 20rpx 0;
  256. padding-left: 40rpx;
  257. .item-input{
  258. padding-left: 40rpx;
  259. .label{
  260. width: 130rpx;
  261. }
  262. }
  263. }
  264. input{
  265. width: 320rpx;
  266. }
  267. }
  268. }
  269. </style>