lhypbMessage.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. <template>
  2. <view>
  3. <view class="u-m-20">
  4. <u-form :model="form" ref="uForm" label-width="220" :error-type="errorType">
  5. <u-form-item label="样品名称" prop="yangPinMingCheng" required>
  6. <u-input placeholder="请输入样品名称" v-model="form.yangPinMingCheng"
  7. :disabled="type == 'detail'?true :false" />
  8. </u-form-item>
  9. <u-form-item label="样品编号">
  10. <u-input placeholder="请输入样品编号" v-model="form.yangPinBianHao" disabled />
  11. </u-form-item>
  12. <u-form-item label="姓名">
  13. <u-input placeholder="请输入姓名" v-model="form.xingMing" :disabled="type == 'detail'?true :false" />
  14. </u-form-item>
  15. <u-form-item label="性别">
  16. <uni-data-select placeholder="请选择性别" v-model="form.xingBie" :localdata="sexList"
  17. v-if="type != 'detail'">
  18. </uni-data-select>
  19. <!-- <u-radio-group v-model="form.xingBie" v-if="type != 'detail'">
  20. <u-radio v-for="(it, index) in sexList" :key="index" :name="it.name">
  21. {{it.name}}
  22. </u-radio>
  23. </u-radio-group> -->
  24. <text v-else>{{form.xingBie}}</text>
  25. </u-form-item>
  26. <u-form-item label="年龄">
  27. <u-input placeholder="请输入年龄" v-model="form.nianLing" :disabled="type == 'detail'?true :false" />
  28. </u-form-item>
  29. <u-form-item label="送检批号/编号" prop="songJianPiHao" required>
  30. <u-input placeholder="请输入送检批号/编号" v-model="form.songJianPiHao"
  31. :disabled="type == 'detail'?true :false" />
  32. </u-form-item>
  33. <u-form-item label="样本状态" prop="yangPinZhuangTai" required>
  34. <u-input placeholder="请选择样本状态" v-model="form.yangPinZhuangTai"
  35. :disabled="type == 'detail'?true :false" />
  36. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  37. @click="sheetClick('state')" v-if="type != 'detail'">选择
  38. </u-button>
  39. </u-form-item>
  40. <u-form-item label="送检时间" prop="songJianShiJian" required>
  41. <u-input placeholder="请选择送检时间" v-model="form.songJianShiJian" disabled />
  42. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  43. @click="dateClick('inspect')" v-if="type != 'detail'">选择
  44. </u-button>
  45. </u-form-item>
  46. <u-form-item label="备注">
  47. <u-input placeholder="请输入备注" v-model="form.beiZhu1" :disabled="type == 'detail'?true :false" />
  48. </u-form-item>
  49. <view class="qingshe">
  50. <view class="qingTitle">
  51. 常规项目选择
  52. </view>
  53. </view>
  54. <u-form-item label="项目编号搜索" v-if="type != 'detail'">
  55. <u-input placeholder="请输入项目编号搜索" v-model="form.search" />
  56. </u-form-item>
  57. <u-form-item label="检测类型" v-if="type != 'detail'">
  58. <!-- <u-input placeholder="请选择检测类型" type="select" v-model="form.jianCeType"
  59. @click="selectClick('jianCeType')" /> -->
  60. <lin-select item-key="id" placeholder='请输入内容' :binData="jianCeTypeList" checkType="checkbox"
  61. tags="name" inputStyle="" selectStyle="" overflow="hide" @getBackVal="checkBoxChange">
  62. </lin-select>
  63. </u-form-item>
  64. <view v-if="false">
  65. <uni-data-checkbox v-model="form.jianCeType" multiple :localdata="jianCeTypeList"
  66. @change="checkBoxChange">
  67. </uni-data-checkbox>
  68. </view>
  69. <u-form-item label="检测项目" prop="name">
  70. <div style="display: flex;justify-content: flex-end;" @click="jianCeShow = !jianCeShow">
  71. <!-- <checkbox :checked="checked" style="margin-right: 15rpx;" @click="checkedChange" />全选 -->
  72. <u-icon name="arrow-up" color="#999" v-if="jianCeShow">
  73. </u-icon>
  74. <u-icon name="arrow-down" color="#999" v-else></u-icon>
  75. </div>
  76. </u-form-item>
  77. <view v-if="jianCeShow">
  78. <view v-if="type != 'detail'">
  79. <view>
  80. <checkbox-group v-for="(it, x) in form.jianCeList" :key="x">
  81. <label class=" uni-list-cell uni-list-cell-pd" v-show="it.checked"
  82. style="display: flex;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  83. <view>
  84. <checkbox :checked="it.checked" :value="it.id_" @click="changeIndex(it,x)" />
  85. </view>
  86. <view style="margin-left: 10rpx;font-size: 26rpx;" @click.stop="getSty(it)">
  87. <view>
  88. {{it.xiang_mu_bian_hao || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  89. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '0'}}元]</text>
  90. </view>
  91. <view>检测类别:{{it.jian_ce_lei_bie_}}</view>
  92. <!-- <view>{{it.yi_ju_de_biao_zhu || ''}}</view> -->
  93. <view>报告周期(工作日):{{it.bao_gao_zhou_qi_g || '当'}}天</view>
  94. </view>
  95. </label>
  96. </checkbox-group>
  97. </view>
  98. <view>
  99. <checkbox-group v-for="(it, x) in form.jianCeList" :key="x">
  100. <label class=" uni-list-cell uni-list-cell-pd"
  101. v-show="((form.jianCeTypeString.indexOf(it.jian_ce_lei_bie_ || '') !== -1) || (form.search && it.xiang_mu_bian_hao.indexOf(form.search) !== -1)) && !it.checked"
  102. style="display: flex;margin: 15rpx 10rpx;font-size: 20rpx;line-height: 40rpx;">
  103. <view>
  104. <checkbox :checked="it.checked" :value="it.id_" @click="changeIndex(it,x)" />
  105. </view>
  106. <view style="margin-left: 10rpx;font-size: 26rpx;" @click.stop="getSty(it)">
  107. <view>
  108. {{it.xiang_mu_bian_hao || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  109. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '0'}}元]</text>
  110. </view>
  111. <view>检测类别:{{it.jian_ce_lei_bie_}}</view>
  112. <!-- <view>{{it.yi_ju_de_biao_zhu || ''}}</view> -->
  113. <view>报告周期(工作日):{{it.bao_gao_zhou_qi_g || '当'}}天</view>
  114. </view>
  115. </label>
  116. </checkbox-group>
  117. </view>
  118. </view>
  119. <view v-else>
  120. <view v-for="(it, x) in form.jianCeList" :key="x" v-if="it.checked"
  121. @click="getJianXiangData(it)">
  122. <view class="jiancexiangm">
  123. <view>
  124. {{it.xiang_mu_bian_hao || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  125. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '当'}}元]</text>
  126. </view>
  127. <view>检测类别:{{it.jian_ce_lei_bie_}}</view>
  128. <!-- <view>{{it.yi_ju_de_biao_zhu || ''}}</view> -->
  129. <view>报告周期(工作日):{{it.bao_gao_zhou_qi_g || '当'}}天</view>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="qingshe" v-if="taoCanShow">
  135. <view class="qingTitle">
  136. 套餐选择
  137. </view>
  138. </view>
  139. <u-form-item label="选择套餐" prop="name" label-position="top" v-if="taoCanShow">
  140. <view class="btnBox" v-if="type != 'detail'">
  141. <u-button class="btnSin" size="mini" :type="it.checked ? 'success':''"
  142. v-for="(it, x) in form.taoCanList" :key="x" @click="changeTaoCanIndex(it,x,it.checked)">
  143. {{it.tao_can_ming_chen}}
  144. </u-button>
  145. </view>
  146. <view class="btnBox" v-else>
  147. <u-tag class="btnSin" size="default" v-for="(it, x) in item.taoCanList" v-if="it.checked"
  148. :text="it.tao_can_ming_chen" :key="x" />
  149. </view>
  150. </u-form-item>
  151. <u-form-item label="套餐项目" prop="name" v-if="taoCanShow">
  152. <div style="display: flex;justify-content: flex-end;"
  153. @click="taoCanXiangMuShow = !taoCanXiangMuShow">
  154. <u-icon name="arrow-up" v-if="taoCanXiangMuShow"></u-icon>
  155. <u-icon name="arrow-down" v-else></u-icon>
  156. </div>
  157. </u-form-item>
  158. <view v-if="taoCanXiangMuShow && form.taoCanXiangMuList && form.taoCanXiangMuList.length > 0">
  159. <view style="padding: 0 20rpx;">
  160. <view v-for="(it, x) in form.taoCanXiangMuList" :key="x" @click.stop="getSty(it)">
  161. <view class="jiancexiangm">
  162. <view>
  163. {{it.jian_ce_lei_bie_ || ''}}-{{it.jian_ce_xiang_mu_ || ''}}
  164. <text style="color: red;">[{{it.zhe_hou_jia_ge_ || '当'}}元]</text>
  165. </view>
  166. <view>{{it.yi_ju_de_biao_zhu || ''}}</view>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="qingshe" @click="form.showBoolean1 = !form.showBoolean1">
  172. <view>
  173. </view>
  174. <view>
  175. <u-icon name="arrow-up" v-if="form.showBoolean1"></u-icon>
  176. <u-icon name="arrow-down" v-else></u-icon>
  177. </view>
  178. </view>
  179. <block v-if="form.showBoolean1">
  180. <u-form-item label="样品类型①" required>
  181. <u-input placeholder="请选择样品类型①" v-model="form.yangPinLeiXing"
  182. :disabled="type == 'detail'?true :false" />
  183. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  184. @click="sheetClick('yangpinType1','样品类型')" v-if="type != 'detail'">选择
  185. </u-button>
  186. </u-form-item>
  187. <u-form-item label="样品运输条件①" required>
  188. <u-input placeholder="请选择样品运输条件①" v-model="form.yangBenYunShuTiao"
  189. :disabled="type == 'detail'?true :false" />
  190. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  191. @click="sheetClick('transportType1')" v-if="type != 'detail'">选择
  192. </u-button>
  193. </u-form-item>
  194. <u-form-item label="样品数量①" required>
  195. <uni-number-box v-model="form.shuLiang" v-if="type != 'detail'"></uni-number-box>
  196. <text v-else>{{form.shuLiang}}</text>
  197. </u-form-item>
  198. <u-form-item label="样品规格①" required>
  199. <u-input placeholder="请输入样品规格①" v-model="form.yangPinGuiGe"
  200. :disabled="type == 'detail'?true :false" />
  201. <u-button slot="right" type="success" class="btn-back-color" size="mini"
  202. @click="sheetClick('specification1','样品规格')" v-if="type != 'detail'">规格
  203. </u-button>
  204. </u-form-item>
  205. </block>
  206. <view
  207. v-if="(type == 'detail' && (form.yangPinLeiXingEr || form.yangPinYunShuTiao || form.shuLiangEr > 0 || form.yangPinGuiGeEr)) || type != 'detail'">
  208. <view class="qingshe" @click="form.showBoolean2 = !form.showBoolean2">
  209. <view>
  210. </view>
  211. <view>
  212. <u-icon name="arrow-up" v-if="form.showBoolean2"></u-icon>
  213. <u-icon name="arrow-down" v-else></u-icon>
  214. </view>
  215. </view>
  216. <block v-if="form.showBoolean2">
  217. <u-form-item label="样品类型②" required>
  218. <u-input placeholder="请选择样品类型②" v-model="form.yangPinLeiXingEr"
  219. :disabled="type == 'detail'?true :false" />
  220. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  221. @click="sheetClick('yangpinType2','样品类型')" v-if="type != 'detail'">选择
  222. </u-button>
  223. </u-form-item>
  224. <u-form-item label="样品运输条件②" required>
  225. <u-input placeholder="请选择样品运输条件②" v-model="form.yangPinYunShuTiao"
  226. :disabled="type == 'detail'?true :false" />
  227. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  228. @click="sheetClick('transportType2')" v-if="type != 'detail'">选择
  229. </u-button>
  230. </u-form-item>
  231. <u-form-item label="样品数量②" required>
  232. <uni-number-box v-model="form.shuLiangEr" v-if="type != 'detail'"></uni-number-box>
  233. <text v-else>{{form.shuLiangEr}}</text>
  234. </u-form-item>
  235. <u-form-item label="样品规格②" required>
  236. <u-input placeholder="请输入样品规格②" v-model="form.yangPinGuiGeEr"
  237. :disabled="type == 'detail'?true :false" />
  238. <u-button slot="right" type="success" class="btn-back-color" size="mini"
  239. @click="sheetClick('specification2','样品规格')" v-if="type != 'detail'">规格
  240. </u-button>
  241. </u-form-item>
  242. </block>
  243. </view>
  244. <view
  245. v-if="(type == 'detail' && (form.yangPinLeiXingSan || form.yangPinYunShuSan || form.shuLiangSan > 0 || form.yangPinGuiGeSan)) || type != 'detail'">
  246. <view class="qingshe" @click="form.showBoolean3 = !form.showBoolean3">
  247. <view>
  248. </view>
  249. <view>
  250. <u-icon name="arrow-up" v-if="form.showBoolean3"></u-icon>
  251. <u-icon name="arrow-down" v-else></u-icon>
  252. </view>
  253. </view>
  254. <block v-if="form.showBoolean3">
  255. <u-form-item label="样品类型③" required>
  256. <u-input placeholder="请选择样品类型③" v-model="form.yangPinLeiXingSan"
  257. :disabled="type == 'detail'?true :false" />
  258. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  259. @click="sheetClick('yangpinType3','样品类型')" v-if="type != 'detail'">选择
  260. </u-button>
  261. </u-form-item>
  262. <u-form-item label="样品运输条件③" required>
  263. <u-input placeholder="请选择样品运输条件③" v-model="form.yangPinYunShuSan"
  264. :disabled="type == 'detail'?true :false" />
  265. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  266. @click="sheetClick('transportType3')" v-if="type != 'detail'">选择
  267. </u-button>
  268. </u-form-item>
  269. <u-form-item label="样品数量③" required>
  270. <uni-number-box v-model="form.shuLiangSan" v-if="type != 'detail'"></uni-number-box>
  271. <text v-else>{{form.shuLiangSan}}</text>
  272. </u-form-item>
  273. <u-form-item label="样品规格③" required>
  274. <u-input placeholder="请输入样品规格③" v-model="form.yangPinGuiGeSan"
  275. :disabled="type == 'detail'?true :false" />
  276. <u-button slot="right" type="success" class="btn-back-color" size="mini"
  277. @click="sheetClick('specification3','样品规格')" v-if="type != 'detail'">规格
  278. </u-button>
  279. </u-form-item>
  280. </block>
  281. </view>
  282. <view
  283. v-if="(type == 'detail' && (form.yangPinLeiXingSi || form.yangPinYunShuSi || form.shuLiangSi > 0 || form.yangPinGuiGeSi)) || type != 'detail'">
  284. <view class="qingshe" @click="form.showBoolean4 = !form.showBoolean4">
  285. <view>
  286. </view>
  287. <view>
  288. <u-icon name="arrow-up" v-if="form.showBoolean4"></u-icon>
  289. <u-icon name="arrow-down" v-else></u-icon>
  290. </view>
  291. </view>
  292. <block v-if="form.showBoolean4">
  293. <u-form-item label="样品类型④" required>
  294. <u-input placeholder="请选择样品类型④" v-model="form.yangPinLeiXingSi"
  295. :disabled="type == 'detail'?true :false" />
  296. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  297. @click="sheetClick('yangpinType4','样品类型')" v-if="type != 'detail'">选择
  298. </u-button>
  299. </u-form-item>
  300. <u-form-item label="样品运输条件④" required>
  301. <u-input placeholder="请选择样品运输条件④" v-model="form.yangPinYunShuSi"
  302. :disabled="type == 'detail'?true :false" />
  303. <u-button type="success" slot="right" class="btn-back-color" size="mini"
  304. @click="sheetClick('transportType4')" v-if="type != 'detail'">选择
  305. </u-button>
  306. </u-form-item>
  307. <u-form-item label="样品数量④" required>
  308. <uni-number-box v-model="form.shuLiangSi" v-if="type != 'detail'"></uni-number-box>
  309. <text v-else>{{form.shuLiangSi}}</text>
  310. </u-form-item>
  311. <u-form-item label="样品规格④" required>
  312. <u-input placeholder="请输入样品规格④" v-model="form.yangPinGuiGeSi"
  313. :disabled="type == 'detail'?true :false" />
  314. <u-button slot="right" type="success" class="btn-back-color" size="mini"
  315. @click="sheetClick('specification4','样品规格')" v-if="type != 'detail'">规格
  316. </u-button>
  317. </u-form-item>
  318. </block>
  319. </view>
  320. <u-form-item label="项目名称" prop="xiangMuMingCheng" v-if="form.mingChengShow">
  321. <u-input placeholder="请输入项目名称" v-model="form.xiangMuMingCheng"
  322. :disabled="type == 'detail'?true :false" />
  323. </u-form-item>
  324. <u-form-item label="样品总价" prop="yangPinZongJia">
  325. <u-input v-model="form.yangPinZongJia" disabled />
  326. </u-form-item>
  327. </u-form>
  328. <view style="height: 110rpx;" v-if="itemType"></view>
  329. <view class="btnBottom" v-if="itemType">
  330. <u-row>
  331. <u-col span="6">
  332. <u-button type="success" class="btn green-back-color" @click="deletSing">取消
  333. </u-button>
  334. </u-col>
  335. <u-col span="6">
  336. <u-button type="success" class="btn btn-back-color" @click="sumbitSing">保存
  337. </u-button>
  338. </u-col>
  339. </u-row>
  340. </view>
  341. </view>
  342. <u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback" z-index="2000">
  343. </u-action-sheet>
  344. <u-select v-model="selectShow" :list="list" @confirm="selectConfirm"></u-select>
  345. <u-calendar v-model="dateShow" :mode="mode" max-date="2050-01-01" @change="dateChange"></u-calendar>
  346. <lin-popup ref="picker" :title="title" :list="list" @onConfirm="onConfirm"></lin-popup>
  347. </view>
  348. </template>
  349. <script>
  350. import order from './test.json'
  351. import linSelect from '@/components/lin-select/lin-select.vue'
  352. import meth from './meth.js'
  353. export default {
  354. components: {
  355. linSelect
  356. },
  357. props: {
  358. jianCeTypeList: {
  359. type: Array,
  360. default: () => {
  361. return []
  362. }
  363. },
  364. taoCanShow: {
  365. type: Boolean,
  366. default: true
  367. },
  368. heTongId: {
  369. type: String,
  370. default: ''
  371. },
  372. item: {
  373. type: Object,
  374. default: function() {
  375. return {};
  376. }
  377. },
  378. itemType: {
  379. type: Boolean,
  380. default: true
  381. },
  382. type: {
  383. type: String,
  384. default: 'add'
  385. },
  386. },
  387. data() {
  388. return {
  389. jianCeShow: true,
  390. taoCanXiangMuShow: true,
  391. checked: false,
  392. errorType: ['toast'],
  393. form: this.item,
  394. //样本状态
  395. sampleStateList: order.sampleState,
  396. sexList: order.sex,
  397. //样本类型
  398. sampleTypeList: [],
  399. //样本运输条件
  400. transportTypeList: order.transportType,
  401. //样本规格
  402. // specificationList: order.specification,
  403. specificationList: [],
  404. validList: order.validList,
  405. list: [],
  406. listType: '',
  407. sheetShow: false,
  408. selectShow: false,
  409. dateShow: false,
  410. mode: 'date',
  411. rules: {
  412. yangPinMingCheng: [{
  413. required: true,
  414. message: '请输入样品名称',
  415. trigger: 'blur',
  416. }],
  417. songJianPiHao: [{
  418. required: true,
  419. message: '请输入送检批号/编号',
  420. trigger: 'blur',
  421. }],
  422. yangPinZhuangTai: [{
  423. required: true,
  424. message: '请输入样本状态',
  425. trigger: 'blur',
  426. }],
  427. songJianShiJian: [{
  428. required: true,
  429. message: '请输入送检时间',
  430. trigger: 'blur',
  431. }],
  432. },
  433. title: ''
  434. }
  435. },
  436. created() {
  437. this.getYpbzggb()
  438. this.getYplxb()
  439. },
  440. methods: {
  441. //获取初始化数据,在添加使用
  442. getInit(data) {
  443. this.form = JSON.parse(JSON.stringify(data))
  444. },
  445. //样品类型
  446. getYplxb() {
  447. let sql =
  448. `select lei_xing_ from t_yplxb order by create_time_ desc`
  449. let requestData = this.$sig(sql)
  450. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  451. if (res.data.state == 200) {
  452. const datas = res.data.variables.data
  453. if (datas.length > 0) {
  454. datas.forEach(item => {
  455. this.$set(item, 'name', item.lei_xing_)
  456. })
  457. this.sampleTypeList = datas
  458. }
  459. }
  460. })
  461. },
  462. //样品规格
  463. getYpbzggb() {
  464. let sql =
  465. `select yang_pin_gui_ge_ from t_ypbzggb order by create_time_ desc`
  466. let requestData = this.$sig(sql)
  467. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  468. if (res.data.state == 200) {
  469. const datas = res.data.variables.data
  470. if (datas.length > 0) {
  471. datas.forEach(item => {
  472. this.$set(item, 'name', item.yang_pin_gui_ge_)
  473. })
  474. this.specificationList = datas
  475. }
  476. }
  477. })
  478. },
  479. //委托项目 点击事件
  480. changeIndex(it, x) {
  481. let taoCanXiangMuList = this.form.taoCanXiangMuList
  482. if (taoCanXiangMuList.length > 0 && !it.checked) {
  483. //判断是否与套餐项目相同
  484. let showData = taoCanXiangMuList.findIndex(item => item.id_ == it.id_)
  485. if (showData >= 0) {
  486. uni.showToast({
  487. title: it.xiang_mu_bian_hao + '项目与套餐项目相同',
  488. icon: 'none',
  489. duration: 1000
  490. })
  491. }
  492. }
  493. let itemData = this.form
  494. this.form.jianCeList[x].checked = !this.form.jianCeList[x].checked
  495. let show = itemData.jianCeList.some(item => (item.id_ == '1039826037036285952' || item.id_ ==
  496. '1040205909151711232') && item.checked)
  497. if (show) {
  498. itemData.mingChengShow = true
  499. } else {
  500. itemData.xiangMuMingCheng = ''
  501. itemData.mingChengShow = false
  502. }
  503. this.getTotal()
  504. },
  505. //套餐添加事件
  506. changeTaoCanIndex(it, x, checked) {
  507. let itemData = this.form
  508. //checked 判断套餐是否被选中
  509. if (!checked) {
  510. let itList = it.xuan_ze_jian_ce_x.split(',')
  511. let arr = itemData.taoCanXiangMuList.map(item => item.id_)
  512. //判断现选的套餐跟已选套餐是否有相同的
  513. var cList = itList.filter((item) => arr.some((ite) => ite === item))
  514. if (cList.length > 0) {
  515. uni.showToast({
  516. title: it.tao_can_ming_chen + '与其他套餐的检测项目相同,请选择其他套餐',
  517. icon: 'none',
  518. duration: 2000
  519. })
  520. return
  521. }
  522. } else {
  523. itemData.taoCanXiangMuList = itemData.taoCanXiangMuList.filter(item => item.tao_can_zhu_jian_ !== it
  524. .id_)
  525. }
  526. this.form.taoCanList[x].checked = !this.form.taoCanList[x].checked
  527. if (!checked) {
  528. this.taoCanChange(it.id_)
  529. } else {
  530. this.getTotal()
  531. }
  532. },
  533. //计算检测项目和套餐价格
  534. getTotal() {
  535. var itemTotal = 0
  536. this.form.jianCeList.forEach((it, x) => {
  537. if (it.checked) {
  538. itemTotal += parseFloat(it.zhe_hou_jia_ge_ || 0)
  539. }
  540. })
  541. this.form.taoCanXiangMuList.forEach((it, x) => {
  542. itemTotal += parseFloat(it.zhe_hou_jia_ge_ || 0)
  543. })
  544. this.form.yangPinZongJia = (itemTotal).toFixed(2)
  545. if (!this.itemType) {
  546. this.$emit("countTotal")
  547. }
  548. },
  549. //弹出框初始化
  550. selectClick(type) {
  551. this.listType = type
  552. this.selectShow = true
  553. if (type == 'jianCeType') {
  554. this.list = this.jianCeTypeList
  555. }
  556. },
  557. //弹出框初始化
  558. sheetClick(type, title = '') {
  559. this.listType = type
  560. this.title = title
  561. if (type == 'state') {
  562. this.list = this.sampleStateList
  563. }
  564. //1
  565. if (type.includes('yangpinType')) {
  566. this.list = this.sampleTypeList
  567. }
  568. if (type.includes('transportType')) {
  569. this.list = this.transportTypeList
  570. }
  571. if (type.includes('specification')) {
  572. this.list = this.specificationList
  573. }
  574. if (type == 'disposition') {
  575. this.list = this.dispositionList
  576. }
  577. if (type.includes('specification') || type.includes('yangpinType')) {
  578. this.$refs['picker'].show();
  579. } else {
  580. this.sheetShow = true
  581. }
  582. },
  583. //弹出框初始化
  584. selectConfirm(e) {
  585. let that = this
  586. let lists = that.form
  587. if (this.listType == 'jianCeType') {
  588. lists.jianCeType = e[0].value
  589. }
  590. },
  591. //下拉框回调
  592. actionSheetCallback(e) {
  593. let that = this
  594. let lists = that.form
  595. if (this.listType == 'state') {
  596. lists.yangPinZhuangTai = this.list[e].text
  597. }
  598. //1
  599. if (this.listType == 'transportType1') {
  600. lists.yangBenYunShuTiao = that.list[e].text
  601. }
  602. //2
  603. if (this.listType == 'transportType2') {
  604. lists.yangPinYunShuTiao = that.list[e].text
  605. }
  606. //3
  607. if (this.listType == 'transportType3') {
  608. lists.yangPinYunShuSan = that.list[e].text
  609. }
  610. //4
  611. if (this.listType == 'transportType4') {
  612. lists.yangPinYunShuSi = that.list[e].text
  613. }
  614. if (this.listType == 'disposition') {
  615. this.form.yangBenChuLi = this.list[e].text
  616. }
  617. },
  618. //调用日期组件
  619. dateClick(type) {
  620. if (type == 'inspect') {
  621. this.listType = type
  622. this.mode = 'date'
  623. this.dateShow = true
  624. }
  625. },
  626. //日期回调
  627. dateChange(e) {
  628. if (this.listType == 'inspect') {
  629. this.form.songJianShiJian = e.result
  630. }
  631. },
  632. //根据套餐查询套餐项目
  633. taoCanChange(i) {
  634. let sql =
  635. `select tm.*,tt.zhe_hou_jia_ge_,tt.tao_can_zhu_jian_,tt.id_ as tczbId from t_mjjcnlfw tm,t_httcb tt where tm.id_ = tt.jian_ce_xiang_mu_ and tt.tao_can_zhu_jian_ = '${i}' and parent_id_ = '${this.heTongId}'`
  636. let requestData = this.$sig(sql)
  637. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  638. if (res.data.state == 200) {
  639. const datas = res.data.variables.data
  640. let list = []
  641. datas.forEach(item => {
  642. this.form.taoCanXiangMuList.push(item)
  643. //判断与常规项目是否相同
  644. let ypglOne = this.form.jianCeList
  645. ypglOne.forEach(it => {
  646. if ((item.id_ == it.id_) && it.checked) {
  647. list.push(it.xiang_mu_bian_hao)
  648. }
  649. })
  650. })
  651. if (list.length > 0) {
  652. uni.showToast({
  653. title: list.join(",") + '项目与已常规项目相同',
  654. icon: 'none',
  655. duration: 1000
  656. })
  657. }
  658. this.getTotal()
  659. }
  660. })
  661. },
  662. //取消事件
  663. deletSing() {
  664. this.$emit("deletClick")
  665. },
  666. //保存事件
  667. sumbitSing() {
  668. if (this.form.yangPinZongJia == '') {
  669. this.form.yangPinZongJia = 0
  670. }
  671. for (let item of this.validList) {
  672. if (this.form[item.value] == '') {
  673. this.$showToast.getShowToast(item.toast, item.num)
  674. return
  675. }
  676. }
  677. // let itemShow = this.form.jianCeList.every(item => !item.checked)
  678. // if (itemShow && this.form.taoCanXiangMuList.length == 0) {
  679. // return meth.getPrompt('请选择常规项目或者套餐项目')
  680. // }
  681. if (!meth.getJudge(this.form)) {
  682. return
  683. }
  684. // let showIndex = this.form.lhypb.findIndex(item => item.jianCeXiangMu == '')
  685. // if (showIndex >= 0) {
  686. // uni.showToast({
  687. // title: `请在样品信息${showIndex+1}选择委托单需要检测项目`,
  688. // icon: 'none',
  689. // duration: 2000
  690. // })
  691. // return
  692. // }
  693. this.$refs.uForm.validate(valid => {
  694. if (valid) {
  695. this.$emit("sumbitSingClick", this.form)
  696. } else {
  697. uni.showToast({
  698. title: '必填项未填写',
  699. icon: 'none',
  700. duration: 2000
  701. })
  702. }
  703. });
  704. },
  705. //检测项目详情
  706. getSty(item) {
  707. this.$emit('getParentContent', item)
  708. },
  709. checkBoxChange(e) {
  710. this.form.jianCeTypeString = e
  711. },
  712. checkedChange() {
  713. this.checked = !this.checked
  714. if (this.form.jianCeList && this.form.jianCeList.length > 0) {
  715. this.form.jianCeList.forEach(item => {
  716. if (this.form.jianCeTypeString.indexOf(item.jian_ce_lei_bie_) !== -1) {
  717. item.checked = this.checked
  718. }
  719. })
  720. }
  721. },
  722. onConfirm(e) {
  723. let that = this
  724. let lists = that.form
  725. //样品类型
  726. if (this.listType == 'yangpinType1') {
  727. lists.yangPinLeiXing = that.list[e].name
  728. }
  729. if (this.listType == 'yangpinType2') {
  730. lists.yangPinLeiXingEr = that.list[e].name
  731. }
  732. if (this.listType == 'yangpinType3') {
  733. lists.yangPinLeiXingSan = that.list[e].name
  734. }
  735. if (this.listType == 'yangpinType4') {
  736. lists.yangPinLeiXingSi = that.list[e].name
  737. }
  738. //样品规格
  739. if (this.listType == 'specification1') {
  740. lists.yangPinGuiGe = that.list[e].name
  741. }
  742. if (this.listType == 'specification2') {
  743. lists.yangPinGuiGeEr = that.list[e].name
  744. }
  745. if (this.listType == 'specification3') {
  746. lists.yangPinGuiGeSan = that.list[e].name
  747. }
  748. if (this.listType == 'specification4') {
  749. lists.yangPinGuiGeSi = that.list[e].name
  750. }
  751. }
  752. },
  753. onReady() {
  754. this.$refs.uForm.setRules(this.rules);
  755. }
  756. }
  757. </script>
  758. <style lang="scss" scoped>
  759. .qingshe {
  760. background-color: #f0f9eb;
  761. color: #67c23a;
  762. padding: 15rpx 20rpx;
  763. border-radius: 8rpx;
  764. display: flex;
  765. justify-content: space-between;
  766. align-items: center;
  767. margin-top: 25rpx;
  768. }
  769. .btnBottom {
  770. z-index: 1500;
  771. // height: 220rpx;
  772. background-color: #FFFFFF;
  773. position: fixed;
  774. bottom: 0;
  775. left: 0;
  776. right: 0;
  777. .btn {
  778. margin: 20rpx;
  779. }
  780. }
  781. .jiancexiangm {
  782. padding: 10rpx 30rpx;
  783. // width: 100%;
  784. padding: 20rpx;
  785. margin-bottom: 20rpx;
  786. background-color: #f1f1f1;
  787. border-radius: 8rpx;
  788. font-size: 26rpx;
  789. color: $u-content-color;
  790. line-height: 1.7;
  791. view {
  792. line-height: 30rpx;
  793. }
  794. }
  795. .btnBox {
  796. display: flex;
  797. flex-wrap: wrap;
  798. .btnSin {
  799. margin: 10rpx 5rpx;
  800. }
  801. }
  802. // .ellipsis {
  803. // width: 100%;
  804. // display: inline-block;
  805. // white-space: nowrap;
  806. // overflow: hidden;
  807. // text-overflow: ellipsis;
  808. // }
  809. </style>