detail.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. <template>
  2. <div class="s-page">
  3. <el-page-header @back="goBack" :content="title"></el-page-header>
  4. <el-divider></el-divider>
  5. <div slot="moreSearch" v-if="formType != 0">
  6. <el-radio-group v-model="tabIndex" size="small" @change="">
  7. <el-radio-button :label="1">基础资料</el-radio-button>
  8. <el-radio-button :label="2">修改记录</el-radio-button>
  9. </el-radio-group>
  10. <br><br>
  11. </div>
  12. <template v-if="tabIndex == 1">
  13. <el-card class="box-card">
  14. <div style="margin-bottom: 20px;font-weight: bold;">项目信息</div>
  15. <div class="mymain-container">
  16. <el-form ref="formData" :rules="rules" :model="formData" label-width="110px" size="small" label-position="left">
  17. <el-row :gutter="20" justify="start">
  18. <el-col :span="12">
  19. <el-form-item label="所属商户" :required="true" >
  20. <el-input type="text" :value="companyName" disabled></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="12">
  24. <el-form-item label="项目名称" prop="projectName">
  25. <el-input type="text" v-model="formData.projectName" :disabled="formType==2" placeholder="请输入"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="12">
  29. <el-form-item label="负责人" prop="manger">
  30. <el-input type="text" v-model="formData.manger" :disabled="formType==2" placeholder="请输入"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="12">
  34. <el-form-item label="联系电话" prop="mobile">
  35. <el-input type="number" v-model="formData.mobile" oninput="if(value.length > 11) value=value.slice(0, 11)" :disabled="formType==2" placeholder="请输入"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="12">
  39. <el-form-item label="维保时间" prop="dateList">
  40. <el-date-picker
  41. :disabled="formType==2"
  42. v-model="formData.dateList"
  43. @change="selectDate"
  44. value-format="yyyy-MM-dd"
  45. type="daterange"
  46. range-separator="至"
  47. start-placeholder="开始日期"
  48. end-placeholder="结束日期">
  49. </el-date-picker>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="12">
  53. <el-form-item label="工单类型" prop="orderSmallTypeText">
  54. <el-checkbox-group v-model="formData.checkTypeList">
  55. <el-checkbox v-for="(item,index) in orderTypeList" :disabled="formType==2" :key="index" :label="item.id">{{item.orderSmallTypeText}}</el-checkbox>
  56. </el-checkbox-group>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item label="包含全部费用" prop="isAllFee">
  61. <el-radio-group v-model="formData.isAllFee" @change="(e)=>{
  62. if(e == 'YES'){
  63. formData.feePayMethod = ''
  64. }
  65. }">
  66. <el-radio :disabled="formType==2" label="YES">是</el-radio>
  67. <el-radio :disabled="formType==2" label="NO">否</el-radio>
  68. </el-radio-group>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="12">
  72. <el-form-item v-if="formData.isAllFee == 'NO'" label="费用支付方式" prop="feePayMethod">
  73. <el-radio-group v-model="formData.feePayMethod">
  74. <el-radio :disabled="formType==2" label="EXAMINE">审批后结算</el-radio>
  75. <el-radio :disabled="formType==2" label="SITE">现场支付</el-radio>
  76. </el-radio-group>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="24">
  80. <el-form-item label="项目地址" prop="province" :required="true">
  81. <el-row>
  82. <el-col :span="5" style="margin-right: 12px;">
  83. <el-input type="text" v-model="formData.province" disabled placeholder="请选择省"></el-input>
  84. </el-col>
  85. <el-col :span="5" style="margin-right: 12px;">
  86. <el-input type="text" v-model="formData.city" disabled placeholder="请选择市"></el-input>
  87. </el-col>
  88. <el-col :span="5" style="margin-right: 12px;">
  89. <el-input type="text" v-model="formData.area" disabled placeholder="请选择区"></el-input>
  90. </el-col>
  91. <el-col :span="8">
  92. <el-input type="text" v-model="formData.street" disabled placeholder="请选择街道"></el-input>
  93. </el-col>
  94. </el-row>
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="24">
  98. <el-form-item label="" prop="address">
  99. <el-row :gutter="20">
  100. <el-col :span="22">
  101. <el-input type="text" v-model="formData.address" :disabled="formType==2" placeholder="详细地址"></el-input>
  102. </el-col>
  103. <el-col :span="2">
  104. <geographicalPosi :disabled="formType==2" :formData="this.formData" @selectPosi="selectAddress"/>
  105. </el-col>
  106. </el-row>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="24">
  110. <el-form-item label="项目说明">
  111. <el-input type="textarea" :rows="4" :disabled="formType==2" v-model="formData.remark" placeholder="请输入"></el-input>
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. </el-form>
  116. </div>
  117. </el-card>
  118. <br/>
  119. <el-card class="box-card">
  120. <el-tabs v-model="typeIndex" @change="changeType">
  121. <el-tab-pane label="项目设备" name="1"></el-tab-pane>
  122. <el-tab-pane label="项目人员" name="2"></el-tab-pane>
  123. <el-tab-pane label="服务网点" name="3"></el-tab-pane>
  124. <el-tab-pane label="辅材配置" name="4"></el-tab-pane>
  125. <el-tab-pane label="配件配置" name="5"></el-tab-pane>
  126. </el-tabs>
  127. <el-button size="small" v-if="formType!=2" type="primary" @click="add()">新增</el-button>
  128. <div class="table">
  129. <!-- 项目设备 -->
  130. <el-form ref="formData1" :model="formData1">
  131. <el-table v-show="typeIndex == 1" :data="formData1.productList" element-loading-text="Loading" border fit highlight-current-row stripe>
  132. <el-table-column label="品牌" align="center">
  133. <template slot-scope="scope">
  134. <el-form-item :prop="'productList.' + scope.$index + '.brand'" :rules="[{ required: true, message: `请选择品牌`, trigger: 'blur' }]">
  135. <el-select v-model="scope.row.brand" @change="(e)=>{
  136. scope.row.brandId = e.id
  137. scope.row.brandName = e.brandName
  138. }" value-key="id" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  139. <el-option
  140. v-for="(item,ind) in brandList"
  141. :key="ind"
  142. :label="item.brandName"
  143. :value="item">
  144. </el-option>
  145. </el-select>
  146. </el-form-item>
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="产品大类" align="center">
  150. <template slot-scope="scope">
  151. <el-form-item :prop="'productList.' + scope.$index + '.main'" :rules="[{ required: true, message: `请选择产品大类`, trigger: 'blur' }]">
  152. <el-select v-model="scope.row.main" value-key="categoryId" @change="(e)=>{
  153. scope.row.mainId = e.categoryId
  154. scope.row.mainName = e.name
  155. //if(e.categoryId == 0){
  156. // scope.row.small = {categoryId: '0', name: '不限'}
  157. // scope.row.smallName = '不限'
  158. // scope.row.smallId = '0'
  159. //}else{
  160. // scope.row.small = null
  161. // scope.row.smallName = ''
  162. // scope.row.smallId = ''
  163. //}
  164. //scope.row.smallList = e.children?[...[{categoryId: '0', name: '不限'}],...e.children]:[]
  165. scope.row.small = null
  166. scope.row.smallName = ''
  167. scope.row.smallId = ''
  168. scope.row.smallList = e.children?e.children:[]
  169. }" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  170. <el-option
  171. v-for="(item,ind) in mainList"
  172. :key="ind"
  173. :label="item.name"
  174. :value="item">
  175. </el-option>
  176. </el-select>
  177. </el-form-item>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="产品小类" align="center">
  181. <template slot-scope="scope">
  182. <el-form-item :prop="'productList.' + scope.$index + '.small'" :rules="[{ required: true, message: `请选择产品小类`, trigger: 'blur' }]">
  183. <el-select v-model="scope.row.small" @focus="()=>{
  184. if(!scope.row.main){return this.$message.warning('请先选择产品大类!');}
  185. }" @change="(e)=>{
  186. scope.row.smallName = e.name
  187. scope.row.smallId = e.categoryId
  188. scope.row.smallImg = e.imgUrl
  189. }" :disabled="isEdit1 != scope.$index || formType == 2" value-key="categoryId" placeholder="请选择" style="width: 100%;">
  190. <el-option
  191. v-for="(item,ind) in scope.row.smallList"
  192. :key="ind"
  193. :label="item.name"
  194. :value="item">
  195. </el-option>
  196. </el-select>
  197. </el-form-item>
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="" align="center" label="系列名称">
  201. <template slot-scope="scope">
  202. <el-form-item>
  203. <el-input type="text" v-model="scope.row.seriesName" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  204. </el-form-item>
  205. </template>
  206. </el-table-column>
  207. <el-table-column prop="" align="center" label="机型名称">
  208. <template slot-scope="scope">
  209. <el-form-item>
  210. <el-input type="text" v-model="scope.row.productName" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  211. </el-form-item>
  212. </template>
  213. </el-table-column>
  214. <el-table-column align="center" label="设备套数">
  215. <template slot-scope="scope">
  216. <el-form-item :prop="'productList.' + scope.$index + '.num'" :rules="[{ required: true, message: `请输入设备套数`, trigger: 'blur' }]">
  217. <el-input type="number" v-model="scope.row.num" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  218. </el-form-item>
  219. </template>
  220. </el-table-column>
  221. <el-table-column prop="" align="center" label="内机数量" >
  222. <template slot-scope="scope">
  223. <el-form-item>
  224. <el-input type="number" v-model="scope.row.inNum" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  225. </el-form-item>
  226. </template>
  227. </el-table-column>
  228. <el-table-column prop="" align="center" label="外机数量">
  229. <template slot-scope="scope">
  230. <el-form-item>
  231. <el-input type="number" v-model="scope.row.outNum" :disabled="isEdit1 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  232. </el-form-item>
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="操作" align="right" width="140">
  236. <template slot-scope="scope" v-if="formType != 2">
  237. <el-button size="mini" type="primary" v-if="scope.$index != isEdit1" @click="edit(1,scope.$index)">编辑</el-button>
  238. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  239. </template>
  240. </el-table-column>
  241. </el-table>
  242. </el-form>
  243. <!-- 项目人员 -->
  244. <el-form v-show="typeIndex == 2" ref="formData2" :rules="rules2" :model="formData2" label-width="0" size="small" label-position="left">
  245. <el-table :data="formData2.byList" element-loading-text="Loading" border fit highlight-current-row stripe>
  246. <el-table-column align="center" label="姓名">
  247. <template slot-scope="scope">
  248. <el-form-item :prop="'byList.' + scope.$index + '.name'" :rules="[{ required: true, message: `请输入姓名`, trigger: 'blur' }]">
  249. <el-input type="text" v-model="scope.row.name" :disabled="isEdit2 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  250. </el-form-item>
  251. </template>
  252. </el-table-column>
  253. <el-table-column align="center" label="联系电话" >
  254. <template slot-scope="scope">
  255. <el-form-item :prop="'byList.' + scope.$index + '.mobile'"
  256. :rules="[{ required: true, message: `请输入联系电话`, trigger: 'blur' },{ pattern:/^((1[3456789]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }]">
  257. <el-input type="number" oninput="if(value.length > 11) value=value.slice(0, 11)" v-model="scope.row.mobile" :disabled="isEdit2 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  258. </el-form-item>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="费用审批">
  262. <template slot-scope="scope">
  263. <el-form-item :prop="'byList.' + scope.$index + '.feeExamine'" :rules="[{ required: true, message: `请选择费用审批`, trigger: 'blur' }]">
  264. <el-select v-model="scope.row.feeExamine" :disabled="isEdit2 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  265. <el-option
  266. v-for="item in [{id: 'YES',name: '是'},{id: 'NO',name: '否'}]"
  267. :key="item.id"
  268. :label="item.name"
  269. :value="item.id">
  270. </el-option>
  271. </el-select>
  272. </el-form-item>
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="操作" align="right" width="140">
  276. <template slot-scope="scope" v-if="formType != 2">
  277. <el-button size="mini" type="primary" v-if="scope.$index != isEdit2" @click="edit(2,scope.$index)">编辑</el-button>
  278. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  279. </template>
  280. </el-table-column>
  281. </el-table>
  282. </el-form>
  283. <!-- 服务网点 -->
  284. <el-form v-show="typeIndex == 3" ref="formData3" :model="formData3" label-width="0" size="small" label-position="left">
  285. <el-table :data="formData3.websitList" element-loading-text="Loading" border fit highlight-current-row stripe>
  286. <el-table-column align="center" label="网点名称">
  287. <template slot-scope="scope">
  288. <el-form-item :prop="'websitList.' + scope.$index + '.websit'" :rules="[{ required: true, message: `请选择网点名称`, trigger: 'blur' }]">
  289. <el-select v-model="scope.row.websit" @change="(e)=>{
  290. scope.row.websitId = e.websitId
  291. scope.row.websitName = e.name
  292. scope.row.linkName = e.linkName
  293. scope.row.mobile = e.websitPhone
  294. scope.row.address = e.address
  295. }" value-key="websitId" :disabled="isEdit3 != scope.$index || formType == 2" placeholder="请选择" style="width: 100%;">
  296. <el-option
  297. v-for="item in websitData"
  298. :key="item.websitId"
  299. :label="item.name"
  300. :value="item">
  301. </el-option>
  302. </el-select>
  303. </el-form-item>
  304. </template>
  305. </el-table-column>
  306. <el-table-column align="center" label="联系人">
  307. <template slot-scope="scope">
  308. <el-form-item>
  309. <el-input type="text" v-model="scope.row.linkName" disabled placeholder="请输入"></el-input>
  310. </el-form-item>
  311. </template>
  312. </el-table-column>
  313. <el-table-column align="center" label="移动电话" >
  314. <template slot-scope="scope">
  315. <el-form-item>
  316. <el-input type="text" v-model="scope.row.mobile" disabled placeholder="请输入"></el-input>
  317. </el-form-item>
  318. </template>
  319. </el-table-column>
  320. <el-table-column align="center" label="地址" >
  321. <template slot-scope="scope">
  322. <el-form-item>
  323. <el-input type="text" v-model="scope.row.address" disabled placeholder="请输入"></el-input>
  324. </el-form-item>
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="操作" align="right" width="140">
  328. <template slot-scope="scope" v-if="formType != 2">
  329. <el-button size="mini" type="primary" v-if="scope.$index != isEdit3" @click="edit(3,scope.$index)">编辑</el-button>
  330. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  331. </template>
  332. </el-table-column>
  333. </el-table>
  334. </el-form>
  335. <!-- 辅材配置 -->
  336. <el-form ref="formData4" :model="formData4">
  337. <el-table v-show="typeIndex == 4" :data="formData4.itemList" element-loading-text="Loading" border fit highlight-current-row stripe>
  338. <el-table-column label="大类" align="center">
  339. <template slot-scope="scope">
  340. <el-form-item>
  341. {{scope.row.parentCategoryName}}
  342. </el-form-item>
  343. </template>
  344. </el-table-column>
  345. <el-table-column label="小类" align="center">
  346. <template slot-scope="scope">
  347. <el-form-item>
  348. {{scope.row.goodsCategoryName}}
  349. </el-form-item>
  350. </template>
  351. </el-table-column>
  352. <el-table-column label="*辅材名称" align="center">
  353. <template slot-scope="scope">
  354. <el-form-item :prop="'itemList.' + scope.$index + '.auxiliary'" :rules="[{ required: true, message: `请选择辅材名称`, trigger: 'blur' }]">
  355. <el-select v-model="scope.row.auxiliary" @change="(e)=>{
  356. scope.row.goodsId = e.normId
  357. scope.row.goodsName = e.normName
  358. scope.row.goodsCategoryName = e.categoryName
  359. scope.row.goodsCategoryId = e.categoryId
  360. scope.row.parentCategoryName = e.parentCategoryName
  361. scope.row.parentCategoryId = e.parentCategoryId
  362. scope.row.goodsCode = e.normCode
  363. scope.row.goodsSpecification = e.specification
  364. scope.row.goodsStockUnit = e.unit
  365. scope.row.normType = e.normType
  366. scope.row.normAmount = e.normAmount
  367. }" :disabled="isEdit4 != scope.$index || formType == 2" value-key="normId" placeholder="请选择" style="width: 100%;">
  368. <el-option
  369. v-for="(item,ind) in auxiliaryList"
  370. :key="ind"
  371. :label="item.normName"
  372. :value="item">
  373. </el-option>
  374. </el-select>
  375. </el-form-item>
  376. </template>
  377. </el-table-column>
  378. <el-table-column prop="" align="center" label="商品代码">
  379. <template slot-scope="scope">
  380. <el-form-item>
  381. {{scope.row.goodsCode}}
  382. </el-form-item>
  383. </template>
  384. </el-table-column>
  385. <el-table-column prop="" align="center" label="规格型号">
  386. <template slot-scope="scope">
  387. <el-form-item>
  388. {{scope.row.goodsSpecification}}
  389. </el-form-item>
  390. </template>
  391. </el-table-column>
  392. <el-table-column align="center" label="单位">
  393. <template slot-scope="scope">
  394. <el-form-item>
  395. {{scope.row.goodsStockUnit}}
  396. </el-form-item>
  397. </template>
  398. </el-table-column>
  399. <el-table-column prop="" align="center" label="收费类型" >
  400. <template slot-scope="scope">
  401. <el-form-item>
  402. {{scope.row.normType == 'M'?'配件物料':scope.row.normType == 'S'?'服务收费':''}}
  403. </el-form-item>
  404. </template>
  405. </el-table-column>
  406. <el-table-column prop="" align="center" label="*收费标准(元)">
  407. <template slot-scope="scope">
  408. <el-form-item :prop="'itemList.' + scope.$index + '.normAmount'"
  409. :rules="[{ required: true, message: `请输入收费标准`, trigger: 'blur' }]">
  410. <el-input type="number" oninput="if(value < 0) value=0" v-model="scope.row.normAmount" :disabled="isEdit4 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  411. </el-form-item>
  412. </template>
  413. </el-table-column>
  414. <el-table-column label="操作" align="right" width="140">
  415. <template slot-scope="scope" v-if="formType != 2">
  416. <el-button size="mini" type="primary" v-if="scope.$index != isEdit4" @click="edit(4,scope.$index)">编辑</el-button>
  417. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  418. </template>
  419. </el-table-column>
  420. </el-table>
  421. </el-form>
  422. <!-- 配件配置 -->
  423. <el-form ref="formData5" :model="formData5">
  424. <el-table v-show="typeIndex == 5" :data="formData5.itemList" element-loading-text="Loading" border fit highlight-current-row stripe>
  425. <el-table-column label="*配件名称" align="center">
  426. <template slot-scope="scope">
  427. <el-form-item :prop="'itemList.' + scope.$index + '.attachment'" :rules="[{ required: true, message: `请选择辅材名称`, trigger: 'blur' }]">
  428. <el-select v-model="scope.row.attachment" @change="(e)=>{
  429. scope.row.goodsId = e.goodsId
  430. scope.row.goodsName = e.goodsName
  431. scope.row.goodsCode = e.goodsCode
  432. scope.row.goodsStockUnit = e.goodsStockUnit
  433. scope.row.normType = e.normType
  434. scope.row.normAmount = e.normAmount
  435. scope.row.brandRelaName = e.brandRelaName
  436. scope.row.productRelaName = e.productRelaName
  437. }" :disabled="isEdit5 != scope.$index || formType == 2" value-key="goodsId" placeholder="请选择" style="width: 100%;">
  438. <el-option
  439. v-for="(item,ind) in attachmentList"
  440. :key="ind"
  441. :label="item.goodsName"
  442. :value="item">
  443. </el-option>
  444. </el-select>
  445. </el-form-item>
  446. </template>
  447. </el-table-column>
  448. <el-table-column align="center" label="单位">
  449. <template slot-scope="scope">
  450. <el-form-item>
  451. {{scope.row.goodsStockUnit}}
  452. </el-form-item>
  453. </template>
  454. </el-table-column>
  455. <el-table-column prop="" align="center" label="商品代码">
  456. <template slot-scope="scope">
  457. <el-form-item>
  458. {{scope.row.goodsCode}}
  459. </el-form-item>
  460. </template>
  461. </el-table-column>
  462. <el-table-column prop="" align="center" label="收费类型" >
  463. <template slot-scope="scope">
  464. <el-form-item>
  465. {{scope.row.normType == 'M'?'配件物料':scope.row.normType == 'S'?'服务收费':''}}
  466. </el-form-item>
  467. </template>
  468. </el-table-column>
  469. <el-table-column prop="" align="center" label="适用品牌">
  470. <template slot-scope="scope">
  471. <el-form-item>
  472. {{scope.row.brandRelaName}}
  473. </el-form-item>
  474. </template>
  475. </el-table-column>
  476. <el-table-column prop="" align="center" label="适用产品大类">
  477. <template slot-scope="scope">
  478. <el-form-item>
  479. {{scope.row.productRelaName}}
  480. </el-form-item>
  481. </template>
  482. </el-table-column>
  483. <el-table-column prop="" align="center" label="*收费标准(元)">
  484. <template slot-scope="scope">
  485. <el-form-item :prop="'itemList.' + scope.$index + '.normAmount'"
  486. :rules="[{ required: true, message: `请输入收费标准`, trigger: 'blur' }]">
  487. <el-input type="number" oninput="if(value < 0) value=0" v-model="scope.row.normAmount" :disabled="isEdit5 != scope.$index || formType == 2" placeholder="请输入"></el-input>
  488. </el-form-item>
  489. </template>
  490. </el-table-column>
  491. <el-table-column label="操作" align="right" width="140">
  492. <template slot-scope="scope" v-if="formType != 2">
  493. <el-button size="mini" type="primary" v-if="scope.$index != isEdit5" @click="edit(5,scope.$index)">编辑</el-button>
  494. <el-button size="mini" type="danger" @click="del(scope.$index)">删除</el-button>
  495. </template>
  496. </el-table-column>
  497. </el-table>
  498. </el-form>
  499. </div>
  500. </el-card>
  501. <div class="page-footer">
  502. <div class="footer">
  503. <el-button v-if="formType != 2" size="small" type="primary" @click="confirm()">保存</el-button>
  504. <el-button size="small" type="info" @click="goBack">返回</el-button>
  505. </div>
  506. </div>
  507. </template>
  508. <template v-else>
  509. <el-card class="box-card">
  510. <div slot="header" class="clearfix">
  511. <span>修改记录</span>
  512. </div>
  513. <div class="table">
  514. <el-table :data="historyList" element-loading-text="Loading" border fit highlight-current-row stripe>
  515. <el-table-column prop="typeText" align="center" label="操作类型" ></el-table-column>
  516. <el-table-column prop="content" align="left" label="操作内容"></el-table-column>
  517. <el-table-column prop="createBy" align="center" label="操作人"></el-table-column>
  518. <el-table-column prop="createTime" align="center" label="操作时间"></el-table-column>
  519. </el-table>
  520. </div>
  521. </el-card>
  522. </template>
  523. </div>
  524. </template>
  525. <script>
  526. import { getWebsit } from "@/api/customerManagement";
  527. import { lbsAmapRegion } from '@/api/common.js'
  528. import geographicalPosi from '@/components/geographicalPosi/index.vue'
  529. import { getMainList } from "@/api/workOrder/settlementStandardInstall";
  530. import { getBrand } from '@/api/goods'
  531. import { getDetail, getAuxiliaryList, getAttachmentList, save } from "@/api/engineeringMaintenance/basicData";
  532. import request from '@/utils/request'
  533. export default {
  534. components: {geographicalPosi},
  535. props: ['id','title','formType'],
  536. data() {
  537. return {
  538. tabIndex: 1,
  539. typeIndex: '1',
  540. auxiliaryList: [],
  541. attachmentList: [],
  542. orderTypeList: [],
  543. websitData: [],
  544. brandList: [],
  545. historyList: [],
  546. provinceList: [],
  547. cityList: [],
  548. areaList: [],
  549. streetList: [],
  550. mainList: [],
  551. formData: {
  552. dateList: [],
  553. checkTypeList: [],
  554. projectName: '',
  555. manger: '',
  556. mobile: '',
  557. startTime: '',
  558. endTime: '',
  559. orderSmallTypeText: '安装',
  560. isAllFee: 'YES',
  561. feePayMethod: '',
  562. province: '',
  563. provinceId: '',
  564. city: '',
  565. cityId: '',
  566. area: '',
  567. areaId: '',
  568. street: '',
  569. streetId: '',
  570. address: '',
  571. lat: '',
  572. lng: '',
  573. remark: ''
  574. },
  575. formData1: {
  576. productList: [],
  577. },
  578. formData2: {
  579. byList: [],
  580. },
  581. formData3: {
  582. websitList: [],
  583. },
  584. formData4: {
  585. itemList: [],
  586. },
  587. formData5: {
  588. itemList: [],
  589. },
  590. isEdit1: 0,
  591. isEdit2: 0,
  592. isEdit3: 0,
  593. isEdit4: 0,
  594. isEdit5: 0,
  595. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  596. rules: {
  597. projectName: [
  598. { required: true, message: '请输入项目名称', trigger: 'blur' },
  599. ],
  600. manger: [
  601. { required: true, message: '请输入负责人名称', trigger: 'blur' },
  602. ],
  603. mobile: [
  604. { required: true, message: `请输入联系电话`, trigger: 'blur' },
  605. { required: true, message: `请输入联系电话`, trigger: 'change' },
  606. { pattern:/^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }
  607. ],
  608. dateList: [
  609. { required: true, message: '请选择维保时间', trigger: 'change' }
  610. ],
  611. checkTypeList: [
  612. { required: true, message: '请选择工单类型', trigger: 'change' }
  613. ],
  614. address: [
  615. { required: true, message: '请选择详细地址', trigger: 'change' }
  616. ],
  617. feePayMethod: [
  618. { required: true, message: '请选择费用支付方式', trigger: 'change' }
  619. ],
  620. isAllFee: [
  621. { required: true, message: '', trigger: '' }
  622. ],
  623. orderSmallTypeText: [
  624. { required: true, message: '', trigger: '' }
  625. ]
  626. },
  627. rules1: {},
  628. rules2: {},
  629. rules3: {},
  630. rules4: {},
  631. rules5: {},
  632. isSave: true
  633. };
  634. },
  635. computed: {
  636. filterChildren(){
  637. return function(id){
  638. let data = []
  639. this.mainList.forEach(item=>{
  640. if(item.categoryId == id){
  641. // data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
  642. data = item.children?item.children:[]
  643. }
  644. })
  645. return data
  646. }
  647. },
  648. },
  649. created() {
  650. this.initData()
  651. if(this.id){
  652. this.getDetail()
  653. }
  654. },
  655. methods: {
  656. // 返回
  657. goBack() {
  658. this.$emit('back');
  659. },
  660. async getDetail(){
  661. const that = this
  662. this.formData.checkTypeList = []
  663. getDetail({id: this.id}).then( async res => {
  664. Object.assign(this.formData, res.data, {
  665. })
  666. this.historyList = res.data.operatorLogList
  667. this.formData.dateList = [res.data.startTime,res.data.endTime]
  668. this.formData1.productList = res.data.productList.map(item=>{
  669. return Object.assign(item, {
  670. smallList: this.filterChildren(item.mainId),
  671. brand: {id: item.brandId,brandName: item.brandName},
  672. main: {categoryId: item.mainId,name: item.mainName},
  673. small: {categoryId: item.smallId,name: item.smallName}
  674. })
  675. })
  676. res.data.websitList.map(item=>{
  677. item.websit = {websitId: item.websitId,name: item.websitName}
  678. })
  679. res.data.typeList.forEach(item=>{
  680. this.formData.checkTypeList.push(item.id)
  681. })
  682. this.formData2.byList = res.data.byList
  683. this.formData3.websitList = res.data.websitList
  684. res.data.itemList.map(item=>{
  685. if(item.goodsType == 'M'){
  686. item.auxiliary = {normId: item.goodsId}
  687. this.formData4.itemList.push(item)
  688. }else{
  689. item.attachment = {goodsId: item.goodsId}
  690. this.formData5.itemList.push(item)
  691. }
  692. })
  693. console.log(this.formData1.productList,'123123123')
  694. })
  695. },
  696. initData(){
  697. this.getOrderType()
  698. this.getBrandList()
  699. this.getWebsit()
  700. this.getMainList()
  701. this.getAuxiliaryList()
  702. this.getAttachmentList()
  703. this.getinitlbslist()
  704. },
  705. getOrderType(){
  706. request({
  707. url: `/order/smalltype/list`,
  708. method: 'post',
  709. data: {
  710. pageNum: 1,
  711. pageSize: -1,
  712. params: [{param: 'a.is_rp_project_repair',compare: '=', value: 'YES'}]
  713. }
  714. }).then(res => {
  715. this.orderTypeList = res.data.records
  716. })
  717. },
  718. getBrandList(){
  719. getBrand().then(res => {
  720. // this.brandList = [...[{id: '0',brandName: '不限'}],...res.data]
  721. this.brandList = res.data
  722. })
  723. },
  724. getMainList(){
  725. getMainList({type: 2}).then(res => {
  726. // this.mainList = [...[{categoryId: '0',name: '不限',children: [{categoryId: '0',name: '不限'}]}],...res.data]
  727. this.mainList = res.data
  728. })
  729. },
  730. getAuxiliaryList(){
  731. getAuxiliaryList({
  732. pageNum: 1,
  733. pageSize: -1,
  734. params: []
  735. }).then(res => {
  736. this.auxiliaryList = res.data.records
  737. })
  738. },
  739. getAttachmentList(){
  740. getAttachmentList({
  741. pageNum: 1,
  742. pageSize: -1,
  743. params: [{param: "a.norm_type", compare: "=", value: "M"}]
  744. }).then(res => {
  745. this.attachmentList = res.data.records
  746. })
  747. },
  748. getinitlbslist() {
  749. // 初始化请求省市区街道下拉选项数据
  750. lbsAmapRegion({ pid: 0 }).then(res => {
  751. this.provinceList = res.data
  752. // 创建工单时获取ip地址定位赋值
  753. if (!this.id && this.$IpAdd.province) {
  754. var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
  755. if (item) {
  756. this.formData.provinceId = item.id
  757. this.formData.province = item.name
  758. }
  759. }
  760. if (this.formData.provinceId) {
  761. lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
  762. this.cityList = res.data
  763. // 创建工单时获取ip地址定位赋值
  764. if (!this.id && this.$IpAdd.city) {
  765. var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
  766. if (item2) {
  767. this.formData.cityId = item2.id
  768. this.formData.city = item2.name
  769. }
  770. }
  771. if (this.formData.cityId) {
  772. lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
  773. this.areaList = res.data
  774. })
  775. }
  776. if (this.formData.areaId) {
  777. lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
  778. this.streetList = res.data
  779. })
  780. }
  781. })
  782. }
  783. })
  784. },
  785. selectAddress(data){
  786. this.formData.lng = data.center[0]
  787. this.formData.lat = data.center[1]
  788. // 获取定位的省市区街道
  789. var { province, city, district, township } = data.data.addressComponent
  790. // 获取选中省名称id
  791. var { id, name } = this.provinceList.find(item => item.name === province)
  792. this.formData.provinceId = id
  793. this.formData.province = name
  794. // 请求市选项
  795. lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
  796. // 赋值市选项
  797. this.cityList = res.data
  798. // 获取选中市名称id
  799. var { id, name } = res.data.find(item => item.name === city)
  800. this.formData.cityId = id
  801. this.formData.city = name
  802. // 请求区选项
  803. lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
  804. // 赋值区选项
  805. this.areaList = res.data
  806. // 获取选中区名称id
  807. var { id, name } = res.data.find(item => item.name === district)
  808. this.formData.areaId = id
  809. this.formData.area = name
  810. // 请求街道选项
  811. lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
  812. // 赋值街道选项
  813. this.streetList = res.data
  814. // 获取选中街道名称id
  815. var { id, name } = res.data.find(item => item.name === township)
  816. this.formData.streetId = id
  817. this.formData.street = name
  818. // 赋值GPS详细地址
  819. this.formData.address = data.name
  820. })
  821. })
  822. })
  823. },
  824. selectDate(e){
  825. this.formData.startTime = e[0] + ' 00:00:00'
  826. this.formData.endTime = e[1] + ' 23:59:59'
  827. },
  828. getWebsit(){
  829. getWebsit({type: 'C'}).then(res => {
  830. this.websitData = res.data
  831. })
  832. },
  833. getCategory(websitId){
  834. getCategory({websitId}).then(res => {
  835. this.mainList = res.data
  836. })
  837. },
  838. changeType(){
  839. },
  840. preserveRuleForm(name) {
  841. let is_save = false
  842. this.$refs[name].validate((valid) => {
  843. if (valid) {
  844. is_save = true
  845. } else {
  846. is_save = false;
  847. }
  848. });
  849. return is_save
  850. },
  851. edit(typeIndex,index){
  852. if(this.preserveRuleForm('formData' + this.typeIndex)){
  853. this['isEdit' + typeIndex] = index
  854. }
  855. },
  856. add(){
  857. if(!this.preserveRuleForm('formData' + this.typeIndex)){return false}
  858. let name = this.typeIndex == 1?'productList':this.typeIndex == 2?'byList':this.typeIndex == 3?'websitList':'itemList'
  859. this['isEdit' + this.typeIndex] = 0
  860. // if(this['formData' + this.typeIndex][name].length != 0){this['isEdit' + this.typeIndex] += 1}
  861. if(this.typeIndex == 1){
  862. this['formData' + this.typeIndex][name].unshift({
  863. brand: null,
  864. brandId: '',
  865. brandName: '',
  866. inNum: '',
  867. main: null,
  868. mainId: '',
  869. mainName: '',
  870. num: '',
  871. outNum: '',
  872. productName: '',
  873. seriesName: '',
  874. small: null,
  875. smallId: '',
  876. smallName: '',
  877. smallImg: ''
  878. })
  879. }else if(this.typeIndex == 2){
  880. this['formData' + this.typeIndex][name].unshift({
  881. name: '',
  882. mobile: '',
  883. feeExamine: ''
  884. })
  885. }else if(this.typeIndex == 3){
  886. this['formData' + this.typeIndex][name].unshift({
  887. websit: null,
  888. websitId: '',
  889. websitName: '',
  890. linkName: '',
  891. mobile: '',
  892. address: ''
  893. })
  894. }else if(this.typeIndex == 4){
  895. this['formData' + this.typeIndex][name].unshift({
  896. auxiliary: null,
  897. goodsId: '',
  898. goodsName: '',
  899. parentCategoryId: '',
  900. parentCategoryName: '',
  901. goodsCategoryId: '',
  902. goodsCategoryName: '',
  903. goodsCode: '',
  904. goodsSpecification: '',
  905. goodsStockUnit: '',
  906. normType: '',
  907. normAmount: '',
  908. goodsType: 'M'
  909. })
  910. }else if(this.typeIndex == 5){
  911. this['formData' + this.typeIndex][name].unshift({
  912. attachment: null,
  913. goodsId: '',
  914. goodsName: '',
  915. goodsCode: '',
  916. goodsStockUnit: '',
  917. normType: '',
  918. normAmount: '',
  919. brandRelaName: '',
  920. productRelaName: '',
  921. goodsType: 'P'
  922. })
  923. }
  924. },
  925. del(index){
  926. let name = this.typeIndex == 1?'productList':this.typeIndex == 2?'byList':this.typeIndex == 3?'websitList':'itemList'
  927. this['formData' + this.typeIndex][name].splice(index,1)
  928. },
  929. confirm(){
  930. const that = this
  931. this.$refs.formData.validate((valid, invalidFields, errLabels) => {
  932. if (valid) {
  933. if(that.formData1.productList.length == 0){
  934. that.typeIndex = '1'
  935. return that.$message.error('请添加项目设备信息');
  936. }
  937. if(that.formData2.byList.length == 0){
  938. that.typeIndex = '2'
  939. return that.$message.error('请添加项目人员信息');
  940. }
  941. if(that.formData3.websitList.length == 0){
  942. that.typeIndex = '3'
  943. return that.$message.error('请添加服务网点信息');
  944. }
  945. // if(that.formData4.itemList.length == 0){
  946. // that.typeIndex = '4'
  947. // return that.$message.error('请添加辅材配置信息');
  948. // }
  949. // if(that.formData5.itemList.length == 0){
  950. // that.typeIndex = '5'
  951. // return that.$message.error('请添加配件配置信息');
  952. // }
  953. if(!that.preserveRuleForm('formData1')){
  954. return that.typeIndex = '1'
  955. }
  956. if(!that.preserveRuleForm('formData2')){
  957. return that.typeIndex = '2'
  958. }
  959. if(!that.preserveRuleForm('formData3')){
  960. return that.typeIndex = '3'
  961. }
  962. // if(!that.preserveRuleForm('formData4')){
  963. // return that.typeIndex = '4'
  964. // }
  965. // if(!that.preserveRuleForm('formData5')){
  966. // return that.typeIndex = '5'
  967. // }
  968. this.save()
  969. }
  970. })
  971. },
  972. save(){
  973. if(!this.isSave){
  974. return false
  975. }
  976. this.isSave = false
  977. setTimeout(()=>{
  978. this.isSave = true
  979. },3000)
  980. let data = this.orderTypeList.filter((it) => {
  981. const index = this.formData.checkTypeList.findIndex((item) => item === it.id)
  982. return index !== -1
  983. })
  984. const that = this
  985. let params = {
  986. ...this.formData,
  987. byList: this.formData2.byList,
  988. productList: this.formData1.productList,
  989. websitList: this.formData3.websitList,
  990. typeList: data,
  991. itemList: [...this.formData4.itemList,...this.formData5.itemList]
  992. }
  993. save(params).then(res => {
  994. that.$message.success('保存成功!')
  995. setTimeout(()=>{
  996. that.goBack()
  997. },1500)
  998. })
  999. }
  1000. }
  1001. };
  1002. </script>
  1003. <style scoped="scoped" lang="scss">
  1004. .s-page {
  1005. padding: 20px;
  1006. background-color: #ffffff;
  1007. }
  1008. .page-footer {
  1009. height: 70px;
  1010. }
  1011. .footer {
  1012. position: fixed;
  1013. bottom: 0;
  1014. left: 0;
  1015. z-index: 1;
  1016. width: 100%;
  1017. background: #fff;
  1018. padding: 15px 40px;
  1019. box-sizing: border-box;
  1020. transition: all 0.28s;
  1021. text-align: right;
  1022. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  1023. &.hideSidebar {
  1024. margin-left: 54px;
  1025. width: calc(100vw - 54px);
  1026. }
  1027. &.openSidebar {
  1028. margin-left: 210px;
  1029. width: calc(100vw - 210px);
  1030. }
  1031. .tips {
  1032. font-size: 12px;
  1033. color: red;
  1034. margin-top: 10px;
  1035. }
  1036. }
  1037. ::v-deep .numrule input::-webkit-outer-spin-button,
  1038. ::v-deep .numrule input::-webkit-inner-spin-button {
  1039. -webkit-appearance: none!important;
  1040. }
  1041. ::v-deep .numrule input[type="number"]{
  1042. -moz-appearance: textfield;
  1043. }
  1044. </style>