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

319 lines
6.5 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
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"
  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. :key="xi"
  95. v-for="(x, xi) in 20"
  96. >
  97. <view class="label">
  98. 规格{{ xi + 1 }}
  99. </view>
  100. <view class="text">
  101. <input type="text"
  102. :disabled="!isPermission('修改')"
  103. v-model="w['param' + (xi + 1)]"/>
  104. </view>
  105. <view class="text"
  106. v-if="w.specs"
  107. style="margin-left: 20rpx;">
  108. {{ w.specs}}
  109. </view>
  110. </view>
  111. <view class="Work-List"
  112. >
  113. <view class="label">
  114. 备注
  115. </view>
  116. <view class="text">
  117. <input type="text"
  118. :disabled="!isPermission('修改')"
  119. style="width: 450rpx;"
  120. v-model="w.remark"/>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="uni-color-btn"
  128. v-if="isPermission('修改')"
  129. @click="submit">
  130. 保存
  131. </view>
  132. </view>
  133. </template>
  134. <script>
  135. export default {
  136. data() {
  137. return {
  138. id: 0,
  139. StepOne: {},
  140. stepList : [],
  141. index : 0,
  142. title : '',
  143. }
  144. },
  145. onLoad(arg) {
  146. this.id = arg.id
  147. this.index = arg.index || 0
  148. this.title = arg.name
  149. this.queryStepOne()
  150. this.queryTemplateById()
  151. },
  152. methods: {
  153. queryStepOne() {
  154. this.$api('queryStepOne', {
  155. templateId: this.id
  156. }, res => {
  157. if (res.code == 200) {
  158. this.StepOne = res.result.workorderGeneralStepone
  159. }
  160. })
  161. },
  162. // 根据id获取工单详情
  163. queryTemplateById(){
  164. this.$api('queryTemplateById', {
  165. templateId : this.id
  166. }, res =>{
  167. if(res.code == 200){
  168. let p = res.result.workorderStepList[this.index]
  169. this.stepList = p.workorderProcessList
  170. for(let i = 0;i < this.stepList.length;i++){
  171. let step = this.stepList[i]
  172. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  173. let check = step.workorderItemCheckList[j]
  174. if(check.workorderParamSteponeList.length == 0){
  175. check.workorderParamSteponeList.push({
  176. processId : check.id,
  177. templateId : this.id,
  178. })
  179. }
  180. }
  181. }
  182. }
  183. })
  184. },
  185. //工单信息-修改工序参数-工序卡1(选配)
  186. updateParamStepOne(item){
  187. return new Promise((success, error) => {
  188. let data = JSON.parse(JSON.stringify(item))
  189. delete data.updateBy
  190. delete data.updateTime
  191. delete data.createBy
  192. delete data.createTime
  193. for (let k in data) {
  194. if(!data[k] || data[k] == 'null'){
  195. data[k] = ''
  196. }
  197. }
  198. this.$api('updateParamStepOne', data, res => {
  199. if(res.code == 200){
  200. success(res)
  201. }else{
  202. error(res)
  203. }
  204. })
  205. })
  206. },
  207. async submit(){
  208. console.log(this.stepList);
  209. let StepOne = JSON.parse(JSON.stringify(this.StepOne))
  210. delete StepOne.updateBy
  211. delete StepOne.updateTime
  212. delete StepOne.createBy
  213. delete StepOne.createTime
  214. // 修改常规参数
  215. this.$api('updateGeneralStepOne', StepOne, res => {
  216. })
  217. uni.showLoading({
  218. title: '保存中...',
  219. })
  220. // 任务列表
  221. let tasks = []
  222. for(let i = 0;i < this.stepList.length;i++){
  223. let step = this.stepList[i]
  224. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  225. let check = step.workorderItemCheckList[j]
  226. for(let k = 0;k < check.workorderParamSteponeList.length;k++){
  227. let params = check.workorderParamSteponeList[k]
  228. // 将请求添加到任务
  229. tasks.push(this.updateParamStepOne(params))
  230. }
  231. }
  232. }
  233. // 等待任务所有完成
  234. await Promise.all(tasks)
  235. uni.showToast({
  236. title: '保存成功',
  237. icon: 'none'
  238. })
  239. setTimeout(uni.navigateBack, 1000, -1)
  240. },
  241. }
  242. }
  243. </script>
  244. <style scoped lang="scss">
  245. .page{
  246. padding-bottom: 200rpx;
  247. .Work-List{
  248. display: flex;
  249. padding: 16rpx 0rpx;
  250. align-items: center;
  251. .label{
  252. width: 200rpx;
  253. flex-shrink: 0;
  254. }
  255. .text{
  256. input{
  257. background-color: #eee;
  258. padding: 10rpx 20rpx;
  259. border-radius: 20rpx;
  260. }
  261. }
  262. }
  263. .info{
  264. padding: 30rpx;
  265. input{
  266. width: 430rpx;
  267. }
  268. }
  269. .list{
  270. padding: 0 30rpx;
  271. .list-box{
  272. padding: 20rpx 0;
  273. padding-left: 40rpx;
  274. .item-input{
  275. padding-left: 40rpx;
  276. .label{
  277. width: 130rpx;
  278. }
  279. }
  280. }
  281. input{
  282. width: 320rpx;
  283. }
  284. }
  285. }
  286. </style>