index.vue 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706
  1. <template>
  2. <div class="app-container">
  3. <el-dialog
  4. :title="upload.title"
  5. :visible.sync="upload.open"
  6. width="400px"
  7. append-to-body
  8. >
  9. <el-upload
  10. ref="upload"
  11. :limit="1"
  12. accept=".xlsx, .xls"
  13. :headers="upload.headers"
  14. :action="
  15. upload.url +
  16. '?updateSupport=' +
  17. upload.updateSupport +
  18. '&tableName=' +
  19. tableName +
  20. '&sqlKey=' +
  21. tableKey
  22. "
  23. v-loading="upload.isUploading"
  24. :disabled="upload.isUploading"
  25. :on-progress="handleFileUploadProgress"
  26. :on-success="handleFileSuccess"
  27. :auto-upload="false"
  28. :onChange="handleChange"
  29. drag
  30. >
  31. <i class="el-icon-upload"></i>
  32. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  33. <div class="el-upload__tip text-center" slot="tip">
  34. <!-- <div class="el-upload__tip" slot="tip">-->
  35. <!-- <el-checkbox v-model="upload.updateSupport"/>-->
  36. <!-- 是否更新已经存在的用户数据-->
  37. <!-- </div>-->
  38. <span>仅允许导入xls、xlsx格式文件。</span>
  39. <el-link
  40. type="primary"
  41. :underline="false"
  42. style="font-size: 12px; vertical-align: baseline"
  43. @click="importTemplate"
  44. >下载模板
  45. </el-link>
  46. </div>
  47. </el-upload>
  48. <div slot="footer" class="dialog-footer">
  49. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  50. <el-button @click="upload.open = false">取 消</el-button>
  51. </div>
  52. </el-dialog>
  53. <Queryfrom
  54. :form-vals="templateInfo.where"
  55. :statisticList="statisticList"
  56. :showCount="showCount"
  57. :showSearch="showSearch"
  58. @getList="getList"
  59. ref="mychild"
  60. />
  61. <el-row :gutter="10" class="mb8">
  62. <el-col :span="1.5">
  63. <el-button
  64. type="primary"
  65. plain
  66. icon="el-icon-plus"
  67. size="mini"
  68. @click="addHandler"
  69. >新增
  70. </el-button>
  71. </el-col>
  72. <!-- <el-col :span="1.5" v-if="false">
  73. <el-button
  74. type="success"
  75. plain
  76. icon="el-icon-edit"
  77. size="mini"
  78. :disabled="single"
  79. @click="handleUpdate"
  80. >修改
  81. </el-button>
  82. </el-col> -->
  83. <el-col :span="1.5">
  84. <el-button
  85. type="danger"
  86. plain
  87. icon="el-icon-delete"
  88. size="mini"
  89. :disabled="multiple"
  90. @click="batchDelete"
  91. >删除
  92. </el-button>
  93. </el-col>
  94. <el-col :span="1.5">
  95. <el-button
  96. plain
  97. icon="el-icon-upload2"
  98. size="mini"
  99. @click="upload.open = true"
  100. >导入
  101. </el-button>
  102. </el-col>
  103. <el-col :span="1.5">
  104. <el-button
  105. type="warning"
  106. plain
  107. icon="el-icon-download"
  108. size="mini"
  109. @click="handleExport"
  110. >导出
  111. </el-button>
  112. </el-col>
  113. <right-toolbar
  114. style="float: right"
  115. :showCount.sync="showCount"
  116. :showSearch.sync="showSearch"
  117. :counts="true"
  118. @queryTable="pageList"
  119. ></right-toolbar>
  120. <el-radio-group
  121. style="float: right; margin-right: 100px"
  122. v-model="orderType"
  123. size="mini"
  124. @change="orderTypeChange"
  125. >
  126. <el-radio-button :label="0">全部</el-radio-button>
  127. <el-radio-button :label="1">库存</el-radio-button>
  128. <el-radio-button :label="2">生产</el-radio-button>
  129. </el-radio-group>
  130. </el-row>
  131. <el-table
  132. v-loading="loading"
  133. :data="tableList"
  134. @selection-change="handleSelectionChange"
  135. ref="tableRef"
  136. :cell-style="cellStyle"
  137. :reserve-selection="true"
  138. :row-key="getRowKey"
  139. >
  140. <el-table-column
  141. type="selection"
  142. width="55"
  143. reserve-selection
  144. align="center"
  145. >
  146. </el-table-column>
  147. <!-- <span v-for="(key, val) in columns" :key="key">
  148. <el-table-column :label="key" align="center" :prop="val" />
  149. </span> -->
  150. <el-table-column
  151. v-for="item in columns"
  152. :key="item.key"
  153. :label="item.value"
  154. align="center"
  155. :prop="item.key"
  156. >
  157. <template slot-scope="scope">
  158. <!-- 存在字段样式或字典样式 -->
  159. <template
  160. v-if="
  161. scope.row.styleFieldObj != undefined &&
  162. scope.row.styleFieldObj[item.key]
  163. "
  164. >
  165. <!-- 字段样式 -->
  166. <template v-if="scope.row.styleFieldObj[item.key].styleType == 1">
  167. <!-- 一般字体样式 -->
  168. <template
  169. v-if="scope.row.styleFieldObj[item.key].fieldStyleType == 0"
  170. >
  171. <span
  172. :style="`color:${
  173. scope.row.styleFieldObj[item.key].fontColor
  174. }`"
  175. >{{ scope.row[item.key] }}</span
  176. >
  177. </template>
  178. <!-- 标签字体样式 -->
  179. <template
  180. v-else-if="
  181. scope.row.styleFieldObj[item.key].fieldStyleType == 1
  182. "
  183. >
  184. <el-tag
  185. :type="scope.row.styleFieldObj[item.key].tagType"
  186. :effect="
  187. scope.row.styleFieldObj[item.key].isTagFullBg
  188. ? 'dark'
  189. : 'light'
  190. "
  191. >
  192. {{ scope.row[item.key] }}
  193. </el-tag>
  194. </template>
  195. </template>
  196. <!-- 字典样式 -->
  197. <template
  198. v-else-if="scope.row.styleFieldObj[item.key].styleType == 2"
  199. >
  200. <span
  201. v-if="
  202. scope.row.styleFieldObj[item.key].listClass == '' ||
  203. scope.row.styleFieldObj[item.key].listClass == 'default'
  204. "
  205. >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
  206. >
  207. <el-tag
  208. v-else
  209. :type="
  210. scope.row.styleFieldObj[item.key].listClass == 'primary'
  211. ? ''
  212. : scope.row.styleFieldObj[item.key].listClass
  213. "
  214. >{{ scope.row.styleFieldObj[item.key].dictLabel }}</el-tag
  215. >
  216. </template>
  217. </template>
  218. <!-- 显示默认值 -->
  219. <template v-else>
  220. {{ scope.row[item.key] }}
  221. </template>
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. v-if="isShowExcuteCol"
  226. label="操作"
  227. align="center"
  228. class-name="small-padding fixed-width"
  229. >
  230. <template slot-scope="scope">
  231. <!-- <el-button
  232. type="info"
  233. size="default"
  234. @click="handleEdit(scope.$index, scope.row)"
  235. >编辑</el-button
  236. > -->
  237. <Menu
  238. :row="scope.row"
  239. v-for="btnObj in excuteBtnArr"
  240. :key="btnObj.id"
  241. :listAll="btnObj"
  242. @excuteHandler="excuteHandler"
  243. ></Menu>
  244. </template>
  245. </el-table-column>
  246. </el-table>
  247. <pagination
  248. v-show="total > 0"
  249. :total="total"
  250. :page.sync="queryParams.pageNum"
  251. :limit.sync="queryParams.pageSize"
  252. @pagination="pageList"
  253. />
  254. <!-- k-form-build 组件渲染弹窗-->
  255. <el-dialog :title="title" :visible.sync="kOpen" append-to-body>
  256. <k-form-build
  257. v-if="jsonData"
  258. class="formBuild"
  259. ref="addFromRef"
  260. :dynamicData="dynamicData"
  261. :defaultValue="defaultValue"
  262. @submit="tempSubBtn"
  263. @change="formChangeHandler"
  264. :value="jsonData"
  265. />
  266. <div slot="footer" class="dialog-footer">
  267. <el-button type="primary" @click="editConfirmHandler">确 定</el-button>
  268. <el-button @click="kCancel">取 消</el-button>
  269. </div>
  270. </el-dialog>
  271. <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
  272. <el-dialog :title="title" :visible.sync="open" append-to-body>
  273. <!-- <iframe
  274. :src="iframeUrl"
  275. width="100%"
  276. height="600px"
  277. style="border: none"
  278. scrolling="no"
  279. >
  280. </iframe> -->
  281. <!-- <k-form-build
  282. v-if="jsonData"
  283. class="formBuild"
  284. ref="addFromRef"
  285. :dynamicData="dynamicData"
  286. :defaultValue="defaultValue"
  287. @submit="tempSubBtn"
  288. @change="formChangeHandler"
  289. :value="jsonData"
  290. /> -->
  291. <el-row :gutter="20">
  292. <el-form
  293. :model="formData"
  294. ref="formDataRef"
  295. :rules="rules"
  296. label-width="100px"
  297. :inline="true"
  298. size="normal"
  299. >
  300. <!-- <el-form-item prop="saleNo" label="合同号:">
  301. <el-input size="small" v-model="formData.saleNo"></el-input>
  302. </el-form-item> -->
  303. <el-col :span="12">
  304. <el-form-item prop="saleDate" label="日期:">
  305. <el-date-picker
  306. size="small"
  307. v-model="formData.saleDate"
  308. value-format="yyyy-MM-dd"
  309. format="yyyy-MM-dd"
  310. type="date"
  311. placeholder="选择日期"
  312. >
  313. </el-date-picker>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :span="12">
  317. <el-form-item prop="saleCustomNo" label="客户名称:">
  318. <el-select
  319. size="small"
  320. v-model="formData.saleCustomNo"
  321. placeholder="请选择客户"
  322. clearable
  323. filterable
  324. @change="customChangeHandler"
  325. >
  326. <el-option
  327. v-for="item in customerOptions"
  328. :key="item.customNo"
  329. :label="item.customName"
  330. :value="item.customNo"
  331. >
  332. </el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="12">
  337. <el-form-item label="联系人:" size="normal">
  338. {{ formData.contactPerson }}
  339. </el-form-item>
  340. <el-form-item label="客户地址:" size="normal">
  341. {{ formData.customAddress }}
  342. </el-form-item>
  343. <el-form-item label="客户国别:" size="normal">
  344. {{ formData.customCountryType }}
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="12">
  348. <el-form-item
  349. label-width="120px"
  350. prop="saleDate"
  351. label="预计下单时间:"
  352. >
  353. <el-date-picker
  354. size="small"
  355. v-model="formData.saleOrderEstimatedTime"
  356. value-format="yyyy-MM-dd"
  357. format="yyyy-MM-dd"
  358. type="date"
  359. placeholder="选择日期"
  360. >
  361. </el-date-picker>
  362. </el-form-item>
  363. </el-col>
  364. <el-col :span="12">
  365. <el-form-item label="交货周期:" size="normal" prop="saleLeadTime">
  366. <el-input size="small" v-model="formData.saleLeadTime"></el-input>
  367. </el-form-item>
  368. </el-col>
  369. <el-col :span="24">
  370. <el-divider>货品明细</el-divider>
  371. </el-col>
  372. <el-table
  373. :data="productionTableData"
  374. border
  375. show-summary
  376. :summary-method="getSummaries"
  377. sum-text="小计"
  378. style="width: 100%"
  379. >
  380. <el-table-column prop="productName" label="品名" width="180">
  381. <template slot-scope="scope">
  382. <!-- <el-input
  383. v-model="scope.row.productName"
  384. size="small"
  385. clearable
  386. ></el-input> -->
  387. <el-select
  388. v-model="scope.row.productNo"
  389. placeholder=""
  390. clearable
  391. filterable
  392. @change="handleProductChange(scope.row.productNo, scope.row)"
  393. >
  394. <el-option
  395. v-for="item in productionOptions"
  396. :key="item.productNo"
  397. :label="item.productName"
  398. :value="item.productNo"
  399. >
  400. </el-option>
  401. </el-select>
  402. </template>
  403. </el-table-column>
  404. <el-table-column prop="productNumber" label="数量/kg">
  405. <template slot-scope="scope">
  406. <el-input
  407. v-model="scope.row.productNumber"
  408. size="small"
  409. clearable
  410. @change="computedPrice(scope.row)"
  411. ></el-input>
  412. </template>
  413. </el-table-column>
  414. <el-table-column prop="productUnitPrice" label="单价">
  415. <template slot-scope="scope">
  416. <el-input
  417. v-model="scope.row.productUnitPrice"
  418. size="small"
  419. @change="computedPrice(scope.row)"
  420. clearable
  421. ></el-input>
  422. </template>
  423. </el-table-column>
  424. <el-table-column prop="productAmounts" label="金额">
  425. <template slot-scope="scope">
  426. <!-- <el-input
  427. v-model="scope.row.productAmounts"
  428. size="small"
  429. clearable
  430. ></el-input> -->
  431. {{ scope.row.productAmounts }}
  432. </template>
  433. </el-table-column>
  434. <el-table-column prop="sliceType" label="切片型号">
  435. <template slot-scope="scope">
  436. <el-select
  437. v-model="scope.row.sliceType"
  438. placeholder=""
  439. clearable
  440. filterable
  441. @change="sliceTypeChangeHandler(scope.row)"
  442. >
  443. <el-option
  444. v-for="item in sliceTypeOptions"
  445. :key="item.materielCode"
  446. :label="item.materielName"
  447. :value="item.materielCode"
  448. >
  449. </el-option>
  450. </el-select>
  451. </template>
  452. </el-table-column>
  453. <el-table-column prop="colourNumber" label="色号">
  454. <template slot-scope="scope">
  455. <el-select
  456. v-model="scope.row.colourNumber"
  457. placeholder=""
  458. clearable
  459. filterable
  460. @change="colourNumberChangeHandler(scope.row)"
  461. >
  462. <el-option
  463. v-for="item in colourNumberOptions"
  464. :key="item.materielCode"
  465. :label="item.materieColorNumber"
  466. :value="item.materielCode"
  467. >
  468. </el-option>
  469. </el-select>
  470. </template>
  471. </el-table-column>
  472. <el-table-column prop="remark" label="备注">
  473. <template slot-scope="scope">
  474. <el-input
  475. v-model="scope.row.remark"
  476. size="small"
  477. clearable
  478. ></el-input>
  479. </template>
  480. </el-table-column>
  481. <el-table-column label="操作">
  482. <template slot-scope="scope">
  483. <el-button
  484. type="danger"
  485. size="small"
  486. @click="deleteProduct(scope.$index)"
  487. >删除</el-button
  488. >
  489. </template>
  490. </el-table-column>
  491. </el-table>
  492. <el-button
  493. class="mt5"
  494. type="primary"
  495. style="width: 100%"
  496. size="small"
  497. @click="addProduct"
  498. >添加货品</el-button
  499. >
  500. <el-col :span="12">
  501. <el-form-item label-width="120px" label="合计金额(大写)">
  502. <el-input
  503. v-model="formData.saleAmountInWords"
  504. size="small"
  505. clearable
  506. ></el-input>
  507. </el-form-item>
  508. </el-col>
  509. <el-col :span="12">
  510. <el-form-item label="付款方式">
  511. <el-input
  512. v-model="formData.salePayType"
  513. size="small"
  514. clearable
  515. ></el-input>
  516. </el-form-item>
  517. </el-col>
  518. <el-col :span="24">
  519. <el-divider>工艺要求</el-divider>
  520. </el-col>
  521. <el-col :span="12">
  522. <el-form-item label="网络:">
  523. <el-input
  524. v-model="formData.craftGrid"
  525. size="small"
  526. clearable
  527. ></el-input>
  528. </el-form-item>
  529. </el-col>
  530. <el-col :span="12">
  531. <el-form-item label="油剂:">
  532. <el-input
  533. v-model="formData.craftOil"
  534. size="small"
  535. clearable
  536. ></el-input>
  537. </el-form-item>
  538. </el-col>
  539. <el-col :span="12">
  540. <el-form-item label="卷装:">
  541. <el-input
  542. v-model="formData.craftPackage"
  543. size="small"
  544. clearable
  545. ></el-input>
  546. </el-form-item>
  547. </el-col>
  548. <el-col :span="12">
  549. <el-form-item label="色牢度:">
  550. <el-input
  551. v-model="formData.craftColorFastness"
  552. size="small"
  553. clearable
  554. ></el-input>
  555. </el-form-item>
  556. </el-col>
  557. <el-col :span="12">
  558. <el-form-item label="其它:">
  559. <el-input
  560. v-model="formData.craftOther"
  561. size="small"
  562. clearable
  563. ></el-input>
  564. </el-form-item>
  565. </el-col>
  566. <el-col :span="12">
  567. <el-form-item label="包装/贴唛:">
  568. <el-input
  569. v-model="formData.craftMark"
  570. size="small"
  571. clearable
  572. ></el-input>
  573. </el-form-item>
  574. </el-col>
  575. <el-col :span="12">
  576. <el-form-item label="运输方式:">
  577. <el-input
  578. v-model="formData.shippingMethod"
  579. size="small"
  580. clearable
  581. ></el-input>
  582. </el-form-item>
  583. </el-col>
  584. <el-col :span="24">
  585. <el-divider>审计人员数据</el-divider>
  586. </el-col>
  587. <el-col :span="12">
  588. <el-form-item label="业务员:">
  589. <!-- <el-input
  590. v-model="formData.salesman"
  591. size="small"
  592. clearable
  593. ></el-input> -->
  594. {{ nickName }}
  595. </el-form-item>
  596. </el-col>
  597. </el-form>
  598. </el-row>
  599. <div slot="footer" class="dialog-footer">
  600. <el-button type="primary" @click="editConfirm">确 定</el-button>
  601. <el-button @click="cancel">取 消</el-button>
  602. </div>
  603. </el-dialog>
  604. <!-- 绑定按钮dialog -->
  605. <el-dialog
  606. title="提示"
  607. :visible.sync="btnDialogVisible"
  608. :before-close="handleClose"
  609. >
  610. <DialogTemplate
  611. ref="dialogRef"
  612. :groupKey="groupKey"
  613. :rowobj="rowobj"
  614. :subCount="subCount"
  615. :tableCount="tableCount"
  616. :subTableName="subTableName"
  617. @addList="addListHandler"
  618. >
  619. </DialogTemplate>
  620. <span slot="footer" class="dialog-footer">
  621. <el-button @click="btnDialogVisible = false">取 消</el-button>
  622. <el-button type="primary" @click="btnComfirm">确 定</el-button>
  623. </span>
  624. </el-dialog>
  625. <!-- 自定义弹窗 -->
  626. <el-dialog
  627. title="提示"
  628. :visible.sync="btnDialogVisible"
  629. :before-close="handleClose"
  630. >
  631. <DialogTemplate
  632. ref="dialogRef"
  633. :groupKey="groupKey"
  634. :rowobj="rowobj"
  635. :subCount="subCount"
  636. :tableCount="tableCount"
  637. :subTableName="subTableName"
  638. @addList="addListHandler"
  639. >
  640. </DialogTemplate>
  641. <span slot="footer" class="dialog-footer">
  642. <el-button @click="btnDialogVisible = false">取 消</el-button>
  643. <el-button type="primary" @click="btnComfirm">确 定</el-button>
  644. </span>
  645. </el-dialog>
  646. <!-- 详情弹窗 -->
  647. <el-dialog title="详情" :visible.sync="detailShow" width="1200px">
  648. <div ref="detailTable" id="detail"></div>
  649. <span slot="footer" class="dialog-footer">
  650. <el-button @click="detailShow = false">取 消</el-button>
  651. <el-button type="primary" @click="detailPrintHandler">打 印</el-button>
  652. </span>
  653. </el-dialog>
  654. <div id="printDom"></div>
  655. </div>
  656. </template>
  657. <script>
  658. import {
  659. delTableData,
  660. dragTableInfo,
  661. listTable,
  662. unionListTableData,
  663. getInfoBySqlKey,
  664. btnCommonApi,
  665. addTableData,
  666. batchEdit,
  667. getStatisticList,
  668. getTableList1,
  669. } from "@/api/tablelist/commonTable";
  670. import { listData } from "@/api/system/tenant/data";
  671. import { getToken } from "@/utils/auth";
  672. import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
  673. import { camelCase, toUnderline } from "@/utils";
  674. import { inputDisableComplete } from "@/utils/other";
  675. import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
  676. import { checkRole } from "@/utils/permission";
  677. import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
  678. import { queryDropDownBoxData } from "@/api/dragform/form";
  679. import { v4 as uuidv4 } from "uuid";
  680. import { mapState } from "vuex";
  681. import moment from "moment";
  682. export default {
  683. name: "listInfo",
  684. components: { Queryfrom, Menu, DialogTemplate },
  685. data() {
  686. return {
  687. // 详情弹窗数据
  688. detailShow: false,
  689. printDomData: "",
  690. // k-form-build组件渲染弹窗
  691. kOpen: false,
  692. // 新的自定义数据 start
  693. orderType: 0, //新的条件查询参数
  694. productIds: [], //货品Ids
  695. isEdit: false,
  696. formData: {
  697. //订单表数据
  698. saleNo: "", //合同号
  699. saleCustomNo: "", //客户编号
  700. saleDate: "", //销售单日期
  701. saleOrderEstimatedTime: "", //预计下单时间
  702. saleLeadTime: "", //交货周期
  703. saleAmounts: "", //合计金额 小写
  704. saleAmountInWords: "", //合计金额 大写
  705. salePayType: "", //支付方式
  706. salesman: "", //业务员
  707. saleLeader: "", //业务主管
  708. finance: "", //财务部
  709. production: "", //生产部
  710. saleApprover: "", //批准人
  711. customAddress: "", //客户地址
  712. customCountryType: "", //国家类型
  713. contactPerson: "", //联系人
  714. // 货品明细表数据
  715. productNo: "", //货品号
  716. productName: "", //货品名称
  717. productNumber: "", //销售数量
  718. productWeight: "", //销售重量kg
  719. productUnitPrice: "", //单价
  720. productAmounts: "", //金额
  721. sliceType: "", //切片类型
  722. sliceTypeLabel: "",
  723. colourNumberLabel: "",
  724. colourNumber: "", //色号
  725. remark: "", //备注
  726. // 工艺表
  727. craftGrid: "", //网络
  728. craftOil: "", //油剂
  729. craftPackage: "", //卷装
  730. craftColorFastness: "", //色牢度
  731. craftOther: "", //其它工艺要求
  732. craftMark: "", //包装/贴唛
  733. shippingMethod: "", //运输方式
  734. },
  735. productionOptions: [],
  736. customerOptions: [],
  737. productionTableData: [
  738. // {
  739. // productNo: "", //货品名称
  740. // productNumber: 2, //销售数量
  741. // productWeight: 1, //销售重量kg
  742. // productUnitPrice: 20, //单价
  743. // productAmounts: 20, //金额
  744. // remark: "", //备注
  745. // },
  746. ],
  747. rules: {
  748. saleDate: [
  749. {
  750. required: true,
  751. message: "请选择日期",
  752. trigger: "change",
  753. },
  754. ],
  755. saleCustomNo: [
  756. {
  757. required: true,
  758. message: "请选择客户",
  759. trigger: "change",
  760. },
  761. ],
  762. saleDate: [
  763. {
  764. required: true,
  765. message: "请选择预计下单时间",
  766. trigger: "change",
  767. },
  768. ],
  769. saleLeadTime: [
  770. {
  771. required: true,
  772. message: "请输入交货周期",
  773. trigger: "blur",
  774. },
  775. ],
  776. },
  777. // end
  778. // 绑定按钮dialog
  779. btnDialogVisible: false,
  780. // 绑定修改dialog
  781. groupKey: "",
  782. // 遮罩层
  783. loading: true,
  784. // 选中数组
  785. ids: [],
  786. // 非单个禁用
  787. single: true,
  788. // 非多个禁用
  789. multiple: true,
  790. // 显示统计
  791. showCount: true,
  792. // 显示搜索条件
  793. showSearch: true,
  794. // 总条数
  795. total: 0,
  796. // 用户表格数据
  797. tableList: [],
  798. // 弹出层标题
  799. title: "",
  800. // 日期范围
  801. dateRange: [],
  802. // 表单参数
  803. form: {},
  804. // cru 弹窗
  805. open: false,
  806. // excel共通导入数据
  807. upload: {
  808. // 是否显示弹出层
  809. open: false,
  810. // 弹出层标题(
  811. title: "",
  812. // 是否禁用上传
  813. isUploading: false,
  814. // 是否更新已经存在的数据
  815. updateSupport: 0,
  816. // 设置上传的请求头部
  817. headers: { Authorization: "Bearer " + getToken() },
  818. // 上传的地址
  819. url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
  820. },
  821. // 排序方式 默认降序
  822. sortOrder: true,
  823. // 共通查询参数接受子组件的参数
  824. queryParams: {
  825. pageNum: 1, // 第几页
  826. pageSize: 10, // 每页大小
  827. orderByColumn: "", // 根据某列排序
  828. isAsc: "", // desc(降序)或 asc(升序)
  829. saleOrderOrderType: "",
  830. // 基本查询参数
  831. basicMap: {
  832. tableName: "drag_form",
  833. },
  834. // 当前表字段筛选参数
  835. queryMap: {
  836. // 当前查询基本参数
  837. // ... key : value 当前页面的筛选条件
  838. // 超级查询的唯一值
  839. queryCriteriaValue: "",
  840. },
  841. },
  842. // 列信息
  843. columns: {},
  844. // 当前模版信息
  845. templateInfo: {},
  846. // 查询条件
  847. queryFromWhere: {},
  848. // 当前table唯一标识
  849. tableKey: null,
  850. // 当前表名称
  851. tableName: null,
  852. //存放html代码块
  853. iframeUrl: "",
  854. //存放表单渲染数据
  855. jsonData: {},
  856. // 回显表格数据,
  857. defaultValue: {},
  858. // 统计card
  859. statisticList: [],
  860. // 样式表
  861. styleList: [],
  862. // 字典样式对象
  863. dictStyleObj: {},
  864. // 操作列 按钮数据
  865. excuteBtnArr: [],
  866. // 下拉框动态数据
  867. dynamicData: {},
  868. // 当前点击按钮的数据
  869. currentBtnData: {},
  870. // 修改选中行
  871. rowobj: {},
  872. // 该行的统计信息
  873. subCount: [],
  874. tableCount: [],
  875. // 弹窗新增数据
  876. addLists: [],
  877. subTableName: "",
  878. // 当前点击行的数据
  879. currentRow: {},
  880. };
  881. },
  882. created() {
  883. // 得到当前展示的table的唯一标识
  884. this.tableKey = this.$route.query.tableKey;
  885. },
  886. watch: {},
  887. async mounted() {
  888. await this.getDropDownData();
  889. },
  890. computed: {
  891. isShowExcuteCol() {
  892. return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
  893. },
  894. ...mapState({
  895. nickName: (state) => state.user.nickName,
  896. }),
  897. },
  898. methods: {
  899. // 产品名称改变
  900. handleProductChange(productNo, row) {
  901. if (!productNo) {
  902. return;
  903. }
  904. row.productName = this.productionOptions.find(
  905. (item) => item.productNo == productNo
  906. )?.productName;
  907. },
  908. // 订单类型改变回调
  909. orderTypeChange(type) {
  910. this.getList(false, type);
  911. },
  912. // 重置审计表单数据
  913. resetFormData() {
  914. Object.assign(this.formData, {
  915. //订单表数据
  916. saleNo: "", //合同号
  917. saleCustomNo: "", //客户编号
  918. saleDate: "", //销售单日期
  919. saleOrderEstimatedTime: "", //预计下单时间
  920. saleLeadTime: "", //交货周期
  921. saleAmounts: "", //合计金额 小写
  922. saleAmountInWords: "", //合计金额 大写
  923. salePayType: "", //支付方式
  924. salesman: "", //业务员
  925. saleLeader: "", //业务主管
  926. finance: "", //财务部
  927. production: "", //生产部
  928. saleApprover: "", //批准人
  929. customAddress: "", //客户地址
  930. customCountryType: "", //国家类型
  931. contactPerson: "", //联系人
  932. // 货品明细表数据
  933. productNo: "", //货品号
  934. productName: "", //货品名称
  935. productNumber: "", //销售数量
  936. productWeight: "", //销售重量kg
  937. productUnitPrice: "", //单价
  938. productAmounts: "", //金额
  939. sliceType: "", //切片类型
  940. sliceTypeLabel: "",
  941. colourNumberLabel: "",
  942. colourNumber: "", //色号
  943. remark: "", //备注
  944. // 工艺表
  945. craftGrid: "", //网络
  946. craftOil: "", //油剂
  947. craftPackage: "", //卷装
  948. craftColorFastness: "", //色牢度
  949. craftOther: "", //其它工艺要求
  950. craftMark: "", //包装/贴唛
  951. shippingMethod: "", //运输方式
  952. });
  953. this.productionTableData = [];
  954. },
  955. // 自定义的小计计算方法
  956. getSummaries(param) {
  957. const { columns, data } = param;
  958. console.log(columns, data);
  959. const sums = [];
  960. columns.forEach((column, index) => {
  961. if (index === 0) {
  962. sums[index] = "小计";
  963. return;
  964. }
  965. const values = data.map((item) => Number(item[column.property]));
  966. if (index === 4 || index === 5 || index === 6 || index === 7) {
  967. sums[index] = "";
  968. } else if (!values.every((value) => isNaN(value))) {
  969. sums[index] = values.reduce((prev, curr) => {
  970. const value = Number(curr);
  971. if (!isNaN(value)) {
  972. return prev + curr;
  973. } else {
  974. return prev;
  975. }
  976. }, 0);
  977. sums[index];
  978. } else {
  979. sums[index] = "N/A";
  980. }
  981. });
  982. return sums;
  983. },
  984. // 货品表格数据删除回调
  985. deleteProduct(index) {
  986. this.productionTableData.splice(index, 1);
  987. },
  988. // 货品表格数据新增回调
  989. addProduct() {
  990. this.productionTableData.push({
  991. saleProductNo: uuidv4(),
  992. productNo: "", //货品编号
  993. productName: "", //货品名称
  994. productNumber: "", //销售数量
  995. productWeight: "", //销售重量kg
  996. productUnitPrice: "", //单价
  997. productAmounts: "", //金额
  998. sliceType: "", //切片类型
  999. sliceTypeLabel: "",
  1000. colourNumberLabel: "",
  1001. colourNumber: "", //色号
  1002. remark: "", //备注
  1003. });
  1004. },
  1005. // 客户名称改变回调
  1006. customChangeHandler(val) {
  1007. // if (!val) return;
  1008. let customData = this.customerOptions.find(
  1009. (item) => item.customNo == val
  1010. );
  1011. this.formData.customAddress = customData?.customAddress || "无";
  1012. this.formData.customCountryType = customData?.customCountryType || "无";
  1013. this.formData.contactPerson = customData?.contactPerson || "无";
  1014. },
  1015. //审计新增
  1016. async addHandler() {
  1017. this.isEdit = false;
  1018. await this.getDropDownData();
  1019. this.resetFormData();
  1020. this.title = "新增审计单";
  1021. this.open = true;
  1022. },
  1023. // 获取下拉框数据
  1024. async getDropDownData() {
  1025. try {
  1026. let payLoad = [
  1027. {
  1028. basicMap: {
  1029. tableName: "production",
  1030. },
  1031. },
  1032. {
  1033. basicMap: {
  1034. tableName: "customer",
  1035. },
  1036. },
  1037. ];
  1038. let res = await queryDropDownBoxData(payLoad);
  1039. if (res.code == 200) {
  1040. let { production, customer } = res.data.resultMap;
  1041. this.productionOptions = production || [];
  1042. this.customerOptions = customer || [];
  1043. } else {
  1044. throw Error("获取下拉框数据失败");
  1045. }
  1046. } catch (error) {
  1047. console.log(error);
  1048. }
  1049. // 色号数据
  1050. try {
  1051. let payLoad = [
  1052. {
  1053. basicMap: {
  1054. tableName: "materiel",
  1055. },
  1056. conditionMap: {
  1057. materiel_species: ["1"],
  1058. },
  1059. },
  1060. ];
  1061. let res = await queryDropDownBoxData(payLoad);
  1062. if (res.code == 200) {
  1063. console.log(res.data.resultMap);
  1064. let { materiel } = res.data.resultMap;
  1065. this.colourNumberOptions = materiel || [];
  1066. } else {
  1067. throw Error("获取下拉框数据失败");
  1068. }
  1069. } catch (error) {
  1070. console.log(error);
  1071. }
  1072. // 切片型号
  1073. try {
  1074. let payLoad = [
  1075. {
  1076. basicMap: {
  1077. tableName: "materiel",
  1078. },
  1079. conditionMap: {
  1080. materiel_species: ["6"],
  1081. },
  1082. },
  1083. ];
  1084. let res = await queryDropDownBoxData(payLoad);
  1085. if (res.code == 200) {
  1086. console.log(res.data.resultMap);
  1087. let { materiel } = res.data.resultMap;
  1088. this.sliceTypeOptions = materiel || [];
  1089. } else {
  1090. throw Error("获取下拉框数据失败");
  1091. }
  1092. } catch (error) {
  1093. console.log(error);
  1094. }
  1095. },
  1096. //
  1097. // 获取row-key
  1098. getRowKey(row) {
  1099. return row[
  1100. camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
  1101. ];
  1102. },
  1103. /** 查询列表 */
  1104. getList(queryParams, orderType = 0) {
  1105. this.loading = true;
  1106. // 序列化当前查询参数列表
  1107. queryParams && (this.queryParams.queryMap = queryParams.queryMap);
  1108. // 获取当前表单结构信息
  1109. dragTableInfo({ queryMap: { tableKey: this.tableKey } })
  1110. .then((res) => {
  1111. // 得到当前模版信息 --- sql columns queryWhere
  1112. this.templateInfo = res.data.resultMap;
  1113. this.styleList = res.data.resultMap.style?.map((item) => {
  1114. item.styleField = camelCase(
  1115. item.styleField.replace(".", "_") || ""
  1116. );
  1117. return item;
  1118. });
  1119. // 获取操作列的按钮数据
  1120. this.excuteBtnArr = res.data.resultMap.button;
  1121. console.log(this.excuteBtnArr, "excuteBtnArr");
  1122. // if (this.excuteBtnArr.length) {
  1123. this.excuteBtnArr[0].children.push(
  1124. {
  1125. btnName: "编辑",
  1126. btnType: "myEdit",
  1127. btnIcon: "",
  1128. btnShowCondition: "",
  1129. children: [],
  1130. },
  1131. {
  1132. btnName: "详情",
  1133. btnType: "myDetail",
  1134. btnIcon: "",
  1135. btnShowCondition: "",
  1136. children: [],
  1137. }
  1138. );
  1139. // }
  1140. this.queryParams.orderByColumn =
  1141. res.data.resultMap.querySql.orderByColumn;
  1142. this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
  1143. // 根据拖拽时设置当前列表排列顺序
  1144. this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
  1145. this.tableName = this.templateInfo.template.dtTableName;
  1146. // 得到查询条件
  1147. this.queryFromWhere = res.data.resultMap.where;
  1148. // 得到当前列表信息
  1149. this.columns = this.columnsHandler(
  1150. JSON.parse(this.templateInfo.template.dtColumnName)
  1151. );
  1152. console.log(this.columns, "000");
  1153. })
  1154. .finally((fes) => {
  1155. if (this.templateInfo == {}) return;
  1156. // 调用查询需要携带当前table的唯一标识
  1157. this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
  1158. this.queryParams.orderByColumn = camelCase(
  1159. this.queryParams.orderByColumn || ""
  1160. );
  1161. // 根据sql语句查询当前表数据
  1162. let getListFun = orderType == 0 ? unionListTableData : getTableList1;
  1163. if (orderType != 0) {
  1164. this.queryParams.conditionMap = {
  1165. columnName: "order_type",
  1166. columnValue: orderType,
  1167. };
  1168. }
  1169. getListFun(this.queryParams).then(async (res) => {
  1170. this.tableList = [];
  1171. res.rows.forEach((item) => {
  1172. this.tableList.push(item.resultMap);
  1173. });
  1174. // 驼峰转换
  1175. let tempTableList = [];
  1176. tempTableList = this.tableList.map((item) => {
  1177. let kv = {};
  1178. for (let itemKey in item) {
  1179. kv[camelCase(itemKey)] = item[itemKey];
  1180. }
  1181. return kv;
  1182. });
  1183. // this.setDictStyleData().then(() => {
  1184. // this.tableList = this.setFieldStyleData(this.tableList);
  1185. // });
  1186. this.tableList = await this.setFieldStyleData(tempTableList);
  1187. this.total = res.total;
  1188. // this.$nextTick(() => {
  1189. // this.$refs.tableRef?.clearSelection();
  1190. // });
  1191. this.loading = false;
  1192. });
  1193. // 查询统计信息
  1194. getStatisticList({
  1195. queryMap: {
  1196. tableKey: this.templateInfo.template.tableKey,
  1197. queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
  1198. },
  1199. }).then((res) => {
  1200. this.statisticList = res.data;
  1201. });
  1202. });
  1203. },
  1204. // 审计 提交编辑结果按钮回调
  1205. async editConfirm() {
  1206. this.$refs.formDataRef.validate(async (valid) => {
  1207. if (valid) {
  1208. let {
  1209. //订单表数据
  1210. saleCustomNo,
  1211. saleDate,
  1212. saleOrderEstimatedTime,
  1213. saleLeadTime,
  1214. saleAmounts,
  1215. saleAmountInWords,
  1216. salePayType,
  1217. salesman,
  1218. saleLeader,
  1219. finance,
  1220. production,
  1221. saleApprover,
  1222. // 工艺表数据
  1223. craftGrid,
  1224. craftOil,
  1225. craftPackage,
  1226. craftColorFastness,
  1227. craftOther,
  1228. craftMark,
  1229. shippingMethod,
  1230. } = this.formData;
  1231. let saleCraftNo = this.isEdit ? this.formData.saleCraftNo : uuidv4(),
  1232. saleNo = this.isEdit ? this.formData.saleNo : uuidv4();
  1233. let saleProductsNo = this.productionTableData
  1234. .map((item) => item.saleProductNo)
  1235. .join(","); //销售单表sale_products_no字段存货品表的sale_product_no,逗号分割
  1236. let saleValue = {
  1237. status: 1, //新增销售单时 默认为1
  1238. saleNo,
  1239. saleProductsNo,
  1240. saleOrderTechnologyNo: saleCraftNo,
  1241. saleCustomNo,
  1242. saleDate: moment(new Date(saleDate)).format("YYYY-MM-DD"),
  1243. saleOrderEstimatedTime: moment(
  1244. new Date(saleOrderEstimatedTime)
  1245. ).format("YYYY-MM-DD"),
  1246. saleLeadTime,
  1247. // saleAmounts, //合计金额 小写
  1248. saleAmountInWords,
  1249. salePayType,
  1250. salesman: this.nickName,
  1251. saleLeader,
  1252. finance,
  1253. production,
  1254. saleApprover,
  1255. };
  1256. let craftValue = {
  1257. saleOrderNo: saleNo,
  1258. saleCraftNo,
  1259. craftGrid,
  1260. craftOil,
  1261. craftPackage,
  1262. craftColorFastness,
  1263. craftOther,
  1264. craftMark,
  1265. shippingMethod,
  1266. };
  1267. let saleData = {
  1268. //订单表新增数据
  1269. basicMap: {
  1270. tableName: "sale_order",
  1271. },
  1272. // addListMap: [saleValue],
  1273. conditionMap: {},
  1274. commMap: {},
  1275. btnParametersMap: {},
  1276. };
  1277. let craftData = {
  1278. //工艺表新增数据
  1279. basicMap: {
  1280. tableName: "sale_craft",
  1281. },
  1282. // addListMap: [craftValue],
  1283. conditionMap: {},
  1284. commMap: {},
  1285. btnParametersMap: {},
  1286. };
  1287. this.productionTableData.forEach((item) => {
  1288. item.saleOrderNo = saleNo;
  1289. delete item.id;
  1290. delete item.productNotes;
  1291. delete item.updateBy;
  1292. delete item.updateById;
  1293. delete item.updateTime;
  1294. delete item.createBy;
  1295. delete item.createTime;
  1296. delete item.createById;
  1297. delete item.delFlag;
  1298. delete item.sliceTypeLabel;
  1299. delete item.colourNumberLabel;
  1300. });
  1301. let productData = {
  1302. //货品表新增数据
  1303. basicMap: {
  1304. tableName: "sale_products",
  1305. },
  1306. addListMap: [...this.productionTableData],
  1307. conditionMap: {},
  1308. commMap: {},
  1309. btnParametersMap: {},
  1310. };
  1311. if (this.isEdit) {
  1312. //修改
  1313. Object.keys(saleValue).map((k) => {
  1314. saleData.commMap[k] = saleValue[k];
  1315. });
  1316. Object.keys(craftValue).map((k) => {
  1317. craftData.commMap[k] = craftValue[k];
  1318. });
  1319. saleData.conditionMap.saleNo = saleValue.saleNo;
  1320. craftData.conditionMap.saleCraftNo = craftValue.saleCraftNo;
  1321. // for(let i = 0;i<this.)
  1322. let deletPayload = {
  1323. //删除货品数据的接口
  1324. basicMap: {
  1325. tableName: "sale_products",
  1326. },
  1327. conditionMap: {
  1328. saleProductNo: this.productIds,
  1329. },
  1330. };
  1331. let delRes = { code: 200 };
  1332. if (this.productIds.length) {
  1333. delRes = await delTableData(deletPayload); //删除旧数据
  1334. }
  1335. let updateSaleRes = await batchEdit(saleData);
  1336. let updateCraftRes = await batchEdit(craftData);
  1337. let addProductRes = { code: 200 };
  1338. if (productData.addListMap.length) {
  1339. addProductRes = await addTableData(productData);
  1340. }
  1341. console.log(delRes, updateSaleRes, updateCraftRes, addProductRes);
  1342. if (
  1343. delRes?.code === 200 &&
  1344. updateSaleRes?.code === 200 &&
  1345. updateCraftRes?.code === 200 &&
  1346. addProductRes?.code === 200
  1347. ) {
  1348. this.$message.success("修改成功");
  1349. this.open = false;
  1350. this.getList();
  1351. } else {
  1352. this.$message.error("修改失败");
  1353. }
  1354. } else {
  1355. //新增
  1356. saleData.addListMap = [saleValue];
  1357. craftData.addListMap = [craftValue];
  1358. let saleRes = await addTableData(saleData);
  1359. let craftRes = await addTableData(craftData);
  1360. let productRes = { code: 200 };
  1361. if (productData.addListMap.length) {
  1362. productRes = await addTableData(productData);
  1363. }
  1364. if (
  1365. saleRes.code === 200 &&
  1366. craftRes.code === 200 &&
  1367. productRes.code === 200
  1368. ) {
  1369. this.$message.success("添加成功");
  1370. this.open = false;
  1371. this.getList();
  1372. } else {
  1373. this.$message.error("添加失败");
  1374. }
  1375. }
  1376. // Object.keys(saleValue).map((k) => {
  1377. // saleData.commMap[k] = saleValue[k];
  1378. // });
  1379. }
  1380. });
  1381. },
  1382. // 审计 编辑回调
  1383. async handleEdit(index, row) {
  1384. console.log(row);
  1385. let { saleOrderSaleNo } = row;
  1386. try {
  1387. let payLoad = [
  1388. {
  1389. basicMap: {
  1390. tableName: "sale_order",
  1391. },
  1392. conditionMap: {
  1393. sale_no: [saleOrderSaleNo],
  1394. },
  1395. },
  1396. {
  1397. basicMap: {
  1398. tableName: "sale_products",
  1399. },
  1400. conditionMap: {
  1401. sale_order_no: [saleOrderSaleNo],
  1402. },
  1403. },
  1404. {
  1405. basicMap: {
  1406. tableName: "sale_craft",
  1407. },
  1408. conditionMap: {
  1409. sale_order_no: [saleOrderSaleNo],
  1410. },
  1411. },
  1412. ];
  1413. let res = await queryDropDownBoxData(payLoad);
  1414. if (res.code == 200) {
  1415. this.isEdit = true;
  1416. let { sale_craft, sale_order, sale_products } = res.data.resultMap;
  1417. Object.assign(this.formData, {
  1418. ...sale_craft[0],
  1419. ...sale_order[0],
  1420. });
  1421. let { saleDate, saleOrderEstimatedTime } = sale_order[0];
  1422. saleDate && (this.formData.saleDate = new Date(saleDate));
  1423. saleOrderEstimatedTime &&
  1424. (this.formData.saleOrderEstimatedTime = saleOrderEstimatedTime);
  1425. this.productionTableData = sale_products;
  1426. this.productIds = sale_products.map((item) => item.saleProductNo);
  1427. await this.getDropDownData();
  1428. if (this.formData.saleCustomNo) {
  1429. this.customChangeHandler(this.formData.saleCustomNo);
  1430. }
  1431. this.title = "编辑审计单";
  1432. this.open = true;
  1433. }
  1434. } catch (error) {
  1435. console.log(error);
  1436. }
  1437. },
  1438. // 审计 批量删除回调
  1439. async batchDelete() {
  1440. if (!this.ids.length) return;
  1441. try {
  1442. await this.$confirm("是否确认删除选中的数据?", "警告", {
  1443. confirmButtonText: "确定",
  1444. cancelButtonText: "取消",
  1445. type: "warning",
  1446. });
  1447. let orderPayload = {
  1448. basicMap: {
  1449. tableName: "sale_order",
  1450. },
  1451. conditionMap: {
  1452. saleNo: this.ids,
  1453. },
  1454. };
  1455. let productsPayload = {
  1456. basicMap: {
  1457. tableName: "sale_products",
  1458. },
  1459. conditionMap: {
  1460. saleOrderNo: this.ids,
  1461. },
  1462. };
  1463. let craftPayload = {
  1464. basicMap: {
  1465. tableName: "sale_craft",
  1466. },
  1467. conditionMap: {
  1468. saleOrderNo: this.ids,
  1469. },
  1470. };
  1471. let orderRes = await delTableData(orderPayload);
  1472. // let productRes = await delTableData(productsPayload);
  1473. // let craftRes = await delTableData(craftPayload);
  1474. if (orderRes.code == 200) {
  1475. this.$message.success("删除成功");
  1476. this.getList();
  1477. } else {
  1478. this.$message.error("删除失败");
  1479. throw Error("删除失败");
  1480. }
  1481. this.ids = [];
  1482. this.$refs.tableRef.clearSelection();
  1483. } catch (error) {
  1484. console.log(error);
  1485. }
  1486. },
  1487. // 计算金额
  1488. computedPrice(row) {
  1489. let { productNumber, productUnitPrice } = row;
  1490. row.productAmounts = Number(productNumber) * Number(productUnitPrice);
  1491. },
  1492. isUpperCase(char) {
  1493. return char === char.toUpperCase();
  1494. },
  1495. // 下划线命名转驼峰命名
  1496. toUnderScoreCase(str) {
  1497. if (str === null) {
  1498. return null;
  1499. }
  1500. let sb = "";
  1501. // 前置字符是否大写
  1502. let preCharIsUpperCase = true;
  1503. // 当前字符是否大写
  1504. let curreCharIsUpperCase = true;
  1505. // 下一字符是否大写
  1506. let nexteCharIsUpperCase = true;
  1507. for (let i = 0; i < str.length; i++) {
  1508. let c = str.charAt(i);
  1509. if (i > 0) {
  1510. preCharIsUpperCase = isUpperCase(str.charAt(i - 1));
  1511. } else {
  1512. preCharIsUpperCase = false;
  1513. }
  1514. curreCharIsUpperCase = isUpperCase(c);
  1515. if (i < str.length - 1) {
  1516. nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
  1517. }
  1518. if (
  1519. preCharIsUpperCase &&
  1520. curreCharIsUpperCase &&
  1521. !nexteCharIsUpperCase
  1522. ) {
  1523. sb += SEPARATOR;
  1524. } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
  1525. sb += SEPARATOR;
  1526. }
  1527. sb += c.toLowerCase();
  1528. }
  1529. return sb;
  1530. },
  1531. // 处理列表信息
  1532. columnsHandler(columns) {
  1533. let resArr = [];
  1534. console.log(columns, 111);
  1535. columns.forEach((item) => {
  1536. for (const key in item) {
  1537. let tempObj = {};
  1538. tempObj.key = camelCase(key);
  1539. tempObj.value = item[key];
  1540. resArr.push(tempObj);
  1541. }
  1542. });
  1543. console.log(resArr, 222);
  1544. return resArr;
  1545. },
  1546. // 取消按钮
  1547. cancel() {
  1548. this.open = false;
  1549. // this.reset();
  1550. },
  1551. // k-form-build 取消按钮
  1552. kCancel() {
  1553. this.kOpen = false;
  1554. // this.reset();
  1555. },
  1556. // 分页查询
  1557. pageList(row) {
  1558. // 调用子组件-》携带子组件参数请求后台
  1559. this.$refs.mychild.pageList(
  1560. row == undefined
  1561. ? {
  1562. limit: this.queryParams.pageSize,
  1563. page: this.queryParams.pageNum,
  1564. }
  1565. : row
  1566. );
  1567. },
  1568. // 多选框选中数据
  1569. handleSelectionChange(selection) {
  1570. // this.ids = selection.map(
  1571. // (item) =>
  1572. // item[
  1573. // camelCase(
  1574. // this.tableName + "_" + this.templateInfo.template?.primaryKey
  1575. // )
  1576. // ]
  1577. // );
  1578. this.ids = selection.map((item) => item.saleOrderSaleNo);
  1579. this.single = selection.length != 1;
  1580. this.multiple = !selection.length;
  1581. },
  1582. // 更多操作触发
  1583. handleCommand(command, row) {
  1584. switch (command) {
  1585. case "handleResetPwd":
  1586. this.handleResetPwd(row);
  1587. break;
  1588. case "handleAuthRole":
  1589. this.handleAuthRole(row);
  1590. break;
  1591. default:
  1592. break;
  1593. }
  1594. },
  1595. /** 新增按钮操作 */
  1596. handleAdd(row) {
  1597. // this.reset();
  1598. this.defaultValue = {};
  1599. getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
  1600. if (!data || !data.dfVueTemplate) {
  1601. this.jsonData = false;
  1602. this.$message.error("当前表格未绑定表单!");
  1603. return;
  1604. }
  1605. if (data.dfFormSql) {
  1606. let dynamicData = JSON.parse(data.dfFormSql);
  1607. Object.assign(this.dynamicData, dynamicData);
  1608. }
  1609. this.jsonData = JSON.parse(data.dfVueTemplate);
  1610. this.open = true;
  1611. this.title = "添加信息";
  1612. this.form.password = this.initPassword;
  1613. this.$nextTick(() => {
  1614. this.$refs.addFromRef.reset();
  1615. inputDisableComplete();
  1616. });
  1617. });
  1618. },
  1619. longestCommonSubstring(strs) {
  1620. if (!strs || strs.includes("")) return "";
  1621. let str1_Length = strs[0].length;
  1622. let str_Nums = strs.length;
  1623. let flag = 0;
  1624. for (let i = 0; i < str1_Length && flag == 0; i++) {
  1625. let char = strs[0][i];
  1626. for (var j = 1; j < str_Nums; j++) {
  1627. if (char !== strs[j][i] || i == strs[j].length) {
  1628. return strs[1].substring(0, i);
  1629. }
  1630. }
  1631. }
  1632. return strs[0];
  1633. },
  1634. // 绑定dialog对话框关闭
  1635. handleClose() {
  1636. this.btnDialogVisible = false;
  1637. },
  1638. getLastUppercaseWord(text) {
  1639. const pattern = /\b[A-Z][a-z]*\b/g;
  1640. const matches = [...text.matchAll(pattern)];
  1641. if (matches.length > 0) {
  1642. const lastMatch = matches[matches.length - 1][0];
  1643. return lastMatch;
  1644. } else {
  1645. return null;
  1646. }
  1647. },
  1648. /** 修改按钮操作 */
  1649. async handleUpdate(row, btnData) {
  1650. let nameTable = this.templateInfo.template.dtTableName;
  1651. this.rowobj = {};
  1652. let obj = {};
  1653. for (let key in row) {
  1654. let modifiedTable = key
  1655. .replace(/[A-Z]/g, (match) => `_${match}`)
  1656. .toLowerCase();
  1657. this.rowobj[modifiedTable] = row[key];
  1658. let str = modifiedTable.substring(nameTable.length + 1);
  1659. obj[str] = row[key];
  1660. }
  1661. // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
  1662. // if (!data || !data.dfVueTemplate) {
  1663. // this.$message.error("当前表格未绑定表单!");
  1664. // return;
  1665. // }});
  1666. // 新的修改请求
  1667. try {
  1668. let payLoad = {
  1669. basicMap: {
  1670. btnType: this.currentBtnData.btnType,
  1671. btnKey: this.currentBtnData.btnKey,
  1672. visible: "false",
  1673. sqlKey: this.templateInfo.template.sqlKey,
  1674. tableName: this.tableName,
  1675. },
  1676. conditionMap: {},
  1677. };
  1678. let primary = camelCase(
  1679. this.tableName + "_" + this.templateInfo.template?.primaryKey
  1680. );
  1681. payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
  1682. row[primary];
  1683. let res = await btnCommonApi(payLoad);
  1684. // 判断是否绑定dialog弹窗
  1685. if (!this.currentBtnData.btnTableFormGroupKey) {
  1686. if (!res.data || !res.data.template) {
  1687. this.$message.error("当前按钮未绑定表单!");
  1688. return;
  1689. }
  1690. res.data.template.dfFormSql &&
  1691. (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
  1692. this.addRealFieldName(res.data.result.resultMap);
  1693. let resultMap = res.data.result.resultMap;
  1694. Object.assign(this.defaultValue, resultMap);
  1695. this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
  1696. this.kOpen = true;
  1697. this.title = "修改信息";
  1698. this.form.password = this.initPassword;
  1699. this.$nextTick(() => {
  1700. this.$refs.addFromRef.setData(res.data.result.resultMap);
  1701. });
  1702. } else {
  1703. this.subTableName = res.data.result.dragTables[1].dtTableName;
  1704. this.btnDialogVisible = true;
  1705. this.groupKey = this.currentBtnData.btnTableFormGroupKey;
  1706. this.$nextTick(() => {
  1707. let refChild = this.$refs.dialogRef;
  1708. refChild.getLists(this.groupKey);
  1709. });
  1710. let tablesubKey = res.data.result.dragTables[1].tableKey;
  1711. // 查询统计信息
  1712. getStatisticList({
  1713. queryMap: {
  1714. tableKey: tablesubKey,
  1715. },
  1716. }).then((res) => {
  1717. this.subCount = res.data;
  1718. });
  1719. let prmKey = this.templateInfo.template.primaryKey;
  1720. let pkey = prmKey.replace(/_([a-z])/g, (match, p1) =>
  1721. p1.toUpperCase()
  1722. );
  1723. let data = {
  1724. queryMap: {
  1725. tableKey: res.data.result.dragTables[2].tableKey,
  1726. },
  1727. };
  1728. let key =
  1729. "#{" +
  1730. this.templateInfo.template.dtTableName +
  1731. "." +
  1732. this.templateInfo.template.primaryKey;
  1733. data.queryMap[key] =
  1734. "'" + obj[this.templateInfo.template.primaryKey] + "'";
  1735. getStatisticList(data).then((res) => {
  1736. this.tableCount = res.data;
  1737. });
  1738. }
  1739. // let fieldList = Object.keys(resultMap);
  1740. // let tableName = this.longestCommonSubstring(fieldList);
  1741. // fieldList.forEach((field) => {
  1742. // let realField = field.replace(tableName, "");
  1743. // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
  1744. // resultMap[realField] = resultMap[field];
  1745. // });
  1746. } catch (error) {
  1747. this.$message.error("网络异常,请稍后再试");
  1748. console.log(error);
  1749. }
  1750. return;
  1751. // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
  1752. // if (!data || !data.dfVueTemplate) {
  1753. // this.$message.error("当前表格未绑定表单!");
  1754. // return;
  1755. // }
  1756. // // let fieldList = Object.keys(row);
  1757. // // let tableName = this.longestCommonSubstring(fieldList);
  1758. // // fieldList.forEach((field) => {
  1759. // // let realField = field.replace(tableName, "");
  1760. // // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
  1761. // // row[realField] = row[field];
  1762. // // });
  1763. // this.addRealFieldName(row);
  1764. // Object.assign(this.defaultValue, row);
  1765. // this.jsonData = JSON.parse(data.dfVueTemplate);
  1766. // this.open = true;
  1767. // this.title = "修改信息";
  1768. // this.form.password = this.initPassword;
  1769. // this.$nextTick(() => {
  1770. // this.$refs.addFromRef.setData(row);
  1771. // });
  1772. // });
  1773. // return;
  1774. this.reset();
  1775. const userId = row.userId || this.ids;
  1776. getUser(userId).then((response) => {
  1777. this.form = response.data;
  1778. this.postOptions = response.posts;
  1779. this.roleOptions = response.roles;
  1780. this.$set(this.form, "postIds", response.postIds);
  1781. this.$set(this.form, "roleIds", response.roleIds);
  1782. this.open = true;
  1783. this.title = "修改当前信息";
  1784. this.form.password = "";
  1785. });
  1786. },
  1787. // 添加真正的字段名
  1788. addRealFieldName(row) {
  1789. let fieldList = Object.keys(row);
  1790. // let tableName = this.longestCommonSubstring(fieldList);
  1791. let tableName = camelCase(this.tableName);
  1792. fieldList.forEach((field) => {
  1793. let realField = field.replace(tableName, "");
  1794. realField = realField[0].toLocaleLowerCase() + realField.substring(1);
  1795. row[realField] = row[field];
  1796. });
  1797. },
  1798. /** 提交按钮 */
  1799. submitForm: function () {
  1800. this.$refs["form"].validate((valid) => {
  1801. if (valid) {
  1802. if (this.form.userId != undefined) {
  1803. updateUser(this.form).then((response) => {
  1804. this.$modal.msgSuccess("修改成功");
  1805. this.open = false;
  1806. this.getList();
  1807. });
  1808. } else {
  1809. addUser(this.form).then((response) => {
  1810. this.$modal.msgSuccess("新增成功");
  1811. this.open = false;
  1812. this.getList();
  1813. });
  1814. }
  1815. }
  1816. });
  1817. },
  1818. /** 删除按钮操作
  1819. *
  1820. * 删除提示信息语句(标识)
  1821. * */
  1822. handleDelete(row, btnData) {
  1823. let delIds = this.ids;
  1824. let primary = camelCase(this.templateInfo.template?.primaryKey);
  1825. // let realyKey=
  1826. this.addRealFieldName(row);
  1827. if (row[primary] != undefined && row[primary] != null) {
  1828. delIds = [];
  1829. delIds.push(row[primary]);
  1830. }
  1831. let data = {
  1832. basicMap: {
  1833. btnType: btnData.btnType,
  1834. btnKey: btnData.btnKey,
  1835. tableName: this.tableName,
  1836. },
  1837. conditionMap: {
  1838. // id: delIds,
  1839. },
  1840. btnParametersMap: {},
  1841. };
  1842. if (this.currentBtnData.btnParams) {
  1843. let btnParams =
  1844. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
  1845. let conditionData =
  1846. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  1847. conditionData.forEach((item) => {
  1848. data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
  1849. ? item.fieldValue
  1850. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  1851. });
  1852. btnParams.forEach((item) => {
  1853. data.btnParametersMap[item.fieldName.split(".")[1]] = item.fieldValue
  1854. ? item.fieldValue
  1855. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  1856. });
  1857. }
  1858. // data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
  1859. this.$modal
  1860. .confirm('是否确认删除"' + delIds + '"的数据项?')
  1861. .then(function () {
  1862. // return delTableData(data);
  1863. return btnCommonApi(data);
  1864. })
  1865. .then(() => {
  1866. // 调用子组件查询方法 目的是携带上子组件中的查询参数
  1867. this.$refs.mychild.pageList();
  1868. this.$modal.msgSuccess("删除成功");
  1869. })
  1870. .catch(() => {});
  1871. },
  1872. // 批量删除接口
  1873. handleBatchDelete() {
  1874. let delIds = this.ids;
  1875. let primary = camelCase(this.templateInfo.template?.primaryKey);
  1876. // if (row && row[primary] != undefined && row[primary] != null) {
  1877. // delIds = [];
  1878. // delIds.push(row[primary]);
  1879. // }
  1880. let data = {
  1881. basicMap: {
  1882. tableName: this.tableName,
  1883. },
  1884. conditionMap: {
  1885. // id: delIds,
  1886. },
  1887. };
  1888. // if (this.currentBtnData.btnParams) {
  1889. // let btnParams = JSON.parse(this.currentBtnData.btnParams);
  1890. // btnParams.forEach((item) => {
  1891. // data.btnParametersMap[
  1892. // this.formatField(item.fieldName, camelCase(this.tableName))
  1893. // ] = item.fieldValue
  1894. // ? item.fieldValue
  1895. // : this.currentRow[item.fieldName];
  1896. // });
  1897. // }
  1898. data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
  1899. this.$modal
  1900. .confirm('是否确认删除"' + delIds + '"的数据项?')
  1901. .then(function () {
  1902. return delTableData(data);
  1903. // return btnCommonApi(data);
  1904. })
  1905. .then(() => {
  1906. // 调用子组件查询方法 目的是携带上子组件中的查询参数
  1907. this.$refs.mychild.pageList();
  1908. this.$modal.msgSuccess("删除成功");
  1909. })
  1910. .catch(() => {});
  1911. },
  1912. /** 导出按钮操作 */
  1913. handleExport() {
  1914. let primary = camelCase(this.templateInfo.template?.primaryKey);
  1915. let realyKey = camelCase(this.tableName + "_" + primary);
  1916. if (this.ids.length > 0) {
  1917. this.queryParams["execlMap"] = [];
  1918. this.ids.forEach((item) => {
  1919. this.queryParams.execlMap.push(
  1920. this.tableList.find((ttem) => {
  1921. return ttem[realyKey] === item;
  1922. })
  1923. );
  1924. });
  1925. } else {
  1926. this.$message.warning("请至少勾选一条导出数据");
  1927. return;
  1928. }
  1929. this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
  1930. this.download(
  1931. process.env.VUE_APP_BASE_API1 + "common/export",
  1932. {
  1933. ...this.queryParams,
  1934. },
  1935. `文件名称_${new Date().getTime()}.xlsx`
  1936. );
  1937. },
  1938. /** 导入按钮操作 */
  1939. handleImport() {
  1940. this.upload.title = "当前导入";
  1941. this.upload.open = true;
  1942. },
  1943. /** 下载模板操作 */
  1944. importTemplate() {
  1945. this.download(
  1946. process.env.VUE_APP_BASE_API1 +
  1947. `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
  1948. {},
  1949. `下载模版名称${new Date().getTime()}.xlsx`
  1950. );
  1951. },
  1952. // 文件上传中处理
  1953. handleFileUploadProgress(event, file, fileList) {
  1954. this.upload.isUploading = true;
  1955. },
  1956. // 文件上传成功处理
  1957. handleFileSuccess(response, file, fileList) {
  1958. this.upload.open = false;
  1959. this.upload.isUploading = false;
  1960. this.$refs.upload.clearFiles();
  1961. this.$alert(
  1962. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  1963. response.msg +
  1964. "</div>",
  1965. "导入结果",
  1966. { dangerouslyUseHTMLString: true }
  1967. );
  1968. this.$refs.mychild.pageList({
  1969. limit: this.queryParams.pageSize,
  1970. page: this.queryParams.pageNum,
  1971. });
  1972. },
  1973. //重点在这里
  1974. handleChange(file, fileList) {
  1975. file.name = this.tableName + "." + file.name.split(".")[1];
  1976. fileList.forEach((item) => {
  1977. item.name = this.tableName + "." + file.name.split(".")[1];
  1978. });
  1979. let newFile = new File(
  1980. [file],
  1981. this.tableName + "." + file.name.split(".")[1]
  1982. ); //创建出来也是不可编辑的file对象
  1983. },
  1984. // 提交上传文件
  1985. submitFileForm() {
  1986. this.$refs.upload.submit();
  1987. },
  1988. // 弹窗新增的数
  1989. addListHandler(val) {
  1990. this.addLists.push(...val);
  1991. },
  1992. // 绑定弹窗Dialog确定按钮
  1993. btnComfirm() {
  1994. // let data = {
  1995. // addListMap:[],
  1996. // basicMap:{
  1997. // btnType: 10,
  1998. // tableName: this.subTableName,
  1999. // visible: true,
  2000. // },
  2001. // commMap: {},
  2002. // conditionMap: {},
  2003. // }
  2004. // // data.addListMap =
  2005. // btnCommonApi(data).then(res => {
  2006. // console.log('弹窗确定', res);
  2007. // })
  2008. },
  2009. // 去掉表名 开头字母小写
  2010. formatField(field = "", tableName) {
  2011. let temp = field.replace(tableName, "");
  2012. return toUnderline(temp[0].toLowerCase() + temp.slice(1));
  2013. },
  2014. //提交编辑结果按钮回调
  2015. async editConfirmHandler() {
  2016. if (this.$refs.addFromRef) {
  2017. this.$refs.addFromRef
  2018. .getData()
  2019. .then(async (values) => {
  2020. let data = {
  2021. basicMap: {
  2022. tableName: this.tableName,
  2023. // btnKey: btnData.btnKey,
  2024. btnKey: this.currentBtnData.btnKey,
  2025. },
  2026. addListMap: [values],
  2027. conditionMap: {},
  2028. commMap: {},
  2029. btnParametersMap: {},
  2030. };
  2031. if (this.currentBtnData.btnParams) {
  2032. let btnParams =
  2033. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
  2034. [];
  2035. let conditionData =
  2036. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  2037. // let
  2038. btnParams.forEach((item) => {
  2039. data.btnParametersMap[item.fieldName.split(".")[1]] =
  2040. item.fieldValue
  2041. ? item.fieldValue
  2042. : this.currentRow[
  2043. camelCase(item.fieldName.replace(".", "_"))
  2044. ];
  2045. });
  2046. conditionData.forEach((item) => {
  2047. data.conditionMap[item.fieldName.split(".")[1]] =
  2048. item.fieldValue
  2049. ? item.fieldValue
  2050. : this.currentRow[
  2051. camelCase(item.fieldName.replace(".", "_"))
  2052. ];
  2053. });
  2054. }
  2055. if (Object.keys(this.defaultValue).length) {
  2056. // data.conditionMap[this.templateInfo.template?.primaryKey] =
  2057. // this.defaultValue[this.templateInfo.template?.primaryKey];
  2058. Object.keys(values).map((k) => {
  2059. data.commMap[k] = values[k];
  2060. });
  2061. data.basicMap.btnType = this.currentBtnData.btnType;
  2062. data.basicMap.visible = true;
  2063. } else {
  2064. data.basicMap.btnType = "INSERT";
  2065. data.basicMap.visible = true;
  2066. }
  2067. try {
  2068. let res = await btnCommonApi(data);
  2069. if (res.code == 200) {
  2070. this.$message.success("操作成功");
  2071. } else {
  2072. this.$message.error("网络异常,请稍后再试");
  2073. }
  2074. } catch (error) {
  2075. console.log(error);
  2076. this.$message.error("网络异常,请稍后再试");
  2077. }
  2078. this.getList();
  2079. this.defaultValue = {};
  2080. this.kOpen = false;
  2081. })
  2082. .catch((res) => {
  2083. console.log(res);
  2084. this.$modal.msgError("表单校验失败,请规范填写数据");
  2085. });
  2086. } else {
  2087. // 没有绑定表单
  2088. let data = {
  2089. basicMap: {
  2090. tableName: this.tableName,
  2091. // btnKey: btnData.btnKey,
  2092. btnKey: this.currentBtnData.btnKey,
  2093. btnType: this.currentBtnData.btnType,
  2094. visible: true,
  2095. },
  2096. addListMap: [],
  2097. conditionMap: {},
  2098. commMap: {},
  2099. btnParametersMap: {},
  2100. };
  2101. if (this.currentBtnData.btnParams) {
  2102. let btnParams =
  2103. JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
  2104. let conditionData =
  2105. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  2106. conditionData.forEach((item) => {
  2107. data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
  2108. ? item.fieldValue
  2109. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2110. });
  2111. btnParams.forEach((item) => {
  2112. data.btnParametersMap[item.fieldName.split(".")[1]] =
  2113. item.fieldValue
  2114. ? item.fieldValue
  2115. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2116. });
  2117. }
  2118. // data.basicMap.btnType = this.currentBtnData.btnType;
  2119. // data.basicMap.visible = true;
  2120. try {
  2121. let res = await btnCommonApi(data);
  2122. if (res.code == 200) {
  2123. this.$message.success("操作成功");
  2124. } else {
  2125. this.$message.error("网络异常,请稍后再试");
  2126. }
  2127. } catch (error) {
  2128. console.log(error);
  2129. this.$message.error("网络异常,请稍后再试");
  2130. }
  2131. this.getList();
  2132. this.defaultValue = {};
  2133. this.kOpen = false;
  2134. }
  2135. },
  2136. // 使用提交数据类型的按钮获取数据
  2137. tempSubBtn(getData) {
  2138. getData()
  2139. .then((values) => {
  2140. console.log("验证通过", values);
  2141. })
  2142. .catch(() => {
  2143. console.log("验证未通过,获取失败");
  2144. });
  2145. },
  2146. // 判断是否生效行样式
  2147. cellStyle({ row, column, rowIndex, columnIndex }) {
  2148. let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
  2149. if (!rowStyleList.length) return "";
  2150. let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
  2151. for (let i = 0; i < rowStyleList.length; i++) {
  2152. let item = rowStyleList[i];
  2153. let judgeRes = this.determineCondition(item.styleCondtion, row);
  2154. if (judgeRes) {
  2155. let styleCode = JSON.parse(item.styleCode);
  2156. return `background-color:${styleCode.rowBgColor};`;
  2157. }
  2158. }
  2159. },
  2160. // 获取生效条件组结果
  2161. determineCondition(conditionStr, row) {
  2162. let conditionList = JSON.parse(conditionStr);
  2163. if (!conditionList.length) return false;
  2164. return conditionList.every((item) => this.judgeOneCondition(item, row));
  2165. },
  2166. // 获取单个判断条件结果
  2167. judgeOneCondition(item, row) {
  2168. let fullField = camelCase(item.tableName + "_" + item.fieldName);
  2169. switch (item.condition) {
  2170. case 1:
  2171. return row[fullField] > item.flagValue;
  2172. case 2:
  2173. return row[fullField] < item.flagValue;
  2174. case 3:
  2175. return row[fullField] == item.flagValue;
  2176. case 4:
  2177. return row[fullField] >= item.flagValue;
  2178. case 5:
  2179. return row[fullField] <= item.flagValue;
  2180. default:
  2181. return true; //默认为true
  2182. }
  2183. },
  2184. // 设置表格字段样式
  2185. async setFieldStyleData(tableList) {
  2186. console.log(JSON.parse(JSON.stringify(tableList)));
  2187. let fieldConditionList = this.styleList.filter(
  2188. (item) => item.styleType == 1 || item.styleType == 2
  2189. );
  2190. if (!fieldConditionList.length) return tableList;
  2191. let res = await this.setDictStyleData();
  2192. this.dictStyleObj = res.reduce((pre, item) => {
  2193. return {
  2194. ...pre,
  2195. ...item,
  2196. };
  2197. }, {});
  2198. // console.log("this.dictStyleObj", this.dictStyleObj);
  2199. tableList.forEach((row) => {
  2200. // if (!row.styleFieldObj) row.styleFieldObj = {};
  2201. for (let i = 0; i < fieldConditionList.length; i++) {
  2202. let item = fieldConditionList[i];
  2203. if (item.styleType == 1) {
  2204. //字段样式
  2205. let judgeRes = this.determineCondition(item.styleCondtion, row);
  2206. if (judgeRes) {
  2207. let styleCode = JSON.parse(item.styleCode);
  2208. if (!row.styleFieldObj) row.styleFieldObj = {};
  2209. row.styleFieldObj[item.styleField] = {
  2210. styleType: item.styleType,
  2211. fieldStyleType: styleCode.fieldStyleType,
  2212. fontColor: styleCode.fontColor,
  2213. isTagFullBg: styleCode.isTagFullBg,
  2214. tagType: styleCode.tagType,
  2215. };
  2216. // row.styleField = item.styleField; //样式生效字段
  2217. // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
  2218. // row.fieldStyleType = styleCode.fieldStyleType; //0:文本 1:标签
  2219. // row.fontColor = styleCode.fontColor;
  2220. // row.isTagFullBg = styleCode.isTagFullBg; //true/false
  2221. // row.tagType = styleCode.tagType; //string
  2222. }
  2223. } else {
  2224. //字典样式
  2225. let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
  2226. return dict.dictValue == row[item.styleField];
  2227. });
  2228. if (dicStyle) {
  2229. if (!row.styleFieldObj) row.styleFieldObj = {};
  2230. row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
  2231. row.styleFieldObj[item.styleField].styleType = 2;
  2232. }
  2233. }
  2234. }
  2235. });
  2236. return tableList;
  2237. },
  2238. //设置表格字典相关数据
  2239. setDictStyleData() {
  2240. let fieldConditionList = this.styleList.filter(
  2241. (item) => item.styleType == 2
  2242. );
  2243. if (!fieldConditionList.length) return;
  2244. let PromiseList = fieldConditionList.map((item) => {
  2245. return new Promise((resolve, reject) => {
  2246. let temp = {};
  2247. try {
  2248. listData({
  2249. isEnablePaging: false,
  2250. dictType: item.styleCondtion,
  2251. }).then((res) => {
  2252. temp[item.styleField] = res.rows;
  2253. resolve(temp);
  2254. });
  2255. } catch (error) {
  2256. reject(error);
  2257. }
  2258. });
  2259. });
  2260. return Promise.all(PromiseList);
  2261. },
  2262. // 内链页面跳转
  2263. routerHandler(btnData, type) {
  2264. let { url, commonFieldData } = JSON.parse(btnData.btnParams);
  2265. let tempArr = [];
  2266. if (commonFieldData) {
  2267. let queryArr = JSON.parse(commonFieldData);
  2268. tempArr = queryArr.map((item) => {
  2269. let key = this.formatField(item.fieldName, camelCase(this.tableName));
  2270. let value = item.fieldValue
  2271. ? item.fieldValue
  2272. : this.currentRow[item.fieldName];
  2273. return key + "=" + value;
  2274. });
  2275. }
  2276. if (tempArr.length) {
  2277. url += "?" + tempArr.join("&");
  2278. }
  2279. // let link = btnData.btnParams;
  2280. if (type == "INNERLINK") {
  2281. this.$router.push(url);
  2282. } else {
  2283. window.open("http://" + url, "_blank");
  2284. }
  2285. },
  2286. async handleDetail(row) {
  2287. this.printDomData = await this.getDetailTableString(row);
  2288. this.detailShow = true;
  2289. this.$nextTick(() => {
  2290. this.$refs.detailTable.innerHTML = this.printDomData;
  2291. });
  2292. },
  2293. // 切片类型改变回调
  2294. sliceTypeChangeHandler(row) {
  2295. let { sliceType } = row;
  2296. if (sliceType) {
  2297. row.sliceTypeLabel = this.sliceTypeOptions.find(
  2298. (item) => item.materielCode == sliceType
  2299. )?.materielName;
  2300. }
  2301. },
  2302. // 色号改变回调
  2303. colourNumberChangeHandler(row) {
  2304. let { colourNumber } = row;
  2305. if (colourNumber) {
  2306. row.colourNumberLabel = this.colourNumberOptions.find(
  2307. (item) => item.materielCode == colourNumber
  2308. )?.materieColorNumber;
  2309. }
  2310. },
  2311. // 打印回调
  2312. detailPrintHandler() {
  2313. document.body.innerHTML = document.getElementById("printDom").innerHTML =
  2314. this.printDomData;
  2315. window.print(); //打印
  2316. window.location.reload();
  2317. return false;
  2318. },
  2319. // 获取详情html字符串
  2320. async getDetailTableString(row) {
  2321. let { saleOrderSaleNo } = row;
  2322. let payLoad = [
  2323. {
  2324. basicMap: {
  2325. tableName: "sale_order",
  2326. },
  2327. conditionMap: {
  2328. sale_no: [saleOrderSaleNo],
  2329. },
  2330. },
  2331. {
  2332. basicMap: {
  2333. tableName: "sale_products",
  2334. },
  2335. conditionMap: {
  2336. sale_order_no: [saleOrderSaleNo],
  2337. },
  2338. },
  2339. {
  2340. basicMap: {
  2341. tableName: "sale_craft",
  2342. },
  2343. conditionMap: {
  2344. sale_order_no: [saleOrderSaleNo],
  2345. },
  2346. },
  2347. ];
  2348. let res = await queryDropDownBoxData(payLoad);
  2349. if (res.code == 200) {
  2350. console.log(res);
  2351. let { sale_craft, sale_order, sale_products } = res.data.resultMap;
  2352. let {
  2353. //订单表数据
  2354. saleNo, //合同号
  2355. saleCustomNo, //客户编号
  2356. saleDate, //销售单日期
  2357. saleOrderEstimatedTime, //预计下单时间
  2358. saleLeadTime, //交货周期
  2359. saleAmounts, //合计金额 小写
  2360. saleAmountInWords, //合计金额 大写
  2361. salePayType, //支付方式
  2362. salesman, //业务员
  2363. saleLeader, //业务主管
  2364. finance, //财务部
  2365. production, //生产部
  2366. saleApprover, //批准人
  2367. // customAddress, //客户地址
  2368. // customCountryType, //国家类型
  2369. // contactPerson, //联系人
  2370. // 货品明细表数据
  2371. // productNo, //货品号
  2372. // productName, //货品名称
  2373. // productNumber: "", //销售数量
  2374. // productWeight: "", //销售重量kg
  2375. // productUnitPrice: "", //单价
  2376. // productAmounts: "", //金额
  2377. // remark: "", //备注
  2378. // 工艺表
  2379. craftGrid, //网络
  2380. craftOil, //油剂
  2381. craftPackage, //卷装
  2382. craftColorFastness, //色牢度
  2383. craftOther, //其它工艺要求
  2384. craftMark, //包装/贴唛
  2385. shippingMethod, //运输方式
  2386. } = { ...sale_craft[0], ...sale_order[0] };
  2387. let customData = this.customerOptions.find(
  2388. (item) => item.customNo == saleCustomNo
  2389. );
  2390. let customerName = customData ? customData.customName : "";
  2391. let customAddress = customData?.customAddress || "无";
  2392. let customCountryType = customData?.customCountryType || "";
  2393. let contactPerson = customData?.contactPerson || "无";
  2394. let printStr = `
  2395. <table style="width:1050px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
  2396. <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
  2397. <div style="text-align:center;">销售合同审计单</div>
  2398. <tbody>
  2399. <tr>
  2400. <td width="600px" colspan="4">合同号:${saleNo}</td>
  2401. <td width="450px" colspan="3">日期:${saleDate.replace(
  2402. "T",
  2403. " "
  2404. )}</td>
  2405. </tr>
  2406. <tr align="center">
  2407. <td width="300px" colspan="2">客户名称:</td>
  2408. <td width="300px" colspan="2">${customerName}</td>
  2409. <td width="300px" colspan="2">联系人:</td>
  2410. <td width="150px" colspan="1">${contactPerson}</td>
  2411. </tr>
  2412. <tr align="center">
  2413. <td width="300px" colspan="2">客户地址:</td>
  2414. <td width="300px" colspan="2">${customAddress}</td>
  2415. <td width="300px" colspan="2">客户国别:</td>
  2416. <td width="150px" colspan="1">${customCountryType}</td>
  2417. </tr>
  2418. <tr align="center">
  2419. <td width="300px" colspan="2">预计下单时间:</td>
  2420. <td width="300px" colspan="2">${saleOrderEstimatedTime.replace(
  2421. "T",
  2422. " "
  2423. )}</td>
  2424. <td width="300px" colspan="2">交货周期:</td>
  2425. <td >${saleLeadTime}</td>
  2426. </tr>
  2427. <tr align="center">
  2428. <td colspan="7">货品明细</td>
  2429. </tr>
  2430. <tr align="center">
  2431. <td width="150px">品名</td>
  2432. <td width="150px">数量/kg</td>
  2433. <td width="150px">单价</td>
  2434. <td width="150px">金额</td>
  2435. <td width="150px">切片型号</td>
  2436. <td width="150px">色号</td>
  2437. <td width="150px">备注</td>
  2438. </tr>`;
  2439. let amountTotal = 0,
  2440. singlTotal = 0,
  2441. moneyTotal = 0;
  2442. for (let i = 0; i < sale_products.length; i++) {
  2443. let item = sale_products[i];
  2444. amountTotal += Number(item.productNumber);
  2445. singlTotal += Number(item.productUnitPrice);
  2446. moneyTotal += Number(item.productAmounts);
  2447. let productData = this.productionOptions.find(
  2448. (pro) => pro.productNo == item.productNo
  2449. );
  2450. console.log("item", item);
  2451. item.sliceTypeLabel =
  2452. this.sliceTypeOptions.find(
  2453. (k) => k.materielCode == item.sliceType
  2454. )?.materielName || "";
  2455. item.colourNumberLabel = this.colourNumberOptions.find(
  2456. (k) => k.materielCode == item.colourNumber
  2457. )?.materieColorNumber;
  2458. let productName = productData ? productData.productName : "";
  2459. printStr += `<tr align="center">
  2460. <td>${productName}</td>
  2461. <td>${item.productNumber}</td>
  2462. <td>${item.productUnitPrice}</td>
  2463. <td>${item.productAmounts}</td>
  2464. <td>${item.sliceTypeLabel}</td>
  2465. <td>${item.colourNumberLabel}</td>
  2466. <td>${item.remark}</td>
  2467. </tr>`;
  2468. }
  2469. // 计算小计
  2470. printStr += `
  2471. <tr align="center">
  2472. <td>小计:</td>
  2473. <td>${amountTotal}</td>
  2474. <td>${singlTotal}</td>
  2475. <td>${moneyTotal}</td>
  2476. <td></td>
  2477. <td></td>
  2478. <td></td>
  2479. </tr>
  2480. <tr>
  2481. <td colspan="7">合计金额(大写):${saleAmountInWords}</td>
  2482. </tr>
  2483. <tr>
  2484. <td colspan="7">付款方式:${salePayType}</td>
  2485. </tr>
  2486. <tr align="center">
  2487. <td colspan="7">工艺要求</td>
  2488. </tr>
  2489. <tr align="center">
  2490. <td width="150px">网络</td>
  2491. <td width="150px">油剂</td>
  2492. <td width="150px">卷装</td>
  2493. <td width="150px">色牢度</td>
  2494. <td width="150px">其他</td>
  2495. <td width="150px"></td>
  2496. <td width="150px"></td>
  2497. </tr>
  2498. <tr align="center">
  2499. <td >${craftGrid}</td>
  2500. <td>${craftOil}</td>
  2501. <td>${craftPackage}</td>
  2502. <td>${craftColorFastness}</td>
  2503. <td>${craftOther}</td>
  2504. <td width="150px"></td>
  2505. <td width="150px"></td>
  2506. </tr>
  2507. <tr>
  2508. <td colspan="7">包装/贴唛:${craftMark}</td>
  2509. </tr>
  2510. <tr>
  2511. <td colspan="7">装运方式:${shippingMethod}</td>
  2512. </tr>
  2513. <tr align="center">
  2514. <td colspan="2">业务员:</td>
  2515. <td colspan="2">${salesman}</td>
  2516. <td colspan="2">业务主管:</td>
  2517. <td>${saleLeader}</td>
  2518. </tr>
  2519. <tr align="center">
  2520. <td colspan="2">财务部:</td>
  2521. <td colspan="2">${finance}</td>
  2522. <td colspan="2">生产部:</td>
  2523. <td>${production}</td>
  2524. </tr>
  2525. <tr align="center">
  2526. <td colspan="2">批准人:</td>
  2527. <td colspan="2">${saleApprover}</td>
  2528. <td></td>
  2529. <td></td>
  2530. <td></td>
  2531. </tr>
  2532. </tbody>
  2533. </table>
  2534. `;
  2535. return printStr;
  2536. // <tr align="center">
  2537. // <td colspan="2"> 2</td>
  2538. // <td> </td>
  2539. // <td> </td>
  2540. // <td> </td>
  2541. // <td> </td>
  2542. // </tr>
  2543. // <tr>
  2544. // <td colspan="2">小计:</td>
  2545. // <td></td>
  2546. // <td></td>
  2547. // <td></td>
  2548. // <td></td>
  2549. // </tr>
  2550. }
  2551. },
  2552. // 操作列回调
  2553. excuteHandler(btnData, row) {
  2554. let { btnType, btnParams, btnFormType } = btnData;
  2555. this.currentBtnData = btnData;
  2556. this.currentRow = JSON.parse(JSON.stringify(row));
  2557. console.log("btnData", btnType, btnData, row);
  2558. // 无表单
  2559. if (btnFormType == "noNeed") {
  2560. this.noNeedHandler(btnData, row);
  2561. return;
  2562. }
  2563. switch (btnType) {
  2564. case "INNERLINK":
  2565. this.routerHandler(btnData, btnType);
  2566. break;
  2567. case "OUTLINK":
  2568. this.routerHandler(btnData, btnType);
  2569. break;
  2570. case "UPDATE":
  2571. this.handleUpdate(row, btnData);
  2572. break;
  2573. case "EXECUTE":
  2574. this.handleUpdate(row, btnData);
  2575. break;
  2576. case "INITIATED":
  2577. this.handleUpdate(row, btnData);
  2578. break;
  2579. case "DELETE":
  2580. this.handleDelete(row, btnData);
  2581. break;
  2582. case "myEdit":
  2583. this.handleEdit("1", row);
  2584. break;
  2585. case "myDetail":
  2586. this.handleDetail(row);
  2587. break;
  2588. default:
  2589. break;
  2590. }
  2591. },
  2592. noNeedHandler(btnData, row) {
  2593. this.$modal
  2594. .confirm("是否确认执行该操作?")
  2595. .then(async () => {
  2596. // 获取默认参数
  2597. let data = {
  2598. basicMap: {
  2599. tableName: this.tableName,
  2600. // btnKey: btnData.btnKey,
  2601. btnKey: this.currentBtnData.btnKey,
  2602. },
  2603. conditionMap: {},
  2604. commMap: {},
  2605. btnParametersMap: {},
  2606. };
  2607. console.log(this.currentBtnData, this.currentRow);
  2608. if (this.currentBtnData.btnParams) {
  2609. let conditionData =
  2610. JSON.parse(this.currentBtnData.btnParams).conditionData || [];
  2611. // let
  2612. let commonData =
  2613. JSON.parse(this.currentBtnData.btnParams).commonFieldData || [];
  2614. conditionData.forEach((item) => {
  2615. data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
  2616. ? item.fieldValue
  2617. : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
  2618. });
  2619. commonData.forEach((item) => {
  2620. data.btnParametersMap[item.fieldName.split(".")[1]] =
  2621. item.fieldValue
  2622. ? item.fieldValue
  2623. : this.currentRow[
  2624. camelCase(item.fieldName.replace(".", "_"))
  2625. ];
  2626. });
  2627. }
  2628. data.basicMap.btnType = this.currentBtnData.btnType;
  2629. data.basicMap.visible = true;
  2630. try {
  2631. let res = await btnCommonApi(data);
  2632. if (res.code == 200) {
  2633. this.$message.success(res.msg);
  2634. } else {
  2635. this.$message.error("网络异常,请稍后再试");
  2636. }
  2637. } catch (error) {
  2638. console.log(error);
  2639. this.$message.error("网络异常,请稍后再试");
  2640. }
  2641. })
  2642. .then(() => {
  2643. // 调用子组件查询方法 目的是携带上子组件中的查询参数
  2644. this.$refs.mychild.pageList();
  2645. // this.$modal.msgSuccess("操作成功");
  2646. })
  2647. .catch(() => {});
  2648. },
  2649. // k-form-build表单变化回调
  2650. formChangeHandler(value, label) {
  2651. // console.log(value, label);
  2652. },
  2653. },
  2654. };
  2655. </script>
  2656. <style scoped lang="scss">
  2657. ::v-deep .el-dialog:not(.is-fullscreen) {
  2658. min-width: 610px !important;
  2659. }
  2660. </style>