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

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