customContract.vue 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797
  1. <template>
  2. <section>
  3. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  4. <el-form :inline="true">
  5. <!-- 合同编号/名称 -->
  6. <el-form-item>
  7. <div style="display: flex;align-items: center;height: 40px;">
  8. <el-input v-model="keyword" class="input-with-select" @keyup.enter.native="searchFilter"
  9. :placeholder="searchField == 1 ? $t('qing-shu-ru-he-tong-bian-hao') : $t('qing-shu-ru-he-tong-ming-cheng')"
  10. clearable size="small" style="width: 300px;">
  11. <el-select slot="prepend" v-model="searchField" :placeholder="$t('defaultText.pleaseChoose')"
  12. style="width:100px">
  13. <el-option :label="$t('he-tong-ming-cheng')" :value="0"></el-option>
  14. <el-option :label="$t('contractno')" :value="1"></el-option>
  15. </el-select>
  16. <el-button slot="append" @click="searchFilter" icon="el-icon-search"></el-button>
  17. </el-input>
  18. </div>
  19. </el-form-item>
  20. <!-- 合同类型 -->
  21. <el-form-item>
  22. <span style="margin-left:5px;margin-right:5px;color:#606266;">{{ $t('he-tong-lei-xing') }}</span>
  23. <el-select v-model="typeName" style="width:120px;" :placeholder="$t('defaultText.pleaseChoose')"
  24. @change="searchFilter" size="small" clearable>
  25. <el-option v-for="item in typeList" :key="item.id" :label="item.typeName" :value="item.id"></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <!-- 状态 -->
  29. <el-form-item>
  30. <span style="margin-left:5px;margin-right:5px;color:#606266;">{{ $t('state.states') }}</span>
  31. <el-select v-model="status" style="width:120px;" :placeholder="$t('defaultText.pleaseChoose')"
  32. @change="searchFilter" size="small" clearable>
  33. <el-option v-for="item, index in statusList" :key="item.label" :label="item.label"
  34. :value="index"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item>
  38. <span style="margin-left:5px;margin-right:5px;color:#606266;">供应商名称</span>
  39. <el-input v-model.trim="customerOrgs" placeholder="请输入" size="small" style="width: 150px" clearable
  40. @input="onCustomerOrgsInput"></el-input>
  41. </el-form-item>
  42. <el-form-item>
  43. <span style="margin-left:5px;margin-right:5px;color:#606266;">合同状态</span>
  44. <el-select v-model="finishStatuss" placeholder="请选择" style="width:120px" size="small" clearable
  45. @change="searchFilter">
  46. <el-option label="履约中" :value="1"></el-option>
  47. <el-option label="履约完成" :value="2"></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item>
  51. <span style="margin-left:5px;margin-right:5px;color:#606266;">合同印花税缴纳</span>
  52. <el-select v-model="stampDutyStatusVal" style="width:120px;" :placeholder="$t('defaultText.pleaseChoose')"
  53. @change="searchFilter" size="small" clearable>
  54. <el-option v-for="item in stampDutyStatusList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item style="float:right;">
  58. <el-dropdown>
  59. <el-link type="primary" :underline="false">{{ $t('viewmore') }}<i
  60. class="el-icon-arrow-down el-icon--right"></i></el-link>
  61. <el-dropdown-menu slot="dropdown">
  62. <el-dropdown-item v-if="permissions.contractType" @click.native="typeEdit()"><el-link type="primary"
  63. :underline="false">{{ $t('bian-ji') + $t('types') }}</el-link></el-dropdown-item>
  64. <el-dropdown-item v-if="permissions.contractType" @click.native="typeEditTwo()"><el-link type="primary"
  65. :underline="false">二级分类</el-link></el-dropdown-item>
  66. <el-dropdown-item v-if="permissions.contractImport" @click.native="importDialog = true"><el-link
  67. type="primary" :underline="false">{{ $t('dao-ru') }}</el-link></el-dropdown-item>
  68. <el-dropdown-item v-if="permissions.contractExport" @click.native="exportContract()"><el-link
  69. type="primary" :underline="false">{{ $t('export.export') }}</el-link></el-dropdown-item>
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. </el-form-item>
  73. <el-form-item style="float:right;" v-if="permissions.contractNew">
  74. <el-link type="primary" :underline="false" @click="newlyAdd()">{{ $t('xin-zeng-he-tong') }}</el-link>
  75. </el-form-item>
  76. </el-form>
  77. </el-col>
  78. <el-table :data="contractList" v-loading="listLoading" :height="tableHeight" border highlight-current-row>
  79. <el-table-column type="index" width="50"></el-table-column>
  80. <el-table-column prop="name" :label="$t('he-tong-ming-cheng')" min-width="190"></el-table-column>
  81. <el-table-column prop="number" :label="$t('contractno')" min-width="190"></el-table-column>
  82. <el-table-column prop="typeName" label="合同类型" min-width="190"></el-table-column>
  83. <el-table-column prop="secTypeName" label="二级分类" min-width="190"></el-table-column>
  84. <el-table-column prop="customerOrg" label="供应商名称" min-width="190"></el-table-column>
  85. <el-table-column prop="finishStatus" label="合同状态(是否结清)" min-width="190">
  86. <template slot-scope="scope">
  87. <span v-if="scope.row.finishStatus == 1" style="color: #E6A23C;">履约中</span>
  88. <span v-if="scope.row.finishStatus == 2" style="color: #67C23A;">履约完成</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="customerContact" label="供应商联系人" min-width="190"></el-table-column>
  92. <el-table-column prop="customerPhone" label="对方联系电话" min-width="190"></el-table-column>
  93. <el-table-column prop="useDepartment" label="使用部门" min-width="190"></el-table-column>
  94. <el-table-column prop="fundsSource" label="经费来源" min-width="190">
  95. <template slot-scope="scope">
  96. <span v-if="scope.row.fundsSource == 1">科研</span>
  97. <span v-if="scope.row.fundsSource == 2">其他(专项等)</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column prop="undertaker" label="合同承办人" min-width="190"></el-table-column>
  101. <el-table-column prop="agent" label="委托代理人" min-width="190"></el-table-column>
  102. <el-table-column prop="signDate" label="签订日期" min-width="190"></el-table-column>
  103. <el-table-column prop="startDate" label="合同生效日期" min-width="190"></el-table-column>
  104. <el-table-column prop="endDate" label="合同终止日期" min-width="190"></el-table-column>
  105. <el-table-column prop="filingsDate" label="备案日期" min-width="190"></el-table-column>
  106. <el-table-column prop="amounts" label="合同金额(元)/含税价" min-width="190"></el-table-column>
  107. <el-table-column prop="taxRate" label="增值税税率" min-width="190">
  108. <template slot-scope="scope">
  109. <span v-if="scope.row.taxRate">{{ scope.row.taxRate || 0 }} %</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column prop="amountsNoTax" label="合同金额(元)/不含税价" min-width="190"></el-table-column>
  113. <el-table-column prop="isAmountFixed" label="是否固定金额" min-width="190">
  114. <template slot-scope="scope">
  115. <span>{{ scope.row.isAmountFixed ? '是' : '否' }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="currency" label="币种" min-width="190"></el-table-column>
  119. <el-table-column prop="status" :label="$t('state.states')" min-width="120" align="center">
  120. <template slot-scope="scope">
  121. <span :style="statusList[scope.row.status].color">{{ statusList[scope.row.status].label }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="remarks" label="备注" min-width="190"></el-table-column>
  125. <el-table-column prop="stampDutyStatus" label="合同印花税缴纳状态" min-width="190">
  126. <template slot-scope="scope">
  127. {{ scope.row.stampDutyStatus | stampDutyStatusFilter }}
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="stampDutyTime" label="合同印花税缴纳时间" min-width="190"></el-table-column>
  131. <el-table-column prop="indate" :label="$t('creationtime')" min-width="130" align="center"></el-table-column>
  132. <el-table-column width="340" :label="$t('operation')" align="left" fixed="right">
  133. <template slot-scope="scope">
  134. <el-button v-if="permissions.contractView || permissions.contractManagement" size="mini"
  135. @click="lookover(scope.row)">{{ $t('cha-kan') }}</el-button>
  136. <el-button v-if="permissions.contractManagement" size="mini" @click="editContract(scope.row)"
  137. type="primary">{{ $t('bian-ji') }}</el-button>
  138. <el-button v-if="permissions.contractAudit && (scope.row.status == 1 || scope.row.status == 3)" size="mini"
  139. @click="process(scope.row, 0)" type="success">{{ $t('btn.through') }}</el-button>
  140. <el-button v-if="permissions.contractAudit && (scope.row.status == 1 || scope.row.status == 3)" size="mini"
  141. @click="processR(scope.row, 2)" type="danger">{{ $t('btn.rejected') }}</el-button>
  142. </template>
  143. </el-table-column>
  144. </el-table>
  145. <el-col :span="24" class="toolbar">
  146. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  147. :page-sizes="[20, 50, 80, 100]" :page-size="size" layout="total, sizes, prev, pager, next" :total="total"
  148. style="float:right;"></el-pagination>
  149. </el-col>
  150. <el-dialog :title="dialogTitle + $t('he-tong')" :visible.sync="addDialog" v-if="addDialog"
  151. :close-on-click-modal="false" customClass="customWidth" width="1200px" :top="'7.8vh'">
  152. <div style="height: 72vh;overflow-y: auto;overflow-x: hidden;">
  153. <el-form ref="contractForm" :model="contractForm" label-width="160px" :rules="rules" class="contractForm">
  154. <el-form-item :label="$t('contractno')">
  155. <el-input v-model="contractForm.number" :disabled="contractForm.status == 0" :maxlength="50"
  156. style="width:260px;" show-word-limit :placeholder="$t('peaseenterthe')" clearable
  157. @input="searchProject"></el-input>
  158. <span style="margin-left:20px;">{{ $t('rselatedprojects') }}</span>
  159. <el-select v-model="contractForm.projectId" filterable clearable style="width:260px;"
  160. :disabled="contractForm.status == 0">
  161. <el-option v-for="item in projectList" :key="item.id"
  162. :label="item.projectName + '\u3000' + (item.projectCode == null ? '' : item.projectCode)"
  163. :value="item.id">
  164. <span style="float: left; color: #8492a6; font-size: 13px;">{{ item.projectCode }}</span>
  165. <span style="float: right;">{{ item.projectName }}</span>
  166. </el-option>
  167. </el-select>
  168. </el-form-item>
  169. <el-form-item :label="$t('he-tong-ming-cheng')" prop='name'>
  170. <el-input v-model="contractForm.name" :disabled="contractForm.status == 0" :maxlength="100" show-word-limit
  171. :placeholder="$t('peaseenterthe')" clearable></el-input>
  172. </el-form-item>
  173. <el-form-item :label="$t('he-tong-lei-xing')">
  174. <el-select v-model="contractForm.typeId" :disabled="contractForm.status == 0"
  175. :placeholder="$t('defaultText.pleaseChoose')" style="width:100%" @change="selectSecTypeId()">
  176. <el-option v-for="item in typeList" :key="item.id" :label="item.typeName" :value="item.id"></el-option>
  177. </el-select>
  178. </el-form-item>
  179. <el-form-item label="二级分类">
  180. <el-select v-model="contractForm.secTypeId" :disabled="contractForm.status == 0 || !contractForm.typeId"
  181. :placeholder="$t('defaultText.pleaseChoose')" style="width:100%" @change="refreshDatas()">
  182. <el-option v-for="item in secondaryficationList" :key="item.id" :label="item.secTypeName"
  183. :value="item.id"></el-option>
  184. </el-select>
  185. </el-form-item>
  186. <el-form-item label="供应商名称">
  187. <el-input v-model="contractForm.customerOrg" :disabled="contractForm.status == 0"
  188. :placeholder="$t('peaseenterthe')" clearable></el-input>
  189. </el-form-item>
  190. <el-form-item label="供应商联系人">
  191. <el-input v-model="contractForm.customerContact" :disabled="contractForm.status == 0"
  192. :placeholder="$t('peaseenterthe')" clearable></el-input>
  193. </el-form-item>
  194. <el-form-item label="对方联系电话">
  195. <el-input v-model="contractForm.customerPhone" :disabled="contractForm.status == 0"
  196. :placeholder="$t('peaseenterthe')" clearable></el-input>
  197. </el-form-item>
  198. <el-form-item label="采购方式">
  199. <el-select v-model="contractForm.procurementWay" :disabled="contractForm.status == 0" placeholder="请选择">
  200. <el-option label="公开招标" :value="0"></el-option>
  201. <el-option label="邀请招标" :value="1"></el-option>
  202. <el-option label="询比价" :value="2"></el-option>
  203. <el-option label="竞争性谈判" :value="3"></el-option>
  204. <el-option label="单一来源" :value="4"></el-option>
  205. </el-select>
  206. </el-form-item>
  207. <el-form-item label="使用部门">
  208. <el-input v-model="contractForm.useDepartment" :disabled="contractForm.status == 0"
  209. :placeholder="$t('peaseenterthe')" clearable></el-input>
  210. </el-form-item>
  211. <el-form-item label="经费来源">
  212. <el-select v-model="contractForm.fundsSource" :disabled="contractForm.status == 0" placeholder="请选择">
  213. <el-option label="科研" value="1"></el-option>
  214. <el-option label="其他(专项等)" value="2"></el-option>
  215. </el-select>
  216. </el-form-item>
  217. <el-form-item label="合同承办人">
  218. <el-input v-model="contractForm.undertaker" :disabled="contractForm.status == 0"
  219. :placeholder="$t('peaseenterthe')" clearable></el-input>
  220. </el-form-item>
  221. <el-form-item label="委托代理人">
  222. <el-input v-model="contractForm.agent" :disabled="contractForm.status == 0"
  223. :placeholder="$t('peaseenterthe')" clearable></el-input>
  224. </el-form-item>
  225. <el-form-item label="签订日期">
  226. <el-date-picker v-model="contractForm.signDate" :disabled="contractForm.status == 0"
  227. value-format="yyyy-MM-dd" type="date" :placeholder="$t('optiondate')"></el-date-picker>
  228. </el-form-item>
  229. <el-form-item label="合同生效日期">
  230. <el-date-picker v-model="contractForm.startDate" :disabled="contractForm.status == 0"
  231. value-format="yyyy-MM-dd" type="date" :placeholder="$t('optiondate')"></el-date-picker>
  232. </el-form-item>
  233. <el-form-item label="合同终止日期">
  234. <el-date-picker v-model="contractForm.endDate" :disabled="contractForm.status == 0"
  235. value-format="yyyy-MM-dd" type="date" :placeholder="$t('optiondate')"></el-date-picker>
  236. </el-form-item>
  237. <el-form-item label="备案日期">
  238. <el-date-picker v-model="contractForm.filingsDate" :disabled="contractForm.status == 0"
  239. value-format="yyyy-MM-dd" type="date" :placeholder="$t('optiondate')"></el-date-picker>
  240. </el-form-item>
  241. <el-form-item label="合同金额(元)/含税价">
  242. <el-input v-model="contractForm.amounts" :disabled="contractForm.status == 0 || !contractForm.isAmountFixed"
  243. :placeholder="$t('peaseenterthe')" @change="chgPayedAmount()" clearable>
  244. <span slot="prefix">¥</span>
  245. </el-input>
  246. </el-form-item>
  247. <el-form-item label="增值税税率">
  248. <el-input v-model="contractForm.taxRate" :disabled="contractForm.status == 0"
  249. :placeholder="$t('peaseenterthe')" clearable @input="theContractAmountDoesNotIncludeTax()">
  250. <span slot="prefix">%</span>
  251. </el-input>
  252. </el-form-item>
  253. <el-form-item label="合同金额(元)/不含税价">
  254. <el-input v-model="contractForm.amountsNoTax" :disabled="contractForm.status == 0"
  255. :placeholder="$t('peaseenterthe')" clearable>
  256. <span slot="prefix">¥</span>
  257. </el-input>
  258. </el-form-item>
  259. <el-form-item label="是否固定金额">
  260. <el-select v-model="contractForm.isAmountFixed" :disabled="contractForm.status == 0" placeholder="请选择"
  261. @change="processingContractAmount()">
  262. <el-option label="是" :value="true"></el-option>
  263. <el-option label="否" :value="false"></el-option>
  264. </el-select>
  265. </el-form-item>
  266. <el-form-item label="币种">
  267. <el-input v-model="contractForm.currency" :disabled="contractForm.status == 0"
  268. :placeholder="$t('peaseenterthe')" clearable></el-input>
  269. </el-form-item>
  270. <el-form-item label="合同状态(是否结清)">
  271. <el-select v-model="contractForm.finishStatus" :disabled="contractForm.status == 0" placeholder="请选择">
  272. <el-option label="履约中" :value="1"></el-option>
  273. <el-option label="履约完成" :value="2"></el-option>
  274. </el-select>
  275. </el-form-item>
  276. <el-form-item label="合同印花税缴纳状态">
  277. <el-select v-model="contractForm.stampDutyStatus" :disabled="!permissions.contractStampDuty" placeholder="请选择"
  278. @change="stampDutyStatusChange()">
  279. <el-option v-for="item in stampDutyStatusList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  280. </el-select>
  281. </el-form-item>
  282. <el-form-item label="合同印花税缴纳时间">
  283. <el-date-picker v-model="contractForm.stampDutyTime" value-format="yyyy-MM-dd" type="date"
  284. placeholder="选择缴纳日期" :disabled="[0, 1].includes(contractForm.stampDutyStatus) || !permissions.contractStampDuty"
  285. :clearable="false" @change="stampDutyTimeChange()"></el-date-picker>
  286. </el-form-item>
  287. <el-form-item :label="$t('bei-zhu')">
  288. <el-input v-model="contractForm.remarks" :disabled="contractForm.status == 0"
  289. :placeholder="$t('peaseenterthe')" type="textarea" :rows="3" clearable></el-input>
  290. </el-form-item>
  291. <el-form-item label="付款计划">
  292. <el-table :data="contractPaymentList" size="small" :key="Math.random()" :height="'300px'"
  293. show-header="false" style="margin-top:10px;">
  294. <el-table-column prop="isPayed" width="120">
  295. <template slot-scope="scope">
  296. <el-checkbox v-model="scope.row.isPayed">已付款</el-checkbox>
  297. </template>
  298. <template slot="header">
  299. <span style="font-size:14px;font-weight:normal;">是否已付款</span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column prop="payedAmount" label="已付款金额(元)" width="160">
  303. <template slot-scope="scope">
  304. <el-input-number v-model="scope.row.payedAmount" controls-position="right" @change="chgPayedAmount()"
  305. :min="0" size="small" :precision="2" :controls="false"></el-input-number>
  306. </template>
  307. </el-table-column>
  308. <el-table-column prop="payType" label="付款类型" width="140">
  309. <template slot-scope="scope">
  310. <el-select v-model="scope.row.payType" placeholder="请选择" size="small">
  311. <el-option label="预付" :value="1"></el-option>
  312. <el-option label="报账" :value="0"></el-option>
  313. </el-select>
  314. </template>
  315. </el-table-column>
  316. <el-table-column prop="billNumber" label="凭证号" width="210">
  317. <template slot-scope="scope">
  318. <el-input v-model="scope.row.billNumber" :placeholder="$t('peaseenterthe')" clearable
  319. size="small"></el-input>
  320. </template>
  321. </el-table-column>
  322. <el-table-column v-if="contractForm.isAmountFixed" prop="pendingAmounts" label="待付款金额(元)" width="210">
  323. <template slot-scope="scope">
  324. {{ scope.row.pendingAmounts | pendingPaymentAmount }}
  325. </template>
  326. </el-table-column>
  327. <el-table-column prop="stampDutyTime" label="印花税缴纳时间" width="150">
  328. <template slot-scope="scope">
  329. <div><el-date-picker type="date" v-model="scope.row.stampDutyTime" style="width:140px;" :placeholder="$t('optiondate')" value-format="yyyy-MM-dd" size="small" :disabled="!permissions.contractStampDuty || contractForm.isAmountFixed || (!contractForm.isAmountFixed && [0, 1].includes(contractForm.stampDutyStatus))"></el-date-picker></div>
  330. </template>
  331. </el-table-column>
  332. <el-table-column width="80" fixed="right">
  333. <template slot-scope="scope">
  334. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;"
  335. @click.stop.native="deleteItem(scope.$index)"></el-button>
  336. </template>
  337. <template slot="header">
  338. <el-link type="primary" :underline="false" @click="addItem">{{ $t('addTian') }}</el-link>
  339. </template>
  340. </el-table-column>
  341. </el-table>
  342. </el-form-item>
  343. <el-form-item label-width="0" class="contractFiles">
  344. <div class="contractFiles_title">{{ $t('fu-jian') }}
  345. <el-upload style="float:right;margin-right:5%;" ref="uploadFile" action="#" :http-request="httpRequest"
  346. :on-change="fileChange" :auto-upload="false" :show-file-list="false">
  347. <el-link type="primary">{{ $t('xin-zeng-fu-jian') }}</el-link>
  348. </el-upload>
  349. </div>
  350. <el-table :data="fileList" :header-cell-style="{ 'font-weight': 'normal' }" highlight-current-row
  351. max-height="240" style="width: 100%;margin-top:10px;margin-bottom:15px">
  352. <el-table-column :label="$t('headerTop.serialNumber')" min-width="40" align="center">
  353. <template slot-scope="scope">
  354. <div>{{ scope.$index + 1 }}</div>
  355. </template>
  356. </el-table-column>
  357. <el-table-column :label="$t('filenames')" prop="name" min-width="140">
  358. <template slot-scope="scope">
  359. <el-link v-if="scope.row.url" @click="previewArea(scope.row)" type="primary">{{ scope.row.name }}</el-link>
  360. <span v-else>{{ scope.row.name }}</span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column :label="$t('operation')" min-width="40">
  364. <template slot-scope="scope">
  365. <el-link @click="fileDelete(scope.row)" type="primary">{{ $t('btn.delete') }}</el-link>
  366. </template>
  367. </el-table-column>
  368. </el-table>
  369. </el-form-item>
  370. </el-form>
  371. </div>
  372. <div slot="footer" class="dialog-footer;">
  373. <el-button @click.native="deleteContract()" style="float:left" v-if="dialogTitle == $t('bian-ji')">{{
  374. $t('btn.delete') }}</el-button>
  375. <el-button @click.native="addDialog = false">{{ $t('btn.cancel') }}</el-button>
  376. <el-button type="primary" @click="submitInsert()" :loading="submitLoading">{{ $t('btn.submit') }}</el-button>
  377. </div>
  378. </el-dialog>
  379. <el-dialog :title="$t('cha-kan-he-tong')" :visible.sync="lookoverDialog" v-if="lookoverDialog"
  380. :close-on-click-modal="false" customClass="customWidth" width="1200px" top="7.5vh">
  381. <div style="height: 72vh;overflow-y: auto;overflow-x: hidden;">
  382. <el-form label-width="160px" class="lookoverContract clearfix">
  383. <el-form-item :label="$t('contractno')">
  384. {{ contractForm.number }}
  385. </el-form-item>
  386. <el-form-item :label="$t('he-tong-ming-cheng')">
  387. {{ contractForm.name }}
  388. </el-form-item>
  389. <el-form-item :label="$t('he-tong-lei-xing')">
  390. {{ contractForm.typeName }}
  391. </el-form-item>
  392. <el-form-item label="二级分类">
  393. {{ contractForm.secTypeName }}
  394. </el-form-item>
  395. <el-form-item :label="$t('state.states')">
  396. {{ statusList[contractForm.status].label }}
  397. </el-form-item>
  398. <el-form-item :label="$t('dismissreason')" v-if="contractForm.status == 2">
  399. <span v-if="user.userNameNeedTranslate == 1">
  400. <span>
  401. <TranslationOpenDataText type='userName' :openid='contractForm.msg.name'></TranslationOpenDataText>
  402. </span>
  403. <span>{{ contractForm.msg.text }}</span>
  404. </span>
  405. <span v-else>
  406. {{ contractForm.msg ? contractForm.msg : '' }}
  407. </span>
  408. </el-form-item>
  409. <el-form-item :label="$t('founder')">
  410. <span v-if="user.userNameNeedTranslate == 1">
  411. <TranslationOpenDataText type='userName' :openid='contractForm.creatorName'></TranslationOpenDataText>
  412. </span>
  413. <span v-else>{{ contractForm.creatorName }}</span>
  414. </el-form-item>
  415. <el-form-item :label="$t('creationtime')">
  416. {{ contractForm.indate }}
  417. </el-form-item>
  418. <el-form-item label="供应商名称">
  419. {{ contractForm.customerOrg }}
  420. </el-form-item>
  421. <el-form-item label="供应商联系人">
  422. {{ contractForm.customerContact }}
  423. </el-form-item>
  424. <el-form-item label="对方联系电话">
  425. {{ contractForm.customerPhone }}
  426. </el-form-item>
  427. <el-form-item label="采购方式">
  428. {{ ['公开招标', '邀请招标', '询比价', '竞争性谈判', '单一来源'][contractForm.procurementWay] }}
  429. </el-form-item>
  430. <el-form-item label="使用部门">
  431. {{ contractForm.useDepartment }}
  432. </el-form-item>
  433. <el-form-item label="经费来源">
  434. <span v-if="contractForm.fundsSource == 1">科研</span>
  435. <span v-if="contractForm.fundsSource == 2">其他(专项等)</span>
  436. </el-form-item>
  437. <el-form-item label="合同承办人">
  438. {{ contractForm.undertaker }}
  439. </el-form-item>
  440. <el-form-item label="委托代理人">
  441. {{ contractForm.agent }}
  442. </el-form-item>
  443. <el-form-item label="签订日期">
  444. {{ contractForm.signDate }}
  445. </el-form-item>
  446. <el-form-item label="合同生效日期">
  447. {{ contractForm.startDate }}
  448. </el-form-item>
  449. <el-form-item label="合同终止日期">
  450. {{ contractForm.endDate }}
  451. </el-form-item>
  452. <el-form-item label="备案日期">
  453. {{ contractForm.filingsDate }}
  454. </el-form-item>
  455. <el-form-item label="合同金额(元)/含税价">
  456. ¥ {{ contractForm.amounts }}
  457. </el-form-item>
  458. <el-form-item label="增值税税率">
  459. {{ contractForm.taxRate || 0 }} %
  460. </el-form-item>
  461. <el-form-item label="合同金额(元)/不含税价">
  462. ¥ {{ contractForm.amountsNoTax }}
  463. </el-form-item>
  464. <el-form-item label="是否固定金额">
  465. {{ contractForm.isAmountFixed ? '是' : '否' }}
  466. </el-form-item>
  467. <el-form-item label="币种">
  468. {{ contractForm.currency }}
  469. </el-form-item>
  470. <el-form-item label="合同状态(是否结清)">
  471. <span v-if="contractForm.finishStatus == 1">履约中</span>
  472. <span v-else>履约完成</span>
  473. </el-form-item>
  474. <el-form-item label="合同印花税缴纳状态">
  475. {{ contractForm.stampDutyStatus | stampDutyStatusFilter }}
  476. </el-form-item>
  477. <el-form-item label="合同印花税缴纳时间">
  478. {{ contractForm.stampDutyTime }}
  479. </el-form-item>
  480. <el-form-item style="width:100%" :label="$t('bei-zhu')">
  481. {{ contractForm.remarks }}
  482. </el-form-item>
  483. <el-form-item style="width:100%" label="付款计划">
  484. <el-table :data="contractPaymentList" size="small" :key="Math.random()" :height="'300px'"
  485. show-header="false" style="margin-top:10px;">
  486. <el-table-column prop="isPayed">
  487. <template slot-scope="scope">
  488. {{ scope.row.isPayed ? '已付款' : '未付款' }}
  489. </template>
  490. <template slot="header">
  491. <span style="font-size:14px;font-weight:normal;">是否已付款</span>
  492. </template>
  493. </el-table-column>
  494. <!-- <el-table-column prop="payDate" label="付款日期" width="150"></el-table-column> -->
  495. <el-table-column prop="payedAmount" label="已付款金额(元)" width="160"></el-table-column>
  496. <el-table-column prop="payType" label="付款类型" width="140">
  497. <template slot-scope="scope">
  498. {{ scope.row.payType ? '预付' : '报账' }}
  499. </template>
  500. </el-table-column>
  501. <el-table-column prop="billNumber" label="凭证号" width="210"></el-table-column>
  502. <el-table-column prop="pendingAmounts" v-if="contractForm.isAmountFixed" label="待付款金额(元)" width="180"></el-table-column>
  503. <el-table-column prop="stampDutyTime" label="合同印花税缴纳时间" width="180"></el-table-column>
  504. </el-table>
  505. </el-form-item>
  506. <el-form-item label-width="0" class="contractFiles">
  507. <div class="contractFiles_title">{{ $t('fu-jian') }}</div>
  508. <el-table :data="fileList" :header-cell-style="{ 'font-weight': 'normal' }" highlight-current-row
  509. max-height="240" style="width: 100%;margin-top:10px;margin-bottom:30px">
  510. <el-table-column :label="$t('headerTop.serialNumber')" min-width="40" align="center">
  511. <template slot-scope="scope">
  512. <div>{{ scope.$index + 1 }}</div>
  513. </template>
  514. </el-table-column>
  515. <el-table-column :label="$t('filenames')" prop="name" min-width="140">
  516. <template slot-scope="scope">
  517. <el-link v-if="scope.row.url" @click="previewArea(scope.row)" type="primary">{{ scope.row.name }}</el-link>
  518. <span v-else>{{ scope.row.name }}</span>
  519. </template>
  520. </el-table-column>
  521. <!-- <el-table-column label="文件大小" min-width="60">
  522. <template slot-scope="scope">
  523. <div>{{scope.$index + 1}}</div>
  524. </template>
  525. </el-table-column> -->
  526. <el-table-column :label="$t('operation')" min-width="40">
  527. <template slot-scope="scope">
  528. <el-link @click="fileDownload(scope.row)" type="primary">{{ $t('other.download') }}</el-link>
  529. </template>
  530. </el-table-column>
  531. </el-table>
  532. </el-form-item>
  533. </el-form>
  534. </div>
  535. </el-dialog>
  536. <el-dialog :title="$t('he-tong-lei-xing-guan-li')" :visible.sync="typeDialog" v-if="typeDialog"
  537. customClass="customWidth" width="500px">
  538. <el-table :data="typeList" highlight-current-row height="400" style="width: 100%;">
  539. <el-table-column type="index" width="60" :label="$t('headerTop.serialNumber')">
  540. <template slot-scope="scope">{{ scope.$index + 1 }}</template>
  541. </el-table-column>
  542. <el-table-column prop="typeName"></el-table-column>
  543. <el-table-column :label="$t('operation')" width="150">
  544. <template slot-scope="scope">
  545. <el-button size="small" type="primary" @click="typeItemEdit(scope.row)">{{ $t('bian-ji') }}</el-button>
  546. <el-button size="small" type="danger" @click="typeItemDelete(scope.row)">{{ $t('btn.delete') }}</el-button>
  547. </template>
  548. </el-table-column>
  549. </el-table>
  550. <div slot="footer" class="dialog-footer;">
  551. <el-button type="primary" @click="typeDialog = false">{{ $t('Shutdown') }}</el-button>
  552. <el-button type="primary" @click="typeItemAdd()">{{ $t('xin-zeng-he-tong-lei-xing') }}</el-button>
  553. </div>
  554. <el-dialog :title="typeTitle == this.$t('add') ? $t('xin-zeng-he-tong-lei-xing') : $t('bian-ji-he-tong-lei-xing')"
  555. :visible.sync="typeItemDialog" v-if="typeItemDialog" append-to-body width="400px">
  556. <div style="height: 12vh;overflow-y: auto;overflow-x: hidden;">
  557. <el-input v-model="typeItemForm.typeName" :maxlength="200"></el-input>
  558. </div>
  559. <div slot="footer" class="dialog-footer;">
  560. <el-button type="primary" @click="typeItemDialog = false">{{ $t('btn.cancel') }}</el-button>
  561. <el-button type="primary" @click="typeItemSubmit()">{{ $t('btn.determine') }}</el-button>
  562. </div>
  563. </el-dialog>
  564. </el-dialog>
  565. <el-dialog :title="$t('dao-ru-he-tong')" :visible.sync="importDialog" v-if="importDialog" width="30%">
  566. <!-- 模板? -->
  567. <p>1. {{ $t('other.download') }}
  568. <el-link type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/上海民航合同模板.xlsx'"
  569. download="上海民航合同模板.xlsx">上海民航合同模板.xlsx</el-link>
  570. </p>
  571. <div slot="footer" class="dialog-footer" style="text-align:center;">
  572. <el-upload ref="upload" action="#" :limit="1" :http-request="importContract" :show-file-list="false">
  573. <el-button type="primary" :loading="importLoading">{{ $t('dao-ru-he-tong') }}</el-button>
  574. </el-upload>
  575. </div>
  576. </el-dialog>
  577. <el-dialog :title="$t('defaultText.pleaseEnterTheReason')" v-if="denyReasonDialog" :visible.sync="denyReasonDialog"
  578. :close-on-click-modal="false" customClass="customWidth" width="500px">
  579. <div>
  580. <el-input type="textarea" v-model="denyReason" rows="2" :placeholder="$t('reasonforyourdecisiontoreject')" />
  581. </div>
  582. <div slot="footer" class="dialog-footer">
  583. <el-button @click="denyReasonDialog = false">{{ $t('btn.cancel') }}</el-button>
  584. <el-button type="primary" @click="process(null, 2)">{{ $t('btn.submit') }}</el-button>
  585. </div>
  586. </el-dialog>
  587. <el-dialog title="二级分类" :visible.sync="typeDialogTwo" width="800px" top="7.8vh">
  588. <div class="secondaryClassification">
  589. <el-tabs v-model="tabsName" tab-position="left" style="height: 100%;" @tab-click="tabClick">
  590. <el-tab-pane v-for="(item, index) in typeList" :key="index" :label="item.typeName" :name="item.typeName">
  591. <div class="secondaryClassification_content">
  592. <el-table :data="secondaryficationList" highlight-current-row v-loading="secondaryLoading" height="50vh"
  593. style="width: 100%;flex: 1">
  594. <el-table-column type="index" width="60" :label="$t('headerTop.serialNumber')">
  595. <template slot-scope="scope">{{ scope.$index + 1 }}</template>
  596. </el-table-column>
  597. <el-table-column prop="secTypeName" label="名称"></el-table-column>
  598. <el-table-column :label="$t('operation')" width="150">
  599. <template slot-scope="scope">
  600. <el-button size="small" type="primary" @click="editTypeTwoItem(scope.row)">{{ $t('bian-ji')
  601. }}</el-button>
  602. <el-button size="small" type="danger" @click="typeItemDeleteTwo(scope.row)">{{ $t('btn.delete')
  603. }}</el-button>
  604. </template>
  605. </el-table-column>
  606. </el-table>
  607. <div slot="footer" class="dialog-footer dibucLas">
  608. <el-button type="primary" @click="typeDialogTwo = false">{{ $t('Shutdown') }}</el-button>
  609. <el-button type="primary" @click="editTypeTwoItem()">新增二级分类</el-button>
  610. </div>
  611. <el-dialog title="新增/编辑分类" :visible.sync="typeTwoItemVisable" append-to-body width="400px">
  612. <div style="height: 12vh;overflow-y: auto;overflow-x: hidden;">
  613. <el-input v-model.trim="typeItemForm.typeName" :maxlength="200"></el-input>
  614. </div>
  615. <div slot="footer" class="dialog-footer;">
  616. <el-button type="primary" @click="typeTwoItemVisable = false">{{ $t('btn.cancel') }}</el-button>
  617. <el-button type="primary" @click="typeItemTwoSubmit()">{{ $t('btn.determine') }}</el-button>
  618. </div>
  619. </el-dialog>
  620. </div>
  621. </el-tab-pane>
  622. </el-tabs>
  623. </div>
  624. </el-dialog>
  625. <el-dialog :title="'以下付款记录均未缴纳印花税,请选择此次缴纳印花税的付款记录:'" v-if="stampDutyTimeListVisable"
  626. :visible.sync="stampDutyTimeListVisable" :close-on-click-modal="false" customClass="customWidth" width="1000px">
  627. <div>
  628. <el-table :data="stampDutyTimeList" border style="width: 100%" height="56vh" @selection-change="stampDutySelection">
  629. <el-table-column type="selection" width="55"></el-table-column>
  630. <el-table-column prop="isPayed" align="center" label="是否已付款" width="120">
  631. <template slot-scope="scope">
  632. <span v-if="scope.row.isPayed">已付款</span>
  633. <span v-else>未付款</span>
  634. </template>
  635. </el-table-column>
  636. <el-table-column prop="payedAmount" align="center" label="已付款金额(元)" width="160"></el-table-column>
  637. <el-table-column prop="payType" align="center" label="付款类型" width="120">
  638. <template slot-scope="scope">
  639. {{ scope.row.payType ? '预付' : '报账' }}
  640. </template>
  641. </el-table-column>
  642. <el-table-column prop="billNumber" align="center" label="凭证号"></el-table-column>
  643. <el-table-column prop="pendingAmounts" align="center" label="待付款金额(元)" width="160"></el-table-column>
  644. </el-table>
  645. </div>
  646. <div slot="footer" class="dialog-footer">
  647. <el-button @click="stampDutyTimeListVisable = false">{{ $t('btn.cancel') }}</el-button>
  648. <el-button type="primary" @click="stampDutyTimeListConfirmed" :disabled="!this.stampDutySelectionList.length">{{ $t('btn.submit') }}</el-button>
  649. </div>
  650. </el-dialog>
  651. <!-- 动态插入预览组件 -->
  652. <FilePreview v-if="filePreviewUrl" :url="filePreviewUrl" />
  653. </section>
  654. </template>
  655. <script>
  656. import { debounce } from 'lodash';
  657. import FilePreview from '../../../components/filePreview.vue';
  658. export default {
  659. components: { FilePreview },
  660. data() {
  661. return {
  662. filePreviewUrl: '',
  663. paymentDate: null,
  664. contractPaymentList: [],
  665. user: JSON.parse(sessionStorage.getItem("user")),
  666. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  667. searchField: 0,
  668. keyword: '',
  669. typeName: '',
  670. status: '',
  671. dateArray: [],
  672. customerOrgs: '',
  673. finishStatuss: '',
  674. typeList: [],
  675. contractList: [],
  676. listLoading: false,
  677. statusList: [
  678. { label: this.$t('state.approved'), color: 'color:#67c23a;' },
  679. { label: this.$t('state.WaitingAudit'), color: 'color:#e6a23c;' },
  680. { label: this.$t('state.rejected'), color: 'color:#f56c6c;' },
  681. // {label:this.$t('other.importWaitingForReview'),color: 'color:#e6a23c;'},
  682. ],
  683. typeDialog: false,
  684. typeTitle: this.$t('add'),
  685. typeItemDialog: false,
  686. typeItemForm: { typeName: '' },
  687. denyReasonDialog: false,
  688. denyReason: '',
  689. denyrow: null,
  690. dialogTitle: this.$t('add'),
  691. addDialog: false,
  692. lookoverDialog: false,
  693. submitLoading: false,
  694. contractForm: {
  695. number: '',
  696. name: '',
  697. amounts: '',
  698. typeId: null,
  699. remarks: '',
  700. startDate: '',
  701. endDate: '',
  702. secTypeId: '',
  703. stampDutyStatus: 1,
  704. stampDutyTime: ''
  705. },
  706. rules: {
  707. name: [{ required: true, message: this.$t('pleaseentername'), trigger: "blur" }],
  708. },
  709. fileList: [],
  710. importDialog: false,
  711. importLoading: false,
  712. typeDialogTwo: false,
  713. projectList: [],
  714. page: 1,
  715. size: 20,
  716. total: 0,
  717. tableHeight: 0,
  718. typeTwoItemVisable: false,
  719. typeItemTwoForm: {
  720. typeName: ''
  721. },
  722. secondaryficationList: [],
  723. secondaryficationListTwo: [],
  724. secondLevelItem: {},
  725. secondaryLoading: false,
  726. tabsName: '',
  727. stampDutyStatusList: [
  728. { label: '无需缴纳', id: 0 },
  729. { label: '未缴纳', id: 1 },
  730. { label: '已缴纳', id: 2 },
  731. { label: '部分缴纳', id: 3 },
  732. ],
  733. stampDutyStatusVal: null,
  734. tampDutyTimeNullList: [],
  735. stampDutySelectionList: [],
  736. stampDutyTimeListVisable: false,
  737. }
  738. },
  739. filters: {
  740. pendingPaymentAmount(value) {
  741. if (!value) return 0
  742. return value.toFixed(2)
  743. },
  744. stampDutyStatusFilter(val) {
  745. if(!val && val != 0) {
  746. return ''
  747. }
  748. return [
  749. { label: '无需缴纳', id: 0 },
  750. { label: '未缴纳', id: 1 },
  751. { label: '已缴纳', id: 2 },
  752. { label: '部分缴纳', id: 3 },
  753. ].find(item => item.id == val).label
  754. }
  755. },
  756. created() {
  757. let height = window.innerHeight;
  758. this.tableHeight = height - 180;
  759. const that = this;
  760. window.onresize = function temp() {
  761. that.tableHeight = window.innerHeight - 185;
  762. };
  763. },
  764. mounted() {
  765. this.getProjectList();
  766. this.getContractList();
  767. this.getContractType();
  768. this.getSecondLevelList()
  769. },
  770. methods: {
  771. previewArea(row) {
  772. const { url } = row
  773. this.filePreviewUrl = ''; // 先清空,防止 iframe 不刷新
  774. this.$nextTick(() => {
  775. this.filePreviewUrl = url
  776. // this.filePreviewUrl = `https://worktime.ttkuaiban.com/upload/7538bc96c9844c21a4c5f99e0de5d0f9.docx`
  777. });
  778. },
  779. onCustomerOrgsInput: debounce(function () {
  780. this.searchFilter();
  781. }, 500),
  782. processingContractAmount() {
  783. if (this.contractForm.isAmountFixed) {
  784. return
  785. }
  786. const list = this.contractPaymentList || []
  787. const totalNum = list.reduce((sum, item) => sum + (item.payedAmount || 0), 0);
  788. console.log(list, '<====== 开始执行')
  789. console.log(totalNum, '<====== 开始执行')
  790. this.contractForm.amounts = totalNum
  791. },
  792. chgPayedAmount() {
  793. const { amounts } = this.contractForm
  794. const list = this.contractPaymentList || []
  795. let totalNum = +amounts || 0
  796. // 计算合同金额不含税
  797. this.theContractAmountDoesNotIncludeTax()
  798. if (amounts <= 0 || list.length <= 0) {
  799. this.processingContractAmount()
  800. return
  801. } else {
  802. this.processingContractAmount()
  803. }
  804. for (let i in list) {
  805. if (list[i].payedAmount) {
  806. let copyTotalNum = JSON.parse(JSON.stringify(totalNum))
  807. totalNum = totalNum - list[i].payedAmount
  808. if (totalNum <= 0) {
  809. totalNum = 0;
  810. list[i].payedAmount = copyTotalNum;
  811. }
  812. list[i].pendingAmounts = totalNum;
  813. }
  814. }
  815. this.contractPaymentList = list
  816. this.$forceUpdate()
  817. },
  818. theContractAmountDoesNotIncludeTax() {
  819. const { amounts, taxRate } = this.contractForm
  820. if(!amounts || !taxRate) {
  821. return
  822. }
  823. this.contractForm.amountsNoTax = (+amounts / (1 + (+taxRate / 100))).toFixed(2)
  824. },
  825. restrictNumber(targetId) {
  826. let inpu = document.getElementById(targetId);
  827. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  828. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  829. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g, '').replace('$#*', '.');//去除其他"."
  830. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  831. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  832. inpu.value = parseFloat(inpu.value);
  833. }
  834. if (inpu.value.split('.')[0].length > 9) {
  835. inpu.value = inpu.value.split('.')[0].substring(0, 9) + (inpu.value.split('.')[1] ? '.' + inpu.value.split('.')[1] : '')
  836. this.contractForm.amounts = inpu.value
  837. }
  838. },
  839. searchProject() {
  840. console.log(this.contractForm.number);
  841. //按合同编号去匹配项目编号,自动加载关联项目
  842. if (this.contractForm.number) {
  843. var matchItem = this.projectList.filter(p => p.projectCode == this.contractForm.number);
  844. if (matchItem.length > 0) {
  845. this.contractForm.projectId = matchItem[0].id;
  846. this.contractForm.name = matchItem[0].projectName;
  847. this.contractForm.amount = matchItem[0].contractAmount;
  848. }
  849. }
  850. },
  851. //删除合同回款情况
  852. deleteItem(index) {
  853. this.contractPaymentList.splice(index, 1);
  854. },
  855. //添加合同回款情况
  856. addItem() {
  857. // let p = 0;
  858. // this.contractPaymentList.push( { contractId:this.contractForm.id, isPayed:false,payDate: null, amount:0.0});
  859. const { isAmountFixed, stampDutyStatus } = this.contractForm
  860. if(!isAmountFixed && stampDutyStatus == 2) {
  861. this.contractForm.stampDutyStatus = 3
  862. if ([0, 1].includes(stampDutyStatus)) {
  863. this.contractForm.stampDutyTime = ''
  864. }
  865. }
  866. let val = {
  867. contractId: this.contractForm.id,
  868. isPayed: false,
  869. payDate: null,
  870. payedAmount: 0,
  871. payType: 1,
  872. billNumber: '',
  873. pendingAmounts: 0,
  874. stampDutyTime: ''
  875. }
  876. this.contractPaymentList.push(val)
  877. },
  878. getProjectList() {
  879. this.http.post('/contract/getProjectList', {},
  880. res => {
  881. if (res.code == 'ok') {
  882. this.projectList = res.data;
  883. } else {
  884. this.$message({
  885. message: res.msg,
  886. type: 'error'
  887. })
  888. }
  889. }, err => {
  890. this.$message({
  891. message: err,
  892. type: 'error'
  893. })
  894. })
  895. },
  896. disabledStart(date) {
  897. if (this.contractForm.endDate) {
  898. if (date > new Date(this.contractForm.endDate)) {
  899. return true
  900. } else {
  901. return false
  902. }
  903. } else {
  904. return false
  905. }
  906. },
  907. disabledEnd(date) {
  908. if (this.contractForm.startDate) {
  909. if (date < new Date(this.contractForm.startDate)) {
  910. return true
  911. } else {
  912. return false
  913. }
  914. } else {
  915. return false
  916. }
  917. },
  918. searchFilter() {
  919. this.page = 1
  920. this.getContractList()
  921. },
  922. handleSizeChange(val) {
  923. this.size = val
  924. this.page = 1
  925. this.getContractList()
  926. },
  927. handleCurrentChange(val) {
  928. this.page = val;
  929. this.getContractList()
  930. },
  931. importContract(item) {
  932. let str = item.file.name.split('.')
  933. let format = str[str.length - 1];
  934. if (format != "xls" && format != "xlsx") {
  935. this.$message({
  936. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  937. type: 'error'
  938. })
  939. } else {
  940. this.importLoading = true
  941. let formData = new FormData();
  942. formData.append("file", item.file);
  943. formData.append("userId", this.user.id);
  944. this.http.uploadFile('/contract/importContract', formData,
  945. res => {
  946. this.$refs.upload.clearFiles();
  947. this.importLoading = false;
  948. if (res.code == 'ok') {
  949. this.importDialog = false
  950. this.$message({
  951. message: this.$t('other.importSuccess'),
  952. type: 'success'
  953. })
  954. this.getContractList()
  955. } else {
  956. this.$message({
  957. message: res.msg,
  958. type: 'error'
  959. })
  960. }
  961. }, err => {
  962. this.importLoading = false;
  963. this.$message({
  964. message: err,
  965. type: 'error'
  966. })
  967. })
  968. }
  969. },
  970. exportContract() {
  971. let parameter = {}
  972. if (this.typeName) {
  973. parameter.typeName = this.typeName
  974. }
  975. if (this.keyword) {
  976. if (this.searchField) {
  977. parameter.number = this.keyword
  978. } else {
  979. parameter.name = this.keyword
  980. }
  981. }
  982. if (this.status !== '') {
  983. parameter.status = this.status
  984. }
  985. if (this.dateArray && this.dateArray.length == 2) {
  986. parameter.startDate = this.dateArray[0]
  987. parameter.endDate = this.dateArray[1]
  988. }
  989. if (this.customerOrgs) {
  990. parameter.customerOrg = this.customerOrgs
  991. }
  992. if (this.finishStatuss) {
  993. parameter.finishStatus = this.finishStatuss
  994. }
  995. this.http.post('/contract/exportContractOneToMany', parameter,
  996. res => {
  997. if (res.code == 'ok') {
  998. let filePath = res.data;
  999. const a = document.createElement('a'); // 创建a标签
  1000. a.setAttribute('download', this.$t('he-tong-dao-chu') + '.xlsx');// download属性
  1001. a.setAttribute('href', filePath);// href链接
  1002. a.click(); //自执行点击事件
  1003. a.remove();
  1004. } else {
  1005. this.$message({
  1006. message: res.msg,
  1007. type: 'error'
  1008. })
  1009. }
  1010. }, err => {
  1011. this.$message({
  1012. message: err,
  1013. type: 'error'
  1014. })
  1015. })
  1016. },
  1017. typeEdit() {
  1018. this.typeDialog = true
  1019. },
  1020. typeEditTwo() {
  1021. console.log(this.typeList)
  1022. console.log(this.secondaryficationList)
  1023. console.log(this.tabsName)
  1024. this.secondLevelItem = this.typeList[0] || {}
  1025. this.tabsName = this.typeList[0] && (this.typeList[0].mainTypeName || this.typeList[0].typeName)
  1026. const id = this.secondLevelItem.id
  1027. this.secondaryficationList = this.secondaryficationListTwo.filter(item => item.mainTypeId == id)
  1028. this.$forceUpdate()
  1029. this.typeDialogTwo = true
  1030. },
  1031. typeItemAdd() {
  1032. if (this.typeList.length == 20) {
  1033. this.$message({
  1034. message: this.$t('he-tong-lei-xing-zui-duo-zhi-neng-chuang-jian-20-ge'),
  1035. type: 'error'
  1036. })
  1037. return
  1038. }
  1039. this.typeTitle = this.$t('add')
  1040. this.typeItemForm = { typeName: '' }
  1041. this.typeItemDialog = true
  1042. },
  1043. typeItemEdit(row) {
  1044. this.typeTitle = this.$t('bian-ji')
  1045. this.typeItemForm = JSON.parse(JSON.stringify(row))
  1046. this.typeItemDialog = true
  1047. },
  1048. typeItemDelete(row) {
  1049. this.$confirm(this.$t('que-ding-yao-shan-chu-ci-tiao-he-tong-lei-xing-ma'), this.$t('other.prompts'), {
  1050. confirmButtonText: this.$t('btn.determine'),
  1051. cancelButtonText: this.$t('btn.cancel'),
  1052. type: 'warning'
  1053. }).then(() => {
  1054. this.http.post('/contractType/deleteContractType', {
  1055. deleteId: row.id
  1056. }, res => {
  1057. if (res.code == 'ok') {
  1058. this.getContractType()
  1059. this.$message({
  1060. type: 'success',
  1061. message: this.$t('message.successfullyDeleted') + '!'
  1062. });
  1063. } else {
  1064. this.$message({
  1065. type: 'error',
  1066. message: res.msg
  1067. });
  1068. }
  1069. }, err => {
  1070. this.$message({
  1071. type: 'error',
  1072. message: err
  1073. });
  1074. })
  1075. }).catch(() => {
  1076. this.$message({
  1077. type: 'info',
  1078. message: this.$t('thedeletionhasbeencancelled')
  1079. });
  1080. });
  1081. },
  1082. typeItemSubmit() {
  1083. this.http.post('/contractType/changeContractType', this.typeItemForm,
  1084. res => {
  1085. if (res.code == 'ok') {
  1086. this.typeItemDialog = false
  1087. this.getContractType()
  1088. this.$message({
  1089. message: this.typeTitle == this.$t('add') ? this.$t('newsuccess') : this.$t('editsuccess'),
  1090. type: 'success'
  1091. })
  1092. } else {
  1093. this.$message({
  1094. message: res.msg,
  1095. type: 'error'
  1096. })
  1097. }
  1098. }, err => {
  1099. this.$message({
  1100. message: err,
  1101. type: 'error'
  1102. })
  1103. })
  1104. },
  1105. stampDutyStatusChange() {
  1106. const val = this.contractForm.stampDutyStatus
  1107. if ([0, 1].includes(val)) {
  1108. this.contractForm.stampDutyTime = ''
  1109. }
  1110. if(!this.contractForm.isAmountFixed && [2, 3].includes(val)) {
  1111. this.contractPaymentList = (this.contractPaymentList || []).map(item => {
  1112. return {
  1113. ...item,
  1114. stampDutyTime: ''
  1115. }
  1116. })
  1117. }
  1118. },
  1119. newlyAdd() {
  1120. this.dialogTitle = this.$t('add')
  1121. this.contractForm = {
  1122. number: '',
  1123. name: '',
  1124. amounts: '',
  1125. typeId: null,
  1126. remarks: '',
  1127. startDate: '',
  1128. endDate: '',
  1129. isAmountFixed: true,
  1130. stampDutyStatus: 1,
  1131. stampDutyTime: ''
  1132. }
  1133. this.contractPaymentList = [];
  1134. this.fileList = []
  1135. this.addDialog = true
  1136. },
  1137. editContract(row) {
  1138. delete row.customData
  1139. this.dialogTitle = this.$t('bian-ji')
  1140. this.contractForm = JSON.parse(JSON.stringify(row))
  1141. console.log('开始执行', '<================')
  1142. if (row.typeId) {
  1143. const id = row.typeId
  1144. this.secondaryficationList = this.secondaryficationListTwo.filter(item => item.mainTypeId == id)
  1145. }
  1146. this.fileList = this.contractForm.files ? this.contractForm.files : []
  1147. for (let i in this.fileList) {
  1148. this.fileList[i].name = this.fileList[i].documentName
  1149. }
  1150. this.addDialog = true;
  1151. this.getContractPaymentList();
  1152. },
  1153. getContractPaymentList() {
  1154. this.contractPaymentList = [];
  1155. this.http.post('/contract-payment/getList', { contractId: this.contractForm.id },
  1156. res => {
  1157. if (res.code == 'ok') {
  1158. res.data = res.data.map(item => ({
  1159. ...item,
  1160. payType: item.payType ? 1 : 0
  1161. }));
  1162. console.log(res.data, '<==== 数据')
  1163. this.contractPaymentList = res.data;
  1164. } else {
  1165. this.$message({
  1166. message: res.msg,
  1167. type: 'error'
  1168. })
  1169. }
  1170. }, err => {
  1171. this.$message({
  1172. message: err,
  1173. type: 'error'
  1174. })
  1175. })
  1176. },
  1177. deleteContract() {
  1178. this.$confirm(this.$t('que-ding-yao-shan-chu-gai-he-tong-ma'), this.$t('other.prompts'), {
  1179. confirmButtonText: this.$t('btn.determine'),
  1180. cancelButtonText: this.$t('btn.cancel'),
  1181. type: 'warning'
  1182. }).then(() => {
  1183. this.http.post('/contract/deleteContract', {
  1184. id: this.contractForm.id
  1185. }, res => {
  1186. if (res.code == 'ok') {
  1187. this.addDialog = false
  1188. this.getContractList()
  1189. this.$message({
  1190. type: 'success',
  1191. message: this.$t('message.successfullyDeleted') + '!'
  1192. });
  1193. } else {
  1194. this.$message({
  1195. type: 'error',
  1196. message: res.msg
  1197. });
  1198. }
  1199. }, err => {
  1200. this.$message({
  1201. type: 'error',
  1202. message: err
  1203. });
  1204. })
  1205. }).catch(() => {
  1206. this.$message({
  1207. type: 'info',
  1208. message: this.$t('thedeletionhasbeencancelled')
  1209. });
  1210. });
  1211. },
  1212. processR(row, status) {
  1213. this.denyReasonDialog = true
  1214. this.denyrowId = row.id
  1215. this.denyReason = ''
  1216. },
  1217. process(row, status) {
  1218. let parameter
  1219. if (status == 2) {
  1220. parameter = {
  1221. id: this.denyrowId,
  1222. status: status,
  1223. msg: this.denyReason
  1224. }
  1225. } else {
  1226. parameter = {
  1227. id: row.id,
  1228. status: status
  1229. }
  1230. }
  1231. this.$confirm(this.$t('que-ren-shen-he-tong-guo-ma-tong-guo-hou-he-tong-ji-ben-xin-xi-wu-fa-xiu-gai'), this.$t('other.prompts'), {
  1232. confirmButtonText: this.$t('btn.determine'),
  1233. cancelButtonText: this.$t('btn.cancel'),
  1234. type: 'warning'
  1235. }).then(() => {
  1236. this.http.post('/contract/processContract', parameter,
  1237. res => {
  1238. if (res.code == 'ok') {
  1239. this.getContractList()
  1240. this.denyReasonDialog = false
  1241. this.$message({
  1242. message: status == 0 ? this.$t('state.alreadyPassed') : this.$t('state.rejected'),
  1243. type: 'success'
  1244. })
  1245. } else {
  1246. this.$message({
  1247. message: res.msg,
  1248. type: 'error'
  1249. })
  1250. }
  1251. }, err => {
  1252. this.$message({
  1253. message: err,
  1254. type: 'error'
  1255. })
  1256. })
  1257. });
  1258. },
  1259. lookover(row) {
  1260. console.log('lookover', row);
  1261. const newRow = JSON.parse(JSON.stringify(row))
  1262. if (this.user.userNameNeedTranslate == 1) {
  1263. let obj = { name: '', text: '' }
  1264. if (newRow.msg) {
  1265. let match = newRow.msg.match(/\$userName=(.*?)\$(.*)/);
  1266. if (match) {
  1267. obj.name = match[1];
  1268. obj.text = match[2];
  1269. } else {
  1270. obj.text = newRow.msg;
  1271. }
  1272. }
  1273. // if(newRow.msg.indexOf('$userName=') != '-1') {
  1274. // let str = newRow.msg.split('$userName=')[1]
  1275. // let arr = str.split('$')
  1276. // obj.name = arr[0]
  1277. // obj.text = arr[1]
  1278. // } else {
  1279. // obj.text = newRow.msg
  1280. // }
  1281. newRow.msg = obj
  1282. this.contractForm = newRow
  1283. } else {
  1284. this.contractForm = newRow
  1285. }
  1286. this.fileList = this.contractForm.files ? this.contractForm.files : []
  1287. for (let i in this.fileList) {
  1288. this.fileList[i].name = this.fileList[i].documentName
  1289. }
  1290. this.lookoverDialog = true;
  1291. this.getContractPaymentList();
  1292. },
  1293. returnValuableData(list) {
  1294. return list.map(obj => {
  1295. return Object.fromEntries(
  1296. Object.entries(obj).filter(([key, value]) => value !== null && value !== undefined && value !== '')
  1297. );
  1298. });
  1299. },
  1300. submitInsert() {
  1301. this.$refs.contractForm.validate(valid => {
  1302. if (valid) {
  1303. //校验回款日期和金额
  1304. var totalPayment = 0.0;
  1305. for (var i = 0; i < this.contractPaymentList.length; i++) {
  1306. // if (!this.contractPaymentList[i].payDate) {
  1307. // this.$message({
  1308. // message: this.$t('hui-kuan-ri-qi-bu-neng-wei-kong'),
  1309. // type: 'error'
  1310. // })
  1311. // return;
  1312. // }
  1313. if (!this.contractPaymentList[i].payedAmount) {
  1314. this.$message({
  1315. message: this.$t('hui-kuan-jinebu-neng-wei-0'),
  1316. type: 'error'
  1317. })
  1318. return;
  1319. }
  1320. totalPayment += parseFloat(this.contractPaymentList[i].payedAmount);
  1321. }
  1322. if ((totalPayment > parseFloat(this.contractForm.amounts)) && this.contractForm.isAmountFixed) {
  1323. this.$message({
  1324. message: this.$t('zong-hui-kuan-jinebu-de-da-yu-he-tong-jin-e'),
  1325. type: 'error'
  1326. })
  1327. return;
  1328. }
  1329. this.submitLoading = true
  1330. delete this.contractForm.files
  1331. this.contractForm.paymentListStr = JSON.stringify(this.returnValuableData(this.contractPaymentList));
  1332. delete this.contractForm.msg
  1333. delete this.contractForm.nextPaymentDate
  1334. delete this.contractForm.nextPaymentAmount
  1335. delete this.contractForm.payCustomizedData
  1336. delete this.contractForm.checkerId
  1337. this.http.post(this.dialogTitle == this.$t('add') ? '/contract/addContract' : '/contract/editContract', this.contractForm,
  1338. res => {
  1339. this.submitLoading = false
  1340. if (res.code == 'ok') {
  1341. this.addDialog = false
  1342. this.$message({
  1343. message: res.msg,
  1344. type: 'success'
  1345. })
  1346. if (this.dialogTitle == this.$t('add')) {
  1347. this.contractForm.id = res.data
  1348. }
  1349. this.submitFile()
  1350. } else {
  1351. this.$message({
  1352. message: res.msg,
  1353. type: 'error'
  1354. })
  1355. }
  1356. }, err => {
  1357. this.submitLoading = false
  1358. this.$message({
  1359. message: err,
  1360. type: 'error'
  1361. })
  1362. })
  1363. }
  1364. })
  1365. },
  1366. fileChange(file, fileList) {
  1367. // console.log('fileChange',file,fileList);
  1368. file.needUpload = true
  1369. this.fileList.push(file)
  1370. },
  1371. fileDelete(row) {
  1372. // console.log(row,this.fileList);
  1373. this.$confirm(this.$t('que-ding-yao-shan-chu-gai-wen-jian-ma'), this.$t('other.prompts'), {
  1374. confirmButtonText: this.$t('btn.determine'),
  1375. cancelButtonText: this.$t('btn.cancel'),
  1376. type: 'warning'
  1377. }).then(() => {
  1378. if (row.uid) {
  1379. for (let i in this.fileList) {
  1380. if (this.fileList[i].uid && this.fileList[i].uid == row.uid) {
  1381. this.fileList.splice(i, 1)
  1382. }
  1383. }
  1384. } else {
  1385. this.http.post('/contract-document/fileDelete', {
  1386. contractId: this.contractForm.id,
  1387. fileIds: [row.id]
  1388. }, res => {
  1389. if (res.code == 'ok') {
  1390. this.getContractList()
  1391. this.fileList.filter(item => !item.id || item.id != row.id)
  1392. this.$message({
  1393. type: 'success',
  1394. message: this.$t('message.successfullyDeleted') + '!'
  1395. });
  1396. } else {
  1397. this.$message({
  1398. type: 'error',
  1399. message: res.msg
  1400. });
  1401. }
  1402. }, err => {
  1403. this.$message({
  1404. type: 'error',
  1405. message: err
  1406. });
  1407. })
  1408. }
  1409. }).catch(() => {
  1410. this.$message({
  1411. type: 'info',
  1412. message: this.$t('thedeletionhasbeencancelled')
  1413. });
  1414. });
  1415. },
  1416. fileDownload(row) {
  1417. this.http.downloadFile('/contract-document/fileDown', {
  1418. contractId: this.contractForm.id,
  1419. fileId: row.id
  1420. }, row.name, err => {
  1421. this.$message({
  1422. message: err,
  1423. type: 'error'
  1424. })
  1425. })
  1426. },
  1427. submitFile() {
  1428. // console.log('submitFile',this.fileList);
  1429. let formData = new FormData();
  1430. for (let i in this.fileList) {
  1431. if (this.fileList[i].needUpload) {
  1432. formData.append("file", this.fileList[i].raw);
  1433. }
  1434. }
  1435. formData.append("ContractId", this.contractForm.id);
  1436. this.http.uploadFile('/contract-document/fileUpload', formData,
  1437. res => {
  1438. if (res.code == 'ok') {
  1439. this.getContractList()
  1440. } else {
  1441. this.$message({
  1442. message: res.msg,
  1443. type: 'error'
  1444. })
  1445. }
  1446. }, err => {
  1447. this.$message({
  1448. message: err,
  1449. type: 'error'
  1450. })
  1451. })
  1452. },
  1453. getContractType() {
  1454. this.http.post('/contractType/getContractType', {},
  1455. res => {
  1456. if (res.code == 'ok') {
  1457. this.typeList = res.data
  1458. } else {
  1459. this.$message({
  1460. message: res.msg,
  1461. type: 'error'
  1462. })
  1463. }
  1464. }, err => {
  1465. this.$message({
  1466. message: err,
  1467. type: 'error'
  1468. })
  1469. })
  1470. },
  1471. getContractList() {
  1472. // pageIndex,pageSize,number,name,typeName,status,startDate,endDate
  1473. let parameter = {
  1474. pageIndex: this.page,
  1475. pageSize: this.size,
  1476. }
  1477. if (this.typeName) {
  1478. parameter.typeName = this.typeName
  1479. }
  1480. if (this.keyword) {
  1481. if (this.searchField) {
  1482. parameter.number = this.keyword
  1483. } else {
  1484. parameter.name = this.keyword
  1485. }
  1486. }
  1487. if (this.status !== '') {
  1488. parameter.status = this.status
  1489. }
  1490. if (this.dateArray && this.dateArray.length == 2) {
  1491. parameter.startDate = this.dateArray[0]
  1492. parameter.endDate = this.dateArray[1]
  1493. }
  1494. if (this.paymentDate && this.paymentDate.length == 2) {
  1495. parameter.paymentStartDate = this.paymentDate[0]
  1496. parameter.paymentEndDate = this.paymentDate[1]
  1497. }
  1498. if (this.customerOrgs) {
  1499. parameter.customerOrg = this.customerOrgs
  1500. }
  1501. if (this.finishStatuss) {
  1502. parameter.finishStatus = this.finishStatuss
  1503. }
  1504. if(this.stampDutyStatusVal || this.stampDutyStatusVal === 0) {
  1505. parameter.stampDutyStatus = this.stampDutyStatusVal
  1506. }
  1507. this.listLoading = true
  1508. this.http.post('/contract/getContractPage', parameter,
  1509. res => {
  1510. this.listLoading = false
  1511. if (res.code == 'ok') {
  1512. const newData = res.data.data.map(item => {
  1513. return {
  1514. ...item,
  1515. ...item.customData
  1516. }
  1517. })
  1518. this.contractList = newData
  1519. this.total = res.data.total
  1520. } else {
  1521. this.$message({
  1522. message: res.msg,
  1523. type: 'error'
  1524. })
  1525. }
  1526. }, err => {
  1527. this.listLoading = false
  1528. this.$message({
  1529. message: err,
  1530. type: 'error'
  1531. })
  1532. })
  1533. },
  1534. tabClick(e) {
  1535. const item = this.typeList[e.index]
  1536. const { id } = item
  1537. this.secondLevelItem = item
  1538. this.secondaryficationList = this.secondaryficationListTwo.filter(item => item.mainTypeId == id)
  1539. },
  1540. selectSecTypeId() {
  1541. this.contractForm.secTypeId = ''
  1542. const id = this.contractForm.typeId
  1543. this.secondaryficationList = this.secondaryficationListTwo.filter(item => item.mainTypeId == id)
  1544. },
  1545. refreshDatas() {
  1546. this.$forceUpdate()
  1547. },
  1548. editTypeTwoItem(row) {
  1549. const { id, secTypeName } = row || {};
  1550. this.typeItemForm = {
  1551. id: id || undefined,
  1552. typeName: secTypeName || ''
  1553. };
  1554. this.typeTwoItemVisable = true;
  1555. },
  1556. typeItemDeleteTwo(row) {
  1557. const { id, secTypeName } = row
  1558. this.$confirm(`此操作将永久删除【${secTypeName}】, 是否继续?`, '提示', {
  1559. confirmButtonText: '确定',
  1560. cancelButtonText: '取消',
  1561. type: 'warning'
  1562. }).then(() => {
  1563. this.postData(`/contract-type-sec/deleteContractType`, {
  1564. deleteId: id
  1565. }).then(() => {
  1566. this.getSecondLevelList()
  1567. this.$message({
  1568. type: 'success',
  1569. message: '删除成功!'
  1570. })
  1571. })
  1572. }).catch(() => { });
  1573. },
  1574. getSecondLevelList() {
  1575. this.secondaryLoading = true
  1576. this.postData(`/contract-type-sec/getContractType `, {
  1577. }).then(res => {
  1578. const { id } = this.secondLevelItem
  1579. this.secondaryficationList = res.data.filter(item => item.mainTypeId == id)
  1580. this.secondaryficationListTwo = res.data || []
  1581. }).finally(() => {
  1582. this.secondaryLoading = false
  1583. })
  1584. },
  1585. typeItemTwoSubmit() {
  1586. console.log(this.typeItemForm, '<=== 要提交的数据')
  1587. const mainTypeId = this.secondLevelItem.id
  1588. const secTypeName = this.typeItemForm.typeName
  1589. const formVal = {
  1590. mainTypeId,
  1591. secTypeName
  1592. }
  1593. if (this.typeItemForm.id) {
  1594. formVal.id = this.typeItemForm.id
  1595. }
  1596. this.postData(`/contract-type-sec/changeContractType`, {
  1597. ...formVal
  1598. }).then(() => {
  1599. this.getSecondLevelList()
  1600. this.typeTwoItemVisable = false
  1601. })
  1602. },
  1603. stampDutyTimeChange() {
  1604. const { id, isAmountFixed } = this.contractForm
  1605. if (id && !isAmountFixed && this.contractForm.status != 0) {
  1606. this.getStampDutyTimeNullList(id)
  1607. }
  1608. },
  1609. stampDutySelection(val) {
  1610. this.stampDutySelectionList = val
  1611. },
  1612. getStampDutyTimeNullList(id) {
  1613. // this.postData(`/contract-pay-customized/getStampDutyTimeNullList`, {
  1614. // contractId: id
  1615. // }).then(res => {
  1616. // this.stampDutySelectionList = []
  1617. // this.stampDutyTimeList = res.data
  1618. // if((res.data || []).length > 0) {
  1619. // this.stampDutyTimeListVisable = true
  1620. // }
  1621. // })
  1622. const list = [...(this.contractPaymentList || [])].filter(item => {
  1623. return item.stampDutyTime == null
  1624. })
  1625. this.stampDutySelectionList = []
  1626. this.stampDutyTimeList = [...list]
  1627. if(list.length > 0) {
  1628. this.stampDutyTimeListVisable = true
  1629. }
  1630. },
  1631. stampDutyTimeListConfirmed() {
  1632. const billNumberList = this.stampDutySelectionList.map(item => item.billNumber)
  1633. this.contractPaymentList = this.contractPaymentList.map(items => {
  1634. const obj = { ...items }
  1635. if(billNumberList.includes(items.billNumber)) {
  1636. obj.stampDutyTime = this.contractForm.stampDutyTime
  1637. }
  1638. return {
  1639. ...obj
  1640. }
  1641. })
  1642. this.stampDutyTimeListVisable = false
  1643. },
  1644. async postData(urls, param) {
  1645. return new Promise((resolve, reject) => {
  1646. this.http.post(urls, { ...param },
  1647. res => {
  1648. if (res.code == 'ok') {
  1649. resolve(res)
  1650. } else {
  1651. this.$message({
  1652. message: res.msg,
  1653. type: 'error'
  1654. })
  1655. reject(res)
  1656. }
  1657. resolve(res)
  1658. },
  1659. error => {
  1660. this.$message({
  1661. message: error,
  1662. type: "error"
  1663. });
  1664. reject(error)
  1665. }
  1666. )
  1667. });
  1668. },
  1669. },
  1670. }
  1671. </script>
  1672. <style>
  1673. .lookoverContract {
  1674. margin-top: 30px;
  1675. }
  1676. .lookoverContract .el-form-item {
  1677. width: 50%;
  1678. float: left;
  1679. }
  1680. .lookoverContract .el-form-item__label {
  1681. font-weight: 600;
  1682. }
  1683. .lookoverContract .contractFiles {
  1684. width: 100%;
  1685. }
  1686. .lookoverContract .contractFiles_title {
  1687. margin-left: 5%;
  1688. font-size: 16px;
  1689. line-height: 20px;
  1690. margin-top: 16px;
  1691. }
  1692. .contractForm {
  1693. margin-top: 30px;
  1694. }
  1695. .contractForm .el-form-item {
  1696. width: 90%;
  1697. }
  1698. .contractForm .contractFiles {
  1699. width: 100%;
  1700. }
  1701. .contractForm .contractFiles_title {
  1702. margin-left: 5%;
  1703. font-size: 16px;
  1704. line-height: 20px;
  1705. margin-top: 16px;
  1706. }
  1707. .secondaryClassification {
  1708. width: 100%;
  1709. height: 60vh;
  1710. overflow: auto;
  1711. }
  1712. .secondaryClassification_content {
  1713. padding: 10px 20px;
  1714. display: flex;
  1715. flex-direction: column;
  1716. height: 58vh;
  1717. }
  1718. .dibucLas {
  1719. padding-top: 10px;
  1720. display: flex;
  1721. justify-content: flex-end;
  1722. }
  1723. </style>