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

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