engin_form.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header :content="listItem ? '编辑' : '新增'" @back="goBack" />
  4. <div class="main-title">
  5. <div class="title">工程信息单</div>
  6. </div>
  7. <el-form
  8. ref="mainForm"
  9. :model="mainForm"
  10. :rules="mainFormRules"
  11. label-width="110px"
  12. size="small"
  13. label-position="right"
  14. >
  15. <el-row :gutter="20">
  16. <el-col :xs="24" :sm="12" :lg="8">
  17. <el-form-item label="工程登录编号" prop="orderNum">
  18. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled />
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  22. <el-form-item label="单据日期" prop="orderDate">
  23. <el-date-picker
  24. v-model="mainForm.orderDate"
  25. disabled
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. style="width: 100%"
  29. placeholder="系统自动生成"
  30. />
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="8">
  34. <el-form-item label="业务员" prop="salesMan">
  35. <el-select
  36. v-model="mainForm.salesMan"
  37. placeholder="选择业务员"
  38. size="small"
  39. filterable
  40. clearable
  41. style="width: 100%"
  42. >
  43. <el-option
  44. v-for="item in salesmanList"
  45. :key="item.adminUserId"
  46. :label="item.nickName"
  47. :value="item.adminUserId"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. </el-col>
  52. <!-- <el-col :xs="24" :sm="12" :lg="8">
  53. <el-form-item label="产品大类" prop="mainId">
  54. <el-select v-model="mainForm.mainId" placeholder="选择产品大类" style="width: 100%">
  55. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. </el-col> -->
  59. </el-row>
  60. <el-row :gutter="20">
  61. <el-col :xs="24" :sm="12" :lg="8">
  62. <el-form-item label="经销商编码" prop="jxsNum">
  63. <el-input v-model="mainForm.jxsNum" placeholder="选择经销商" disabled />
  64. </el-form-item>
  65. </el-col>
  66. <el-col :xs="24" :sm="12" :lg="8">
  67. <el-form-item label="项目名称" prop="enginName">
  68. <el-input v-model="mainForm.enginName" placeholder="请输入项目名称" />
  69. </el-form-item>
  70. </el-col>
  71. <el-col :xs="24" :sm="12" :lg="8">
  72. <el-form-item label="机型类别" prop="machineType">
  73. <el-select
  74. v-model="mainForm.machineType"
  75. placeholder="选择机型类别"
  76. size="small"
  77. clearable
  78. style="width: 100%"
  79. >
  80. <el-option
  81. v-for="item in machineTypeList"
  82. :key="item.dictCode"
  83. :label="item.dictValue"
  84. :value="item.dictCode"
  85. />
  86. </el-select>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :xs="24" :sm="12" :lg="8">
  90. <el-form-item label="经销商名称" prop="jxsNum">
  91. <el-select
  92. v-model="mainForm.jxsNum"
  93. placeholder="选择经销商"
  94. size="small"
  95. filterable
  96. clearable
  97. style="width: 100%"
  98. :disabled="listItem != undefined"
  99. @change="changeDealer"
  100. >
  101. <el-option v-for="item in dealerList" :key="item.id" :label="item.name" :value="item.number" />
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :xs="24" :sm="12" :lg="8">
  106. <el-form-item label="使用单位" prop="company">
  107. <el-input v-model="mainForm.company" placeholder="请输入使用单位" />
  108. </el-form-item>
  109. </el-col>
  110. <el-col :xs="24" :sm="12" :lg="8">
  111. <el-form-item label="行业类别" prop="tradeCategory">
  112. <el-select
  113. v-model="mainForm.tradeCategory"
  114. placeholder="选择行业类别"
  115. size="small"
  116. clearable
  117. style="width: 100%"
  118. >
  119. <el-option v-for="item in tradeCategoryList" :key="item.value" :label="item.label" :value="item.value" />
  120. </el-select>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :xs="24" :sm="12" :lg="8">
  124. <el-form-item label="工程编号" prop="enginNum">
  125. <div style="display: flex">
  126. <el-input v-model="mainForm.enginNum" placeholder="请输入工程编号" />
  127. <el-button
  128. style="margin-left: 10px"
  129. @click="
  130. () => {
  131. if (!this.mainForm.loginType) return this.$errorMsg('请选择工程登录类型')
  132. this.visible = true
  133. this.getLoginOrderList()
  134. }
  135. "
  136. >引用</el-button
  137. >
  138. </div>
  139. </el-form-item>
  140. </el-col>
  141. <el-col :xs="24" :sm="12" :lg="8">
  142. <el-form-item label="厂工程编码" prop="factoryNum">
  143. <el-input v-model="mainForm.factoryNum" placeholder="请输入厂工程编码" />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="8">
  147. <el-form-item label="工程登录类型" prop="loginType">
  148. <el-select
  149. v-model="mainForm.loginType"
  150. placeholder="选择工程登录类型"
  151. size="small"
  152. clearable
  153. style="width: 100%"
  154. >
  155. <el-option
  156. v-for="item in loginTypeList"
  157. :key="item.dictCode"
  158. :label="item.dictValue"
  159. :value="item.dictCode"
  160. />
  161. </el-select>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :xs="24" :sm="12" :lg="8">
  165. <el-form-item label="联系人" prop="linkman">
  166. <el-input v-model="mainForm.linkman" placeholder="请输入联系人" />
  167. </el-form-item>
  168. </el-col>
  169. <el-col :xs="24" :sm="12" :lg="8">
  170. <el-form-item label="联系电话" prop="phone">
  171. <el-input v-model="mainForm.phone" placeholder="请输入联系电话" />
  172. </el-form-item>
  173. </el-col>
  174. <el-col :xs="24" :sm="12" :lg="8">
  175. <el-form-item label="固定电话" prop="tel">
  176. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" />
  177. </el-form-item>
  178. </el-col>
  179. <el-col :xs="24" :sm="16" :lg="16">
  180. <el-form-item label="安装地址" prop="address">
  181. <el-input v-model="mainForm.address" placeholder="请输入安装地址" />
  182. </el-form-item>
  183. </el-col>
  184. <el-col :xs="24" :sm="8" :lg="8">
  185. <el-form-item label="文件编号" prop="fileNo">
  186. <el-input v-model="mainForm.fileNo" placeholder="请输入文件编号" />
  187. </el-form-item>
  188. </el-col>
  189. <el-col v-if="!isDealer" :xs="24" :sm="24" :lg="16">
  190. <el-form-item label="格力内部备注" prop="greeRemark">
  191. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注" />
  192. </el-form-item>
  193. </el-col>
  194. <el-col v-if="!isDealer" :xs="24" :sm="12" :lg="8">
  195. <el-form-item label="权限分类" prop="power">
  196. <el-select v-model="mainForm.power" placeholder="选择权限分类" size="small" clearable style="width: 100%">
  197. <el-option
  198. v-for="item in powerList"
  199. :key="item.dictCode"
  200. :label="item.dictValue"
  201. :value="item.dictCode"
  202. />
  203. </el-select>
  204. </el-form-item>
  205. </el-col>
  206. <el-col :xs="24" :sm="24" :lg="24">
  207. <el-form-item label="格力回复" prop="greeReply">
  208. <el-input
  209. v-model="mainForm.greeReply"
  210. :placeholder="isDealer ? '' : '请输入格力回复'"
  211. :disabled="isDealer"
  212. />
  213. </el-form-item>
  214. </el-col>
  215. <el-col :xs="24" :sm="24" :lg="24">
  216. <el-form-item label="备注" prop="remark">
  217. <el-input v-model="mainForm.remark" placeholder="请输入备注" />
  218. </el-form-item>
  219. </el-col>
  220. <el-col :xs="24" :sm="12" :lg="8">
  221. <el-form-item label="制单人" prop="createMan">
  222. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled />
  223. </el-form-item>
  224. </el-col>
  225. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  226. <el-form-item label="制单日期" prop="createDate">
  227. <el-date-picker
  228. v-model="mainForm.createDate"
  229. type="date"
  230. disabled
  231. value-format="yyyy-MM-dd"
  232. style="width: 100%"
  233. placeholder="选择日期"
  234. />
  235. </el-form-item>
  236. </el-col>
  237. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  238. <el-form-item label="合同有效期" prop="contractDate">
  239. <el-date-picker
  240. v-model="mainForm.contractDate"
  241. :disabled="isDealer"
  242. type="date"
  243. value-format="yyyy-MM-dd"
  244. style="width: 100%"
  245. placeholder="选择日期"
  246. />
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. </el-form>
  251. <div class="main-title">
  252. <div class="title">货品信息</div>
  253. <div>
  254. <el-button type="primary" size="mini" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  255. <el-divider direction="vertical" />
  256. <!-- <ImportButton :imUrl="'engin-info-order/import-item'" @importSuccess="getImportList" :isIcon="false" style="display: inline-block" />
  257. <ExportButton :exUrl="'engin-info-order/download'" :exParams="{}" :exText="'下载导入模版'" :isIcon="false" style="display: inline-block" /> -->
  258. </div>
  259. </div>
  260. <div class="table" style="margin-top: 20px">
  261. <el-table
  262. :data="goodsList"
  263. element-loading-text="Loading"
  264. border
  265. fit
  266. highlight-current-row
  267. stripe
  268. show-summary
  269. :summary-method="$getSummaries"
  270. max-height="400"
  271. >
  272. <el-table-column align="center" label="序号" type="index" width="50" />
  273. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip>
  274. <template slot-scope="scope">
  275. <el-select
  276. v-if="listItem"
  277. v-model="scope.row.saleTypeId"
  278. placeholder="选择销售类型"
  279. size="mini"
  280. clearable
  281. style="width: 100%"
  282. @change="changeSaleType(scope.$index)"
  283. >
  284. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id" />
  285. </el-select>
  286. <div v-else>{{ scope.row.saleTypeName }}</div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip />
  290. <el-table-column
  291. align="center"
  292. label="产品编码"
  293. prop="materialOldNumber"
  294. min-width="120"
  295. show-overflow-tooltip
  296. />
  297. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  298. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
  299. <template slot-scope="scope">
  300. <el-input v-if="listItem" v-model="scope.row.specification" size="mini" />
  301. <div v-else>{{ scope.row.specification }}</div>
  302. </template>
  303. </el-table-column>
  304. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  305. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  306. <template slot-scope="scope">
  307. <el-input v-model="scope.row.price" size="small" type="number" @mousewheel.native.prevent />
  308. </template>
  309. </el-table-column>
  310. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  311. <template slot-scope="scope">
  312. <el-input v-model.number="scope.row.qty" size="small" type="number" @mousewheel.native.prevent />
  313. </template>
  314. </el-table-column>
  315. <el-table-column align="center" label="订单金额" prop="myTotalAmount" min-width="100" show-overflow-tooltip>
  316. <template slot-scope="scope">
  317. {{ (scope.row.price || 0) * (scope.row.qty || 0) }}
  318. </template>
  319. </el-table-column>
  320. <el-table-column align="center" label="备注" prop="remark" min-width="200" show-overflow-tooltip>
  321. <template slot-scope="scope">
  322. <el-input v-model="scope.row.remark" size="small" />
  323. </template>
  324. </el-table-column>
  325. <el-table-column align="center" label="税率" prop="taxRate" min-width="100" show-overflow-tooltip />
  326. <el-table-column align="center" label="操作" width="100" fixed="right">
  327. <template slot-scope="scope">
  328. <el-button type="text" @click="deleteItem(scope.$index, scope.row, scope.row.cid)">删除</el-button>
  329. </template>
  330. </el-table-column>
  331. </el-table>
  332. </div>
  333. <div class="page-footer">
  334. <div class="footer">
  335. <el-button type="primary" :loading="btnLoading" @click="clickSubmitForm(1)">保 存</el-button>
  336. <!-- <el-button type="primary" @click="clickSubmitForm(2)">提交审核</el-button>-->
  337. <el-popconfirm title="确定关闭吗?" style="margin-left: 10px" @confirm="goBack">
  338. <el-button slot="reference">返回列表</el-button>
  339. </el-popconfirm>
  340. </div>
  341. </div>
  342. <el-dialog
  343. title="添加产品"
  344. :modal-append-to-body="true"
  345. :append-to-body="true"
  346. :visible.sync="isShowGoodsDialog"
  347. width="80%"
  348. >
  349. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  350. <el-row :gutter="20">
  351. <el-col :xs="12" :sm="6" :lg="6">
  352. <el-form-item prop="salesType">
  353. <el-select v-model="goodsScreenForm.salesType" placeholder="选择销售类型" style="width: 100%" clearable>
  354. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id" />
  355. </el-select>
  356. </el-form-item>
  357. </el-col>
  358. <el-col :xs="12" :sm="6" :lg="6">
  359. <el-form-item prop="proNum">
  360. <el-input
  361. @keyup.enter.native="submitGoodsScreenForm"
  362. v-model="goodsScreenForm.proNum"
  363. placeholder="请输入产品编码"
  364. />
  365. </el-form-item>
  366. </el-col>
  367. <el-col :xs="12" :sm="6" :lg="6">
  368. <el-form-item prop="proName">
  369. <el-input
  370. @keyup.enter.native="submitGoodsScreenForm"
  371. v-model="goodsScreenForm.proName"
  372. placeholder="请输入产品名称"
  373. />
  374. </el-form-item>
  375. </el-col>
  376. <el-col :xs="12" :sm="6" :lg="6">
  377. <el-form-item prop="proModel">
  378. <el-input
  379. @keyup.enter.native="submitGoodsScreenForm"
  380. v-model="goodsScreenForm.proModel"
  381. placeholder="请输入产品型号"
  382. />
  383. </el-form-item>
  384. </el-col>
  385. <el-col :xs="12" :sm="6" :lg="6">
  386. <el-form-item prop="price1" style="display: flex">
  387. <el-input
  388. @keyup.enter.native="submitGoodsScreenForm"
  389. v-model="goodsScreenForm.price1"
  390. placeholder="请输入价格"
  391. style="width: 46%"
  392. />
  393. <span> - </span>
  394. <el-input
  395. @keyup.enter.native="submitGoodsScreenForm"
  396. v-model="goodsScreenForm.price2"
  397. placeholder="请输入价格"
  398. style="width: 46%"
  399. />
  400. </el-form-item>
  401. </el-col>
  402. <el-col :xs="12" :sm="18" :lg="18" class="tr">
  403. <el-form-item label="">
  404. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  405. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  406. </el-form-item>
  407. </el-col>
  408. </el-row>
  409. </el-form>
  410. <div class="tables">
  411. <div class="table">
  412. <el-table
  413. :data="leftGoodsList"
  414. element-loading-text="Loading"
  415. border
  416. fit
  417. highlight-current-row
  418. stripe
  419. height="400"
  420. @selection-change="leftSelectionChange"
  421. >
  422. <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect" />
  423. <el-table-column align="center" label="销售类型" prop="saleName" show-overflow-tooltip />
  424. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip />
  425. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  426. <el-table-column
  427. align="center"
  428. label="产品型号"
  429. prop="specification"
  430. min-width="160"
  431. show-overflow-tooltip
  432. />
  433. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  434. </el-table>
  435. <div class="pagination clearfix" style="margin-top: 10px">
  436. <div class="fr">
  437. <el-pagination
  438. :current-page="currentPage"
  439. :page-size="10"
  440. background
  441. layout="prev, pager, next"
  442. :total="listTotal"
  443. @current-change="handleTableCurrentChange"
  444. />
  445. </div>
  446. </div>
  447. </div>
  448. <div class="buttons">
  449. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  450. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  451. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  452. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  453. </div>
  454. <div class="table">
  455. <el-table
  456. :data="rightGoodsList"
  457. element-loading-text="Loading"
  458. border
  459. fit
  460. highlight-current-row
  461. stripe
  462. height="400"
  463. @selection-change="rightSelectionChange"
  464. >
  465. <el-table-column align="center" type="selection" width="55" />
  466. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip />
  467. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  468. <el-table-column
  469. align="center"
  470. label="产品型号"
  471. prop="specification"
  472. min-width="160"
  473. show-overflow-tooltip
  474. />
  475. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  476. <el-table-column align="center" prop="saleName" label="销售类型" show-overflow-tooltip />
  477. </el-table>
  478. </div>
  479. </div>
  480. <span slot="footer" class="dialog-footer">
  481. <el-button @click="closeDialog">取 消</el-button>
  482. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  483. </span>
  484. </el-dialog>
  485. <el-dialog
  486. title="商用工程登录项目"
  487. :visible.sync="visible"
  488. width="60%"
  489. :modal-append-to-body="true"
  490. :append-to-body="true"
  491. :close-on-click-modal="false"
  492. @close="onClose"
  493. >
  494. <div>
  495. <el-row :gutter="20">
  496. <el-form ref="formData" :model="formData" label-width="0" :inline="false" size="small">
  497. <el-col :span="18">
  498. <el-form-item prop="projectNo">
  499. <el-input v-model="formData.projectNo" placeholder="请输入项目编号" />
  500. </el-form-item>
  501. </el-col>
  502. <!-- <el-col :span="6">
  503. <el-form-item prop="projectName">
  504. <el-input v-model="formData.projectName" placeholder="请输入项目名称" />
  505. </el-form-item>
  506. </el-col>
  507. <el-col :span="6">
  508. <el-form-item prop="address">
  509. <el-input v-model="formData.address" placeholder="请输入项目地址" />
  510. </el-form-item>
  511. </el-col> -->
  512. <el-col :span="6" style="text-align: right">
  513. <el-button
  514. size="small"
  515. @click="
  516. currentPage2 = 1
  517. getLoginOrderList()
  518. "
  519. >查询</el-button
  520. >
  521. <el-button size="small" type="primary" @click="resetGoodsScreenForm2">重置</el-button></el-col
  522. >
  523. </el-form>
  524. </el-row>
  525. <div>
  526. <zj-table
  527. ref="tableEl"
  528. style="margin-bottom: 20px"
  529. :is-drop="true"
  530. :columns="columns"
  531. :table-data="tableData"
  532. :table-attributes="{
  533. border: true,
  534. maxHeight: '600px'
  535. }"
  536. />
  537. <div class="fr">
  538. <el-pagination
  539. :current-page="currentPage2"
  540. :page-sizes="[10, 20, 30, 50]"
  541. :page-size="10"
  542. layout="total, sizes, prev, pager, next, jumper"
  543. :total="listTotal2"
  544. @size-change="handleSizeChange"
  545. @current-change="handleCurrentChange"
  546. />
  547. </div>
  548. </div>
  549. </div>
  550. <span slot="footer">
  551. <el-button @click="onClose">取 消</el-button>
  552. <el-button type="primary" @click="submitAddOrder">确 定</el-button>
  553. </span>
  554. </el-dialog>
  555. </div>
  556. </template>
  557. <script>
  558. import {
  559. getEnginDetail,
  560. getRetailProductList,
  561. addEngin,
  562. editEngin,
  563. submitEngin,
  564. delItem,
  565. getLoginOrderList
  566. } from '@/api/supply/engin'
  567. import { getDictList, getTypeList, getSalesmanList, getDealerList } from '@/api/common'
  568. export default {
  569. name: 'EnginForm',
  570. componentName: 'EnginForm',
  571. props: ['listItem'],
  572. data() {
  573. return {
  574. goodsList: [],
  575. mainForm: {
  576. orderNum: '',
  577. orderDate: '',
  578. // mainId: '102',
  579. jxsNum: '',
  580. enginName: '',
  581. machineType: '',
  582. jxsName: '',
  583. jxsId: '',
  584. company: '',
  585. address: '',
  586. enginNum: '',
  587. factoryNum: '',
  588. loginType: '',
  589. linkman: '',
  590. phone: '',
  591. tel: '',
  592. remark: '',
  593. salesMan: '',
  594. createMan: '',
  595. createDate: '',
  596. contractDate: '',
  597. tradeCategory: '',
  598. power: '',
  599. greeRemark: '',
  600. greeReply: '',
  601. fileNo: ''
  602. },
  603. mainFormRules: {
  604. salesMan: [{ required: true, message: '请选择业务员', trigger: 'change' }],
  605. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  606. enginName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
  607. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  608. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  609. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  610. enginNum: [{ required: true, message: '请输入工程编号', trigger: 'blur' }],
  611. loginType: [{ required: true, message: '请输入工程登录类型', trigger: 'blur' }],
  612. tradeCategory: [{ required: true, message: '请选择行业类别', trigger: 'change' }]
  613. },
  614. loginTypeList: [],
  615. powerList: [],
  616. machineTypeList: [],
  617. tradeCategoryList: [
  618. { value: '房地产', label: '房地产' },
  619. { value: '公共建筑', label: '公共建筑' },
  620. { value: '工业制造', label: '工业制造' },
  621. { value: '商业项目', label: '商业项目' },
  622. { value: '采暖及清洁能源', label: '采暖及清洁能源' },
  623. { value: '轨道交通', label: '轨道交通' },
  624. { value: '数据通讯', label: '数据通讯' },
  625. { value: '冷冻冷藏', label: '冷冻冷藏' },
  626. { value: '高端制造', label: '高端制造' },
  627. { value: '医院医疗', label: '医院医疗' },
  628. { value: '其他', label: '其他' }
  629. ],
  630. btnLoading: false,
  631. typeList: [],
  632. salesTypeList: [],
  633. salesmanList: [],
  634. dealerList: [],
  635. isShowGoodsDialog: false,
  636. goodsScreenForm: {
  637. proNum: '',
  638. proName: '',
  639. proModel: '',
  640. price1: '',
  641. price2: '',
  642. salesType: ''
  643. },
  644. currentPage: 1,
  645. listTotal: 0,
  646. leftGoodsList: [],
  647. rightGoodsList: [],
  648. leftSelection: [],
  649. rightSelection: [],
  650. examineStatus: '',
  651. visible: false,
  652. currentPage2: 1,
  653. pageSize2: 10,
  654. listTotal2: 0,
  655. formData: {
  656. address: '',
  657. projectName: '',
  658. projectNo: ''
  659. },
  660. tableData: [],
  661. current: ''
  662. }
  663. },
  664. computed: {
  665. isDealer() {
  666. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  667. },
  668. columns() {
  669. return [
  670. {
  671. columnAttributes: {
  672. label: '操作',
  673. width: 45
  674. },
  675. render: (h, { row, column, index }) => {
  676. return (
  677. <div>
  678. <el-radio
  679. style="margin-left:20px"
  680. value={this.current}
  681. label={row.id}
  682. onChange={val => {
  683. this.current = row.id
  684. }}
  685. >
  686. {}
  687. </el-radio>
  688. </div>
  689. )
  690. }
  691. },
  692. {
  693. columnAttributes: {
  694. label: '项目编号',
  695. prop: 'projectNo',
  696. width: 100
  697. }
  698. },
  699. {
  700. columnAttributes: {
  701. label: '项目名称',
  702. prop: 'projectName',
  703. width: 200
  704. }
  705. },
  706. {
  707. columnAttributes: {
  708. label: '项目地址',
  709. prop: 'address'
  710. }
  711. }
  712. ]
  713. }
  714. },
  715. watch: {
  716. goodsList: {
  717. deep: true,
  718. immediate: true,
  719. handler(val, oval) {
  720. val.forEach(item => {
  721. item.myTotalAmount = (item.price || 0) * (item.qty || 0)
  722. item.sums1 = ['number', 'directTransferQty', 'qty', 'enginNum', 'oldQty', 'hasSendQty']
  723. item.sums2 = ['myTotalAmount', 'payAmount', 'price', 'payRebateAmount', 'discAmount']
  724. })
  725. }
  726. }
  727. },
  728. async created() {
  729. await this.getSalesmanList()
  730. this.getDictList()
  731. this.getTypeList()
  732. this.getDealerList()
  733. if (this.listItem) {
  734. this.getDetail()
  735. } else {
  736. this.mainForm.jxsNum = JSON.parse(localStorage.getItem('supply_user')).customerNumber
  737. this.mainForm.jxsName = JSON.parse(localStorage.getItem('supply_user')).customerName
  738. this.mainForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
  739. this.mainForm.createDate = this.getDate(0)
  740. this.mainForm.contractDate = this.getDate(1)
  741. }
  742. },
  743. methods: {
  744. // 返回列表
  745. goBack() {
  746. this.$emit('backListFormDetail')
  747. },
  748. getLoginOrderList() {
  749. getLoginOrderList({
  750. pageNum: this.currentPage2,
  751. pageSize: this.pageSize2,
  752. ...this.formData,
  753. orderType: this.mainForm.loginType
  754. }).then(res => {
  755. this.tableData = res.data.records
  756. this.listTotal2 = res.data.total
  757. })
  758. },
  759. getDate(addYear) {
  760. var date = new Date()
  761. var seperator1 = '-'
  762. var year = date.getFullYear() + addYear
  763. var month = date.getMonth() + 1
  764. var strDate = date.getDate()
  765. if (month >= 1 && month <= 9) {
  766. month = '0' + month
  767. }
  768. if (strDate >= 0 && strDate <= 9) {
  769. strDate = '0' + strDate
  770. }
  771. var currentdate = year + seperator1 + month + seperator1 + strDate
  772. return currentdate
  773. },
  774. // 获取详情
  775. getDetail() {
  776. getEnginDetail({ id: this.listItem.enginInfoId }).then(res => {
  777. const data = res.data
  778. this.mainForm.orderNum = data.enginInfoNo
  779. this.mainForm.orderDate = data.orderDate
  780. // this.mainForm.mainId = data.productCategoryId;
  781. this.mainForm.jxsNum = data.customerNumber
  782. this.mainForm.enginName = data.projectName
  783. this.mainForm.machineType = data.machineType
  784. this.mainForm.jxsName = data.customerName
  785. this.mainForm.company = data.useUnit
  786. this.mainForm.tradeCategory = data.tradeCategory
  787. this.mainForm.address = data.installAddress
  788. this.mainForm.enginNum = data.projectNo
  789. this.mainForm.factoryNum = data.enginFactoryNo
  790. this.mainForm.loginType = data.enginSignType
  791. this.mainForm.linkman = data.linkman
  792. this.mainForm.phone = data.phone
  793. this.mainForm.tel = data.tel
  794. this.mainForm.remark = data.remark
  795. this.mainForm.salesMan = data.serviceId
  796. this.mainForm.createMan = data.createName
  797. this.mainForm.createDate = data.createTime
  798. this.mainForm.contractDate = data.contractExpireDate
  799. this.mainForm.power = data.powerCategory
  800. this.mainForm.greeRemark = data.geLiInerNote
  801. this.mainForm.greeReply = data.geLiNote
  802. this.mainForm.fileNo = data.fileNo
  803. this.examineStatus = data.examineStatus
  804. data.items.forEach(item => {
  805. item.cantDel = true
  806. item.cid = item.id
  807. })
  808. this.goodsList = data.items
  809. })
  810. },
  811. // 获取经销商列表
  812. getDealerList() {
  813. getDealerList({
  814. pageNum: 1,
  815. pageSize: -1
  816. // bindUser: false
  817. }).then(res => {
  818. this.dealerList = res.data.records
  819. })
  820. },
  821. // 获取产品大类列表
  822. getDictList() {
  823. getDictList({ sysDictEnum: 'PRODUCT_TYPE' }).then(res => {
  824. this.typeList = res.data
  825. })
  826. getDictList({ sysDictEnum: 'MACHINE_TYPE' }).then(res => {
  827. this.machineTypeList = res.data
  828. })
  829. getDictList({ sysDictEnum: 'POWER_CATEGORY' }).then(res => {
  830. this.powerList = res.data
  831. })
  832. getDictList({ sysDictEnum: 'SIGN_TYPE' }).then(res => {
  833. this.loginTypeList = res.data
  834. })
  835. },
  836. // 获取销售类型列表
  837. getTypeList() {
  838. getTypeList({
  839. pageNum: 1,
  840. pageSize: -1
  841. }).then(res => {
  842. this.salesTypeList = res.data.records
  843. })
  844. },
  845. async getSalesmanList() {
  846. const res = await getSalesmanList({
  847. pageNum: 1,
  848. pageSize: -1,
  849. isCustomer: 0,
  850. status: true
  851. })
  852. this.salesmanList = res.data.records
  853. },
  854. changeDealer() {
  855. if (this.mainForm.jxsNum) {
  856. const jxsItem = this.dealerList.find(o => o.number == this.mainForm.jxsNum)
  857. this.mainForm.jxsName = jxsItem.name
  858. this.mainForm.jxsId = jxsItem.id
  859. } else {
  860. this.mainForm.jxsName = ''
  861. this.mainForm.jxsId = ''
  862. }
  863. },
  864. changeSaleType(index) {
  865. if (this.goodsList[index].saleTypeId) {
  866. const obj = this.salesTypeList.find(o => o.id == this.goodsList[index].saleTypeId)
  867. this.goodsList[index].saleTypeName = obj.saleName
  868. this.goodsList[index].saleTypeCode = obj.saleCode
  869. } else {
  870. this.goodsList[index].saleTypeName = ''
  871. this.goodsList[index].saleTypeCode = ''
  872. }
  873. },
  874. // 获取商品列表
  875. getGoodsList() {
  876. getRetailProductList({
  877. pageNum: this.currentPage,
  878. pageSize: 10,
  879. saleId: this.goodsScreenForm.salesType,
  880. materialCode: this.goodsScreenForm.proNum,
  881. materialName: this.goodsScreenForm.proName,
  882. specification: this.goodsScreenForm.proModel,
  883. price1: this.goodsScreenForm.price1,
  884. price2: this.goodsScreenForm.price2,
  885. customerId: this.listItem ? this.listItem.customerId : ''
  886. }).then(res => {
  887. const oldGoodsList = this.goodsList
  888. const newGoodsList = res.data.records
  889. for (let i = 0; i < oldGoodsList.length; i++) {
  890. const oldItem = oldGoodsList[i]
  891. for (let j = 0; j < newGoodsList.length; j++) {
  892. const newItem = newGoodsList[j]
  893. if (`${newItem.number}_${newItem.saleTypeId}` === `${newItem.number}_${newItem.saleTypeId}`) {
  894. newGoodsList[j].selected = true
  895. break
  896. }
  897. }
  898. }
  899. res.data.records.forEach(item => {
  900. item.materialName = item.name
  901. item.materialCode = item.number
  902. item.saleTypeName = item.saleName
  903. item.unit = item.baseUnit
  904. item.price = item.batchPrice
  905. item.tax = item.taxRate
  906. item.isDirectTransfer = false
  907. item.directTransferQty = ''
  908. item.status1 = ''
  909. item.status2 = ''
  910. item.rebateAmount = ''
  911. item.rebateRate = ''
  912. item.productPriceId = item.id
  913. // item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  914. })
  915. this.leftGoodsList = res.data.records
  916. this.listTotal = res.data.total
  917. })
  918. },
  919. // 查询重复值并禁选
  920. checkboxSelect(row, rowIndex) {
  921. if (row.selected) {
  922. return false // 禁用
  923. } else {
  924. return true // 不禁用
  925. }
  926. },
  927. // 点击 选择商品
  928. openDialog() {
  929. this.isShowGoodsDialog = true
  930. this.getGoodsList()
  931. },
  932. // 提交筛选表单
  933. submitGoodsScreenForm() {
  934. this.currentPage = 1
  935. this.getGoodsList()
  936. },
  937. // 重置筛选表单
  938. resetGoodsScreenForm() {
  939. this.$refs.goodsScreenForm.resetFields()
  940. this.currentPage = 1
  941. this.getGoodsList()
  942. },
  943. // 更改列表当前页
  944. handleTableCurrentChange(val) {
  945. this.currentPage = val
  946. this.getGoodsList()
  947. },
  948. // 关闭 弹窗
  949. closeDialog() {
  950. this.isShowGoodsDialog = false
  951. },
  952. // 左侧列表选择
  953. leftSelectionChange(val) {
  954. this.leftSelection = val
  955. },
  956. // 右侧列表选择
  957. rightSelectionChange(val) {
  958. this.rightSelection = val
  959. },
  960. // 数组去重
  961. delRepeat(arr1, arr2) {
  962. const allArr = arr1.concat(arr2) // 两个数组对象合并
  963. const newArr = [] // 存放去重后数据的新数组
  964. for (let i = 0; i < allArr.length; i++) {
  965. // 循环allArr数组对象的内容
  966. let flag = true // 建立标记,判断数据是否重复,true为不重复
  967. for (let j = 0; j < newArr.length; j++) {
  968. // 循环新数组的内容
  969. if (allArr[i].id == newArr[j].id) {
  970. // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  971. flag = false
  972. }
  973. }
  974. if (flag) {
  975. // 判断是否重复
  976. newArr.push(allArr[i]) // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  977. }
  978. }
  979. return newArr
  980. },
  981. // 全部添加
  982. addAllGoods() {
  983. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList)
  984. },
  985. // 添加
  986. addGoods() {
  987. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList)
  988. },
  989. // 删除
  990. deleteGoods() {
  991. const rightGoodsList = this.rightGoodsList
  992. const rightSelection = this.rightSelection
  993. for (let i = 0; i < rightGoodsList.length; i++) {
  994. for (let j = 0; j < rightSelection.length; j++) {
  995. if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
  996. this.rightGoodsList.splice(i, 1)
  997. }
  998. }
  999. }
  1000. },
  1001. // 全部删除
  1002. deleteAllGoods() {
  1003. this.rightGoodsList = []
  1004. },
  1005. // 确定 添加产品
  1006. submitAddGoods() {
  1007. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  1008. this.goodsList = this.goodsList.concat(this.rightGoodsList)
  1009. this.goodsList.forEach(k => {
  1010. if (!k.qty) {
  1011. k.qty = 0
  1012. }
  1013. if (!k.cid) {
  1014. k.cid = ''
  1015. }
  1016. })
  1017. this.isShowGoodsDialog = false
  1018. this.leftGoodsList = []
  1019. this.rightGoodsList = []
  1020. },
  1021. // 删除产品
  1022. deleteItem(index, row, id) {
  1023. // id id存在就说明这个货品已经引用过了
  1024. // if (this.listItem && this.examineStatus === 'OK' && id) {
  1025. // this.$errorMsg('已审核通过的型号不能删除')
  1026. // return
  1027. // }
  1028. if (id) {
  1029. delItem({
  1030. enginInfoNo: row.enginInfoNo,
  1031. itemId: row.id
  1032. }).then(res => {
  1033. this.goodsList.splice(index, 1)
  1034. this.$successMsg('存在的货品删除成功')
  1035. })
  1036. } else {
  1037. this.goodsList.splice(index, 1)
  1038. this.$successMsg('删除成功')
  1039. }
  1040. },
  1041. // 导入产品
  1042. getImportList(data) {
  1043. this.goodsList = this.goodsList.concat(data)
  1044. },
  1045. clickSubmitForm(type) {
  1046. this.btnLoading = true
  1047. this.$refs.mainForm.validate(valid => {
  1048. if (valid) {
  1049. for (let i = 0; i < this.goodsList.length; i++) {
  1050. if (!this.goodsList[i].saleTypeId) {
  1051. this.$errorMsg('请选择销售类型')
  1052. return
  1053. }
  1054. console.log(this.goodsList[i].qty)
  1055. if (this.goodsList[i].qty == null || this.goodsList[i].qty === '' || Number(this.goodsList[i].qty) < 0) {
  1056. this.$errorMsg('数量不能为空或者小于0')
  1057. return
  1058. }
  1059. if (!this.goodsList[i].materialNumber) {
  1060. return
  1061. }
  1062. }
  1063. const goodsList = JSON.parse(JSON.stringify(this.goodsList))
  1064. goodsList.forEach(item => {
  1065. delete item.productList
  1066. delete item.id
  1067. })
  1068. const saleManItem = this.mainForm.salesMan
  1069. ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan)
  1070. : ''
  1071. const params = {
  1072. // orderDate: this.mainForm.orderDate + ' 00:00:00',
  1073. // mainId: this.mainForm.mainId,
  1074. projectName: this.mainForm.enginName,
  1075. machineType: this.mainForm.machineType,
  1076. useUnit: this.mainForm.company,
  1077. tradeCategory: this.mainForm.tradeCategory,
  1078. installAddress: this.mainForm.address,
  1079. projectNo: this.mainForm.enginNum,
  1080. enginFactoryNo: this.mainForm.factoryNum,
  1081. enginSignType: this.mainForm.loginType,
  1082. linkman: this.mainForm.linkman,
  1083. phone: this.mainForm.phone,
  1084. serviceId: this.mainForm.salesMan,
  1085. serviceName: saleManItem.nickName,
  1086. tel: this.mainForm.tel,
  1087. remark: this.mainForm.remark,
  1088. contractExpireDate: this.mainForm.contractDate,
  1089. powerCategory: this.mainForm.power,
  1090. geLiInerNote: this.mainForm.greeRemark,
  1091. geLiNote: this.mainForm.greeReply,
  1092. fileNo: this.mainForm.fileNo,
  1093. items: goodsList
  1094. }
  1095. console.log(params)
  1096. if (type === 1) {
  1097. if (this.listItem) {
  1098. params.enginInfoId = this.listItem.enginInfoId
  1099. editEngin(params)
  1100. .then(res => {
  1101. this.$successMsg('编辑成功')
  1102. this.goBack()
  1103. })
  1104. .finally(() => {
  1105. this.btnLoading = false
  1106. })
  1107. } else {
  1108. params.customerNumber = this.mainForm.jxsNum
  1109. params.customerName = this.mainForm.jxsName
  1110. params.customerId = this.mainForm.jxsId
  1111. addEngin(params)
  1112. .then(res => {
  1113. this.$successMsg('保存成功')
  1114. this.goBack()
  1115. })
  1116. .finally(() => {
  1117. this.btnLoading = false
  1118. })
  1119. }
  1120. } else {
  1121. if (this.listItem) {
  1122. params.enginInfoId = this.listItem.enginInfoId
  1123. } else {
  1124. params.customerNumber = this.mainForm.jxsNum
  1125. params.customerName = this.mainForm.jxsName
  1126. params.customerId = this.mainForm.jxsId
  1127. }
  1128. submitEngin(params)
  1129. .then(res => {
  1130. this.$successMsg('提交审核成功')
  1131. this.goBack()
  1132. })
  1133. .finally(() => {
  1134. this.btnLoading = false
  1135. })
  1136. }
  1137. }
  1138. })
  1139. },
  1140. handleSizeChange(val) {
  1141. this.pageSize2 = val
  1142. this.currentPage2 = 1
  1143. this.getLoginOrderList()
  1144. },
  1145. handleCurrentChange(val) {
  1146. this.currentPage2 = val
  1147. this.getLoginOrderList()
  1148. },
  1149. // 重置筛选表单
  1150. resetGoodsScreenForm2() {
  1151. this.$refs.formData.resetFields()
  1152. this.currentPage2 = 1
  1153. this.getLoginOrderList()
  1154. },
  1155. submitAddOrder() {
  1156. const item = this.tableData.find(k => k.id === this.current)
  1157. this.mainForm.enginNum = item.projectNo
  1158. this.mainForm.enginName = item.projectName
  1159. this.mainForm.linkman = item.enginLinkName
  1160. this.mainForm.phone = item.enginLinkMobile
  1161. this.mainForm.address = item.joinAddress
  1162. this.onClose()
  1163. },
  1164. onClose() {
  1165. this.$nextTick(() => {
  1166. this.current = ''
  1167. this.$refs.formData.resetFields()
  1168. this.visible = false
  1169. })
  1170. }
  1171. }
  1172. }
  1173. </script>
  1174. <style scoped lang="scss">
  1175. .detail-container {
  1176. width: 100%;
  1177. height: 100%;
  1178. }
  1179. .main-title {
  1180. display: flex;
  1181. justify-content: space-between;
  1182. align-items: center;
  1183. margin-top: 20px;
  1184. height: 60px;
  1185. border-bottom: 1px solid #dcdfe6;
  1186. margin-bottom: 20px;
  1187. .title {
  1188. font-size: 16px;
  1189. font-weight: 600;
  1190. padding-left: 10px;
  1191. }
  1192. }
  1193. .tables {
  1194. display: flex;
  1195. margin-top: 10px;
  1196. .table {
  1197. width: 45%;
  1198. }
  1199. .buttons {
  1200. display: flex;
  1201. flex-direction: column;
  1202. justify-content: center;
  1203. align-items: center;
  1204. padding: 0 10px;
  1205. button {
  1206. margin: 0;
  1207. margin-top: 10px;
  1208. }
  1209. }
  1210. }
  1211. ::v-deep input::-webkit-outer-spin-button,
  1212. ::v-deep input::-webkit-inner-spin-button {
  1213. -webkit-appearance: none;
  1214. }
  1215. ::v-deep input[type='number'] {
  1216. -moz-appearance: textfield;
  1217. }
  1218. </style>