materiel.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. <template>
  2. <fullscreen :fullscreen.sync="fullscreen" class="container">
  3. <div class="container-box">
  4. <toolList @iconCli="iconCli" :tooltit="tooltit"></toolList>
  5. <div class="search">
  6. <mySearch
  7. :searchList="searchList"
  8. @searchInfo="searchInfo"
  9. ></mySearch>
  10. <el-button
  11. class="btn-check"
  12. size="medium" type="primary"
  13. @click="exportTempletelist" v-if="userInfo.duty <= 9" >下载导入模板
  14. </el-button>
  15. <el-button
  16. class="btn-check"
  17. size="medium"
  18. type="primary"
  19. @click="dialogCheck(3)" v-if="userInfo.loginNoStr == 'jiangshuai'"
  20. >添加
  21. </el-button>
  22. <myUpload style="display:inline-block;" :fileInfo="fileInfot" v-if="userInfo.loginNoStr == 'jiangshuai'"
  23. :fileList="fileInfot.fileList" @uploadBack='uploadBack'></myUpload>
  24. </div>
  25. <div class="tabbox">
  26. <el-table
  27. height="calc(100% - 40px)"
  28. class="com-table"
  29. ref="multipleTable"
  30. :data="tableData"
  31. tooltip-effect="dark"
  32. size="small"
  33. border
  34. style="width: 100%"
  35. v-loading="loading"
  36. >
  37. <el-table-column prop="sceneName" label="使用场景">
  38. </el-table-column>
  39. <el-table-column prop="proviceFlagName" label="下单模式">
  40. </el-table-column>
  41. <el-table-column
  42. prop="metirialCode"
  43. label="物料编码"
  44. show-overflow-tooltip
  45. >
  46. </el-table-column>
  47. <el-table-column prop="metirialName" label="物料名称">
  48. </el-table-column>
  49. <el-table-column prop="unit" label="物料单位">
  50. </el-table-column>
  51. <el-table-column prop="price" label="不含税单价(元)">
  52. </el-table-column>
  53. <!-- <el-table-column prop="proviceFlagName" label="申请权限">
  54. </el-table-column> -->
  55. <el-table-column label="操作" width="160px" align="center">
  56. <template slot-scope="scope">
  57. <el-button
  58. size="mini"
  59. type="primary"
  60. @click="dialogCheck(1, scope.row)"
  61. >查看</el-button
  62. >
  63. <el-button
  64. size="mini"
  65. type="primary"
  66. @click="dialogCheck(2, scope.row)" v-if="userInfo.loginNoStr == 'jiangshuai'"
  67. >修改</el-button
  68. >
  69. <!-- v-if="userInfo.loginNo=='jiangshuai'" -->
  70. <el-button
  71. size="mini"
  72. type="danger"
  73. @click="delLine(scope.row)" v-if="userInfo.loginNoStr == 'jiangshuai'"
  74. >删除</el-button
  75. >
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. class="pageBox"
  81. @current-change="currchange"
  82. layout="prev, pager, next"
  83. background
  84. :total="total"
  85. >
  86. </el-pagination>
  87. </div>
  88. </div>
  89. <el-dialog
  90. :title="titname + '物料类型'"
  91. :visible.sync="dialogStatus"
  92. width="50%"
  93. :destroy-on-close="true"
  94. :modal-append-to-body="false"
  95. :close-on-click-modal="false"
  96. :before-close="closedia"
  97. >
  98. <div v-loading="loadinged">
  99. <el-form
  100. :model="infolist"
  101. ref="infolist"
  102. :rules="rules"
  103. style="height: 50vh;overflow-y: scroll;"
  104. >
  105. <div class="info-line">
  106. <el-form-item prop="sceneName">
  107. <!-- :disabled="disableStatus" -->
  108. <span>使用场景</span>
  109. <el-select
  110. :popper-append-to-body="false"
  111. multiple
  112. v-model="infolist.sceneName"
  113. placeholder="使用场景"
  114. @change="usePlance"
  115. >
  116. <el-option
  117. v-for="item in sceneopt"
  118. :key="item.dataName"
  119. :label="item.dataName"
  120. :value="item.dataName"
  121. >
  122. </el-option>
  123. </el-select>
  124. </el-form-item>
  125. <!-- :disabled="disableStatus" -->
  126. <el-form-item prop="proviceFlagName">
  127. <span>下单模式</span>
  128. <el-select
  129. :popper-append-to-body="false"
  130. v-model="infolist.proviceFlagName"
  131. placeholder="下单模式"
  132. >
  133. <el-option
  134. v-for="item in proviceopt"
  135. :key="item.id"
  136. :label="item.name"
  137. :value="item.name"
  138. >
  139. </el-option>
  140. </el-select>
  141. </el-form-item>
  142. <!-- <el-form-item prop="metirialType">-->
  143. <!-- <span>物料类别</span>-->
  144. <!-- <el-select-->
  145. <!-- :disabled="disableStatus"-->
  146. <!-- :popper-append-to-body="false"-->
  147. <!-- v-model="infolist.metirialType"-->
  148. <!-- placeholder="物料类别"-->
  149. <!-- >-->
  150. <!-- <el-option-->
  151. <!-- v-for="(item, index) in metirialTypeopt"-->
  152. <!-- :key="index"-->
  153. <!-- :label="item.dataName"-->
  154. <!-- :value="item.dataName"-->
  155. <!-- >-->
  156. <!-- </el-option>-->
  157. <!-- </el-select>-->
  158. <!-- </el-form-item>-->
  159. <!-- <el-form-item prop="isAsic">-->
  160. <!-- <span>基础数据</span>-->
  161. <!-- <el-select-->
  162. <!-- :disabled="disableStatus"-->
  163. <!-- :popper-append-to-body="false"-->
  164. <!-- v-model="infolist.isAsic"-->
  165. <!-- placeholder="基础数据"-->
  166. <!-- >-->
  167. <!-- <el-option-->
  168. <!-- v-for="item in isAsicopt"-->
  169. <!-- :key="item.id"-->
  170. <!-- :label="item.name"-->
  171. <!-- :value="item.name"-->
  172. <!-- >-->
  173. <!-- </el-option>-->
  174. <!-- </el-select>-->
  175. <!-- </el-form-item>-->
  176. <!-- <el-form-item prop="metirialType">
  177. <span>细分类型</span>
  178. <el-input v-model="infolist.metirialType" placeholder="细分类型" :disabled="disableStatus">
  179. </el-input>
  180. </el-form-item> -->
  181. <!-- :disabled="metirialCodeDisableStatus" -->
  182. <el-form-item prop="metirialCode">
  183. <span>物料编码</span>
  184. <el-input
  185. v-model="infolist.metirialCode"
  186. placeholder="物料编码"
  187. >
  188. </el-input>
  189. </el-form-item>
  190. <el-form-item prop="metirialName">
  191. <span>物料名称</span>
  192. <!-- <el-select :disabled="disableStatus" :popper-append-to-body="false"
  193. v-model="infolist.metirialName" placeholder="物料名称">
  194. <el-option v-for="item in nameopt" :key="item.dataCode" :label="item.dataName"
  195. :value="item.dataName">
  196. </el-option>
  197. </el-select> -->
  198. <!-- :disabled="disableStatus" -->
  199. <el-input
  200. v-model="infolist.metirialName"
  201. placeholder="物料名称"
  202. >
  203. </el-input>
  204. </el-form-item>
  205. <!-- <el-form-item prop="supplierCode">-->
  206. <!-- <span>供应商</span>-->
  207. <!-- <el-select-->
  208. <!-- :disabled="disableStatus"-->
  209. <!-- :popper-append-to-body="false"-->
  210. <!-- v-model="infolist.supplierCode"-->
  211. <!-- placeholder="供应商"-->
  212. <!-- @change="verifall"-->
  213. <!-- >-->
  214. <!-- <el-option-->
  215. <!-- v-for="item in suppOpt"-->
  216. <!-- :key="item.code"-->
  217. <!-- :label="item.name"-->
  218. <!-- :value="item.code"-->
  219. <!-- >-->
  220. <!-- </el-option>-->
  221. <!-- </el-select>-->
  222. <!-- </el-form-item>-->
  223. <!-- <el-form-item prop="size">-->
  224. <!-- <span>规格尺寸</span>-->
  225. <!-- <el-input-->
  226. <!-- v-model="infolist.size"-->
  227. <!-- placeholder="规格尺寸"-->
  228. <!-- :disabled="disableStatus"-->
  229. <!-- ></el-input>-->
  230. <!-- </el-form-item>-->
  231. <!-- <el-form-item prop="coefficient">-->
  232. <!-- <span>勾选后系数</span>-->
  233. <!-- <el-select-->
  234. <!-- :disabled="disableStatus"-->
  235. <!-- :popper-append-to-body="false"-->
  236. <!-- v-model="infolist.coefficient"-->
  237. <!-- placeholder="勾选后系数"-->
  238. <!-- >-->
  239. <!-- <el-option-->
  240. <!-- v-for="item in coefficientopt"-->
  241. <!-- :key="item.id"-->
  242. <!-- :label="item.name"-->
  243. <!-- :value="item.id"-->
  244. <!-- >-->
  245. <!-- </el-option>-->
  246. <!-- </el-select>-->
  247. <!-- </el-form-item>-->
  248. <!-- :disabled="disableStatus" -->
  249. <el-form-item prop="unit">
  250. <span>物料单位</span>
  251. <!-- <el-input v-model="infolist.unit" placeholder="单位" :disabled="disableStatus"></el-input> -->
  252. <el-select
  253. :popper-append-to-body="false"
  254. v-model="infolist.unit"
  255. placeholder="物料单位"
  256. >
  257. <el-option
  258. v-for="item in unitopt"
  259. :key="item.id"
  260. :label="item.name"
  261. :value="item.name"
  262. >
  263. </el-option>
  264. </el-select>
  265. </el-form-item>
  266. <!-- :disabled="disableStatus" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" -->
  267. <el-form-item prop="price">
  268. <span>不含税单价(元)</span>
  269. <el-input
  270. oninput="value = value.replace(/^(-)(\d+).(\d\d).$/,’$1$2.$3’)"
  271. type="number"
  272. v-model="infolist.price"
  273. placeholder="不含税单价(元)"
  274. ></el-input>
  275. </el-form-item>
  276. <!-- <el-form-item>
  277. <span>税率</span>
  278. <el-input v-model="infolist.tax" placeholder="税率" :disabled="disableStatus"></el-input>
  279. </el-form-item> -->
  280. <!-- <el-form-item>
  281. <span>安装</span>
  282. <el-input v-model="infolist.install" placeholder="是否需要安装" :disabled="disableStatus"></el-input>
  283. </el-form-item> -->
  284. </div>
  285. <!-- <el-form-item class="info-line online" prop="quality">
  286. <span>物料材质</span>
  287. <el-input v-model="infolist.quality" placeholder="物料材质" :disabled="disableStatus"
  288. type="textarea" :rows="4"></el-input>
  289. </el-form-item> -->
  290. </el-form>
  291. <div slot="footer" class="dialog-footer myfooter">
  292. <el-button
  293. type="primary"
  294. @click="dialogCli(2)"
  295. v-if="titname === '修改'"
  296. >确 定</el-button
  297. >
  298. <el-button
  299. type="primary"
  300. @click="xintianjia()"
  301. v-if="titname === '添加'"
  302. >确 定</el-button
  303. >
  304. <el-button @click="dialogCli(1)" v-if="titname === '查看'"
  305. >确 定</el-button
  306. >
  307. <el-button @click="dialogCli(1)">取 消</el-button>
  308. </div>
  309. </div>
  310. </el-dialog>
  311. <myMessage
  312. :messTit="messTit"
  313. @closeMessage="closeMessage"
  314. :centerDialogVisible="centerDialogVisible"
  315. v-if="centerDialogVisible"
  316. ></myMessage>
  317. </fullscreen>
  318. </template>
  319. <script>
  320. import mySearch from "../../../components/search.vue";
  321. import myMessage from "../../../components/myMessage.vue";
  322. import toolList from "../../../components/toolList";
  323. import myUpload from "../../../components/upload.vue";
  324. export default {
  325. components: {
  326. mySearch,
  327. myMessage,
  328. toolList,
  329. myUpload
  330. },
  331. data() {
  332. // const sceneName = (rule, value, callback) => {
  333. // if (!this.infolist.sceneName) {
  334. // callback(new Error("使用场景不能为空"));
  335. // } else {
  336. // callback();
  337. // }
  338. // };
  339. let sceneName = (rule, value, callback) => {
  340. if (!this.isFirstLoad) {
  341. // console.log(value);
  342. if(value == ''|| value == undefined){
  343. callback(new Error("使用场景不能为空"));
  344. }else{
  345. callback();
  346. }
  347. } else {
  348. this.isFirstLoad = false;
  349. }
  350. };
  351. const metirialName = (rule, value, callback) => {
  352. if (!this.infolist.metirialName) {
  353. callback(new Error("不能为空"));
  354. } else {
  355. callback();
  356. }
  357. };
  358. const metirialType = (rule, value, callback) => {
  359. if (!this.infolist.metirialType) {
  360. callback(new Error("不能为空"));
  361. } else {
  362. callback();
  363. }
  364. };
  365. const isAsic = (rule, value, callback) => {
  366. if (!this.infolist.isAsic) {
  367. callback(new Error("不能为空"));
  368. } else {
  369. callback();
  370. }
  371. };
  372. const metirialCode = (rule, value, callback) => {
  373. if (!this.infolist.metirialCode) {
  374. callback(new Error("不能为空"));
  375. } else {
  376. callback();
  377. }
  378. };
  379. const proviceFlag = (rule, value, callback) => {
  380. if (!this.infolist.proviceFlag) {
  381. callback(new Error("不能为空"));
  382. } else {
  383. callback();
  384. }
  385. };
  386. const proviceFlagName = (rule, value, callback) => {
  387. if (!this.infolist.proviceFlagName) {
  388. callback(new Error("不能为空"));
  389. } else {
  390. callback();
  391. }
  392. };
  393. const supplierCode = (rule, value, callback) => {
  394. if (!this.infolist.supplierCode) {
  395. callback(new Error("不能为空"));
  396. } else {
  397. callback();
  398. }
  399. };
  400. const size = (rule, value, callback) => {
  401. if (!this.infolist.size) {
  402. callback(new Error("不能为空"));
  403. } else {
  404. callback();
  405. }
  406. };
  407. const coefficient = (rule, value, callback) => {
  408. if (!this.infolist.coefficient) {
  409. callback(new Error("不能为空"));
  410. } else {
  411. callback();
  412. }
  413. };
  414. const unit = (rule, value, callback) => {
  415. if (!this.infolist.unit) {
  416. callback(new Error("不能为空"));
  417. } else {
  418. callback();
  419. }
  420. };
  421. const price = (rule, value, callback) => {
  422. if (!this.infolist.price) {
  423. callback(new Error("单价不能为空"));
  424. } else if (parseFloat(this.infolist.price) > 999999.99) {
  425. callback(new Error("数量过大"));
  426. } else if (parseFloat(this.infolist.price) <= 0){
  427. callback(new Error("请输入正数"));
  428. }else {
  429. callback();
  430. }
  431. };
  432. const quality = (rule, value, callback) => {
  433. if (!this.infolist.quality) {
  434. callback(new Error("不能为空"));
  435. } else {
  436. callback();
  437. }
  438. };
  439. return {
  440. isFirstLoad : true,
  441. rules: {
  442. metirialName: [
  443. {
  444. required: true,
  445. trigger: "blur",
  446. message: "物料名称不能为空"
  447. }
  448. ],
  449. sceneName: [
  450. {
  451. required: true,
  452. trigger: "change",
  453. type: 'array',
  454. validator: sceneName
  455. // message: "使用场景不能为空"
  456. }
  457. ],
  458. // sceneName: [
  459. // {
  460. // required: true,
  461. // trigger: "change",
  462. // validator: function (rule, value, callback) {
  463. // if (value.length === 0) {
  464. // callback(new Error('请选择高风险问题1'))
  465. // } else {
  466. // callback()
  467. // }
  468. // },
  469. // // validator: sceneName
  470. // // message: "使用场景不能为空"
  471. // }
  472. // ],
  473. metirialCode: [
  474. {
  475. required: true,
  476. trigger: "blur",
  477. message: "物料编码不能为空"
  478. }
  479. ],
  480. proviceFlagName: [
  481. {
  482. required: true,
  483. trigger: "change",
  484. message: "下单模式不能为空"
  485. }
  486. ],
  487. // proviceFlagName: [
  488. // {
  489. // required: true,
  490. // trigger: "change",
  491. // validator: proviceFlagName
  492. // }
  493. // ],
  494. // supplierCode: [
  495. // {
  496. // required: true,
  497. // trigger: "change",
  498. // validator: supplierCode
  499. // }
  500. // ],
  501. // size: [
  502. // {
  503. // required: true,
  504. // trigger: "blur",
  505. // validator: size
  506. // }
  507. // ],
  508. // coefficient: [
  509. // {
  510. // required: true,
  511. // trigger: "blur",
  512. // validator: coefficient
  513. // }
  514. // ],
  515. unit: [
  516. {
  517. required: true,
  518. trigger: "change",
  519. message: "物料单位不能为空"
  520. }
  521. ],
  522. // price: [
  523. // {
  524. // required: true,
  525. // trigger: "blur",
  526. // message: "物料单价不能为空"
  527. // }
  528. // ],
  529. price: [
  530. {
  531. required: true,
  532. trigger: "change",
  533. validator: price
  534. }
  535. ],
  536. },
  537. searchList: [
  538. {
  539. type: "sel",
  540. tit: "使用场景",
  541. value: "",
  542. width: "31%",
  543. options: [
  544. {
  545. dataCode: "营业厅-VI改造-自有渠道",
  546. dataName: "营业厅-VI改造-自有渠道"
  547. },
  548. {
  549. dataCode: "营业厅-常规物料-自有渠道",
  550. dataName: "营业厅-常规物料-自有渠道"
  551. },
  552. {
  553. dataCode: "营业厅-VI改造-合作渠道",
  554. dataName: "营业厅-VI改造-合作渠道"
  555. },
  556. {
  557. dataCode: "营业厅-常规物料-合作渠道",
  558. dataName: "营业厅-常规物料-合作渠道"
  559. },
  560. {
  561. dataCode: "小区",
  562. dataName: "小区"
  563. },
  564. {
  565. dataCode: "校园",
  566. dataName: "校园"
  567. },
  568. {
  569. dataCode: "政企",
  570. dataName: "政企"
  571. }
  572. ]
  573. },
  574. {
  575. type: "sel",
  576. tit: "下单模式",
  577. value: "",
  578. width: "31%",
  579. options: [
  580. {
  581. dataCode: "省公司",
  582. dataName: "省公司"
  583. },
  584. {
  585. dataCode: "地市",
  586. dataName: "地市"
  587. },
  588. {
  589. dataCode: "省+地市",
  590. dataName: "省+地市"
  591. },
  592. {
  593. dataCode: "省+市",
  594. dataName: "省+市"
  595. }
  596. ]
  597. },
  598. { type: "input", tit: "物料名称", value: "", width: "31%" },
  599. { type: "input", tit: "物料编码", value: "", width: "31%" }
  600. ],
  601. fileInfot: {
  602. type: 'btn',
  603. typename: '导入',
  604. btntype: 'primary',
  605. limit: 1,
  606. url: '/market/cadvSecbuyMetirial/import',
  607. fileList: [],
  608. woNo: "",
  609. },
  610. tooltit: "宣传物料及印刷品类型建档",
  611. fullscreen: false,
  612. total: 0,
  613. pageSize: 1,
  614. tableData: [],
  615. dialogStatus: false,
  616. disableStatus: false,//是否禁用弹窗
  617. titname: "",
  618. infolist: {
  619. 'infolist.sceneName':[]
  620. },
  621. userInfo: {},
  622. params: {},
  623. centerDialogVisible: false,
  624. messTit: "",
  625. delid: "",
  626. loading: false,
  627. loadinged: false,
  628. //下单模式
  629. proviceopt: [
  630. {
  631. id: "0",
  632. name: "省公司"
  633. },
  634. {
  635. id: "1",
  636. name: "地市"
  637. },
  638. {
  639. id: "2",
  640. name: "省+地市"
  641. },{
  642. id: "3",
  643. name: "省+市"
  644. }
  645. ],
  646. //使用场景
  647. sceneopt: [
  648. {
  649. dataCode: "1",
  650. dataName: "小区"
  651. },
  652. {
  653. dataCode: "2",
  654. dataName: "校园"
  655. },
  656. {
  657. dataCode: "3",
  658. dataName: "营业厅-VI改造-自有渠道"
  659. },
  660. {
  661. dataCode: "4",
  662. dataName: "营业厅-常规物料-自有渠道"
  663. },
  664. {
  665. dataCode: "5",
  666. dataName:'营业厅-VI改造-合作渠道'
  667. },
  668. {
  669. dataCode: "6",
  670. dataName: '营业厅-常规物料-合作渠道'
  671. },
  672. {
  673. dataCode: "7",
  674. dataName: "政企"
  675. }
  676. ],
  677. // 基础数据
  678. isAsicopt: [
  679. {
  680. id: "0",
  681. name: "是"
  682. },
  683. {
  684. id: "1",
  685. name: "否"
  686. }
  687. ],
  688. coefficientopt: [
  689. {
  690. id: "0",
  691. name: "按需录入"
  692. },
  693. {
  694. id: "1",
  695. name: "1"
  696. }
  697. ],
  698. //单位
  699. unitopt: [
  700. {
  701. id: "0",
  702. name: "平方米"
  703. },
  704. {
  705. id: "1",
  706. name: "个"
  707. },
  708. {
  709. id: "2",
  710. name: "延长米"
  711. },
  712. {
  713. id: "3",
  714. name: "套"
  715. },
  716. {
  717. id: "4",
  718. name: "组"
  719. },{
  720. id: "5",
  721. name: "延米"
  722. },{
  723. id:'6',
  724. name:'张'
  725. }
  726. ],
  727. //物料名称
  728. nameopt: [],
  729. //供应商
  730. suppOpt: [],
  731. usePlanceArr: [],
  732. metirialTypeopt: [],
  733. metirialCodeDisableStatus: false,//物料编码是否禁用
  734. // scene:[]
  735. };
  736. },
  737. methods: {
  738. //处理所需数据
  739. verifall(v) {
  740. // for (let j = 0; j < this.suppOpt.length; j++) {
  741. // if (this.suppOpt[j].code == v) {
  742. // this.infolist.supplierName = this.suppOpt[j].name;
  743. // }
  744. // }
  745. },
  746. exportTempletelist() {
  747. let data = this.params;
  748. // console.log(data);
  749. // return
  750. this.$http({
  751. url: "/market/cadvSecbuyMetirial/excelExportTemplete",
  752. method: "post",
  753. headers: {
  754. "Content-Type": "application/json",
  755. },
  756. responseType: "blob",
  757. data: data,
  758. }).then((response) => {
  759. if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  760. let blob = new Blob([response.data], {
  761. type: 'application/vnd.ms-excel'
  762. })
  763. window.navigator.msSaveOrOpenBlob(blob,
  764. new Date().getTime() + '.xlsx')
  765. } else {
  766. /* 火狐谷歌的文件下载方式 */
  767. var blob = new Blob([response.data])
  768. var downloadElement = document.createElement('a')
  769. var href = window.URL.createObjectURL(blob)
  770. downloadElement.href = href
  771. downloadElement.download = new Date().getTime() + '.xlsx'
  772. document.body.appendChild(downloadElement)
  773. downloadElement.click()
  774. document.body.removeChild(downloadElement)
  775. window.URL.revokeObjectURL(href)
  776. }
  777. });
  778. },
  779. usePlance(v) {
  780. this.usePlanceArr = v;
  781. // let value = ''
  782. // if(v == '1'){
  783. // value = 'house';
  784. // }else if(v == '2'){
  785. // value = 'school';
  786. // }else if(v == '3'){
  787. // value = 'serviceHall';
  788. // }
  789. // this.$http({
  790. // url: "/market/cfgDataDict/queryList",
  791. // method: "post",
  792. // headers: {
  793. // "Content-Type": "application/json",
  794. // },
  795. // data: {
  796. // dictCode: value
  797. // },
  798. // }).then((res) => {
  799. // this.nameopt = res.data;
  800. // });
  801. },
  802. closedia() {
  803. this.infolist = {};
  804. this.dialogStatus = false;
  805. },
  806. //搜索数据
  807. searchInfo(v) {
  808. this.params = {};
  809. v[0] ? (this.params.sceneName = v[0]) : "";
  810. v[1] ? (this.params.proviceFlagName = v[1]) : "";
  811. v[2] ? (this.params.metirialName = v[2]) : "";
  812. v[3] ?(this.params.metirialCode = v[3]) :"";
  813. this.getList(this.params, this.pageSize);
  814. },
  815. uploadBack(v) {
  816. let that = this;
  817. // console.log(v);
  818. // console.log(v.data.desc);
  819. // if(v.data.desc != "导入成功"){
  820. // let timer = setTimeout(() => {
  821. // this.$message.error("物料编码已存在,请更改物料编码");
  822. // },800)
  823. // }
  824. if(v.data.result==0){
  825. that.getList({}, 1);
  826. that.getUser();
  827. that.getMetirialType();
  828. that.getMetirialInfo();
  829. }
  830. },
  831. getMetirialInfo() {
  832. this.$http({
  833. url: "/market/cadvSecbuyMetirial/queryList",
  834. method: "post",
  835. headers: {
  836. "Content-Type": "application/json"
  837. },
  838. data: {
  839. dictCodePks: "metirialType"
  840. }
  841. }).then(res => {
  842. this.materialNameopt = res.data;
  843. });
  844. },
  845. getMetirialType() {
  846. this.$http({
  847. url: "/sysmgr/cfgDataDicts/queryMap",
  848. method: "post",
  849. headers: {
  850. "Content-Type": "application/json"
  851. },
  852. data: {
  853. dictCodePks: "metirialType"
  854. }
  855. }).then(res => {
  856. this.metirialTypeopt = res.data.body.metirialType;
  857. });
  858. },
  859. //获取列表
  860. getList(v, n) {
  861. this.pageSize = n;
  862. let _this = this;
  863. this.loading = true;
  864. this.tableData = [];
  865. this.$http({
  866. url: "/market/cadvSecbuyMetirial/queryPage",
  867. method: "post",
  868. headers: {
  869. "Content-Type": "application/json",
  870. page: '{"pageNo":"' + n + '","pageSize":"10"}'
  871. },
  872. data: v
  873. }).then(res => {
  874. res.data.data.forEach(item => {
  875. for (let i = 0; i < this.sceneopt.length; i++) {
  876. if (this.sceneopt[i].dataCode == item.sceneName) {
  877. item.sceneName = this.sceneopt[i].dataName;
  878. }
  879. }
  880. });
  881. this.tableData = res.data.data;
  882. this.total = res.data.totalRecord;
  883. this.loading = false;
  884. });
  885. },
  886. // 分页
  887. currchange(v) {
  888. this.pageSize = v;
  889. this.getList(this.params, this.pageSize);
  890. },
  891. //申请
  892. dialogCheck(v, n) {
  893. this.dialogStatus = true;
  894. this.infolist.sceneName = [],
  895. this.isFirstLoad = true;
  896. this.infolist = Object.assign({}, n);
  897. if (v === 1) {
  898. this.titname = "查看";
  899. this.disableStatus = true;
  900. this.metirialCodeDisableStatus = true;
  901. this.infolist.sceneName = this.infolist.sceneName.split("/");
  902. return;
  903. } else if (v === 2) {
  904. this.titname = "修改";
  905. this.disableStatus = false;
  906. this.metirialCodeDisableStatus = true;
  907. this.infolist.sceneName = this.infolist.sceneName.split("/");
  908. // this.usePlance(n.scene);
  909. } else if (v === 3) {
  910. this.titname = "添加";
  911. this.disableStatus = false;
  912. }
  913. this.infolist.opNo = this.userInfo.loginNo;
  914. this.infolist.opName = this.userInfo.loginName;
  915. },
  916. // 添加1
  917. xintianjia(e) {
  918. this.$refs.infolist.validate((valid) => {
  919. if (valid) {
  920. this.infolist.price = parseFloat(this.infolist.price).toFixed(2);
  921. let scene = "";
  922. this.infolist.sceneName.forEach((item, index) => {
  923. scene += item;
  924. if (index != this.infolist.sceneName.length - 1) {
  925. scene += "/";
  926. }
  927. });
  928. this.infolist.sceneName = scene;
  929. this.$http({
  930. url: "/market/cadvSecbuyMetirial/add",
  931. method: "post",
  932. headers: {
  933. "Content-Type": "application/json",
  934. },
  935. data: this.infolist,
  936. }).then((res) => {
  937. // if(res.data.desc == "添加成功"){
  938. // this.infolist = {};
  939. // this.$message.success("成功");
  940. // this.dialogStatus = false;
  941. // this.getList({}, this.pageSize);
  942. // }
  943. if (res.data.result === 1) {
  944. this.infolist.sceneName = this.infolist.sceneName.split(
  945. "/"
  946. );
  947. this.$message({
  948. message: res.data.desc,
  949. type: "error"
  950. });
  951. } else if (res.data.result === -1) {
  952. this.infolist.sceneName = this.infolist.sceneName.split(
  953. "/"
  954. );
  955. this.$message({
  956. message: res.data.desc,
  957. type: "fail"
  958. });
  959. } else {
  960. this.$message({
  961. message: "成功",
  962. type: "success"
  963. });
  964. this.infolist = {};
  965. this.dialogStatus = false;
  966. this.getList({}, this.pageSize);
  967. }
  968. });
  969. }
  970. })
  971. },
  972. //添加
  973. dialogCli(v) {
  974. if (v === 1) {
  975. this.infolist = {};
  976. this.dialogStatus = false;
  977. return;
  978. } else {
  979. this.infolist.opTime = this.$formatDate(
  980. new Date(),
  981. "YYYY-MM-DD"
  982. );
  983. this.infolist.sts = "0";
  984. this.infolist.stsDesc = "在用";
  985. // this.infolist.proviceFlagName = this.infolist.proviceFlag
  986. // this.infolist.proviceFlagName = this.infolist.proviceFlag == "0"?'省公司':'地市公司';
  987. if (this.infolist.proviceFlag == 0) {
  988. this.infolist.proviceFlagName = "省公司";
  989. } else if (this.infolist.proviceFlag == 1) {
  990. this.infolist.proviceFlagName = "地市公司";
  991. } else if (this.infolist.proviceFlag == 2) {
  992. this.infolist.proviceFlagName = "省+地市";
  993. }
  994. if (this.titname === "添加") {
  995. this.submitInfo("/market/cadvSecbuyMetirial/add");
  996. } else if (this.titname === "修改") {
  997. this.submitInfo("/market/cadvSecbuyMetirial/update", v);
  998. }
  999. }
  1000. },
  1001. submitInfo(u) {
  1002. this.infolist.price = parseFloat(this.infolist.price).toFixed(2);
  1003. let _this = this;
  1004. this.$refs.infolist.validate(valid => {
  1005. if (valid) {
  1006. this.loadinged = true;
  1007. let scene = "";
  1008. this.infolist.sceneName.forEach((item, index) => {
  1009. scene += item;
  1010. if (index != this.infolist.sceneName.length - 1) {
  1011. scene += "/";
  1012. }
  1013. });
  1014. this.infolist.sceneName = scene;
  1015. this.$http({
  1016. url: u,
  1017. method: "post",
  1018. headers: {
  1019. "Content-Type": "application/json"
  1020. },
  1021. data: this.infolist
  1022. }).then(res => {
  1023. this.loadinged = false;
  1024. if (res.data.result === 1) {
  1025. this.infolist.sceneName = this.infolist.sceneName.split(
  1026. "/"
  1027. );
  1028. _this.$message({
  1029. message: res.data.desc,
  1030. type: "error"
  1031. });
  1032. } else if (res.data.result === -1) {
  1033. this.infolist.sceneName = this.infolist.sceneName.split(
  1034. "/"
  1035. );
  1036. _this.$message({
  1037. message: res.data.desc,
  1038. type: "fail"
  1039. });
  1040. } else {
  1041. _this.$message({
  1042. message: "成功",
  1043. type: "success"
  1044. });
  1045. _this.infolist = {};
  1046. _this.dialogStatus = false;
  1047. _this.getList({}, _this.pageSize);
  1048. }
  1049. });
  1050. }
  1051. });
  1052. },
  1053. closeMessage(v) {
  1054. this.centerDialogVisible = false;
  1055. let _this = this;
  1056. if (v === 1) {
  1057. _this
  1058. .$http({
  1059. url: "/market/cadvSecbuyMetirial/del",
  1060. method: "post",
  1061. headers: {
  1062. "Content-Type": "application/json"
  1063. },
  1064. data: {
  1065. id: this.delid
  1066. }
  1067. })
  1068. .then(res => {
  1069. if (res.data.result === 1) {
  1070. _this.$message({
  1071. message: res.data.desc,
  1072. type: "error"
  1073. });
  1074. } else if (res.data.result === -1) {
  1075. _this.$message({
  1076. message: res.data.desc,
  1077. type: "fail"
  1078. });
  1079. } else {
  1080. _this.$message({
  1081. message: "删除成功",
  1082. type: "success"
  1083. });
  1084. _this.getList(this.params, this.pageSize);
  1085. }
  1086. });
  1087. }
  1088. },
  1089. //删除
  1090. delLine(v) {
  1091. this.centerDialogVisible = true;
  1092. this.messTit = "即将删除此条数据, 是否删除?";
  1093. this.delid = v.id;
  1094. },
  1095. //文件返回值
  1096. //功能栏
  1097. iconCli(v) {
  1098. if (v === 1) {
  1099. this.getList(this.params, this.pageSize);
  1100. }
  1101. if (v === 2) {
  1102. this.fullscreen = !this.fullscreen;
  1103. }
  1104. },
  1105. getUser() {
  1106. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  1107. this.$http({
  1108. url: "/market/cadvSupplier/queryValidSupplierList",
  1109. method: "post",
  1110. headers: {
  1111. "Content-Type": "application/json"
  1112. },
  1113. // data: { buyTypeCode: "2" }
  1114. data: {}
  1115. }).then(res => {
  1116. this.suppOpt = res.data;
  1117. });
  1118. }
  1119. },
  1120. mounted() {
  1121. this.getList({}, 1);
  1122. this.getUser();
  1123. // this.$http({
  1124. // url: "/sysmgr/cfgDataDicts/queryMap",
  1125. // method: "post",
  1126. // headers: {
  1127. // "Content-Type": "application/json"
  1128. // },
  1129. // data: {
  1130. // dictCodePks: "metirialType"
  1131. // }
  1132. // }).then(res => {
  1133. // this.metirialTypeopt = res.data.body.metirialType;
  1134. // // this.stypeList = res.data.body.materType;
  1135. // });
  1136. },
  1137. created() {
  1138. // if (this.multiples) this.infolist.sceneName = []
  1139. this.$set(this.infolist, 'this.infolist.sceneName', [])
  1140. }
  1141. };
  1142. </script>
  1143. <style scoped lang="scss">
  1144. .onetab {
  1145. margin-bottom: 20px;
  1146. padding: 0 20px;
  1147. }
  1148. .titbox {
  1149. div {
  1150. float: right;
  1151. i {
  1152. font-size: 22px;
  1153. margin-left: 20px;
  1154. cursor: pointer;
  1155. }
  1156. }
  1157. }
  1158. .tabbox {
  1159. margin-top: 15px;
  1160. }
  1161. .pageBox {
  1162. text-align: right;
  1163. margin-top: 10px;
  1164. }
  1165. .info-line {
  1166. width: 100%;
  1167. display: block;
  1168. padding-left: 20px;
  1169. div {
  1170. width: 50%;
  1171. display: inline-block;
  1172. }
  1173. span {
  1174. width: 80px;
  1175. display: inline-block;
  1176. text-align: left;
  1177. i {
  1178. color: red;
  1179. display: inline-block;
  1180. padding-right: 5px;
  1181. }
  1182. }
  1183. .el-select,
  1184. .el-input {
  1185. width: calc(100% - 100px);
  1186. }
  1187. }
  1188. .online {
  1189. width: 100%;
  1190. .el-select {
  1191. width: calc(100% - 100px);
  1192. }
  1193. span {
  1194. vertical-align: top;
  1195. }
  1196. .el-textarea {
  1197. width: calc(100% - 100px);
  1198. }
  1199. }
  1200. </style>